:root {
  /* Modal `.n64-c` lives outside `.n64-c-pad`; must inherit a size */
  --n64-c-size: 96px;
  --tablet-chassis-texture: url("/assets/images/Horror_Metal_12-256x256_n64_soft.png");
  --tablet-chassis-fill: rgba(32, 52, 94, 0.6);
  --tablet-chassis-line: rgba(163, 206, 255, 0.42);
  --tablet-shell-padding: 14px;
  --tablet-module-gap: 12px;
  --tablet-module-border: 1px solid rgba(163, 206, 255, 0.38);
  --tablet-module-inset: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
  /* #view only — chassis cutout / well (minimap & console keep gadget chrome) */
  --tablet-view-well-inset: 3px;
  --tablet-view-well-bg: rgba(8, 11, 18, 0.92);
  --tablet-view-border: 1px solid rgba(0, 0, 0, 0.52);
  --tablet-view-recess-shadow:
    inset 0 3px 14px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px rgba(0, 0, 0, 0.34),
    0 1px 0 rgba(255, 255, 255, 0.04);
  /* Inner “glass” depth above WebGL (inset shadows on the container sit under opaque canvas) */
  --tablet-view-inner-rim-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    inset 0 4px 18px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(0, 0, 0, 0.55),
    inset 0 -10px 36px rgba(0, 0, 0, 0.18);
  /* Minimap + console: solid plastic + PC-98 style stacked 1px lines (no pattern) */
  --tablet-gadget-bezel-outer-radius: 10px;
  --tablet-gadget-bezel-inner-radius: 7px;
  --tablet-gadget-bezel-plastic-base: #484d58;
  --tablet-gadget-bezel-plastic-outer: #3a3f4c;
  --tablet-gadget-bezel-plastic-mid: #5c626f;
  --tablet-gadget-bezel-plastic-light: #6a707c;
  --tablet-gadget-bezel-drop: 0 5px 16px rgba(0, 0, 0, 0.38);
  /* Inner “double line” at content boundary (inset 0 0 0 N px rings) */
  --tablet-gadget-bezel-line-dark: rgba(10, 12, 18, 0.78);
  --tablet-gadget-bezel-line-light: rgba(236, 242, 252, 0.16);
  /* Console as loose notepaper (not a machined window) */
  --tablet-console-paper-tilt: -0.55deg;
  --tablet-console-paper-shadow:
    0 2px 0 rgba(255, 255, 255, 0.18),
    0 4px 14px rgba(12, 10, 8, 0.28),
    0 10px 22px rgba(8, 6, 5, 0.12);
  /* Inner layout: left column (view + C-pad); modals in #root */
  --tablet-inner-width: calc(960px + var(--tablet-module-gap) + 350px);
  /* Sidebar: minimap + stacked HUD (absolute); title at top of column */
  --special-room-hud-stack-height: 56px;
  --tablet-sidebar-height: 350px;
  /* Underside: console + compass; disc bracket row sits below #view (not over canvas) */
  --tablet-cpad-min: 17px;
  --tablet-view-disc-bracket: 38px;
  --tablet-left-stack-height: calc(
    720px + var(--tablet-view-disc-bracket) + var(--tablet-cpad-min)
  );
  --tablet-main-row-height: max(
    var(--tablet-left-stack-height),
    var(--tablet-sidebar-height)
  );
  --tablet-inner-height: var(--tablet-main-row-height);
  /* Orbit ring dots (menu + modals); overrides embed until next React build */
  --ui-orbit-dot: rgba(255, 255, 255, 0.95);
}

html, body {
    margin: 0;
    padding: 0;
    background-color: #C4C4C4;
}
canvas {
	  display: flex;
}

.container {
    display: flex;
}

#scale-wrapper {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
	background-image:
    linear-gradient(rgba(18, 24, 22, 0.82), rgba(18, 24, 22, 0.82)),
    url("/assets/images/letterbox-tile.png");
  background-repeat: repeat, repeat;
  background-size: auto, auto;
  background-position: 0 0, 0 0;
}

body {
  overflow: hidden;
  background-color: #161a19;
  /* react-ui-embed.css sets min-height: 100vh on body — drops huge empty band in the tablet */
  min-height: 0;
}

