:root {
  color-scheme: dark;
  --bg: #101718;
  --surface: #182021;
  --ink: #f4f0e7;
  --muted: #b8c1ba;
  --line: #394545;
  --gold: #f0d39c;
  --green: #bce1c5;
  --pink: #f4bba7;
  --headline: "Songti TC", "Noto Serif TC", Georgia, serif;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang HK", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
}
:root:lang(zh-Hans) {
  --headline: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
:root:lang(ja) {
  --headline: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}
:root:lang(en) { --headline: Georgia, serif; }
* { box-sizing: border-box; }
html { background: var(--bg); scroll-padding-block: 12px; }
body {
  margin: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  color: var(--ink);
  background: radial-gradient(ellipse at 7% 0%, #223033 0%, var(--bg) 48%);
  line-height: 1.6;
}
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
a { color: var(--gold); text-underline-offset: .18em; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
.page { width: min(1136px, calc(100% - 64px)); margin: 0 auto; }
.masthead, .footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.masthead { min-height: 78px; border-bottom: 1px solid var(--line); }
.wordmark { display: flex; gap: 10px; align-items: center; color: var(--gold); letter-spacing: .2em; font-size: .88rem; font-weight: 750; }
.wordmark span:last-child { color: var(--muted); font-size: .75rem; letter-spacing: .04em; font-weight: 500; }
.wordmark span:last-child::before { content: '／ '; }
.brand-mark { font-size: 1.55rem; line-height: 1; }
.masthead-actions { display: flex; align-items: center; gap: 10px; }
.language-select { min-height: 44px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: .84rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.intro { margin: 42px 0 28px; }
.eyebrow { color: var(--gold); font-size: .75rem; font-weight: 700; letter-spacing: .15em; margin: 0 0 8px; }
.eyebrow span { color: #8d977b; padding-inline: .3em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-family: var(--headline); font-size: clamp(2.75rem, 7vw, 5rem); line-height: 1.1; letter-spacing: .045em; }
.lede { margin-bottom: 0; max-width: 58ch; color: var(--muted); }
.game { border: 1px solid var(--line); background: var(--surface); border-radius: 19px; overflow: hidden; }
.case-bar { min-height: 60px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 22px; border-bottom: 1px solid var(--line); }
.case-number { color: var(--gold); font: 650 .82rem ui-monospace, monospace; letter-spacing: .1em; white-space: nowrap; }
.case-bar h2 { margin: 0; font-size: 1rem; }
.score { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.desk { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); }
.specimen { margin: 0; min-width: 0; padding: 20px; border-right: 1px solid var(--line); }
.image-box { position: relative; display: grid; min-height: 332px; max-height: 520px; aspect-ratio: 1.18; place-items: center; border: 1px solid #374243; background: #111819; border-radius: 10px; overflow: hidden; }
.image-box img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.image-tag { position: absolute; inset: 12px auto auto 12px; padding: 4px 10px; border: 1px solid #78827a; border-radius: 3px; background: #111819ed; color: var(--ink); font: 600 .72rem ui-monospace, monospace; letter-spacing: .08em; }
.specimen figcaption { color: var(--muted); font-size: .74rem; margin-top: 10px; }
.specimen summary { cursor: pointer; }
.credit { margin: 4px 0 0 1em; }
.clue-jump { display: none; }
.tools { padding: 20px 22px; min-width: 0; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.section-title h3 { margin: 0; font-size: 1.08rem; }
.section-title span { color: var(--muted); font-size: .78rem; }
.clues { display: grid; gap: 7px; }
.clue { display: grid; grid-template-columns: 31px 1fr auto; align-items: start; column-gap: 9px; min-height: 53px; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: #141c1d; }
.clue b { font-size: .85rem; }
.clue-index { color: var(--gold); font: 600 .73rem ui-monospace, monospace; margin-top: 6px; }
.clue p { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.clue-status { font-size: .71rem; color: var(--muted); margin-top: 3px; }
.clue-trigger { width: 100%; align-items: center; text-align: start; color: var(--ink); cursor: pointer; border-color: #796747; }
.clue-trigger .clue-index { margin-top: 0; }
.clue-trigger:hover, .clue-trigger:active { background: #352e24; border-color: var(--gold); }
.clue-open { color: var(--gold); font-size: .8rem; white-space: nowrap; }
.choices-label { margin: 16px 0 7px; font-size: .9rem; font-weight: 700; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.choice { min-height: 49px; padding: 7px 3px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: transparent; cursor: pointer; font-size: .86rem; font-weight: 650; }
.choice:hover:not(:disabled), .choice[aria-pressed="true"] { border-color: var(--gold); background: #423625; color: #ffefcc; }
.choice.correct { border-color: #7daa8b; color: var(--green); background: #23382f; }
.choice.incorrect { border-color: #a87664; color: var(--pink); background: #372920; }
.primary { min-height: 44px; padding: 9px 16px; border-radius: 8px; color: #201a13; background: var(--gold); border: 1px solid transparent; font-weight: 750; cursor: pointer; }
.primary:hover:not(:disabled) { background: #ffe5b6; }
.primary:disabled { color: #bac1b8; background: #303b3a; }
.submit { width: 100%; margin-top: 10px; }
.answer { margin-top: 15px; padding: 12px 13px; border: 1px solid #677e6e; border-radius: 9px; background: #1d2b27; }
.answer h3 { margin-bottom: 5px; color: var(--green); font-size: .98rem; }
.answer p, .answer li { font-size: .85rem; margin-bottom: 5px; }
.answer ul { margin: 6px 0 10px; padding-left: 1.1em; color: var(--muted); }
.links { display: flex; gap: 10px 14px; flex-wrap: wrap; font-size: .8rem; }
.answer .primary { margin-top: 13px; width: 100%; }
.complete { padding: clamp(26px, 7vw, 68px); }
.complete h2 { font: 700 clamp(2rem, 5vw, 3.1rem) var(--headline); margin-bottom: 8px; }
.complete p { color: var(--muted); }
.recap { list-style: none; display: grid; gap: 7px; margin: 20px 0; padding: 0; max-width: 520px; }
.recap li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; }
.recap span { color: var(--muted); }
.footer { padding: 18px 0 24px; color: var(--muted); font-size: .73rem; }
.lab-nav { display: flex; gap: 20px; border-bottom: 1px solid var(--line); }
.lab-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 3px 2px; border-bottom: 2px solid transparent; color: var(--muted); font-size: .9rem; font-weight: 650; text-decoration: none; }
.lab-nav a[aria-current], .lab-nav a:hover { color: var(--gold); border-bottom-color: currentColor; }
body.daily-mode {
  --surface: #261c30;
  --muted: #d9c8d5;
  --line: #634c65;
  --gold: #efca8b;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 80% 13%, #39243e 0%, transparent 52%),
    radial-gradient(ellipse at 0% 90%, #241b38 0%, transparent 55%),
    #150f20;
}
.daily-mode .lab-nav { border-color: #785d6c; }
.daily-mode .intro.daily-intro { margin: clamp(19px, 4.5vw, 52px) 0 clamp(14px, 2.8vw, 29px); }
.daily-intro .eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .7rem;
  letter-spacing: .18em;
}
.daily-intro .eyebrow::before { content: '✦'; font-size: .95rem; }
.daily-mode .daily-intro h1 { font-size: clamp(2.6rem, 7vw, 5rem); font-weight: 650; color: #f9ebd7; }
.daily-intro .lede { max-width: 60ch; }
.daily-reading {
  border: 1px solid #826472;
  border-radius: 17px;
  background:
    radial-gradient(ellipse at 50% 76%, #52304e6b, transparent 61%),
    radial-gradient(ellipse at 50% 2%, #301c38, #1c1426 80%);
  box-shadow: 0 20px 70px #0e091a70, inset 0 0 0 3px #211529, inset 0 0 0 4px #c2967c24;
}
.reading-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-inline: clamp(13px, 3.6vw, 38px);
  padding-block: 13px;
  border-bottom: 1px solid #a27c7b55;
  font-size: .82rem;
  color: var(--muted);
}
.reading-bar span { color: var(--gold); font-weight: 700; }
.reading-bar i { margin-inline-end: 4px; font-style: normal; }
.reading-bar time { text-align: end; }
.daily-service-message { padding: clamp(20px, 4vw, 42px); color: var(--muted); }
.daily-service-message p { margin-bottom: 0; }
.daily-service-message .primary { margin-top: 14px; }
.card-choices {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px clamp(10px, 2vw, 20px);
  width: min(730px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 30px) 19px;
}
.deck-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-inline: clamp(13px, 3.6vw, 38px);
  padding: 10px 0 13px;
  border-top: 1px solid #a27c7b55;
}
.deck-guide { display: grid; gap: 2px; color: var(--muted); font-size: .78rem; }
.deck-guide span:first-child { color: var(--gold); font-weight: 700; }
.deck-swipe, .deck-arrows { display: none; }
.deck-arrows button {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #a27c7b;
  border-radius: 7px;
  background: #2b2036;
  color: var(--gold);
  cursor: pointer;
  font-size: 1.12rem;
}
.deck-arrows button[aria-disabled="true"] { opacity: .48; cursor: default; }
.deck-arrows button:hover:not([aria-disabled="true"]) { background: #492f49; }
.card-back {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--gold);
  background: none;
  cursor: pointer;
}
.card-back img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  border: 1px solid #b99261;
  border-radius: 7px;
  background: #2a1932;
  box-shadow: 0 12px 26px #100c1aaf;
}
.card-back:hover img, .card-back:focus-visible img { border-color: #ffe6a3; filter: brightness(1.17); }
.card-back span { color: var(--gold); font: 600 .75rem Georgia, serif; letter-spacing: .18em; }
.reading-result {
  display: grid;
  grid-template-columns: minmax(160px, 260px) minmax(0, 540px);
  grid-template-rows: auto 1fr;
  grid-template-areas: 'card heading' 'card details';
  justify-content: center;
  column-gap: clamp(20px, 6vw, 73px);
  row-gap: 14px;
  padding: clamp(16px, 4vw, 42px);
}
.card-face {
  position: relative;
  grid-area: card;
  align-self: start;
  min-width: 0;
  margin: 0;
  padding: clamp(8px, 1.6vw, 16px);
  border: 1px solid #b48b56;
  border-radius: 12px;
  background: radial-gradient(ellipse at 20% 4%, #fff3d5, #e8d0a3 84%);
  box-shadow: inset 0 0 0 3px #b38b5f, 0 18px 30px #120b1bc2;
  color: #342434;
  text-align: center;
}
.card-numeral {
  position: absolute;
  z-index: 1;
  inset: 6px auto auto 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 25px;
  padding: 0 7px;
  border: 1px solid #a97a49;
  border-radius: 99px;
  background: #f5e7c8;
  background: color-mix(in srgb, var(--card-hue) 22%, #f5e7c8);
  font: 700 .73rem Georgia, serif;
  letter-spacing: .08em;
}
.card-window {
  overflow: hidden;
  margin-top: 3px;
  border: 1px solid #855d4a;
  border-radius: 100px 100px 5px 5px / 25px 25px 5px 5px;
  background: #392944;
  box-shadow: 0 0 0 1px #a98256;
}
.card-window img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; }
.card-face figcaption {
  margin: 9px 0 0;
  padding: 5px 1px 4px;
  border-top: 1px solid #a98256;
  font: 700 clamp(.95rem, 1.6vw, 1.16rem) / 1.2 var(--headline);
  overflow-wrap: anywhere;
}
.card-imprint { display: block; margin-top: 1px; font: 700 .48rem Georgia, serif; letter-spacing: .25em; }
.reading-title { grid-area: heading; min-width: 0; }
.card-keywords { color: var(--gold); font-weight: 700; font-size: .84rem; margin-bottom: 6px; }
.reading-title h2 { color: #f9ebd7; font: 700 clamp(1.75rem, 5vw, 3.35rem) / 1.12 var(--headline); margin-bottom: 0; }
.reading-details { grid-area: details; display: grid; align-content: start; gap: 15px; margin: 0; }
.reading-details div { border-top: 1px solid #aa849759; padding-top: 10px; }
.reading-details dt { color: var(--gold); font-size: .82rem; font-weight: 700; }
.reading-details dd { margin: 3px 0 0; color: #f3e8e6; }
@media (max-width: 759px) {
  .card-choices {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: clamp(75px, 23vw, 116px);
    gap: 12px;
    padding: 18px 13px 11px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 13px;
    scrollbar-width: thin;
    scrollbar-color: #896780 transparent;
  }
  .card-back { scroll-snap-align: start; }
  .deck-swipe { display: block; }
  .deck-arrows { display: flex; gap: 7px; min-width: 95px; }
}
@media (max-width: 1000px) {
  .page { width: calc(100% - 32px); }
  .masthead { min-height: 58px; }
  .intro { margin: 28px 0 20px; }
  .desk { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .specimen, .tools { padding: 13px; }
  .image-box { min-height: 0; max-height: 390px; aspect-ratio: 4 / 3; }
  .case-bar { min-height: 48px; padding: 8px 13px; }
  .clue p, .answer p, .answer li { font-size: .9rem; }
}
@media (max-width: 639px) {
  .page { width: min(100% - 24px, 580px); }
  .masthead { min-height: 49px; }
  .wordmark span:last-child { display: none; }
  .intro { margin: 19px 0 15px; }
  .intro h1 { font-size: clamp(2.1rem, 9vw, 3.25rem); }
  .lede { font-size: .92rem; }
  .desk { grid-template-columns: 1fr; }
  .specimen { border: 0; border-bottom: 1px solid var(--line); }
  .image-box { max-height: 225px; aspect-ratio: 1.6; }
  .specimen figcaption { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-top: 5px; }
  .specimen summary { min-height: 44px; align-content: center; }
  .clue-jump { display: inline-flex; gap: 5px; align-items: center; min-height: 44px; padding-inline: 4px; white-space: nowrap; }
  .clue-trigger { min-height: 53px; }
  .links { gap: 1px 14px; }
  .links a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (min-width: 540px) and (max-width: 639px) and (orientation: landscape) {
  .desk { grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); }
  .specimen { border-bottom: 0; border-right: 1px solid var(--line); }
  .image-box { aspect-ratio: 4 / 3; }
  .clue-jump { display: none; }
}
@media (max-width: 1240px) and (max-height: 850px) and (orientation: landscape) {
  .masthead { min-height: 40px; }
  .intro { margin: 7px 0 9px; }
  .intro .eyebrow { display: none; }
  .intro h1 { margin-bottom: 4px; font-size: clamp(1.85rem, 3.8vw, 2.35rem); }
  .case-bar { min-height: 42px; }
  .clue { padding-block: 7px; }
  .choices-label { margin-top: 10px; }
}
@media (max-width: 420px) {
  .footer { align-items: start; flex-direction: column; }
}
@media (max-width: 520px) {
  .reading-result {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'heading' 'card' 'details';
    grid-template-rows: auto;
    gap: 18px;
  }
  .reading-title { text-align: center; }
  .card-face { width: min(74%, 210px); margin-inline: auto; }
}
