:root {
  /* IBM Plex Mono** may appear only as tiny mechanical readouts on dials. */
  --soil: #17130F;
  --umber: #4A3325;
  --persimmon: #D36B3D;
  --indigo: #4F5878;
  --ochre: #D8A84C;
  --moss: #7B8664;
  --paper: #E7DCC2;
  --ink: #17130F;
  --font-display: "Fraunces", Georgia, serif;
  --font-label: "Anybody", Impact, system-ui, sans-serif;
  --font-jp: "Noto Sans JP", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono**", "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; overflow: hidden; }

body {
  background: var(--soil);
  color: var(--paper);
  font-family: var(--font-label);
}

button { font: inherit; color: inherit; }

.quest-room {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 20%, rgba(79, 88, 120, .34), transparent 34%),
    radial-gradient(circle at 15% 90%, rgba(74, 51, 37, .86), transparent 36%),
    linear-gradient(135deg, #17130F 0%, #21170F 48%, #120F0C 100%);
}

.grain,
.grain::before,
.grain::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grain {
  opacity: .5;
  background-image:
    radial-gradient(circle, rgba(231, 220, 194, .08) 1px, transparent 1px),
    radial-gradient(circle, rgba(23, 19, 15, .45) 1px, transparent 1px);
  background-size: 9px 9px, 13px 13px;
  mix-blend-mode: screen;
}

.grain::before {
  content: "";
  background: repeating-linear-gradient(95deg, transparent 0 9px, rgba(231, 220, 194, .035) 10px 11px);
}

.lantern-sweep {
  position: absolute;
  width: 42vmax;
  height: 42vmax;
  left: 58%;
  top: 34%;
  border-radius: 50%;
  pointer-events: none;
  opacity: .7;
  background: radial-gradient(circle, rgba(216, 168, 76, .22) 0 7%, rgba(216, 168, 76, .09) 18%, transparent 62%);
  transform: translate(-50%, -50%);
  filter: blur(2px);
}

.board {
  position: relative;
  width: min(1480px, calc(100vw - 48px));
  height: min(860px, calc(100vh - 48px));
  margin: 24px auto;
  border: 4px solid var(--umber);
  border-radius: 18px;
  background:
    linear-gradient(rgba(23,19,15,.68), rgba(23,19,15,.68)),
    repeating-linear-gradient(0deg, rgba(231,220,194,.04) 0 2px, transparent 2px 8px);
  box-shadow: 0 28px 80px rgba(0,0,0,.7), inset 0 0 0 2px rgba(231,220,194,.08);
  opacity: .2;
  transform: scale(.97) rotate(-.3deg);
  animation: boardWake 1.1s cubic-bezier(.2,1.45,.38,1) .15s forwards;
}

.instrument {
  opacity: 0;
  transform: translateY(18px) scale(.88) rotate(var(--r, 0deg));
  animation: bounceIn .84s cubic-bezier(.15,1.6,.38,1) forwards;
  cursor: pointer;
}

.board-header { --r: -1deg; animation-delay: .55s; position: absolute; left: 34px; top: 24px; width: 525px; }

.stamp {
  display: inline-block;
  padding: 7px 15px;
  color: var(--persimmon);
  border: 3px solid var(--persimmon);
  border-radius: 3px;
  font-family: var(--font-jp);
  font-weight: 800;
  letter-spacing: .08em;
  transform: rotate(-4deg);
  background: rgba(231,220,194,.06);
  box-shadow: 3px 3px 0 rgba(211,107,61,.25);
}

.wordmark {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: clamp(4.6rem, 8vw, 8.8rem);
  line-height: .76;
  font-variation-settings: "WONK" 1, "SOFT" 80, "opsz" 80;
  letter-spacing: -.08em;
  color: var(--paper);
  text-shadow: 5px 4px 0 var(--persimmon), -4px -3px 0 rgba(79,88,120,.82);
}

.wordmark span,
.wordmark i { display: inline-block; font-style: normal; animation: letterSquash .82s cubic-bezier(.15,1.8,.38,1) both; }
.wordmark span:nth-child(2) { animation-delay: .08s; }
.wordmark span:nth-child(3) { animation-delay: .14s; }
.wordmark span:nth-child(4) { animation-delay: .2s; }
.wordmark span:nth-child(6) { animation-delay: .28s; }
.wordmark span:nth-child(7) { animation-delay: .34s; }
.wordmark span:nth-child(8) { animation-delay: .4s; }
.wordmark span:nth-child(9) { animation-delay: .46s; }
.wordmark span:nth-child(10) { animation-delay: .52s; }

