:root {
  color-scheme: dark;
  --bg: #101916; --panel: #17231e; --text: #f4ebd8; --muted: #b8bbab;
  --gold: #efc783; --gold-dark: #ba8f55; --border: #405044;
  --serif: "Songti SC", "STSong", "SimSun", serif;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  line-height: 1.65;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--bg); min-width: 320px; }
.shell { width: min(1080px, calc(100% - 48px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); }
.header-content { min-height: 78px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; font: 700 25px var(--serif); }
.brand small { display: block; font: 14px system-ui; color: var(--muted); margin-top: 2px; }
.seal { display: grid; place-items: center; border-radius: 10px; width: 42px; aspect-ratio: 1; color: #251b0e; background: var(--gold); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; font-family: var(--serif); }
h1 { font-size: clamp(2.1rem, 6vw, 4.8rem); }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
h3 { font-size: 1.25rem; }
p + p { margin-top: .7rem; }
button, textarea, select { font: inherit; }
a { color: var(--gold); text-underline-offset: .18em; }
button { cursor: pointer; min-height: 46px; border-radius: 8px; padding: 8px 18px; }
button:disabled { cursor: default; opacity: .67; }
:focus-visible { outline: 3px solid #fff1a9; outline-offset: 4px; }
.primary { color: #21190d; background: var(--gold); border: 1px solid var(--gold); font-weight: 700; }
.primary:not(:disabled):hover { background: #ffdda3; }
.quiet { color: var(--text); background: transparent; border: 1px solid var(--border); }
.quiet:hover { border-color: var(--gold-dark); }
.guide-link { border-color: transparent; color: var(--gold); }
.hero { min-height: 450px; display: grid; grid-template-columns: 1fr .95fr; align-items: center; gap: 28px; padding: 42px 0 30px; }
.hero h1 { margin: 0 0 20px; }
.eyebrow { color: var(--gold); letter-spacing: .12em; font-size: .875rem; }
.description { color: var(--muted); max-width: 34em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; }
.hero-art { min-width: 0; position: relative; isolation: isolate; display: grid; place-items: center; aspect-ratio: 1.3; background: radial-gradient(ellipse, #28362a 0, transparent 67%); }
.hero-art::before, .hero-art::after { content: ""; position: absolute; z-index: -1; border: 1px solid #b6915957; width: 75%; aspect-ratio: 1; border-radius: 50%; }
.hero-art::after { width: 64%; border-style: dashed; }
.hero-art .coin { width: 48%; transform: rotate(-13deg); filter: drop-shadow(0 12px 17px #0009); }
.hero-art .coin + .coin { width: 26%; position: absolute; right: 10%; bottom: 10%; transform: rotate(21deg); }
.process { margin: 24px 0 48px; }
.process h2 { margin-bottom: 18px; color: var(--muted); font: 600 .875rem/1.5 system-ui, sans-serif; }
.process-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.panel { border: 1px solid var(--border); background: var(--panel); border-radius: 14px; padding: clamp(16px, 3vw, 28px); }
.process p, .muted { color: var(--muted); }
.process p { margin-top: 7px; }
.screen { padding: 40px 0 52px; }
.screen > h1 { margin-bottom: 14px; font-size: clamp(2rem, 5vw, 3.5rem); }
.locked-pillars { margin: 14px 0; display: flex; flex-wrap: wrap; gap: 8px clamp(12px, 3vw, 26px); }
.locked-pillars div { display: grid; gap: 1px; }
.locked-pillars dt { color: var(--muted); font-size: .875rem; }
.locked-pillars dd { margin: 0; font: 700 1.2rem/1.3 var(--serif); }
.locked-pillars div:last-child dd { color: var(--gold); }
.screen > .panel, .result-meta { margin-top: 20px; }
.prepare { max-width: 680px; margin-inline: auto; }
.manual-panel { margin: 0 auto 24px; }
.manual-panel form { max-width: 640px; margin-top: 16px; }
.manual-time-label { display: block; margin-bottom: 5px; }
.manual-time-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.manual-time-row input {
  flex: 1 1 185px; min-width: 0; max-width: 100%; min-height: 46px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; font: inherit; color: var(--text); background: var(--bg);
}
.manual-panel p { margin-top: 6px; }
.manual-lines { min-width: 0; margin: 16px 0 0; padding: 0; border: 0; }
.manual-lines legend { margin-bottom: 6px; padding: 0; }
.manual-line { display: grid; grid-template-columns: 2.5em minmax(0, 1fr) max-content; align-items: center; gap: 8px; margin-top: 6px; }
.manual-line select { min-width: 0; }
.manual-moving { display: flex; align-items: center; gap: 4px; min-height: 44px; cursor: pointer; }
.manual-moving input { accent-color: var(--gold); }
.prepare label { display: block; margin: 16px 0 5px; }
textarea, select { width: 100%; padding: 10px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
textarea { resize: vertical; }
.shake-layout { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; margin-top: 22px; }
.shake-panel { text-align: center; }
.shake-panel .actions { justify-content: center; }
.coins { display: flex; justify-content: center; align-items: center; gap: clamp(5px, 3vw, 24px); margin: 28px 0 20px; }
.coin { width: min(100%, 100px); display: block; }
.coin-slot { flex: 0 1 100px; min-width: 0; display: grid; justify-items: center; gap: 6px; font-size: .875rem; }
.flipping .coin { animation: flip 850ms ease-in-out infinite; }
.flipping .coin-slot:nth-child(2) .coin { animation-delay: 70ms; }
.flipping .coin-slot:nth-child(3) .coin { animation-delay: 140ms; }
@keyframes flip { 30% { transform: translateY(-12px) rotateY(180deg); } 78% { transform: rotateY(360deg); } }
.line-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 9px; }
.line-list li { display: grid; grid-template-columns: 3em minmax(45px, 1fr) minmax(5.8em, auto); align-items: center; gap: 8px; min-height: 28px; font-size: .875rem; }
.line { color: #b2beab; width: min(100%, 96px); display: inline-flex; height: 8px; gap: 10%; vertical-align: middle; }
.line i { flex: 1; border-radius: 2px; background: currentColor; }
.line.empty i { background: transparent; border: 1px dashed #69776a; }
.moving, .line.moving { color: var(--gold); }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-block: 20px; }
.result-card { width: 100%; min-width: 0; overflow-wrap: anywhere; }
.result-card h2 { margin: 4px 0 10px; }
.result-lines { margin: 12px 0 16px; table-layout: fixed; }
.result-lines th, .result-lines td { padding: 7px 4px; white-space: normal; }
.result-lines thead th { color: var(--muted); font-weight: 400; }
.result-lines th:first-child { min-width: 2.7em; }
.result-line-detail { display: block; color: var(--muted); }
.result-lines thead th:first-child { width: 26%; }
.result-lines.has-chart thead th:nth-child(2) { width: 38%; }
.result-grid:not(.single) .result-lines.has-chart tbody tr { height: calc(3.3em + 16px); }
.result-line-shape { display: grid; grid-template-columns: minmax(0, 80px) 1em 1em; align-items: center; gap: 3px; }
.result-line-shape .line { width: 100%; }
.text-section { margin-top: 18px; }
.text-section h3 { margin-bottom: 6px; }
.moving-text li { margin-bottom: 10px; }
.question { white-space: pre-wrap; overflow-wrap: anywhere; }
summary { cursor: pointer; color: var(--gold); font-size: 1.125rem; font-weight: 700; }
.cast-record { list-style: none; margin: 12px 0 0; padding: 0; }
.cast-record li + li { margin-top: 6px; }
.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th .line, td .line { width: 50px; }
.calendar { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.calendar div { display: flex; gap: 7px; }
.calendar dt { color: var(--muted); }
.calendar dd { margin: 0; }
.chart-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.action-feedback { color: var(--muted); font-size: .875rem; }
.notice { padding: 10px 14px; background: #392e21; border-radius: 8px; margin-top: 12px; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 0 32px; font-size: .875rem; color: var(--muted); }
dialog { width: min(500px, calc(100% - 32px)); color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
dialog li { margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: center; margin-top: 16px; }
#copy-fallback textarea { margin-top: 12px; }
dialog::backdrop { background: #030705c9; }
@media (min-width: 48em) {
  .result-grid:not(.single) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-grid:not(.single) .result-lines.has-chart th,
  .result-grid:not(.single) .result-lines.has-chart td { white-space: nowrap; }
}
@media (max-width: 680px) {
  .shell { width: calc(100% - 32px); }
  .hero, .shake-layout, .process-steps { grid-template-columns: 1fr; }
  .hero { gap: 10px; padding-top: 32px; }
  .hero-art { width: min(100%, 380px); justify-self: center; }
  .process { margin-top: 10px; }
  .screen { padding-top: 28px; }
  .calendar div { flex-wrap: wrap; }
  .calendar dd { overflow-wrap: anywhere; }
}
@media (max-width: 23em) {
  .result-grid:not(.single) .result-lines.has-chart thead th:nth-child(2) { width: 46%; }
}
@media (prefers-reduced-motion: reduce) {
  .flipping .coin { animation: none; }
}
