:root {
  color-scheme: dark;
  --page: #0b1012;
  --panel: #141b1e;
  --ink: #f2f5f3;
  --muted: #a9b4b4;
  --line: #2a3436;
  --mint: #8deac1;
  --gold: #ffe09a;
  --red: #ff796e;
  --pad: clamp(22px, 4.8vw, 98px);
  --mono: "Bahnschrift", "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-family: "Inter", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; background: var(--page); color: var(--ink); }
main { flex: 1; display: flex; flex-direction: column; }
button, select { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; background: transparent; -webkit-tap-highlight-color: transparent; }
button, select, a, summary { touch-action: manipulation; }
:is(button, a, select, summary):focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
button:disabled { cursor: default; opacity: .58; }
[hidden] { display: none !important; }
.wrap { width: min(100%, 2100px); margin-inline: auto; padding-inline: var(--pad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; }
.ic { --size: 18px; flex: none; display: inline-block; width: var(--size); height: var(--size); background: currentColor; -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; vertical-align: middle; }
.topbar { position: relative; z-index: 2; background: #0c1214; border-bottom: 1px solid #344041; }
.bar-inner { height: 72px; display: flex; align-items: center; }
.main-nav { align-self: stretch; display: flex; gap: 6px; }
.nav-item { position: relative; padding: 0 clamp(13px, 1.7vw, 29px); color: #a9b0b1; font-size: 14px; font-weight: 650; }
.nav-item:hover, .icon-btn:hover, .page-footer button:hover { color: white; }
.nav-item.is-here { color: #c3f5da; background: linear-gradient(0deg,#6ce6a90b,transparent 70%); }
.nav-item.is-here::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: -1px; height: 3px; background: var(--mint); }
.history-mobile { display: none; }
.top-tools { display: flex; align-items: center; gap: 17px; margin-left: auto; }
.wallet { display: flex; align-items: center; gap: 9px; padding: 8px 0; color: #c5cbca; font-size: 13px; }
.wallet .ic { color: var(--gold); --size: 21px; }
.wallet b { font: 500 26px/1 var(--mono); color: #f0f0e8; }
.wallet:hover span { color: var(--gold); }
.separator { display: block; height: 18px; width: 1px; background: var(--line); }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; color: #aeb9b8; }
.icon-btn[aria-pressed="true"] { color: var(--mint); }
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; color: #91a09e; font-size: 11px; }
.page-footer > span, .page-footer button { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #8ec4aa; }
.status-dot.off { background: #deb46b; }
.page-footer button { padding: 8px 0 8px 9px; color: #b2bfbd; font-size: 12px; }
.page-footer .ic { --size: 14px; }
.toast { position: fixed; z-index: 5; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: min(90vw,480px); padding: 11px 20px; background: #23332c; border: 1px solid #6b8d7a; color: #d9f2e3; font-size: 13px; text-align: center; }

/* Private panels share the same game controls as the research stage. */
dialog { padding: 0; border: 1px solid #536260; background: #141c1f; color: var(--ink); width: min(720px, calc(100vw - 40px)); max-height: min(90dvh, 880px); box-shadow: 0 28px 100px #000b; overflow: auto; overscroll-behavior: contain; }
dialog[open] { animation: reveal-panel .18s ease-out; }
dialog::backdrop { background: #03090cbd; backdrop-filter: blur(6px); }
body:has(dialog[open]) { overflow: hidden; }
@keyframes reveal-panel { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.dialog-shell { position: relative; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px 19px; border-bottom: 1px solid #344143; background: linear-gradient(110deg,#1e2b2b,#141c1f 72%); }
.dialog-heading h2 { font-size: 24px; line-height: 1.3; margin: 4px 0 0; letter-spacing: .025em; }
.dialog-kicker { font-size: 11px; letter-spacing: .06em; color: var(--mint); }
#dialog[open] { display:flex; flex-direction:column; overflow:hidden; }
#dialog-scroll { min-height:0; overflow:auto; overscroll-behavior:contain; }
#dialog-actions { flex:none; padding-bottom:max(10px,env(safe-area-inset-bottom)); }
#close-dialog { min-height:44px; margin-right:auto; }
.dialog-content { padding: 21px 26px; }
.dialog-actions { display: flex; align-items: stretch; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 16px 26px 20px; border-top: 1px solid #313d3f; background: #11191b; }
.dialog-actions:empty { display: none; }
.dialog-actions button { min-height: 40px; padding: 0 18px; font-size: 13px; gap: 6px; }
.dialog-actions .ic { --size: 15px; }
.panel-intro, .fine-print { margin: 0 0 15px; font-size: 13px; line-height: 1.75; color: #bdcac7; }
.panel-intro strong { color: #f2f3eb; }
.fine-print { font-size: 12px; color: #a7b5b2; }
.fine-print:last-child { margin-bottom: 0; }
.fine-print a { color: #b6e6ce; text-underline-offset: 3px; }
@media (pointer: coarse) {
  .fine-print a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; }
  #film-skip, #film-finish { min-height: 44px; min-width: 44px; }
}
.prize-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.grade-red { --tint: #ff8b81; --glow: #a2312e; }
.grade-gold { --tint: #efcf83; --glow: #775f2f; }
.grade-violet { --tint: #cab8f5; --glow: #5a477b; }
.grade-blue { --tint: #a5cee5; --glow: #3f6576; }
.prize-card { min-width: 0; position: relative; padding: 0 0 9px; background: #1a2226; border: 1px solid #3c484b; border-bottom: 2px solid var(--tint); overflow: hidden; }
.prize-card > b, .prize-card > small { display: block; margin: 4px 8px 0; }
.prize-card > b { font-size: 13px; }
.prize-card > small { font: 11px/1.5 var(--mono),"Microsoft YaHei",sans-serif; color: #c0cbca; }
.award-art { position: relative; isolation: isolate; display: grid; place-items: center; color: var(--tint); height: 68px; overflow: hidden; background: radial-gradient(ellipse at 50% 90%,color-mix(in srgb,var(--glow) 75%,#12181c),#171d21 83%); }
.award-art::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(#b9dbcf0b 1px,transparent 1px),linear-gradient(90deg,#b9dbcf0b 1px,transparent 1px); background-size: 14px 14px; mask-image: linear-gradient(0deg,#000,transparent 130%); }
.award-art .ic { --size: 39px; filter: drop-shadow(0 0 3px var(--glow)); }
.award-art .ic[data-icon="gun"] { --size: 60px; }
.award-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 34%; }
.award-state { position: absolute; top: 5px; right: 5px; padding: 2px 4px; background: #142424e8; border: 1px solid #78988a; color: #ccf4db; font-size: 10px; }
.prize-note { margin: 14px 0 0; }
.rules-list { padding-left: 1.4em; margin: 0; font-size: 14px; line-height: 1.75; color: #cfdbd7; }
.rules-list li + li { margin-top: 5px; }
.subhead { font-size: 14px; margin: 20px 0 10px; color: #e4ece8; }
.cost-strip { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: 4px; }
.cost-cell { background: #1c2729; border: 1px solid #354244; min-width: 0; padding: 8px 2px; text-align: center; }
.cost-cell small { display: block; color: #bdc8c3; font-size: 10px; }
.cost-cell b { display: block; font: 600 18px/1.5 var(--mono); color: var(--gold); }
.rules-foot { margin-top: 18px; }
.history-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-bottom: 18px; }
.history-stats > div { background: #1c2729; border-left: 2px solid #688d7f; padding: 10px 13px; }
.history-stats span { color: #bac6c2; display: block; font-size: 11px; }
.history-stats b { display: block; font: 650 22px/1.3 var(--mono), "Microsoft YaHei",sans-serif; margin-top: 3px; }
.history-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-tools h3 { font-size: 14px; margin: 0; }
.history-tools select { min-height: 34px; border: 1px solid #465553; background: #182224; padding: 0 8px; font-size: 12px; }
.history-round { border-bottom: 1px solid #344143; }
.history-round summary { display: flex; align-items: center; gap: 9px; min-height: 50px; cursor: pointer; list-style: none; font-size: 13px; }
.history-round summary::-webkit-details-marker { display: none; }
.history-round summary > small { margin-left: auto; color: #bdc9c5; font-size: 11px; }
.history-round summary > .ic { --size: 12px; color: #92a7a0; }
.history-round[open] summary > .ic { transform: rotate(180deg); }
.history-round summary b { color: #eff2ef; }
.history-round summary .round-num { color: #a0b2ae; font-size: 11px; }
.history-round .log { padding-bottom: 13px; }
.log { margin: 0; padding: 0; list-style: none; }
.log li { display: flex; align-items: center; gap: 9px; padding: 6px 0; border-top: 1px solid #34414377; font-size: 12px; }
.log .sequence { color: #9cacaa; font: 12px var(--mono); min-width: 21px; }
.log .prize-label { color: var(--tint); }
.log .charge { margin-left: auto; color: #aebfbb; font: 12px var(--mono),"Microsoft YaHei",sans-serif; }
.empty-state { text-align: center; color: #b5c4be; padding: 28px 8px; font-size: 14px; }
.empty-state .ic { display: block; --size: 33px; margin: 0 auto 12px; color: #9ab8aa; }
.reward-show { display: grid; grid-template-columns: 41% 1fr; align-items: stretch; gap: 18px; margin: 0; }
.reward-show .award-art { height: 164px; border: 1px solid #455052; border-bottom: 3px solid var(--tint); }
.reward-show .award-art .ic { --size: 82px; }
.reward-show .award-art .ic[data-icon="gun"] { --size: 132px; }
.reward-copy { align-self: center; }
.reward-copy .reward-type { font-size: 12px; color: var(--tint); }
.reward-copy h3 { margin: 7px 0; font-size: clamp(19px,2vw,26px); line-height: 1.4; }
.reward-copy p { color: #beccc6; font-size: 12px; line-height: 1.8; margin: 0; }
.jackpot-visual { position: relative; isolation: isolate; min-height: 165px; padding: 25px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; border: 1px solid #a5685a; border-bottom: 3px solid var(--red); overflow: hidden; background: #241e1e; }
.jackpot-visual > img { position: absolute; right: 0; top: 0; width: 78%; height: 100%; object-fit: cover; object-position: center 34%; z-index: -3; }
.jackpot-visual::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg,#2a1b1c 0%,#2a1b1cfa 18%,#281c1dc2 41%,#1a161d20 76%),linear-gradient(0deg,#15171bd9,transparent 60%); z-index: -1; }
.jackpot-visual small { color: #ffb7a9; font-size: 12px; }
.jackpot-visual h3 { font-size: clamp(26px,4vw,39px); margin: 5px 0; letter-spacing: .045em; }
.jackpot-visual p { font-size: 13px; color: #e7e0da; margin: 0; }
.bonus-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.bonus-tags span { padding: 4px 7px; border: 1px solid #454d4b; color: #c9d6cf; font-size: 11px; }
.result-log { margin-top: 13px; }
.result-log summary { cursor: pointer; width: fit-content; padding: 4px 0 8px; color: #cedad5; font-size: 13px; }
.reveal-content .award-art, .reveal-content .jackpot-visual { animation: reward-in .38s ease-out; }
.reveal-content .jackpot-visual::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg,transparent 32%,#ffe0c324 47%,#ffbda548 50%,transparent 58%); transform: translateX(110%); animation: reveal-sweep .68s ease-out; }
@keyframes reveal-sweep { from { transform: translateX(-105%); } to { transform: translateX(110%); } }
@keyframes reward-in { from { opacity: .3; transform: translateY(6px); } to { opacity: 1; transform: none; } }