.bureau-note {
  width: 410px;
  margin: 16px 0 0 34px;
  padding: 14px 18px;
  color: var(--soil);
  background: var(--paper);
  clip-path: polygon(0 6%, 96% 0, 100% 88%, 9% 100%);
  font-weight: 700;
}

.route-tabs { position: absolute; left: 52px; top: 306px; display: flex; gap: 0; transform: rotate(-1deg); z-index: 20; }
.tab {
  position: relative;
  padding: 14px 22px 18px;
  border: 3px solid var(--umber);
  border-right: 0;
  background: var(--moss);
  color: var(--soil);
  font-weight: 900;
  letter-spacing: .05em;
  font-variation-settings: "wdth" 118, "wght" 840;
  box-shadow: 0 8px 0 rgba(0,0,0,.22);
  cursor: pointer;
  transition: transform .25s cubic-bezier(.2,1.6,.4,1), background .2s;
}
.tab:nth-child(2) { background: var(--ochre); transform: translateY(8px) rotate(1deg); }
.tab:nth-child(3) { background: var(--indigo); color: var(--paper); transform: translateY(2px) rotate(-1deg); }
.tab:nth-child(4) { background: var(--persimmon); }
.tab:last-of-type { border-right: 3px solid var(--umber); }
.tab.active { transform: translateY(-9px) rotate(-2deg) scale(1.04); background: var(--paper); color: var(--soil); }
.moth-cursor { position: absolute; top: -28px; left: 38px; color: var(--ochre); font-size: 28px; text-shadow: 2px 2px 0 var(--soil); transition: transform .45s cubic-bezier(.2,1.8,.32,1); }

.panel,
.shadow-field,
.specimen-card {
  position: absolute;
  color: var(--soil);
  background: var(--paper);
  border: 4px solid var(--umber);
  box-shadow: 12px 14px 0 rgba(0,0,0,.28), inset 0 0 0 2px rgba(74,51,37,.16);
}

.panel::before,
.specimen-card::before {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(74,51,37,.25) 1px, transparent 1.6px);
  background-size: 10px 10px;
  opacity: .26;
}

.panel-label {
  position: relative;
  display: inline-block;
  margin: 14px 0 0 14px;
  padding: 6px 10px;
  background: var(--soil);
  color: var(--paper);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .12em;
  font-variation-settings: "wdth" 135, "wght" 880;
}

.compass { --r: 2deg; animation-delay: .86s; left: 66px; top: 374px; width: 290px; height: 286px; clip-path: polygon(3% 0, 100% 4%, 96% 96%, 0 100%); }
.compass-face { position: relative; width: 184px; height: 184px; margin: 21px auto 0; border: 6px solid var(--umber); border-radius: 50%; background: var(--indigo); color: var(--paper); }
.compass-face span { position: absolute; font-family: var(--font-mono); font-weight: 600; }
.north { left: 50%; top: 9px; transform: translateX(-50%); } .east { right: 12px; top: 50%; } .south { left: 50%; bottom: 8px; } .west { left: 12px; top: 50%; }
.needle { position: absolute; left: 50%; top: 50%; width: 22px; height: 82px; background: var(--soil); clip-path: polygon(50% 0, 100% 70%, 50% 100%, 0 70%); transform-origin: 50% 86%; transform: translate(-50%, -86%) rotate(36deg); transition: transform .55s cubic-bezier(.2,1.8,.32,1); }
.keyhole { position: absolute; left: 50%; top: 50%; width: 28px; height: 38px; transform: translate(-50%,-50%); background: var(--ochre); clip-path: circle(38% at 50% 30%); }
.jp-note { position: relative; margin: 12px 24px; font-family: var(--font-jp); color: var(--umber); }