#app.tablet-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: calc(var(--tablet-inner-width) + 2 * var(--tablet-shell-padding));
  min-height: calc(var(--tablet-inner-height) + 2 * var(--tablet-shell-padding));
  padding: var(--tablet-shell-padding);
  gap: var(--tablet-module-gap);
  flex-shrink: 0;
  align-items: stretch;
  background:
    linear-gradient(rgba(40, 65, 114, 0.66), rgba(22, 38, 77, 0.72)),
    var(--tablet-chassis-texture),
    var(--tablet-chassis-fill);
  background-size: auto, 256px 256px, auto;
  background-blend-mode: normal, multiply, normal;
  border: 1px solid var(--tablet-chassis-line);
  border-radius: 12px;
  box-shadow:
    inset 0 0 0 1px rgba(216, 235, 255, 0.2),
    0 16px 45px rgba(0, 0, 0, 0.35);
}

#game-area {
  display: flex;
  flex-direction: row;
  gap: var(--tablet-module-gap);
  width: 100%;
  box-sizing: border-box;
  /* Stretch left column to sidebar height so flex filler + C-pad can use dead space */
  align-items: stretch;
}

#game-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 960px;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  position: relative;
}

/* Minimap pinned to bottom-right of the column (below empty space) */
#game-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--tablet-module-gap);
  width: 350px;
  flex-shrink: 0;
  position: relative;
  box-sizing: border-box;
  justify-content: flex-end;
  align-self: stretch;
  min-height: 0;
}

/* CRT-style OSD gadget (formerly sub-LCD): bezel + glass is one push-button toggle */
.vmu-module {
  position: absolute;
  top: calc(0.9 * clamp(112px, 18.5vh, 148px));
  left: 0;
  right: 0;
  z-index: 4;
  width: auto;
  box-sizing: border-box;
  pointer-events: auto;
  display: flex;
  justify-content: center;
  transform: scale(1.25);
  transform-origin: top center;
}

button.vmu-module__screen {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  margin: 0;
  padding: 8px 9px 9px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  width: 232px;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.48);
  position: relative;
  isolation: isolate;
  --orbit-x: 50%;
  --orbit-y: 50%;
  --orbit-visible: 0;
  background:
    linear-gradient(165deg, rgba(92, 98, 112, 0.55), rgba(34, 40, 54, 0.72)),
    var(--tablet-gadget-bezel-plastic-base);
  box-shadow:
    var(--tablet-gadget-bezel-drop),
    inset 0 1px 0 rgba(236, 242, 252, 0.12),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition:
    transform 0.07s ease,
    box-shadow 0.1s ease,
    filter 0.1s ease;
}

button.vmu-module__screen:hover,
button.vmu-module__screen:focus-visible,
button.vmu-module__screen:active {
  cursor: none;
}

button.vmu-module__screen:hover {
  filter: brightness(1.03);
}

button.vmu-module__screen:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(236, 242, 252, 0.08),
    inset 0 0 0 1px rgba(0, 0, 0, 0.42),
    inset 0 3px 10px rgba(0, 0, 0, 0.35);
}

button.vmu-module__screen:focus-visible {
  outline: 2px solid rgba(199, 228, 255, 0.95);
  outline-offset: 3px;
}

button.vmu-module__screen:focus-visible > .button-orbit {
  opacity: 1;
}

button.vmu-module__screen > .button-orbit {
  /* Match compass .n64-c orbit (deck override --orbit-radius: 20px) */
  --orbit-radius: 20px;
  border-radius: 8px;
  z-index: 6;
}

button.vmu-module__screen:hover .orbit-dot,
button.vmu-module__screen:focus-visible .orbit-dot,
button.vmu-module__screen:active .orbit-dot {
  animation: orbit-dot-spin 1.05s linear infinite;
}

.vmu-module__lcd-trough {
  position: relative;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.55);
  background: linear-gradient(180deg, rgba(8, 10, 14, 0.95), rgba(20, 24, 32, 0.88));
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.vmu-module__lcd {
  position: relative;
  width: 100%;
  min-height: 152px;
  aspect-ratio: 5 / 4;
  border-radius: 4px;
  overflow: hidden;
  background: #050608;
  border: 1px solid rgba(0, 0, 0, 0.75);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 8px 24px rgba(0, 0, 0, 0.55);
}

.vmu-module__osd {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 6;
  margin: 0;
  padding: 0;
  pointer-events: none;
  font-family: "VCR OSD Mono", ui-monospace, monospace;
  font-weight: 400;
  font-size: clamp(0.95rem, 1.85vw, 1.18rem);
  line-height: 1;
  letter-spacing: 0.1em;
  color: transparent;
  text-transform: uppercase;
  white-space: nowrap;
}

