:root {
  color-scheme: dark;
  --room: #07101b;
  --gold: #c99a55;
  --gold-bright: #e2bd79;
  --paper: #d8c29e;
  --paper-light: #ead9ba;
  --ink: #21180e;
  --ink-soft: #67553f;
  --cream: #f0dfbd;
  --muted: #b4aa98;
  --danger: #b54434;
  --success: #6f9b74;
  --focus: #f2d391;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-width: 100%; min-height: 100%; margin: 0; }
body {
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--cream);
  background: linear-gradient(180deg, rgba(3,7,12,.5), rgba(3,7,12,.78)), url("/assets/lab/study.webp") center / cover fixed, #07101b;
}
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
a { text-decoration: none; }
h1, h2, p, figure { margin: 0; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, .spot-panel:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

.spot-shell {
  width: min(100%, 1540px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(15px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "head head" "files files" "desk side";
  gap: 18px 24px;
}

.spot-header { grid-area: head; min-height: 76px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 30px; border-bottom: 1px solid rgba(201,154,85,.42); }
.spot-brand { display: flex; align-items: center; gap: 14px; }
.spot-seal { width: 48px; height: 48px; display: grid; place-items: center; flex: none; border: 1px solid var(--gold); color: var(--gold-bright); font: 25px "Songti SC", STSong, SimSun, serif; transform: rotate(-3deg); box-shadow: inset 0 0 0 3px rgba(201,154,85,.12); }
.spot-brand h1 { color: #ebd6b3; font: 700 clamp(26px, 3vw, 43px)/1 "Songti SC", STSong, SimSun, serif; letter-spacing: .12em; }
.spot-brand p { margin-top: 6px; color: var(--muted); font-size: 12px; letter-spacing: .13em; }
.spot-readouts { display: flex; }
.spot-readouts div { min-width: 112px; padding: 2px 20px; display: grid; gap: 3px; border-left: 1px solid rgba(201,154,85,.3); }
.spot-readouts span { color: var(--muted); font-size: 10px; letter-spacing: .14em; }
.spot-readouts strong { color: var(--gold-bright); font: italic 23px Georgia, serif; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.spot-back { min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border-bottom: 1px solid rgba(201,154,85,.6); font: 15px "Songti SC", STSong, serif; letter-spacing: .08em; }
.spot-back svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.spot-files { grid-area: files; padding: 13px 17px 15px; color: var(--ink); background: linear-gradient(rgba(255,255,255,.05), rgba(91,57,23,.09)), url("/assets/lab/paper.webp") center / 460px auto, var(--paper); border: 1px solid #715638; box-shadow: 0 12px 30px rgba(0,0,0,.32); }
.spot-files-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.spot-files-heading span, .spot-kicker { color: #80663f; font: 10px Georgia, serif; letter-spacing: .2em; }
.spot-files-heading h2 { font: 700 20px "Songti SC", STSong, serif; letter-spacing: .12em; }
.spot-files-heading p { color: var(--ink-soft); font-size: 12px; }
.spot-levels { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.spot-levels button { min-height: 42px; padding: 5px 7px; border: 1px solid rgba(68,43,20,.28); color: var(--ink-soft); background: rgba(255,250,235,.28); font-weight: 700; }
.spot-levels button span { display: block; overflow: hidden; font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.spot-levels button[aria-current="true"] { color: #fff5df; border-color: #6e4a25; background: #674625; box-shadow: inset 0 0 0 2px rgba(226,189,121,.25); }
.spot-levels button:disabled { cursor: not-allowed; opacity: .42; }
.spot-levels button.is-complete::after { content: " ✓"; color: #49674d; }

.spot-desk { grid-area: desk; position: relative; min-width: 0; align-self: start; padding: 13px; border: 1px solid #57452e; border-radius: 12px; background: repeating-linear-gradient(95deg, #101214 0 2px, #18191a 2px 5px, #0b0d0e 5px 7px); box-shadow: inset 0 0 0 2px #050606, inset 0 0 0 4px rgba(168,122,61,.22), 0 24px 60px rgba(0,0,0,.5); }
.spot-desk-heading { min-height: 49px; display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 0 7px; }
.spot-desk-heading span { color: var(--gold); font-size: 10px; letter-spacing: .16em; }
.spot-desk-heading h2 { font: 700 19px "Songti SC", STSong, serif; letter-spacing: .1em; }
.spot-tool { min-height: 34px; padding: 0 13px; border: 1px solid rgba(226,189,121,.48); color: var(--paper-light); background: #171411; font-size: 12px; }
.spot-tool:disabled { cursor: wait; opacity: .45; }
.spot-boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.spot-panel { min-width: 0; padding: 0; }
.spot-panel figcaption { height: 32px; display: flex; align-items: center; justify-content: space-between; padding: 0 9px; color: #cdbd9f; background: #0a0c0e; font: 14px "Songti SC", STSong, serif; }
.spot-panel figcaption small { color: #8f806c; font: 9px Georgia, serif; letter-spacing: .13em; }
.spot-viewport { position: relative; aspect-ratio: 4 / 3; overflow: hidden; cursor: crosshair; background: #05080b; border: 1px solid #493921; touch-action: manipulation; }
.spot-media { position: relative; width: 100%; aspect-ratio: 4 / 3; }
.spot-shell.is-zoomed .spot-viewport { overflow: auto; cursor: grab; touch-action: pan-x pan-y; overscroll-behavior: contain; scrollbar-width: thin; }
.spot-shell.is-zoomed .spot-viewport:active { cursor: grabbing; }
.spot-shell.is-zoomed .spot-media { width: 200%; }
.spot-media img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.spot-difference-layer { pointer-events: none; }
.spot-marker { position: absolute; z-index: 4; width: clamp(28px, 4vw, 48px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid var(--gold-bright); border-radius: 50%; background: rgba(20,12,4,.12); box-shadow: 0 0 0 5px rgba(226,189,121,.2), 0 0 19px rgba(226,189,121,.58); pointer-events: none; animation: spotPop 240ms ease-out; }
.spot-marker::before, .spot-marker::after { content: ""; position: absolute; left: 50%; top: 50%; background: var(--gold-bright); transform: translate(-50%, -50%); }
.spot-marker::before { width: 8px; height: 2px; }.spot-marker::after { width: 2px; height: 8px; }
.spot-marker.is-reveal { border-style: dashed; border-color: #e06755; box-shadow: 0 0 0 5px rgba(181,68,52,.2); animation: spotPulse .7s ease-in-out infinite alternate; }
.spot-reticle { position: absolute; z-index: 5; width: 30px; height: 30px; transform: translate(-50%, -50%); border: 1px solid rgba(240,223,189,.92); border-radius: 50%; box-shadow: 0 0 0 4px rgba(0,0,0,.25); pointer-events: none; }
@keyframes spotPop { from { transform: translate(-50%, -50%) scale(.35); opacity: 0; } }
@keyframes spotPulse { to { filter: brightness(1.45); } }
.spot-loading { position: absolute; inset: 62px 13px 13px; z-index: 9; display: grid; place-content: center; justify-items: center; gap: 12px; background: #080d12; color: var(--muted); font-size: 13px; }
.spot-loading button { min-height: 40px; padding: 0 18px; border: 1px solid var(--gold); background: #382719; }
.spot-spinner { width: 34px; height: 34px; border: 2px solid #433a2d; border-top-color: var(--gold-bright); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.spot-sidebar { grid-area: side; align-self: start; padding: 27px 25px 23px; display: grid; gap: 18px; color: var(--ink); background: linear-gradient(rgba(255,255,255,.05), rgba(91,57,23,.1)), url("/assets/lab/paper.webp") center / 420px auto, var(--paper); border: 1px solid #765b39; box-shadow: inset 0 0 0 6px rgba(82,55,27,.09), 0 22px 55px rgba(0,0,0,.45); }
.spot-briefing h2, .spot-result h2 { margin: 5px 0 12px; font: 700 22px/1.25 "Songti SC", STSong, serif; }
.spot-briefing ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; color: #493925; font-size: 13px; line-height: 1.55; }
.spot-keyboard { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(75,51,27,.22); color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.spot-message { min-height: 58px; padding: 13px 14px; color: #4c3822; background: rgba(255,249,230,.32); border-left: 3px solid var(--gold); font-size: 13px; line-height: 1.55; }
.spot-message.is-error { border-color: var(--danger); color: #7a251d; }
.spot-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.spot-actions button, .spot-share { min-height: 45px; border: 1px solid #604522; font-size: 13px; font-weight: 700; letter-spacing: .05em; }
.spot-secondary { color: #4b3822; background: rgba(255,250,235,.28); }
.spot-secondary span { color: #8b2f25; }
.spot-primary { color: #fff1d0; background: linear-gradient(#76512a, #533719); box-shadow: inset 0 0 0 2px rgba(226,189,121,.16); }
.spot-actions #spotNext { grid-column: 1 / -1; }
.spot-actions button:disabled { cursor: not-allowed; opacity: .45; }
.spot-result { padding-top: 17px; display: grid; grid-template-columns: auto 1fr; gap: 14px; border-top: 1px solid rgba(73,48,24,.28); }
.spot-result-mark { width: 44px; height: 44px; display: grid; place-items: center; border: 2px solid #4f7656; border-radius: 50%; color: #355b3d; font-size: 24px; }
.spot-result.is-lost .spot-result-mark { border-color: var(--danger); color: var(--danger); }
.spot-result p:last-child { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.spot-share { width: 100%; color: var(--ink-soft); background: transparent; border-color: rgba(73,48,24,.32); }

@media (max-width: 1050px) {
  .spot-shell { grid-template-columns: 1fr; grid-template-areas: "head" "files" "desk" "side"; }
  .spot-sidebar { grid-template-columns: 1fr 1fr; align-items: start; }
  .spot-message, .spot-actions, .spot-share { grid-column: 2; }
  .spot-result { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .spot-shell { padding-inline: 12px; gap: 12px; }
  .spot-header { grid-template-columns: 1fr auto; gap: 10px; }
  .spot-seal { width: 40px; height: 40px; font-size: 21px; }
  .spot-brand h1 { font-size: 24px; }.spot-brand p { font-size: 10px; }
  .spot-readouts { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: space-between; border-top: 1px solid rgba(201,154,85,.18); padding-top: 8px; }
  .spot-readouts div { width: 50%; min-width: 0; padding: 0 8px; }.spot-readouts div:first-child { border-left: 0; }
  .spot-back span { display: none; }
  .spot-files { padding-inline: 10px; }.spot-files-heading p { display: none; }
  .spot-levels { grid-template-columns: repeat(4, 1fr); }
  .spot-levels button span { display: none; }
  .spot-desk { padding: 8px; }
  .spot-boards { grid-template-columns: 1fr; gap: 10px; }
  .spot-sidebar { grid-template-columns: 1fr; padding: 22px 19px; }
  .spot-message, .spot-actions, .spot-share, .spot-result { grid-column: 1; }
  .spot-keyboard { display: none; }
  .spot-marker { width: 34px; }
}

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