.fuel { --r: -3deg; animation-delay: 1.04s; left: 384px; top: 374px; width: 318px; height: 228px; background: var(--ochre); }
.gauge { position: relative; height: 130px; margin: 14px 26px 0; }
.gauge-arc { position: absolute; left: 18px; right: 18px; bottom: 0; height: 100px; border: 12px solid var(--soil); border-bottom: 0; border-radius: 130px 130px 0 0; }
.gauge-needle { position: absolute; left: 50%; bottom: 6px; width: 8px; height: 92px; background: var(--persimmon); transform-origin: 50% 92%; transform: rotate(47deg); box-shadow: 3px 0 0 rgba(0,0,0,.18); transition: transform .5s cubic-bezier(.2,1.9,.32,1); }
.gauge strong { position: absolute; left: 50%; bottom: 1px; transform: translateX(-50%); font-family: var(--font-display); font-size: 2.3rem; }
.seed-meter { position: relative; display: flex; gap: 10px; padding: 0 28px; }
.seed-meter span { width: 20px; height: 28px; border-radius: 50% 50% 45% 45%; background: var(--soil); transform: rotate(20deg); }
.seed-meter span:nth-child(n+6) { background: rgba(23,19,15,.26); }

.ticker { --r: 1.4deg; animation-delay: 1.18s; left: 330px; top: 628px; width: 420px; height: 142px; background: var(--moss); overflow: hidden; }
.ticker-window { position: relative; margin: 20px; overflow: hidden; border-top: 3px solid var(--soil); border-bottom: 3px solid var(--soil); }
.ticker-track { display: flex; width: max-content; gap: 34px; padding: 14px 0; font-family: var(--font-mono); font-size: .85rem; animation: tickerMove 16s linear infinite; }

.depth { --r: -1.8deg; animation-delay: 1.32s; left: 724px; top: 336px; width: 238px; height: 264px; background: var(--indigo); color: var(--paper); }
.depth .panel-label { background: var(--paper); color: var(--soil); }
.depth-dial { position: relative; width: 164px; height: 164px; margin: 25px auto; border: 8px solid var(--paper); border-radius: 50%; background: conic-gradient(from -30deg, var(--persimmon), var(--ochre), var(--moss), var(--soil), var(--persimmon)); }
.depth-dial span { position: absolute; font-family: var(--font-mono); font-size: .8rem; }
.depth-dial span:nth-child(1) { left: 49%; top: 8px; } .depth-dial span:nth-child(2) { right: 12px; top: 49%; } .depth-dial span:nth-child(3) { left: 48%; bottom: 8px; } .depth-dial span:nth-child(4) { left: 10px; top: 49%; }
.dial-shadow { position: absolute; inset: 34px; border-radius: 50%; background: var(--soil); }
.depth-dial b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 3rem; color: var(--ochre); }

.moth-log { --r: 2.8deg; animation-delay: 1.44s; left: 784px; top: 620px; width: 338px; height: 190px; }
.moth-log ul { position: relative; margin: 18px 24px 4px; padding: 0; list-style: none; font-weight: 700; }
.moth-log li { margin: 8px 0; }
.moth-log b { color: var(--persimmon); font-family: var(--font-mono); }
.moth-row { position: absolute; right: 22px; top: 20px; display: flex; gap: 9px; }
.moth-row span { width: 26px; height: 18px; background: var(--soil); clip-path: polygon(50% 50%, 0 0, 6% 100%, 50% 66%, 94% 100%, 100% 0); animation: mothFlutter 1.8s ease-in-out infinite; }
.moth-row span:nth-child(2) { animation-delay: .25s; } .moth-row span:nth-child(3) { animation-delay: .48s; }

.shadow-field { --r: .6deg; animation-delay: .72s; right: 42px; top: 48px; width: 470px; height: 520px; overflow: hidden; background: var(--indigo); color: var(--paper); clip-path: polygon(1% 2%, 96% 0, 100% 90%, 87% 100%, 0 96%); }
.moon { position: absolute; right: 52px; top: 34px; width: 150px; height: 150px; border-radius: 50%; background: var(--ochre); background-image: radial-gradient(circle, rgba(23,19,15,.28) 2px, transparent 3px); background-size: 13px 13px; box-shadow: -10px 12px 0 rgba(23,19,15,.35); }
.cave-mouth { position: absolute; left: 38px; bottom: 0; width: 300px; height: 220px; background: var(--soil); clip-path: polygon(12% 100%, 16% 50%, 35% 19%, 59% 8%, 83% 42%, 100% 100%); }
.route-lines span { position: absolute; height: 4px; background: var(--ochre); transform-origin: left center; border-radius: 99px; box-shadow: 0 0 14px rgba(216,168,76,.45); }
.route-lines span:nth-child(1) { left: 64px; top: 238px; width: 160px; transform: rotate(-16deg); }
.route-lines span:nth-child(2) { left: 180px; top: 200px; width: 132px; transform: rotate(31deg); }
.route-lines span:nth-child(3) { left: 278px; top: 268px; width: 84px; transform: rotate(-44deg); }
.fragment-label { position: absolute; left: 38px; top: 32px; margin: 0; padding: 8px 12px; background: var(--persimmon); color: var(--soil); font-weight: 900; letter-spacing: .14em; transform: rotate(-3deg); }
.shadow-field h2 { position: absolute; left: 44px; right: 34px; top: 100px; margin: 0; font-family: var(--font-display); font-size: 3.3rem; line-height: .92; font-variation-settings: "WONK" 1, "SOFT" 60; text-shadow: 4px 3px 0 var(--soil); }
.stamp-button { position: absolute; right: 36px; bottom: 34px; padding: 14px 18px; border: 3px solid var(--paper); background: var(--persimmon); color: var(--soil); font-weight: 900; cursor: pointer; box-shadow: 6px 6px 0 var(--soil); transition: transform .18s cubic-bezier(.2,1.7,.38,1); }
.stamp-button:active { transform: translate(4px, 4px) rotate(-3deg); box-shadow: 2px 2px 0 var(--soil); }

