:root {
  --cream: #fff0c4;
  --paper: #fff7dc;
  --ink: #24151b;
  --wine: #793247;
  --coral: #dd6540;
  --gold: #f2ca61;
  --wood: #5b2e19;
  --panel: rgb(36 21 27 / 94%);
  --line: rgb(255 240 196 / 44%);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: #211319;
}

body.time-machine-revision {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgb(33 19 25 / 28%), rgb(33 19 25 / 52%)),
    url("../images/time-machine-room-clean-v3.webp") center / cover fixed;
  color: var(--paper);
}

body.time-machine-revision .route-shell,
body.time-machine-revision .time-machine-stage {
  background:
    linear-gradient(rgb(33 19 25 / 28%), rgb(33 19 25 / 52%)),
    url("../images/time-machine-room-clean-v3.webp") center / cover fixed;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.route-shell {
  min-height: 100svh;
}

.route-nav {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  left: 0;
  background: linear-gradient(180deg, rgb(22 12 17 / 88%), transparent);
  border: 0;
}

.time-machine-stage {
  --desktop-remote-right: 9.1vw;
  --desktop-remote-width: clamp(11rem, 14.35vw, 16rem);

  /*
   * TV CONTENT CALIBRATION CONTROLS
   * These values move/size only the provider player inside the fixed cabinet
   * aperture. They must never be used to crop branding or required controls.
   */
  --tv-content-offset-x: 0px;
  --tv-content-offset-y: 0px;
  --tv-content-width: 100%;
  --tv-content-height: 100%;
  --tv-content-aspect-ratio: auto;
  --tv-content-inner-padding: clamp(2px, 0.22vw, 4px);
  --tv-content-mobile-offset-x: 0px;
  --tv-content-mobile-offset-y: 0px;
  --tv-content-mobile-width: 100%;
  --tv-content-mobile-height: 100%;
  --tv-content-mobile-aspect-ratio: auto;
  --tv-content-mobile-inner-padding: 2px;

  /*
   * RETRO FULLSCREEN CALIBRATION CONTROLS (desktop)
   * The scene enters fullscreen; these values independently size the room,
   * screen aperture, and provider surface without invoking iframe fullscreen.
   */
  --tv-fullscreen-artboard-width: min(100vw, calc(100svh * 1.77683));
  --tv-fullscreen-screen-top: 11.5942%;
  --tv-fullscreen-screen-left: -5.14%;
  --tv-fullscreen-screen-width: 109%;
  --tv-fullscreen-screen-aspect-ratio: 16 / 9;
  --tv-fullscreen-content-offset-x: 0px;
  --tv-fullscreen-content-offset-y: 0px;
  --tv-fullscreen-content-width: 100%;
  --tv-fullscreen-content-height: 100%;
  --tv-fullscreen-content-aspect-ratio: auto;
  --tv-fullscreen-content-inner-padding: 0px;
  position: relative;
  min-height: 100svh;
}

.time-machine-heading {
  position: absolute;
  z-index: 30;
  top: 4.7rem;
  left: clamp(0.8rem, 1.6vw, 1.75rem);
  max-width: min(35rem, 54vw);
  pointer-events: auto;
  filter: drop-shadow(0 3px 0 rgb(59 24 35 / 82%));
}

.time-machine-heading .route-kicker {
  display: inline-flex;
  margin: 0 0 0.35rem;
  padding: 0.28rem 0.65rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-size: clamp(0.62rem, 0.72vw, 0.8rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.time-machine-heading h1 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(1.8rem, 3.35vw, 4.6rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
  text-transform: uppercase;
  text-shadow: 3px 4px 0 #9c4058;
}

.time-machine-app,
.time-machine-console,
.time-machine-scene {
  min-height: 100svh;
}

.time-machine-console {
  position: relative;
  overflow: hidden;
}

.time-machine-scene {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.time-machine-artboard {
  position: relative;
  flex: none;
  width: max(100vw, calc(100svh * 1.77683));
  height: max(100svh, calc(100vw / 1.77683));
}

.time-machine-scene__art {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

.time-machine-tv-stack {
  position: absolute;
  z-index: 4;
  top: 10.62699%;
  left: 10.76555%;
  width: 51.43541%;
  aspect-ratio: 860 / 690;
  isolation: isolate;
}

.time-machine-screen {
  position: absolute;
  z-index: 1;
  top: 11.5942%;
  left: -5.14%;
  width: 109%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  contain: paint;
  background: #000;
}

.time-machine-tv-frame {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: block;
  pointer-events: none;
  user-select: none;
}

.time-machine-tv-frame img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.time-machine-room-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: block;
  pointer-events: auto;
  user-select: none;
}

.time-machine-room-overlay img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

/* Expand and shift the container box horizontally behind the TV cabinet casing */
/* Expand and shift the container box both horizontally and vertically */
.youtube-player-host {
  position: absolute !important;
  top: -6% !important;        /* Shifts the box UP behind the top TV casing */
  left: -15% !important;      /* Shifts the box LEFT behind the side TV casing */
  width: 130% !important;     /* Expands width to push side elements away */
  height: 112% !important;    /* Expands height to push top/bottom elements away */
  overflow: hidden !important; 
  overflow: clip !important;
  background: #000;
}

/* Force the embedded player iframe to fill that widescreen canvas naturally */
.youtube-player-host iframe {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: auto !important; /* Preserves mouse interactivity */
}

//.youtube-player-host iframe {
  //position: absolute;
  //inset: 0;
  //display: block;
  //min-width: 0;
  //min-height: 0;
//}

.youtube-player-host iframe,
iframe.youtube-player-host {
  pointer-events: auto;
}

@media (min-width: 901px) {
  .time-machine-scene:fullscreen {
    width: 100vw;
    min-height: 100vh;
    background: #000;
  }

  .time-machine-scene:fullscreen .time-machine-artboard {
    width: var(--tv-fullscreen-artboard-width);
    height: auto;
    aspect-ratio: 1672 / 941;
  }

  .time-machine-scene:fullscreen .time-machine-screen {
    top: var(--tv-fullscreen-screen-top);
    left: var(--tv-fullscreen-screen-left);
    width: var(--tv-fullscreen-screen-width);
    aspect-ratio: var(--tv-fullscreen-screen-aspect-ratio);
  }

  .time-machine-scene:fullscreen .youtube-player-host {
    top: calc(var(--tv-fullscreen-content-inner-padding) + var(--tv-fullscreen-content-offset-y));
    left: calc(var(--tv-fullscreen-content-inner-padding) + var(--tv-fullscreen-content-offset-x));
    width: calc(var(--tv-fullscreen-content-width) - var(--tv-fullscreen-content-inner-padding) - var(--tv-fullscreen-content-inner-padding));
    max-width: none;
    height: calc(var(--tv-fullscreen-content-height) - var(--tv-fullscreen-content-inner-padding) - var(--tv-fullscreen-content-inner-padding));
    max-height: none;
    aspect-ratio: var(--tv-fullscreen-content-aspect-ratio);
  }
}

.tv-screen-overlay {
  position: absolute;
  z-index: 12;
  inset: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0.14;
  background:
    linear-gradient(116deg, rgb(255 255 255 / 16%) 0 7%, transparent 24% 100%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgb(255 255 255 / 7%) 3px 4px);
  mix-blend-mode: soft-light;
}

.youtube-standby {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 100%;
  padding: clamp(1rem, 4vw, 4rem);
  border: 0;
  background:
    radial-gradient(circle at 50% 40%, rgb(123 78 89 / 54%), transparent 58%),
    #09090a;
  color: var(--cream);
  text-align: center;
  cursor: pointer;
}

.youtube-standby[hidden] {
  display: none !important;
}

.youtube-standby > span {
  display: grid;
  width: clamp(2.8rem, 5vw, 5rem);
  aspect-ratio: 1;
  margin-inline: auto;
  place-items: center;
  border: 2px solid var(--cream);
  border-radius: 50%;
  background: var(--wine);
  font-size: clamp(1.15rem, 2vw, 2rem);
}

.youtube-standby strong {
  font-size: clamp(1rem, 1.55vw, 1.75rem);
  text-transform: uppercase;
}

.youtube-standby small {
  max-width: 42ch;
  font-size: clamp(0.72rem, 0.8vw, 0.95rem);
  line-height: 1.45;
}

.time-static {
  position: absolute;
  z-index: 9;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  background:
    repeating-radial-gradient(circle at 37% 42%, #fff 0 1px, #111 1px 2px, #777 2px 3px),
    repeating-linear-gradient(0deg, transparent 0 3px, rgb(255 255 255 / 45%) 3px 4px);
  background-size: 5px 5px, 100% 4px;
  mix-blend-mode: screen;
  animation: signal-static 90ms steps(2, end) infinite;
}

.time-static[hidden] {
  display: block !important;
  visibility: hidden;
  opacity: 0;
  animation: none;
}

.channel-static {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: #000;
  object-fit: cover;
  pointer-events: none;
}

.channel-static[hidden] {
  display: block !important;
  visibility: hidden;
  opacity: 0;
}

.time-machine-screen.is-channel-changing .youtube-player-host {
  visibility: hidden;
}

@keyframes signal-static {
  from { background-position: 0 0, 0 0; }
  to { background-position: 9px -7px, 0 5px; }
}

.tv-bezel-controls {
  position: absolute;
  z-index: 7;
  top: 21%;
  left: 63.1%;
  display: none !important;
  width: 5.1%;
  gap: clamp(0.35rem, 0.65vw, 0.8rem);
}

.tv-cabinet-button {
  min-height: 2.75rem;
  border: 2px solid #2d180e;
  border-radius: 999px;
  background: linear-gradient(#e0a04e, #7e3d1a);
  color: #170d09;
  font-size: clamp(0.48rem, 0.55vw, 0.72rem);
  font-weight: 900;
  box-shadow: inset 0 2px 2px rgb(255 239 189 / 62%), 0 3px 0 #2b170d;
  cursor: pointer;
  text-transform: uppercase;
}

.time-remote {
  position: absolute;
  z-index: 24;
  top: 39%;
  right: auto;
  left: 62.5%;
  display: flex;
  width: 10.5%;
  height: 48%;
  min-width: 0;
  flex-direction: column;
  gap: clamp(0.35rem, 0.75vh, 0.75rem);
  padding: clamp(0.7rem, 1vw, 1rem);
  overflow: visible;
  border: 3px solid #d9573a;
  border-radius: clamp(1.35rem, 2.5vw, 2.25rem);
  background: linear-gradient(145deg, rgb(255 248 219 / 96%), rgb(232 214 171 / 96%));
  color: var(--ink);
  box-shadow: 0 16px 38px rgb(25 9 12 / 36%);
}

.time-remote__status {
  display: grid;
  min-height: 3rem;
  align-content: center;
  padding: 0.4rem 0.55rem;
  border: 2px solid rgb(70 33 32 / 58%);
  border-radius: 0.6rem;
  background: rgb(255 246 211 / 82%);
  text-align: center;
}

.time-remote__status span {
  overflow: hidden;
  font-size: clamp(0.48rem, 0.55vw, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.time-remote__status strong {
  font-size: clamp(0.9rem, 1.25vw, 1.6rem);
}

.time-remote__primary,
.time-remote__utility {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
}

.remote-button {
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.42rem 0.36rem;
  border: 2px solid #77311f;
  border-radius: 999px;
  background: linear-gradient(#ef825d, #cf4d2e);
  color: #2a1712;
  font-size: clamp(0.48rem, 0.57vw, 0.75rem);
  font-weight: 950;
  line-height: 1.05;
  box-shadow: inset 0 2px 2px rgb(255 220 191 / 62%), 0 3px 0 #742917;
  cursor: pointer;
  text-transform: uppercase;
}

.remote-button:hover {
  filter: brightness(1.08);
}

.remote-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 2px rgb(98 33 20 / 35%), 0 1px 0 #742917;
}

.remote-button[aria-pressed="true"] {
  background: linear-gradient(#a43d4e, #70243b);
  color: #fff7dc;
}

.time-remote__pad {
  display: grid;
  width: 94%;
  aspect-ratio: 1;
  margin: 0 auto;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
}

.remote-button--pad {
  min-height: 0;
  border-radius: 0.75rem;
  font-size: clamp(0.44rem, 0.51vw, 0.68rem);
}

.remote-button--up { grid-area: 1 / 2; }
.remote-button--left { grid-area: 2 / 1; }
.remote-button--menu { grid-area: 2 / 2; border-radius: 50%; }
.remote-button--right { grid-area: 2 / 3; }
.remote-button--down { grid-area: 3 / 2; }

.time-remote__readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgb(255 246 211 / 76%);
  font-size: clamp(0.5rem, 0.55vw, 0.72rem);
  font-weight: 900;
  text-transform: uppercase;
}

.time-remote__readout output {
  font-variant-numeric: tabular-nums;
}

.time-remote__utility {
  grid-template-columns: minmax(0, 1fr);
  margin-top: auto;
}

.time-remote__utility .remote-button {
  min-height: 2.75rem;
  border-radius: 0.75rem;
}

.time-decade-selector {
  position: absolute;
  z-index: 25;
  top: clamp(10rem, 25svh, 14rem);
  /* Share the room artboard with the remote: 62.5% left + 10.5% width. */
  left: calc(73% + 0.75rem);
  right: auto;
  width: clamp(10rem, 12vw, 12.5rem);
  padding: 0.8rem;
  border: 3px solid var(--gold);
  border-radius: 1rem;
  background: rgb(54 25 43 / 91%);
  box-shadow: 0 8px 30px rgb(22 7 12 / 52%), 0 0 0 2px rgb(255 240 196 / 20%);
}

.time-decade-selector p,
.time-decade-selector h2 {
  margin: 0;
}

.time-decade-selector__kicker {
  color: var(--gold);
  font-size: clamp(0.62rem, 0.7vw, 0.78rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.time-decade-selector h2 {
  margin-block: 0.18rem 0.5rem;
  color: var(--cream);
  font-size: clamp(1rem, 1.2vw, 1.3rem);
}

.decade-menu {
  display: grid;
  gap: 0.38rem;
}

.decade-choice,
.year-choice {
  min-height: 2.75rem;
  border: 2px solid var(--ink);
  border-radius: 0.6rem;
  background: var(--cream);
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
}

.decade-choice {
  min-height: 3.5rem;
  padding: 0.45rem;
  border-color: var(--gold);
  font-size: clamp(0.85rem, 1vw, 1.08rem);
  box-shadow: 0 3px 0 rgb(20 9 14 / 60%);
}

.decade-choice[aria-pressed="true"],
.year-choice[aria-pressed="true"] {
  background: var(--wine);
  color: #fff;
  box-shadow: 0 0 0 2px var(--gold);
}

.time-year-selector {
  position: absolute;
  z-index: 8;
  top: 77.2%;
  left: 12.9%;
  width: 46%;
  padding: 0.42rem 0.55rem 0.55rem;
  border: 2px solid rgb(255 240 196 / 66%);
  border-radius: 0.85rem;
  background: rgb(36 21 27 / 88%);
}

.time-year-selector h2 {
  margin: 0 0 0.32rem;
  color: var(--cream);
  font-size: clamp(0.58rem, 0.7vw, 0.86rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.year-menu {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.3rem;
}

.year-choice {
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.2rem;
  font-size: clamp(0.46rem, 0.56vw, 0.72rem);
}

.time-readout {
  position: absolute;
  z-index: 7;
  top: 86.2%;
  left: 12.9%;
  display: grid;
  width: 46%;
  gap: 0.14rem;
  padding: 0.48rem 0.7rem;
  border-radius: 0.7rem;
  background: rgb(32 17 22 / 88%);
  box-shadow: 0 5px 18px rgb(22 9 13 / 28%);
}

.time-readout p,
.time-readout h2 {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-readout > p:first-child {
  color: var(--gold);
  font-size: clamp(0.45rem, 0.53vw, 0.67rem);
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.time-readout h2 {
  color: var(--cream);
  font-size: clamp(0.7rem, 0.92vw, 1.15rem);
}

.time-readout p {
  font-size: clamp(0.42rem, 0.5vw, 0.66rem);
}

.time-utility-rail {
  position: fixed;
  z-index: 12;
  top: 50%;
  left: 0.65rem;
  display: grid;
  width: clamp(6.5rem, 9vw, 9rem);
  gap: 0.55rem;
  transform: translateY(-50%);
}

.utility-button {
  min-height: 2.85rem;
  padding: 0.55rem;
  border: 2px solid var(--gold);
  border-radius: 0.75rem;
  background: rgb(64 28 47 / 94%);
  color: var(--cream);
  font-size: clamp(0.5rem, 0.62vw, 0.8rem);
  font-weight: 950;
  box-shadow: 0 4px 0 #271019;
  cursor: pointer;
  text-transform: uppercase;
}

.time-provenance,
.time-machine-footnote {
  position: relative;
  z-index: 4;
  width: min(74rem, calc(100% - 2rem));
  margin: 1rem auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--panel);
}

.time-provenance {
  display: none;
}

.time-provenance h2 {
  margin-top: 0;
}

.time-provenance dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.time-provenance dl div {
  min-width: 0;
}

.time-provenance dt {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.time-provenance dd {
  margin: 0.2rem 0 0;
  overflow-wrap: anywhere;
}

.time-machine-footnote {
  margin-top: 0;
  color: rgb(255 247 220 / 84%);
  font-size: 0.82rem;
  line-height: 1.55;
}

.time-machine-footnote p {
  margin: 0.25rem 0;
}

.time-panel {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  overflow-y: auto;
  padding: clamp(1rem, 5vw, 4rem);
  border: 0;
  place-items: center;
  background: rgb(17 8 12 / 78%);
  backdrop-filter: blur(10px);
  color: inherit;
}

.time-panel:not([open]) {
  display: none;
}

.time-panel::backdrop {
  background: rgb(17 8 12 / 78%);
  backdrop-filter: blur(10px);
}

.time-panel__card {
  width: min(58rem, 100%);
  max-height: calc(100svh - 2rem);
  overflow-y: auto;
  padding: clamp(1.2rem, 3vw, 2.2rem);
  border: 3px solid var(--gold);
  border-radius: 1.25rem;
  background: #2c1823;
  color: var(--paper);
  box-shadow: 0 24px 70px rgb(0 0 0 / 58%);
}

.time-panel__card--compact {
  width: min(42rem, 100%);
}

.time-panel__heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.time-panel__heading h2,
.shortcut-guide h3 {
  margin-top: 0;
  color: var(--cream);
}

.panel-close {
  display: grid;
  width: 2.75rem;
  min-width: 2.75rem;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

.category-fieldset {
  padding: 0;
  border: 0;
}

.category-fieldset legend {
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 950;
}

.category-fieldset > p {
  color: rgb(255 247 220 / 82%);
}

.category-actions,
.share-actions,
.share-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.category-actions button,
.share-actions button,
.share-actions a,
.share-platforms a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.9rem;
  border: 2px solid var(--gold);
  border-radius: 0.65rem;
  background: var(--wine);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.category-controls {
  display: grid;
  margin-top: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.category-choice {
  display: flex;
  min-height: 3rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgb(255 240 196 / 32%);
  border-radius: 0.65rem;
  background: rgb(255 255 255 / 6%);
  cursor: pointer;
}

.category-choice input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--coral);
}

.category-choice span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.shortcut-guide {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.shortcut-guide dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1rem;
}

.shortcut-guide dl div {
  display: flex;
  gap: 0.75rem;
}

.shortcut-guide dt {
  min-width: 3.5rem;
  color: var(--gold);
  font-weight: 950;
}

.shortcut-guide dd {
  margin: 0;
}

.time-panel label {
  display: block;
  margin: 1rem 0 0.35rem;
  color: var(--gold);
  font-weight: 900;
}

.time-panel input[type="url"],
.time-panel textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid rgb(255 240 196 / 44%);
  border-radius: 0.6rem;
  background: #160c11;
  color: #fff;
}

.share-actions,
.share-platforms {
  margin-top: 0.85rem;
}

body.has-time-panel {
  overflow: hidden;
}

@media (min-width: 901px) and (max-aspect-ratio: 1672 / 941) {
  .time-machine-stage {
    --desktop-remote-right: clamp(4rem, calc(50vw - 72.7svh), 7.3rem);
    --desktop-remote-width: clamp(11rem, 25.5svh, 16rem);
  }
}

@media (max-width: 1100px) {
  .time-machine-heading {
    top: 4.2rem;
  }
}

@media (max-width: 900px) {
  body.time-machine-revision {
    background:
      linear-gradient(rgb(33 19 25 / 54%), rgb(33 19 25 / 82%)),
      url("../images/time-machine-room-clean-v3.webp") center / cover fixed;
  }

  .route-nav {
    position: sticky;
  }

  .time-machine-heading {
    position: relative;
    top: auto;
    left: auto;
    max-width: none;
    padding: 1rem 1rem 0.5rem;
  }

  .time-machine-heading h1 {
    font-size: clamp(2.1rem, 11vw, 4.4rem);
  }

  .time-machine-app,
  .time-machine-console,
  .time-machine-scene {
    min-height: auto;
  }

  .time-machine-scene {
    display: block;
    padding: 0.75rem;
  }

  .time-machine-artboard {
    display: grid;
    width: 100%;
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .time-machine-scene__art {
    position: fixed;
    z-index: -2;
    width: 100vw;
    height: 100svh;
    object-fit: cover;
    filter: brightness(0.55) saturate(0.88);
  }

  .time-machine-room-overlay {
    display: none;
  }

  .time-machine-tv-stack,
  .time-remote,
  .time-decade-selector,
  .time-year-selector,
  .time-readout,
  .time-utility-rail,
  .tv-bezel-controls {
    position: relative;
    inset: auto;
    width: min(100%, 46rem);
    transform: none;
  }

  .time-machine-tv-stack {
    justify-self: center;
    aspect-ratio: auto;
    padding: 10px;
    border: 4px solid #301b12;
    border-radius: 16px;
    background:
      repeating-linear-gradient(0deg, transparent 0 5px, rgb(28 12 5 / 12%) 5px 7px),
      linear-gradient(135deg, #98613b, #5b2e19);
    box-shadow: 0 16px 48px rgb(0 0 0 / 48%);
  }

  .time-machine-tv-frame {
    display: none;
  }

  .time-machine-screen {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 212px;
    aspect-ratio: 4 / 3;
    box-shadow: 0 0 0 3px #171214;
  }

  /* Override the desktop crop on both the initial host and replacement iframe. */
  .youtube-player-host {
    top: calc(var(--tv-content-mobile-inner-padding) + var(--tv-content-mobile-offset-y)) !important;
    left: calc(var(--tv-content-mobile-inner-padding) + var(--tv-content-mobile-offset-x)) !important;
    width: calc(var(--tv-content-mobile-width) - var(--tv-content-mobile-inner-padding) - var(--tv-content-mobile-inner-padding)) !important;
    max-width: calc(100% - var(--tv-content-mobile-inner-padding) - var(--tv-content-mobile-inner-padding));
    height: calc(var(--tv-content-mobile-height) - var(--tv-content-mobile-inner-padding) - var(--tv-content-mobile-inner-padding)) !important;
    max-height: calc(100% - var(--tv-content-mobile-inner-padding) - var(--tv-content-mobile-inner-padding));
    aspect-ratio: var(--tv-content-mobile-aspect-ratio);
  }

  .youtube-player-host:fullscreen,
  .youtube-player-host:-webkit-full-screen {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
  }

  .tv-bezel-controls {
    display: flex;
    justify-self: center;
    justify-content: flex-end;
  }

  .tv-cabinet-button {
    min-width: 4.25rem;
  }

  .time-utility-rail {
    display: grid;
    justify-self: center;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .time-decade-selector,
  .time-year-selector,
  .time-readout {
    justify-self: center;
  }

  .time-decade-selector {
    padding: 1rem;
    border-width: 4px;
    box-shadow: 0 14px 40px rgb(0 0 0 / 48%), 0 0 0 2px rgb(255 240 196 / 22%);
  }

  .decade-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .time-year-selector {
    padding: 0.8rem;
  }

  .year-menu {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .year-choice,
  .decade-choice {
    min-height: 2.75rem;
    font-size: 0.78rem;
  }

  .decade-choice {
    min-height: 3.5rem;
    font-size: 1rem;
  }

  .time-readout p,
  .time-readout h2 {
    white-space: normal;
  }

  .time-remote {
    width: min(100%, 23rem);
    min-width: 0;
    height: auto;
    justify-self: center;
    padding: 1rem;
    border: 4px solid #d9573a;
    border-radius: 2rem;
    background: linear-gradient(145deg, #fff6d7, #ead9b0);
    box-shadow: 0 14px 40px rgb(0 0 0 / 42%);
  }

  .time-remote__status span,
  .time-remote__readout,
  .remote-button {
    font-size: 0.72rem;
  }

  .time-remote__status strong {
    font-size: 1.3rem;
  }

  .time-remote__pad {
    width: min(15rem, 75%);
  }

  .remote-button {
    min-height: 3rem;
  }

  .time-remote__utility .remote-button {
    min-height: 3.25rem;
  }

  .time-provenance {
    display: block;
  }

  .time-provenance dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body.time-machine-revision .route-brand {
    display: inline-flex;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.45rem 0.55rem;
    white-space: nowrap;
  }

  body.time-machine-revision .route-brand span:last-child {
    display: inline;
  }
}

@media (max-width: 560px) {
  .route-links {
    gap: 0.4rem;
  }

  .time-machine-scene {
    padding-inline: 0.5rem;
  }

  .decade-menu,
  .year-menu,
  .category-controls,
  .time-provenance dl,
  .shortcut-guide dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .time-panel {
    padding: 0.5rem;
  }

  .time-panel__card {
    max-height: calc(100svh - 1rem);
    padding: 1rem;
    border-radius: 0.9rem;
  }
}

@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .time-machine-screen {
    height: clamp(212px, calc(100svh - 100px), 260px);
    aspect-ratio: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .time-static {
    animation: none;
  }

  .channel-static {
    object-position: center;
  }
}