.vmu-module--on .vmu-module__osd:not(:empty) {
  color: #39ff14;
  text-shadow:
    0 0 4px rgba(57, 255, 20, 0.95),
    0 0 12px rgba(0, 255, 64, 0.45),
    0 0 22px rgba(0, 200, 40, 0.2);
  animation: vmu-osd-glow 2.6s steps(4, end) infinite;
}

.vmu-module__lcd-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  opacity: 0.22;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0) 42%,
    rgba(255, 255, 255, 0) 100%
  );
  mix-blend-mode: screen;
}

.vmu-module__lcd-static {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.12s ease;
  overflow: hidden;
}

.vmu-module__lcd-static-canvas {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.88;
  mix-blend-mode: soft-light;
  filter: contrast(1.2) brightness(1.08);
  image-rendering: pixelated;
}

.vmu-module__lcd-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.12s ease;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.42) 2px,
    rgba(0, 0, 0, 0.42) 3px
  );
  mix-blend-mode: multiply;
}

.vmu-module--on .vmu-module__lcd-scanlines {
  opacity: 0.55;
}

.vmu-module--on .vmu-module__lcd {
  background:
    radial-gradient(ellipse 80% 55% at 50% 40%, rgba(40, 120, 72, 0.35), transparent 62%),
    #07140e;
}

.vmu-module--on .vmu-module__lcd-static {
  opacity: 0.62;
}

@keyframes vmu-osd-glow {
  0%,
  100% {
    opacity: 1;
    filter: brightness(1);
  }
  40% {
    opacity: 0.94;
    filter: brightness(0.97);
  }
  70% {
    opacity: 0.99;
    filter: brightness(1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vmu-module--on .vmu-module__osd:not(:empty) {
    animation: none;
  }
}

/* “Lost Memories” — recessed type matching .view-nameplate (ECHONAV-PM); top of sidebar, no box */
#lost-memories-brand.lost-memories-nameplate {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  padding: 12px 14px 0;
  text-align: right;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0;
  line-height: 0.88;
  box-sizing: border-box;
}

.lost-memories-nameplate__line {
  display: block;
  font-family: "Arial Black", "Arial Narrow", "Trebuchet MS", sans-serif;
  font-style: italic;
  font-weight: 900;
  text-transform: uppercase;
  color: rgba(122, 146, 182, 0.92);
  text-shadow:
    0 -1px 0 rgba(220, 236, 255, 0.14),
    0 1px 0 rgba(8, 14, 30, 0.92),
    0 2px 2px rgba(0, 0, 0, 0.34);
  opacity: 0.96;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.lost-memories-nameplate__line--primary {
  font-size: clamp(2.1rem, 5.6vw, 3.35rem);
  letter-spacing: 0.1em;
}

.lost-memories-nameplate__line--secondary {
  font-size: clamp(1.65rem, 4.5vw, 2.65rem);
  letter-spacing: 0.08em;
  margin-top: -0.04em;
}

/* Special-room HUD: counter (left) + proximity LED centered in remaining width above minimap */
.special-room-hud-row {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  bottom: calc(350px + var(--tablet-module-gap));
  min-height: var(--special-room-hud-stack-height);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 6px 0 4px;
  box-sizing: border-box;
  pointer-events: none;
}

.special-room-led-rail {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.special-room-counter {
  position: relative;
  width: 186px;
  height: 54px;
  margin: 0;
  flex-shrink: 0;
  padding: 0 12px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid rgba(162, 188, 228, 0.45);
  background:
    linear-gradient(180deg, rgba(12, 19, 40, 0.72), rgba(10, 16, 34, 0.78)),
    linear-gradient(145deg, rgba(66, 90, 134, 0.35), rgba(26, 42, 78, 0.28));
  box-shadow:
    inset 0 1px 0 rgba(223, 236, 255, 0.14),
    inset 0 -1px 0 rgba(3, 7, 15, 0.42),
    0 3px 10px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
}

.special-room-indicator {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.special-room-counter__indicator {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.08) 28%, rgba(0, 0, 0, 0.14) 100%),
    rgba(18, 24, 38, 0.76);
  border: 1px solid rgba(157, 184, 220, 0.35);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    inset 0 -1px 1px rgba(0, 0, 0, 0.55);
}

.special-room-led {
  position: relative;
  left: auto;
  top: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #111823;
  border: 1px solid rgba(157, 184, 220, 0.26);
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.64);
  opacity: 0.7;
}

.special-room-led.is-near {
  background: #ffba57;
  border-color: rgba(255, 222, 168, 0.65);
  opacity: 1;
  animation: special-room-led-pulse-slow 1.45s ease-in-out infinite;
}

.special-room-led.is-very-near {
  background: #ffd983;
  border-color: rgba(255, 236, 193, 0.86);
  opacity: 1;
  animation: special-room-led-pulse-fast 0.96s ease-in-out infinite;
}

@keyframes special-room-led-pulse-slow {
  0%,
  100% {
    opacity: 0.58;
    filter: brightness(0.92);
    box-shadow:
      0 0 0 rgba(255, 186, 87, 0),
      0 0 0 rgba(255, 186, 87, 0),
      inset 0 0 0 1px rgba(255, 252, 242, 0.25);
  }
  50% {
    opacity: 1;
    filter: brightness(1.05);
    box-shadow:
      0 0 10px rgba(255, 186, 87, 0.72),
      0 0 20px rgba(255, 186, 87, 0.36),
      inset 0 0 0 1px rgba(255, 252, 242, 0.42);
  }
}

@keyframes special-room-led-pulse-fast {
  0%,
  100% {
    box-shadow:
      0 0 0 rgba(255, 217, 131, 0),
      0 0 0 rgba(255, 217, 131, 0),
      inset 0 0 0 1px rgba(255, 254, 246, 0.3);
  }
  50% {
    box-shadow:
      0 0 12px rgba(255, 217, 131, 0.82),
      0 0 26px rgba(255, 186, 87, 0.44),
      inset 0 0 0 1px rgba(255, 254, 246, 0.5);
  }
}

.special-room-counter__value {
  margin-top: 0;
  font: 900 1.62rem "Arial Black", "Trebuchet MS", sans-serif;
  letter-spacing: 0.12em;
  color: rgba(138, 255, 186, 0.94);
  text-shadow:
    0 0 8px rgba(90, 248, 164, 0.45),
    0 1px 0 rgba(6, 12, 20, 0.9);
  line-height: 1;
  white-space: nowrap;
}

/* Game view — Unity canvas only inside this frame (sunken well vs gadget bezels elsewhere) */
#view {
  box-sizing: border-box;
  width: 960px;
  height: 720px;
  padding: var(--tablet-view-well-inset);
  background-color: var(--tablet-view-well-bg);
  position: relative;
  /* Stack above .view-disc-bracket-row so the disc (which extends upward) never paints over Unity */
  z-index: 3;
  isolation: isolate;
  flex-shrink: 0;
  margin: 0;
  border: var(--tablet-view-border);
  border-radius: 6px;
  box-shadow: var(--tablet-view-recess-shadow);
  overflow: hidden;
}