.specimen-card { --r: -3.5deg; animation-delay: 1.58s; right: 78px; bottom: 42px; width: 286px; height: 194px; background: var(--paper); padding: 48px 22px 20px; }
.ticket-top { position: absolute; left: 0; right: 0; top: 0; padding: 10px 16px; background: var(--persimmon); color: var(--soil); border-bottom: 4px solid var(--umber); font-weight: 900; letter-spacing: .1em; }
.specimen-card p { position: relative; margin: 0; font-weight: 740; line-height: 1.25; }
.registration { position: absolute; right: 18px; bottom: 14px; width: 54px; height: 54px; }
.registration span { position: absolute; background: var(--soil); }
.registration span:nth-child(1), .registration span:nth-child(2) { left: 24px; top: 0; width: 5px; height: 54px; }
.registration span:nth-child(2) { transform: rotate(90deg); }
.registration span:nth-child(3), .registration span:nth-child(4) { width: 13px; height: 13px; border-radius: 50%; background: var(--persimmon); }
.registration span:nth-child(3) { left: 0; top: 0; } .registration span:nth-child(4) { right: 0; bottom: 0; }

.instrument:hover { filter: saturate(1.12) brightness(1.06); }
.instrument.hit { animation: stampHit .38s cubic-bezier(.18,1.8,.35,1); opacity: 1; }
.story-pop { animation: storyPop .48s cubic-bezier(.18,1.8,.35,1); }

@keyframes boardWake { to { opacity: 1; transform: scale(1) rotate(-.3deg); } }
@keyframes bounceIn { 0% { opacity: 0; transform: translateY(28px) scale(.78) rotate(calc(var(--r, 0deg) - 5deg)); } 64% { opacity: 1; transform: translateY(-9px) scale(1.06) rotate(calc(var(--r, 0deg) + 2deg)); } 100% { opacity: 1; transform: translateY(0) scale(1) rotate(var(--r, 0deg)); } }
@keyframes letterSquash { 0% { transform: translateY(-40px) scale(.65,1.6) rotate(-8deg); opacity: 0; } 65% { transform: translateY(5px) scale(1.25,.72) rotate(3deg); opacity: 1; } 100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; } }
@keyframes tickerMove { to { transform: translateX(-50%); } }
@keyframes mothFlutter { 50% { transform: translateY(-5px) rotate(7deg) scaleX(1.18); } }
@keyframes stampHit { 0% { transform: scale(1) rotate(var(--r, 0deg)); } 45% { transform: scale(.94) rotate(calc(var(--r, 0deg) - 4deg)); } 100% { transform: scale(1) rotate(var(--r, 0deg)); } }
@keyframes storyPop { 0% { transform: scale(.88) rotate(-3deg); opacity: .2; } 70% { transform: scale(1.07) rotate(1deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }

@media (max-width: 980px) {
  html, body { overflow: auto; }
  .quest-room { height: auto; min-height: 100vh; padding: 16px; overflow: visible; }
  .board { width: 100%; height: 1450px; margin: 0; }
  .shadow-field { left: 28px; right: auto; top: 700px; width: calc(100% - 56px); }
  .specimen-card { left: 42px; right: auto; bottom: 42px; }
}
