:root {
  --ink: #17231e;
  --green: #12372d;
  --green-2: #0b2b23;
  --cream: #f1e7cd;
  --paper: #eadbb9;
  --gold: #c89a42;
  --gold-light: #f1d58e;
  --red: #9b3e35;
  --shadow: 0 22px 60px rgba(4, 18, 14, 0.25);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--green-2); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 10%, rgba(57, 112, 87, 0.42), transparent 38rem),
    linear-gradient(145deg, #173d32 0%, #0a2821 70%);
  font-family: "DM Sans", sans-serif;
  overflow-x: hidden;
}

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

.paper-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: soft-light;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

.topbar {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: inherit;
  display: inline-flex;
  gap: 11px;
  align-items: center;
  text-decoration: none;
}

.brand-seal {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(241, 213, 142, .75);
  box-shadow: inset 0 0 0 3px var(--green), inset 0 0 0 4px rgba(241, 213, 142, .35);
  background: var(--gold);
  color: var(--green-2);
  font: 17px/1 "Libre Caslon Display", serif;
}

.brand strong { display: block; font-family: "Libre Caslon Display", serif; font-size: 20px; font-weight: 400; }
.brand small { display: block; color: #b5c6b9; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 9px; }
.style-toggle { display: flex; padding: 3px; border: 1px solid rgba(237,223,189,.18); border-radius: 999px; background: rgba(0,0,0,.12); }
.style-toggle button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 999px; color: #9eb1a4; background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; letter-spacing: .04em; transition: color .18s ease, background .18s ease, box-shadow .18s ease; }
.style-toggle button[aria-pressed="true"] { color: #17231e; background: var(--gold-light); box-shadow: inset 0 1px rgba(255,255,255,.65), 0 2px 7px rgba(0,0,0,.25); }
.mode-toggle button[data-mode="yolo"][aria-pressed="true"] { color: #fff4dc; background: linear-gradient(135deg, #a7372f, #d26a2e); box-shadow: inset 0 1px rgba(255,255,255,.26), 0 2px 9px rgba(98,21,15,.42); }

.icon-button {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(237, 223, 189, .18);
  border-radius: 50%;
  color: var(--cream);
  background: rgba(0, 0, 0, .12);
  cursor: pointer;
}

.icon-button svg { width: 20px; fill: currentColor; }
.icon-button.muted { opacity: .5; }

main { min-height: calc(100vh - 140px); display: grid; place-items: center; }

.intro, .results {
  width: min(560px, calc(100% - 40px));
  padding: 45px 0 60px;
  text-align: center;
  animation: reveal .55s ease both;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.eyebrow span { width: 25px; height: 1px; background: currentColor; opacity: .65; }
.intro .eyebrow span { display: none; }

h1 {
  margin: 18px 0 16px;
  font: 400 clamp(52px, 10vw, 84px)/.94 "Libre Caslon Display", Georgia, serif;
  letter-spacing: -.035em;
}

h1 em { color: var(--gold-light); font-weight: 400; }
.dek { width: min(420px, 100%); margin: 0 auto 28px; color: #c9d4c9; font-size: 16px; line-height: 1.55; }

.mission-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin: 0 0 18px;
  text-align: left;
  border: 1px solid rgba(239, 217, 161, .32);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .035));
  box-shadow: inset 0 1px rgba(255,255,255,.08), 0 15px 35px rgba(0,0,0,.15);
}

.portrait {
  position: relative;
  flex: 0 0 80px;
  height: 92px;
  overflow: hidden;
  border: 5px solid #c39b54;
  outline: 1px solid #f1d58e;
  border-radius: 9px;
  background: #cab98d;
  box-shadow: inset 0 0 20px rgba(42, 27, 8, .6);
}

.portrait-head { position: absolute; width: 49px; height: 60px; left: 10px; top: 12px; border-radius: 48% 48% 43% 43%; background: #534b3d; opacity: .55; }
.portrait-head::after { content: ""; position: absolute; width: 68px; height: 45px; top: 45px; left: -9px; border-radius: 50% 50% 0 0; background: #534b3d; }
.portrait span { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; color: var(--cream); font: 42px/1 "Libre Caslon Display", serif; text-shadow: 0 2px 4px #2a241a; }

.mission-card small, .game-head small { color: var(--gold-light); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.mission-card h2 { margin: 5px 0; font: 400 25px/1.1 "Libre Caslon Display", serif; }
.mission-card p { margin: 0; color: #bdc9bf; font-size: 12px; line-height: 1.5; }

.callsign-field { display: block; margin: 0 0 12px; text-align: left; }
.callsign-field > span { display: flex; justify-content: space-between; margin: 0 3px 6px; color: var(--gold-light); font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.callsign-field small { color: #7f9689; font-size: inherit; }
.callsign-field input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid rgba(239,217,161,.27); border-radius: 10px; outline: none; color: var(--cream); background: rgba(0,0,0,.14); font: 600 14px "DM Sans", sans-serif; transition: border-color .18s ease, box-shadow .18s ease; }
.callsign-field input::placeholder { color: #72877b; }
.callsign-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,154,66,.15); }

.primary-button, .share-button, .hint-button {
  border: 0;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}

.primary-button {
  width: 100%;
  min-height: 58px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  color: #15271f;
  background: linear-gradient(#f0d58d, #c99a43);
  box-shadow: inset 0 1px #fff1be, inset 0 -2px rgba(98, 61, 12, .22), 0 9px 22px rgba(0,0,0,.24);
  font-weight: 800;
}

.primary-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 2.3; }
.primary-button:hover, .share-button:hover, .hint-button:hover { filter: brightness(1.07); }
.primary-button:active, .share-button:active, .hint-button:active { transform: translateY(2px); }
.primary-button:disabled { cursor: wait; opacity: .58; filter: saturate(.5); }
.fine-print { margin: 14px 0 0; color: #8fa398; font-size: 10px; }
.mode-note { margin-top: 5px; color: #6f897b; letter-spacing: .04em; }

.game {
  width: min(1240px, calc(100% - 28px));
  padding: 20px 0 40px;
  animation: reveal .45s ease both;
}

.game-head { display: flex; align-items: end; justify-content: space-between; margin: 0 2px 12px; }
.game-head h2 { margin: 4px 0 0; font: 400 clamp(27px, 4vw, 38px)/1 "Libre Caslon Display", serif; }
.stat-group { display: flex; gap: 8px; }
.stat { min-width: 88px; padding: 7px 11px; border: 1px solid rgba(239,217,161,.25); border-radius: 9px; background: rgba(0,0,0,.12); text-align: right; }
.stat span { display: block; color: #9fb1a4; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.stat strong { color: var(--gold-light); font: 400 22px/1.1 "Libre Caslon Display", serif; }

.level-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 0 2px 10px;
}

.level-track span { height: 3px; border-radius: 999px; background: rgba(239,217,161,.18); transition: background .25s ease, box-shadow .25s ease; }
.level-track span.done { background: #809f80; }
.level-track span.current { background: var(--gold-light); box-shadow: 0 0 12px rgba(241,213,142,.45); }

.scene-frame {
  position: relative;
  padding: 7px;
  border: 1px solid #dbb963;
  border-radius: 10px;
  background: linear-gradient(135deg, #a97827, #f3d992 23%, #77501a 58%, #d7ae53 82%);
  box-shadow: 0 28px 65px rgba(0,0,0,.32), inset 0 0 0 2px rgba(43,28,7,.25);
}

.scene-scroll { position: relative; overflow: auto; border: 2px solid #2f2213; background: #191711; scrollbar-width: none; overscroll-behavior: contain; }
.scene-scroll::-webkit-scrollbar { display: none; }
.scene { position: relative; width: 100%; min-width: 100%; transform-origin: top left; line-height: 0; user-select: none; }
.scene img { width: 100%; height: auto; display: block; pointer-events: none; }
.relocation-layer { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.relocation-patch { position: absolute; inset: 0; width: 100%; height: 100% !important; object-fit: fill; opacity: 0; }
.relocation-curtain {
  -webkit-mask-image: radial-gradient(ellipse var(--source-rx) var(--source-ry) at var(--source-x) var(--source-y), #000 65%, rgba(0,0,0,.94) 76%, transparent 94%);
  mask-image: radial-gradient(ellipse var(--source-rx) var(--source-ry) at var(--source-x) var(--source-y), #000 65%, rgba(0,0,0,.94) 76%, transparent 94%);
  clip-path: inset(0 0 100% 0);
}
.relocation-destination {
  -webkit-mask-image: radial-gradient(ellipse var(--destination-rx) var(--destination-ry) at var(--destination-x) var(--destination-y), #000 30%, rgba(0,0,0,.92) 52%, transparent 82%);
  mask-image: radial-gradient(ellipse var(--destination-rx) var(--destination-ry) at var(--destination-x) var(--destination-y), #000 30%, rgba(0,0,0,.92) 52%, transparent 82%);
  transform: scale(.985);
  transform-origin: var(--destination-x) var(--destination-y);
}
.relocation-layer.is-relocating .relocation-curtain { animation: sourceReplace 760ms cubic-bezier(.22,.72,.18,1) forwards; }
.relocation-layer[data-transition="drape"].is-relocating .relocation-curtain { animation-name: curtainSettle; animation-duration: 1150ms; }
.relocation-layer.is-relocating .relocation-destination { animation: mitchReappear 850ms 720ms cubic-bezier(.2,.76,.2,1) forwards; }
.tap-layer { position: absolute; inset: 0; z-index: 4; cursor: crosshair; touch-action: manipulation; }
.yolo-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.yolo-head {
  position: absolute;
  width: var(--head-size);
  aspect-ratio: 1;
  translate: -50% -50%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
  pointer-events: auto;
  touch-action: manipulation;
  transform: rotate(var(--head-rotation)) scaleX(var(--head-flip));
  filter: drop-shadow(0 .22em .16em rgba(0,0,0,.42));
  transition: filter .16s ease, opacity .2s ease;
  animation: yoloDrop .38s cubic-bezier(.17,.86,.31,1.25) both;
  animation-delay: calc(var(--head-order) * 12ms);
}
.yolo-head img { width: 100%; height: 100%; object-fit: contain; }
.yolo-head.scene-native { opacity: .001; filter: none; animation: none; }
.yolo-head.scene-native:focus-visible { opacity: 1; background: rgba(241,213,142,.12); box-shadow: 0 0 0 3px rgba(18,55,45,.8); }
.yolo-head:hover, .yolo-head:focus-visible { z-index: 1; filter: brightness(1.12) drop-shadow(0 .25em .2em rgba(0,0,0,.5)); }
.yolo-head:focus-visible { outline: 2px dotted rgba(241,213,142,.9); outline-offset: 1px; border-radius: 50%; }
.yolo-head.is-found { opacity: .38; filter: grayscale(.7) drop-shadow(0 .15em .12em rgba(0,0,0,.25)); pointer-events: none; }
.found-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.found-marker {
  position: absolute;
  width: clamp(19px, 2.3vw, 31px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  translate: -50% -50%;
  border: 2px solid #f5df9b;
  border-radius: 50%;
  color: #f9e7aa;
  background: rgba(12, 62, 45, .92);
  box-shadow: 0 0 0 3px rgba(8, 34, 27, .78), 0 4px 14px rgba(0,0,0,.42);
  font: 800 clamp(11px, 1.3vw, 17px)/1 "DM Sans", sans-serif;
  animation: foundPop .42s cubic-bezier(.2, .9, .25, 1.35) both;
}
.cameo-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cameo-target { position: absolute; translate: -50% -50%; padding: 0; border: 0; outline: 0; background: transparent; cursor: crosshair; pointer-events: auto; touch-action: manipulation; filter: saturate(.82) contrast(.96); transition: filter .18s ease; }
.cameo-target img { width: 100%; height: auto; display: block; }
.cameo-target:hover, .cameo-target:focus-visible { filter: saturate(1) brightness(1.08); }
.cameo-target:focus-visible { outline: 2px dotted rgba(241,213,142,.72); outline-offset: 2px; }

.reaction-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.reaction-target {
  position: absolute;
  aspect-ratio: .75;
  translate: -50% -50%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: crosshair;
  pointer-events: auto;
  touch-action: manipulation;
  perspective: 700px;
  filter: saturate(.82) contrast(.95) drop-shadow(0 4px 5px rgba(0,0,0,.28));
  transition: filter .18s ease;
}
.reaction-target:hover, .reaction-target:focus-visible { filter: saturate(1) brightness(1.08) drop-shadow(0 5px 7px rgba(0,0,0,.36)); }
.reaction-target:focus-visible { outline: 2px dotted rgba(241,213,142,.72); outline-offset: 2px; }
.reaction-inner { position: absolute; inset: 0; transform-style: preserve-3d; transform-origin: 50% 56%; }
.reaction-face {
  position: absolute;
  inset: 0;
  display: block;
  background-repeat: no-repeat;
  background-size: 200% 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.reaction-back { background-position: left center; }
.reaction-front { background-position: right center; transform: rotateY(180deg); }
.reaction-target.is-reacting .reaction-inner { animation: livingPortraitTurn var(--turn-duration, 2800ms) cubic-bezier(.48,.04,.21,1) both; }

@keyframes livingPortraitTurn {
  0% { transform: rotateY(0deg) translateZ(0); }
  9% { transform: rotateY(-8deg) translateZ(2px); }
  28%, 72% { transform: rotateY(180deg) translateZ(8px); }
  91% { transform: rotateY(368deg) translateZ(2px); }
  100% { transform: rotateY(360deg) translateZ(0); }
}

.target-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9%;
  aspect-ratio: 1;
  translate: -50% -50%;
  z-index: 3;
  border: 4px solid #f0c85f;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 0 5px rgba(16, 48, 39, .85), 0 0 0 9px rgba(240, 200, 95, .8), 0 0 35px 16px rgba(255, 223, 122, .5);
}
.target-ring.show { opacity: 1; animation: ring .8s ease infinite alternate; }

.level-clear {
  position: absolute;
  inset: 7px;
  z-index: 7;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 20px;
  perspective: 1200px;
  background:
    radial-gradient(circle at 50% 42%, rgba(236,190,84,.29), transparent 26%),
    linear-gradient(125deg, rgba(3,20,15,.94), rgba(12,55,42,.94) 48%, rgba(3,20,15,.94));
  backdrop-filter: blur(7px) saturate(.8);
  opacity: 0;
}

.level-clear.is-active { animation: transitionFade 3.3s ease both; }

.transition-panels, .transition-particles, .transition-stage { position: absolute; inset: 0; pointer-events: none; }
.transition-panels { z-index: 0; display: flex; perspective: 900px; }
.transition-panels span { width: 50%; height: 100%; border-inline: 1px solid rgba(249,218,134,.28); background: repeating-linear-gradient(135deg, rgba(200,154,66,.19) 0 2px, transparent 2px 22px), linear-gradient(110deg, #0b2b23, #1b5845); box-shadow: inset 0 0 80px rgba(0,0,0,.45); }
.transition-panels span:first-child { transform-origin: left center; animation: panelLeft 3.3s cubic-bezier(.2,.8,.2,1) both; }
.transition-panels span:last-child { transform-origin: right center; animation: panelRight 3.3s cubic-bezier(.2,.8,.2,1) both; }

.transition-stage { z-index: 2; display: grid; place-items: center; padding-bottom: 78px; transform-style: preserve-3d; }
.transition-rings { position: absolute; width: min(40vw, 285px); aspect-ratio: 1; transform-style: preserve-3d; animation: ringArrival 3.3s cubic-bezier(.15,.8,.2,1) both; }
.transition-rings span { position: absolute; inset: 0; border: 2px solid rgba(242,205,111,.7); border-radius: 50%; box-shadow: 0 0 20px rgba(240,200,95,.18), inset 0 0 20px rgba(240,200,95,.12); }
.transition-rings span:nth-child(1) { rotate: 0 1 0 68deg; }
.transition-rings span:nth-child(2) { rotate: 1 0 0 68deg; animation: orbitRing 1.1s linear infinite; }
.transition-rings span:nth-child(3) { scale: .76; rotate: 1 1 0 72deg; border-style: dashed; animation: orbitRingReverse 1.45s linear infinite; }

.transition-token { position: relative; width: min(31vw, 225px); aspect-ratio: 1; transform-style: preserve-3d; animation: tokenFlight 3.3s cubic-bezier(.14,.73,.19,1) both; filter: drop-shadow(0 17px 18px rgba(0,0,0,.45)); }
.token-face { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.token-front img { width: 100%; height: 100%; object-fit: contain; }
.token-back { transform: rotateY(180deg); border: 7px double #f1d58e; color: #183a2f; background: radial-gradient(circle at 35% 28%, #fff0b2, #c49438 48%, #704510 82%); box-shadow: inset 0 0 0 8px #14392e, inset 0 0 0 10px rgba(255,235,166,.75); }
.token-back span { font-size: clamp(56px, 9vw, 94px); filter: sepia(1) saturate(.65) contrast(1.2); }

.transition-particles { z-index: 1; }
.transition-particles i { --x: 0px; --y: 0px; position: absolute; left: 50%; top: 45%; color: var(--gold-light); opacity: 0; font-style: normal; font-size: 22px; text-shadow: 0 4px 9px rgba(0,0,0,.5), 0 0 12px rgba(241,213,142,.55); animation: particleBurst 2.5s .25s cubic-bezier(.12,.62,.25,1) both; }
.transition-particles i:nth-child(1) { --x: -390px; --y: -120px; rotate: -19deg; }
.transition-particles i:nth-child(2) { --x: -245px; --y: 145px; rotate: 31deg; }
.transition-particles i:nth-child(3) { --x: -125px; --y: -175px; rotate: -42deg; }
.transition-particles i:nth-child(4) { --x: 365px; --y: -115px; rotate: 28deg; }
.transition-particles i:nth-child(5) { --x: 270px; --y: 135px; rotate: -32deg; }
.transition-particles i:nth-child(6) { --x: 130px; --y: -185px; rotate: 17deg; }
.transition-particles i:nth-child(7) { --x: -355px; --y: 85px; rotate: 46deg; }
.transition-particles i:nth-child(8) { --x: 390px; --y: 70px; rotate: -24deg; }

.level-clear-card {
  position: absolute;
  left: 50%;
  bottom: 5.5%;
  z-index: 3;
  width: min(520px, calc(100% - 28px));
  translate: -50% 18px;
  color: var(--cream);
  opacity: 0;
  text-align: center;
  animation: transitionCopy 3.3s ease both;
}
.level-clear-card small { color: var(--gold-light); font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.level-clear-card h3 { margin: 5px 0 2px; font: 400 clamp(28px, 4vw, 42px)/1 "Libre Caslon Display", serif; text-shadow: 0 3px 14px rgba(0,0,0,.6); }
.level-clear-card > strong { display: block; color: var(--gold-light); font: 400 20px/1.2 "Libre Caslon Display", serif; }
.level-clear-card p { margin: 5px 0 8px; color: #b8cabf; font-size: 11px; line-height: 1.4; }
.transition-skip { padding: 4px 8px; border: 0; color: #8fa79a; background: transparent; cursor: pointer; font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.transition-skip:hover { color: var(--gold-light); }

.miss-marker { position: absolute; width: 27px; height: 27px; translate: -50% -50%; z-index: 4; pointer-events: none; animation: miss .65s ease forwards; }
.miss-marker::before, .miss-marker::after { content: ""; position: absolute; left: 12px; top: 0; width: 3px; height: 27px; border-radius: 3px; background: #ff6657; box-shadow: 0 1px 3px rgba(0,0,0,.8); }
.miss-marker::before { rotate: 45deg; }
.miss-marker::after { rotate: -45deg; }

.toast { position: absolute; left: 50%; top: 24px; translate: -50% -10px; z-index: 6; opacity: 0; padding: 9px 14px; border-radius: 999px; color: #fff5df; background: rgba(93, 35, 31, .93); box-shadow: 0 6px 18px rgba(0,0,0,.3); font-size: 12px; font-weight: 700; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; translate: -50% 0; }

.zoom-controls { position: absolute; right: 16px; bottom: 16px; z-index: 5; display: flex; align-items: center; overflow: hidden; border: 1px solid rgba(255,255,255,.22); border-radius: 8px; background: rgba(9, 30, 24, .9); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.zoom-controls button { width: 38px; height: 36px; border: 0; color: var(--cream); background: transparent; font-size: 21px; cursor: pointer; }
.zoom-controls span { width: 48px; color: #b7c8bb; text-align: center; font-size: 10px; }
.zoom-controls button:disabled { opacity: .3; }

.game-actions { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 4px 0; }
.game-actions p { margin: 0; color: #aebeb2; font-size: 11px; text-align: right; }
.hint-button { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid rgba(239,217,161,.25); border-radius: 9px; color: var(--cream); background: rgba(0,0,0,.14); font-size: 11px; font-weight: 700; }
.hint-button svg { width: 18px; fill: none; stroke: var(--gold-light); stroke-width: 1.8; }
.hint-button span { color: #c6a95e; }
.hint-button:disabled { opacity: .45; cursor: default; }

.results { padding-top: 28px; }
.result-seal { width: 74px; aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto 20px; border: 1px solid #f1d58e; border-radius: 50%; color: var(--green-2); background: var(--gold); box-shadow: inset 0 0 0 5px var(--green), inset 0 0 0 7px #f1d58e, 0 12px 32px rgba(0,0,0,.25); font: 400 34px/1 "Libre Caslon Display", serif; }
.results h1 { margin: 15px 0 10px; font-size: clamp(44px, 9vw, 66px); }
.result-copy { margin: 0 auto 22px; color: #b9c9be; font-size: 14px; }

.score-card { margin: 0 0 16px; padding: 20px 22px 17px; border: 1px solid rgba(239,217,161,.3); border-radius: 14px; background: rgba(0,0,0,.14); box-shadow: inset 0 1px rgba(255,255,255,.05); }
.score-card > span { color: #9daf9f; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.score-card > strong { display: block; margin: 3px 0 14px; color: var(--gold-light); font: 400 56px/1 "Libre Caslon Display", serif; }
.score-breakdown { padding: 12px 0; border-top: 1px solid rgba(255,255,255,.09); border-bottom: 1px solid rgba(255,255,255,.09); }
.score-breakdown p, .best-row { display: flex; justify-content: space-between; margin: 5px 0; color: #adbdaf; font-size: 11px; }
.score-breakdown b { color: #d9e0d9; }
.best-row { margin: 13px 0 0; color: var(--gold-light); font-weight: 700; }
.rank-row { display: flex; justify-content: space-between; margin: 6px 0 0; color: #aebeb2; font-size: 11px; }
.rank-row b { color: var(--gold-light); }
.leaderboard-card { margin: -2px 0 16px; overflow: hidden; border: 1px solid rgba(239,217,161,.22); border-radius: 12px; background: rgba(0,0,0,.1); text-align: left; }
.leaderboard-head { display: flex; justify-content: space-between; padding: 11px 15px; border-bottom: 1px solid rgba(255,255,255,.08); color: var(--gold-light); font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.leaderboard-head small { color: #779084; font-size: 8px; }
.leaderboard-card ol { margin: 0; padding: 6px 15px 8px 39px; }
.leaderboard-card li { min-height: 25px; padding: 4px 0 4px 3px; color: #b9c8be; font-size: 11px; }
.leaderboard-card li::marker { color: #8ea295; font: 400 11px "Libre Caslon Display", serif; }
.leaderboard-card li span { display: flex; justify-content: space-between; gap: 15px; }
.leaderboard-card li b { color: var(--cream); }
.leaderboard-card .leaderboard-empty { list-style: none; margin-left: -24px; color: #7f9488; text-align: center; }
.share-button { width: 100%; min-height: 49px; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(239,217,161,.3); border-radius: 11px; color: var(--cream); background: rgba(0,0,0,.12); font-weight: 700; }
.share-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.satire-note { width: 90%; margin: 16px auto 0; line-height: 1.5; }

.confirm-dialog { width: min(460px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 17px; color: var(--cream); background: transparent; box-shadow: 0 28px 80px rgba(0,0,0,.55); }
.confirm-dialog::backdrop { background: rgba(3,18,14,.78); backdrop-filter: blur(5px); }
.confirm-card { padding: 28px; border: 1px solid rgba(241,213,142,.48); border-radius: 17px; background: linear-gradient(145deg, #1a493a, #092b23); text-align: center; }
.confirm-card small { color: var(--gold-light); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.confirm-card h2 { margin: 8px 0 9px; font: 400 34px/1.08 "Libre Caslon Display", serif; }
.confirm-card p { margin: 0 auto 21px; color: #b4c5ba; font-size: 13px; line-height: 1.55; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 9px; }
.confirm-actions .share-button, .confirm-actions .primary-button { min-height: 49px; margin: 0; padding: 0 12px; font-size: 12px; }

.history-dialog { width: min(760px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; color: var(--cream); background: transparent; box-shadow: 0 35px 100px rgba(0,0,0,.72); }
.history-dialog::backdrop { background: rgba(3,18,14,.84); backdrop-filter: blur(7px) saturate(.65); }
.history-card { position: relative; display: grid; grid-template-columns: minmax(190px, .72fr) 1.28fr; overflow: hidden; border: 1px solid rgba(241,213,142,.5); border-radius: 20px; background: linear-gradient(145deg, #194738, #08271f 72%); }
.history-close { position: absolute; right: 14px; top: 13px; z-index: 2; width: 36px; height: 36px; border: 1px solid rgba(241,213,142,.25); border-radius: 50%; color: var(--cream); background: rgba(4,24,18,.6); cursor: pointer; font-size: 24px; }
.history-portrait { position: relative; min-height: 410px; overflow: hidden; background: radial-gradient(circle at 50% 35%, rgba(231,190,95,.26), transparent 52%), #0a211b; }
.history-portrait::after { content: ""; position: absolute; inset: 0; box-shadow: inset -35px 0 45px rgba(7,30,23,.72); pointer-events: none; }
.history-portrait img { position: absolute; left: 50%; bottom: -2%; width: 115%; max-width: none; translate: -50% 0; }
.history-copy { align-self: center; padding: 42px 45px 34px 34px; }
.history-copy small { color: var(--gold-light); font-size: 9px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.history-copy h2 { margin: 8px 0 6px; font: 400 clamp(38px, 6vw, 52px)/.95 "Libre Caslon Display", serif; letter-spacing: -.025em; }
.history-copy > strong { display: block; color: #d8c99f; font-size: 11px; line-height: 1.45; }
.history-copy p { margin: 18px 0 14px; color: #bdcbc2; font-size: 13px; line-height: 1.62; }
.history-copy a { display: inline-block; margin-bottom: 20px; color: var(--gold-light); font-size: 10px; font-weight: 800; text-underline-offset: 3px; }
.history-copy .primary-button { min-height: 49px; font-size: 12px; }
.history-clock-note { display: block; margin-top: 10px; color: #789287; font-size: 9px; text-align: center; }

footer { width: min(1180px, calc(100% - 40px)); min-height: 55px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; color: #71877b; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }

[hidden] { display: none !important; }

@keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ring { to { scale: 1.08; filter: brightness(1.2); } }
@keyframes foundPop { from { opacity: 0; scale: .25; rotate: -18deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes yoloDrop { from { opacity: 0; transform: translateY(-22px) rotate(var(--head-rotation)) scaleX(var(--head-flip)) scale(.45); } to { opacity: 1; transform: translateY(0) rotate(var(--head-rotation)) scaleX(var(--head-flip)) scale(1); } }
@keyframes miss { 0% { opacity: 0; scale: .4; } 25% { opacity: 1; scale: 1.15; } 100% { opacity: 0; scale: .8; } }
@keyframes curtainSettle {
  0% { opacity: 0; clip-path: inset(0 0 100% 0); filter: brightness(1.06); }
  18% { opacity: 1; }
  72% { clip-path: inset(0 0 0 0); filter: brightness(1); }
  86% { transform: translateY(.35%); }
  100% { opacity: 1; clip-path: inset(0 0 0 0); transform: none; filter: none; }
}
@keyframes sourceReplace {
  0% { opacity: 0; clip-path: inset(0); filter: blur(1px) brightness(1.03); }
  100% { opacity: 1; clip-path: inset(0); filter: none; }
}
@keyframes mitchReappear {
  0% { opacity: 0; transform: scale(.985) translateY(1.1%); filter: blur(2px); }
  58% { opacity: 1; transform: scale(1.003) translateY(-.15%); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: none; }
}
@keyframes transitionFade { 0% { opacity: 0; } 7%, 100% { opacity: 1; } }
@keyframes panelLeft { 0% { transform: rotateY(-96deg); } 14%, 82% { transform: rotateY(0); } 100% { transform: rotateY(96deg); } }
@keyframes panelRight { 0% { transform: rotateY(96deg); } 14%, 82% { transform: rotateY(0); } 100% { transform: rotateY(-96deg); } }
@keyframes ringArrival { 0% { opacity: 0; transform: translateZ(-650px) scale(.2) rotateZ(-100deg); } 18%, 73% { opacity: 1; transform: translateZ(0) scale(1) rotateZ(0); } 100% { opacity: 0; transform: translateZ(520px) scale(2.15) rotateZ(100deg); } }
@keyframes orbitRing { to { rotate: 1 0 0 428deg; } }
@keyframes orbitRingReverse { to { rotate: 1 1 0 -288deg; } }
@keyframes tokenFlight { 0% { opacity: 0; transform: translateZ(-700px) rotateY(-180deg) scale(.12); } 18% { opacity: 1; } 67% { opacity: 1; transform: translateZ(65px) rotateY(720deg) scale(1); } 100% { opacity: 0; transform: translateZ(560px) rotateY(1080deg) scale(1.75); } }
@keyframes particleBurst { 0% { opacity: 0; transform: translate3d(0,0,-200px) scale(.2); } 18% { opacity: 1; } 82% { opacity: .85; } 100% { opacity: 0; transform: translate3d(var(--x),var(--y),150px) scale(1.4); } }
@keyframes transitionCopy { 0%, 42% { opacity: 0; translate: -50% 18px; } 55%, 86% { opacity: 1; translate: -50% 0; } 100% { opacity: 0; translate: -50% -8px; } }

@media (max-width: 700px) {
  .topbar { width: calc(100% - 30px); }
  .brand small { display: none; }
  .brand-seal { width: 37px; }
  .style-toggle button { min-height: 31px; padding: 0 9px; font-size: 9px; }
  .topbar-actions { gap: 5px; }
  .mode-toggle button { padding-inline: 7px; }
  .icon-button { width: 38px; }
  main { min-height: calc(100vh - 120px); }
  .intro { padding-top: 32px; }
  .mission-card { padding: 13px; }
  .portrait { flex-basis: 67px; height: 80px; }
  .portrait-head { left: 5px; }
  .game { width: calc(100% - 16px); max-width: calc(100vw - 16px); min-width: 0; padding-top: 8px; }
  .scene-frame, .scene-scroll { min-width: 0; }
  .game-head { align-items: center; flex-wrap: wrap; gap: 8px; }
  .game-head > div:first-child { width: 100%; }
  .game-head > div:first-child small { display: none; }
  .game-head h2 { margin: 0; font-size: 26px; }
  .stat-group { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .stat { min-width: 0; padding: 5px 6px; text-align: center; }
  .stat strong { font-size: 16px; }
  .found-stat { min-width: 68px; }
  .scene-frame { padding: 5px; }
  .level-track { margin-bottom: 7px; }
  .level-clear { inset: 5px; }
  .transition-stage { padding-bottom: 92px; }
  .transition-token { width: min(47vw, 190px); }
  .transition-rings { width: min(63vw, 255px); }
  .level-clear-card { bottom: 5%; }
  .scene-scroll { height: min(67vh, 590px); }
  .scene { width: 980px; }
  .zoom-controls { display: none; }
  .game-actions { align-items: start; }
  .game-actions p { padding-top: 4px; }
  footer { width: calc(100% - 30px); }
  footer span:last-child { display: none; }
  .confirm-actions { grid-template-columns: 1fr; }
  .history-card { grid-template-columns: 1fr; }
  .history-portrait { min-height: 190px; }
  .history-portrait::after { box-shadow: inset 0 -32px 35px rgba(7,30,23,.82); }
  .history-portrait img { bottom: -68%; width: 62%; }
  .history-copy { padding: 24px 22px 22px; }
  .history-copy h2 { font-size: 38px; }
  .history-copy p { font-size: 12px; }
}

@media (max-width: 470px) {
  .brand > span:last-child { display: none; }
  .topbar { width: calc(100% - 20px); }
  .style-toggle button { padding-inline: 7px; font-size: 8px; }
}

@media (min-width: 701px) {
  .scene-scroll { max-height: calc(100vh - 215px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .level-clear.is-active { opacity: 1; animation: none !important; }
  .transition-panels, .transition-particles, .transition-rings { display: none; }
  .transition-token { opacity: 1; transform: none; animation: none !important; }
  .level-clear-card { opacity: 1; translate: -50% 0; animation: none !important; }
  .reaction-face { transition: opacity .18s ease; }
  .reaction-target.is-reacting .reaction-inner { animation: none !important; transform: none; }
  .reaction-target.is-reacting .reaction-back { opacity: 0; }
  .reaction-target.is-reacting .reaction-front { opacity: 1; transform: none; }
  .relocation-layer.is-relocating .relocation-curtain,
  .relocation-layer.is-relocating .relocation-destination { animation: none !important; opacity: 1; clip-path: none; transform: none; filter: none; }
}