/* Bracket sits under #view (sibling), flush to its bottom — not inside canvas stack */
.view-disc-bracket-row {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  min-height: var(--tablet-view-disc-bracket);
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: flex-start;
  margin: -1px 0 0 0;
  padding: 0;
  box-sizing: border-box;
  /* Must stay below #view — protruding disc must not cover Unity when inserted */
  z-index: 0;
}

.view-nameplate-row {
  width: 100%;
  height: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0 0 -12px 0;
  pointer-events: none;
  box-sizing: border-box;
}

.view-nameplate {
  display: inline-block;
  font-family: "Arial Black", "Arial Narrow", "Trebuchet MS", sans-serif;
  font-size: 0.92rem;
  font-style: italic;
  font-weight: 900;
  letter-spacing: 0.14em;
  transform: translateY(-38px);
  color: rgba(122, 146, 182, 0.88);
  text-shadow:
    0 -1px 0 rgba(220, 236, 255, 0.14),
    0 1px 0 rgba(8, 14, 30, 0.92),
    0 2px 2px rgba(0, 0, 0, 0.34);
  opacity: 0.94;
}

/* ~28% of view width, right-aligned — solid filled grey block (grid keeps |_| silhouette) */
.view-disc-bracket {
  position: relative;
  width: 28%;
  min-width: 218px;
  max-width: 268px;
  height: 38px;
  margin-right: 14px;
  transform: translateX(-14px);
  display: grid;
  grid-template-columns: 11px 1fr 11px;
  grid-template-rows: 1fr 11px;
  gap: 0;
  pointer-events: none;
  box-sizing: border-box;
  background: #5c6068;
  border: 1px solid rgba(0, 0, 0, 0.32);
  border-radius: 0 0 4px 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 1;
}

/* Solid bracket face overlay to guarantee disc is visually behind the bracket. */
.view-disc-bracket::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0 0 4px 4px;
  background: #5c6068;
  border: 1px solid rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  pointer-events: none;
  z-index: 4;
}

.view-disc-bracket__leg {
  background: transparent;
  box-sizing: border-box;
  box-shadow: none;
  position: relative;
  z-index: 5;
}

.view-disc-bracket__leg--left {
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  min-height: 20px;
  border: none;
  border-radius: 0;
}

/* Wii-style vertical slot light on bracket left leg. */
.view-drive-light {
  position: absolute;
  left: 17px;
  top: 19px;
  width: 4px;
  height: 15px;
  border-radius: 1px;
  box-sizing: border-box;
  background: #0f1318;
  border: 1px solid rgba(170, 186, 206, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 0 4px rgba(0, 0, 0, 0.62);
  opacity: 0.7;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.view-drive-light.is-on {
  background: #1fcf6d;
  border-color: rgba(204, 248, 219, 0.55);
  opacity: 1;
  box-shadow:
    0 0 6px rgba(31, 207, 109, 0.5),
    0 0 14px rgba(31, 207, 109, 0.26),
    inset 0 0 0 1px rgba(232, 255, 241, 0.34);
}

.view-drive-light.is-near-exit {
  background: #76f6ad;
  border-color: rgba(186, 255, 214, 0.9);
  opacity: 1;
  box-shadow:
    0 0 12px rgba(118, 246, 173, 0.78),
    0 0 28px rgba(70, 222, 134, 0.5),
    inset 0 0 0 1px rgba(214, 255, 228, 0.5);
}

.view-disc-bracket__leg--right {
  grid-column: 3;
  grid-row: 1;
  align-self: stretch;
  min-height: 20px;
  border: none;
  border-radius: 0;
}

.view-disc-bracket__foot {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 11px;
  align-self: end;
  background: transparent;
  border-radius: 0;
  box-sizing: border-box;
  border: none;
  box-shadow: none;
  position: relative;
  z-index: 5;
}

/* Full disc protruding from bracket bottom (no separate drive zone). */
.view-disc {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 198px;
  height: 198px;
  border-radius: 50%;
  transform: translate(-50%, -52%);
  z-index: 1;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  isolation: isolate;
  --orbit-x: 50%;
  --orbit-y: 50%;
  --orbit-visible: 0;
}

.view-disc__skin {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  z-index: 0;
  transform-origin: 50% 50%;
  border: 1px solid rgba(18, 24, 34, 0.8);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  /* True hole through label + pseudos so #view / Unity shows in the center */
  -webkit-mask-image: radial-gradient(
    circle at 50% 50%,
    transparent 18px,
    #000 20px
  );
  mask-image: radial-gradient(
    circle at 50% 50%,
    transparent 18px,
    #000 20px
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.04) 28%, transparent 38%),
    conic-gradient(
      from 0deg,
      rgba(116, 132, 160, 0.74) 0deg 44deg,
      rgba(186, 196, 214, 0.72) 44deg 88deg,
      rgba(104, 136, 188, 0.74) 88deg 130deg,
      rgba(198, 166, 118, 0.74) 130deg 174deg,
      rgba(130, 154, 184, 0.74) 174deg 218deg,
      rgba(198, 142, 160, 0.72) 218deg 258deg,
      rgba(114, 136, 180, 0.74) 258deg 312deg,
      rgba(186, 196, 214, 0.72) 312deg 360deg
    ),
    radial-gradient(
      circle at center,
      transparent 22px,
      #a0a9b7 24px,
      #7f8794 68%,
      #626a76 100%
    );
}

/* Inner rim only (no fill) so the masked hole stays visually open */
.view-disc__skin::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 1;
  box-sizing: border-box;
  background: transparent;
  border: 2px solid rgba(228, 236, 246, 0.76);
  box-shadow:
    inset 0 0 0 2px rgba(160, 172, 190, 0.5),
    0 0 0 1px rgba(20, 26, 36, 0.45);
}

.view-disc > .button-orbit {
  /* Match compass .n64-c orbit (deck override --orbit-radius: 20px) */
  --orbit-radius: 20px;
  border-radius: 50%;
  z-index: 6;
}

/* While dragging, pointer can leave the disc hitbox; keep ring visible like compass hover */
.view-disc.is-dragging > .button-orbit {
  opacity: 1;
}

.view-disc:hover .orbit-dot,
.view-disc.is-dragging .orbit-dot {
  animation: orbit-dot-spin 1.05s linear infinite;
}

.view-disc:hover,
.view-disc.is-dragging {
  cursor: none;
}

.view-disc.is-spinning .view-disc__skin {
  animation: view-disc-skin-spin 0.35s linear infinite;
}

/* WebGL load: label spin speeds up as createUnityInstance progress approaches 1 (unity-embed.js). */
.view-disc__skin.view-disc__skin--unity-loading {
  animation: view-disc-skin-spin var(--unity-load-spin-s, 7s) linear infinite;
}

.view-disc.is-spinning .view-disc__skin.view-disc__skin--unity-loading {
  animation: view-disc-skin-spin 0.35s linear infinite;
}

.view-disc__skin.view-disc__skin--unity-load-burst {
  animation: view-disc-skin-spin 0.28s linear infinite;
}

.view-disc.is-spinning .view-disc__skin.view-disc__skin--unity-load-burst {
  animation: view-disc-skin-spin 0.35s linear infinite;
}

/* Dragging / ejected off the drive: label must not spin (Unity load skins cleared in JS too). */
.view-disc.is-ejected-free .view-disc__skin,
.view-disc.is-dragging .view-disc__skin {
  animation: none !important;
}

.view-disc.is-ejected-free {
  cursor: grab;
}

.view-disc.is-ejected-free:hover,
.view-disc.is-ejected-free.is-dragging {
  cursor: none;
}

@keyframes view-disc-skin-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes orbit-dot-spin {
  from {
    transform: translate(-50%, -50%) rotate(var(--orbit-angle))
      translateY(calc(-1 * var(--orbit-radius)));
  }
  to {
    transform: translate(-50%, -50%)
      rotate(calc(var(--orbit-angle) + 360deg))
      translateY(calc(-1 * var(--orbit-radius)));
  }
}

/* Unity WebGL fills #view */
#view,
#view #unity-container.unity-desktop,
#view #unity-canvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='3.5' fill='white'/%3E%3C/svg%3E")
    6 6, auto !important;
}
#view #unity-container.unity-desktop {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  box-sizing: border-box;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.55);
  isolation: isolate;
  background: #141210;
}

/* Paints over the canvas so depth reads on top of WebGL (pointer-events pass through). */
#view #unity-container.unity-desktop::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  pointer-events: none;
  z-index: 1;
  box-shadow: var(--tablet-view-inner-rim-shadow);
}

#view #unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  position: relative;
  z-index: 0;
  background:
    radial-gradient(ellipse 95% 70% at 50% 0%, rgba(72, 82, 98, 0.2), transparent 55%),
    radial-gradient(ellipse 70% 55% at 85% 95%, rgba(0, 0, 0, 0.35), transparent 45%),
    #1c181a;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='3.5' fill='white'/%3E%3C/svg%3E")
    6 6, auto !important;
}

/* Intro video over Unity — source file: video/opening.mp4 (next to index.html) */
#intro-video-layer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10050;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 1s ease;
  pointer-events: auto;
  border-radius: 4px;
  overflow: hidden;
}
#intro-video-layer.intro-video-layer--done {
  opacity: 0;
  pointer-events: none;
}
#intro-video-layer video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Blackout + input block while game disc is out (above Unity; still under intro video z-index 10050). */
.disc-drive-overlay {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10040;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border-radius: 4px;
  outline: none;
}

.disc-drive-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.view-underside-deck {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 4px;
}

/* Console — same flex footprint as main; reads as a sheet of notepaper (not a plastic window). */
#console.underside-console {
  flex: 0 1 420px;
  min-width: 253px;
  max-width: 445px;
  margin-left: -14px;
  width: 100%;
  height: 190px;
  flex-shrink: 1;
  margin-top: -86px;
  position: relative;
  z-index: 3;
  box-sizing: border-box;
  border: none;
  border-radius: 4px 5px 3px 4px;
  box-shadow: var(--tablet-console-paper-shadow);
  overflow: hidden;
  transform: rotate(var(--tablet-console-paper-tilt));
  transform-origin: 50% 100%;
  clip-path: polygon(
    0.35% 4px,
    5px 0.25%,
    52% 0%,
    calc(100% - 6px) 0.15%,
    100% 3px,
    100% calc(100% - 4px),
    calc(100% - 4px) 100%,
    7px 100%,
    0 calc(100% - 5px)
  );
  background-color: #7f7568;
  background-image:
    linear-gradient(rgba(42, 33, 24, 0.42), rgba(42, 33, 24, 0.42)),
    linear-gradient(rgba(121, 107, 90, 0.34), rgba(121, 107, 90, 0.34)),
    url("/assets/images/blank-white-notepaper-design_53876-118304_n64_soft.jpg");
  background-repeat: no-repeat;
  background-size: min(104%, 460px) auto;
  background-position: 48% 6px;
  background-blend-mode: multiply, multiply, normal;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
}

#minimap {
  position: relative;
  width: 350px;
  height: 350px;
  flex-shrink: 0;
  margin-top: auto;
  box-sizing: border-box;
  border-radius: var(--tablet-gadget-bezel-outer-radius);
  border: 2px solid var(--tablet-gadget-bezel-plastic-outer);
  background-color: var(--tablet-gadget-bezel-plastic-base);
  box-shadow: var(--tablet-gadget-bezel-drop);
  overflow: hidden;
  z-index: 2;
}

#minimap::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  right: 6px;
  bottom: 6px;
  border-radius: var(--tablet-gadget-bezel-inner-radius);
  pointer-events: none;
  z-index: 2;
  border: 2px solid var(--tablet-gadget-bezel-plastic-mid);
  box-shadow:
    inset 0 0 0 1px var(--tablet-gadget-bezel-line-dark),
    inset 0 0 0 2px var(--tablet-gadget-bezel-line-light),
    inset 0 0 0 3px rgba(0, 0, 0, 0.32);
}

#console.underside-console #console-output {
  width: 100%;
  height: 100%;
  min-height: 0;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 10px;
  box-sizing: border-box;
  color: #211b14;
  opacity: 0.92;
  /* Scroll position is driven by JS only — user cannot scroll back */
  overflow-y: auto;
  overscroll-behavior: none;
  user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: var(--cursor-dot) 6 6, auto;
}

#console.underside-console #console-output div {
  margin-bottom: 3px;
}

#console.underside-console #console-output .console-output__word {
  display: inline-block;
  cursor: var(--cursor-dot) 6 6, pointer;
  border-radius: 2px;
  transition: transform 0.07s ease, filter 0.07s ease;
}

#console.underside-console #console-output .console-output__word:hover {
  filter: brightness(1.06);
}

#console.underside-console #console-output .console-output__word:active {
  transform: scale(0.93) translateY(1px);
  filter: brightness(1.1);
}

@keyframes console-output-word-tap {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.9) translateY(1px);
  }
  100% {
    transform: scale(1);
  }
}

#console.underside-console #console-output .console-output__word--tap {
  animation: console-output-word-tap 0.22s cubic-bezier(0.34, 1.45, 0.64, 1);
}

#console.underside-console #console-output::-webkit-scrollbar {
  display: none;
}

.n64-c-pad-wrap--deck {
  flex: 0 0 auto;
}

/* N64-style row under view; padding-top keeps circles out of #view (no negative translate) */
#view-underside {
  flex: 1 1 auto;
  min-height: var(--tablet-cpad-min);
  min-width: 0;
  width: 100%;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 4px 12px 6px;
  box-sizing: border-box;
}

.n64-c-pad-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  width: 100%;
  max-width: 960px;
  box-sizing: border-box;
}

.n64-c-pad {
  --n64-c-size: 96px;
}

.n64-c-pad--row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: center;
  gap: 150px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 16px;
}

.n64-c-pad.n64-c-pad--row.n64-c-pad--deck {
  gap: 12px;
  padding: 0;
  justify-content: center;
  align-items: flex-end;
}

/* Underside deck: compass rose — N Credits, E Controls, S Memory, W Settings */
.n64-c-pad--compass {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 6px;
  row-gap: 4px;
  width: auto;
  max-width: none;
  padding: 0;
  box-sizing: border-box;
  justify-items: center;
  align-items: center;
}

.n64-c--compass-n {
  grid-column: 2;
  grid-row: 1;
}

.n64-c--compass-e {
  grid-column: 3;
  grid-row: 2;
  justify-self: start;
}

.n64-c--compass-s {
  grid-column: 2;
  grid-row: 3;
}

.n64-c--compass-w {
  grid-column: 1;
  grid-row: 2;
  justify-self: end;
}

.view-underside-deck .n64-c-pad-wrap {
  width: auto;
  max-width: none;
  flex: 0 0 auto;
  /* Keep button position independent from button size changes */
  margin-left: 30px;
  margin-top: -6px;
}

.view-underside-deck .n64-c-pad--compass {
  --n64-c-size: 50px;
  column-gap: 7px;
  row-gap: 16px;
}

.view-underside-deck .n64-c-pad--compass .n64-c {
  padding: 2px;
  border-width: 2px;
}

.view-underside-deck .n64-c-pad--compass .n64-c__label {
  display: none;
}

/* Show text as a caption above each button */
.view-underside-deck .n64-c-pad--compass .n64-c::before {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  top: -16px;
  transform: translateX(-50%);
  font-size: 0.54rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #e8edf7;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.9),
    0 0 3px rgba(10, 18, 38, 0.75);
  pointer-events: none;
}


.view-underside-deck .n64-c-pad--compass .n64-c .button-orbit {
  /* Single radius on and off hover so dots don’t resize when pointer leaves hit area */
  --orbit-radius: 20px;
}

.view-underside-deck .n64-c--high {
  margin-bottom: 0;
}

.n64-c__label {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 94%;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  color: #141414;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.n64-c {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  --orbit-x: 50%;
  --orbit-y: 50%;
  --orbit-visible: 0;
  position: relative;
  flex: 0 0 auto;
  width: var(--n64-c-size);
  height: var(--n64-c-size);
  margin: 0;
  padding: 4px;
  border: 3px solid rgba(12, 22, 48, 0.95);
  border-radius: 50%;
  box-sizing: border-box;
  cursor: var(--cursor-dot) 6 6, pointer;
  line-height: 1;
  color: #1a1a1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: none;
  overflow: visible;
  background:
    radial-gradient(
      circle at 32% 28%,
      rgba(255, 248, 210, 0.95) 0%,
      rgba(255, 220, 72, 0.88) 38%,
      rgba(212, 168, 28, 0.92) 88%
    );
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.55),
    inset 0 -3px 6px rgba(120, 80, 0, 0.45),
    0 3px 0 rgba(0, 0, 0, 0.35);
  transition:
    transform 0.08s ease,
    box-shadow 0.12s ease;
}

/* Orbit ring (classes from react-ui-embed.css); radius sized for circle buttons */
.n64-c .button-orbit {
  --orbit-radius: 24px;
  border-radius: 50%;
  z-index: 3;
}

/* Modal header X: same yellow chrome as nav, much smaller than 96px C-pad */
.n64-c.n64-c--modal-close {
  --n64-c-size: 36px;
  --orbit-radius: 10px;
  padding: 2px;
  border-width: 2px;
}

.n64-c.n64-c--modal-close .n64-c__label {
  font-size: 0.52rem;
  letter-spacing: 0.02em;
}

.n64-c:hover,
.n64-c:focus-visible {
  cursor: none;
  filter: brightness(1.06);
}

.n64-c:hover .orbit-dot,
.n64-c:focus-visible .orbit-dot {
  animation: orbit-dot-spin 1.05s linear infinite;
}

/* Orbit dot color: --ui-orbit-dot (white); glow matches (embed may lag source until rebuild) */
.orbit-dot {
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.55);
}

.n64-c:focus-visible .button-orbit {
  opacity: 1;
}

.n64-c:active {
  transform: translateY(2px) scale(0.96);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.45),
    inset 0 -2px 4px rgba(120, 80, 0, 0.5),
    0 1px 0 rgba(0, 0, 0, 0.4);
}

.n64-c:focus-visible {
  outline: 2px solid rgba(199, 228, 255, 0.95);
  outline-offset: 2px;
}

/* Zigzag without moving into #view: “high” uses margin-bottom so bottoms stay in the underside */
.n64-c--low {
  margin-bottom: 0;
  align-self: flex-end;
}

.n64-c--high {
  margin-bottom: 28px;
  align-self: flex-end;
}

/* React mount: out of tablet flex flow; modals use position:fixed */
.react-root-host {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 12000;
}

.react-root-host * {
  pointer-events: auto;
}

#root .page-shell--embedded {
  width: 0 !important;
  max-width: 0 !important;
  margin: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  padding-inline: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Old embed bundle still renders <main> nav — hide it; modals are separate siblings */
#root .page-shell--embedded > main,
#root .page-shell--embedded main.content-area,
#root .page-shell--embedded > header.top-bar {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  position: absolute !important;
  clip: rect(0, 0, 0, 0) !important;
  pointer-events: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .view-disc:hover .orbit-dot,
  .view-disc.is-dragging .orbit-dot,
  button.vmu-module__screen:hover .orbit-dot,
  button.vmu-module__screen:focus-visible .orbit-dot,
  button.vmu-module__screen:active .orbit-dot {
    animation: none;
  }

  .view-disc.is-spinning .view-disc__skin {
    animation: none;
  }

  .view-disc__skin.view-disc__skin--unity-loading,
  .view-disc__skin.view-disc__skin--unity-load-burst {
    animation: none;
  }
}

