* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --bg: #0a101e;
  --surface: #10192a;
  --line: #2a374c;
  --fg: #f4ecdb;
  --muted: #a8b6cd;
  --gold: #f3d796;
  font: 15px/1.5 "Segoe UI", "Microsoft JhengHei", sans-serif;
}
body { margin: 0; color: var(--fg); background: radial-gradient(ellipse at 48% -16%, #252b47 0, var(--bg) 58%); min-height: 100vh; }
a { color: var(--gold); text-underline-offset: .25em; }
a:hover { color: #fff1c9; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #a8d9ff; outline-offset: 3px; }
button:disabled { cursor: default; opacity: .48; }
.shell { width: min(1280px, calc(100% - 96px)); margin-inline: auto; }
.masthead, .footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.masthead { padding: 22px 0; border-bottom: 1px solid var(--line); }
.masthead nav, .footer nav { display: flex; gap: 24px; }
.masthead nav a, .footer a { color: var(--muted); font-size: .86rem; }
.brand { color: var(--fg); font: 700 24px/1.1 Georgia, serif; text-decoration: none; letter-spacing: -.04em; }
.brand span { margin-left: .5em; color: var(--gold); font-size: .65em; vertical-align: super; }
.hero { padding: 42px 0 28px; }
.proof { display: flex; flex-wrap: wrap; gap: .25rem .9rem; color: var(--muted); font-size: .82rem; }
.hero h1 { margin: 9px 0 8px; font: 400 clamp(52px, 7vw, 99px)/.98 Georgia, "Songti TC", "Microsoft JhengHei", serif; letter-spacing: -.065em; }
html[lang="zh-Hant"] .hero h1 { letter-spacing: .015em; font-size: clamp(44px, 6vw, 72px); margin-block: 14px; }
.hero p { margin: 0; color: var(--muted); font-size: clamp(.94rem, 1.3vw, 1.08rem); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.95fr) minmax(310px, 1fr); gap: 24px; align-items: start; }
.atlas, .panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.atlas { padding: 15px; }
.toolbar, .ledger, .sector-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toolbar { padding: 0 2px 13px; }
.tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid #28354b; border-radius: 9px; background: #0b1322; }
.tabs button, .text-button { background: transparent; border: 0; padding: 7px 12px; border-radius: 6px; color: var(--muted); font-size: .85rem; }
.tabs button[aria-pressed="true"] { background: #263450; color: var(--fg); }
.text-button { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.plate { position: relative; }
.plate img { display: block; width: 100%; height: auto; border-radius: 11px; background: #151d32; }
#chart-hit {
  position: absolute; display: grid; grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr); width: 23.3333%; height: 35%; top: 37.0833%;
  box-shadow: 0 0 0 2px #f3d7969e; border-radius: 4px;
}
#chart-hit button { min-width: 0; min-height: 0; padding: 0; border: 1px solid transparent; background: transparent; }
#chart-hit button:hover:not(:disabled) { border-color: #fff0ae; background: #fff0ae30; }
#chart-hit button[aria-pressed="true"] { border-color: #fff0ae; background: #fff0ae65; }
.ledger { padding: 13px 3px 0; font-size: .9rem; letter-spacing: .025em; }
#progress { color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.range { padding: 2px 3px 0; min-height: 21px; font-size: .78rem; color: var(--muted); }
.panel { padding: 20px; }
.sector-head { align-items: flex-start; }
.sector-head h2 { margin: 0; font: 400 clamp(24px, 2.5vw, 35px)/1.08 Georgia, "Microsoft JhengHei", serif; }
.clock { flex-shrink: 0; text-align: right; color: var(--muted); font-size: .72rem; }
.clock strong { display: block; color: var(--gold); font: 500 1.38rem/1.22 Consolas, monospace; }
.sector-label { color: var(--muted); font-size: .82rem; margin: 16px 0 9px; }
.tiles { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.tiles button {
  display: grid; place-items: center; min-width: 0; min-height: 28px; aspect-ratio: 1.3;
  padding: 0; border: 1px solid #394866; border-radius: 5px; background: #17233b; color: #b4c4de;
  font-size: .78rem; font-variant-numeric: tabular-nums;
}
.tiles button:hover:not(:disabled) { background: #2d4262; border-color: #7592bc; color: #fff; }
.tiles button.placed { color: var(--gold); background: #302b26; border-color: #84704a; opacity: 1; }
.tiles button[aria-pressed="true"] { color: #171321; background: var(--gold); border-color: var(--gold); }
.legend { display: flex; flex-wrap: wrap; gap: 9px 15px; margin-top: 13px; color: var(--muted); font-size: .73rem; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 2px; border: 1px solid #60708c; }
.legend-empty { background: #17233b; }
.legend-placed { background: #77623f; }
.legend-selected { background: var(--gold); }
.eligibility { min-height: 2.7em; margin: 16px 0 11px; color: #c8d3e6; font-size: .85rem; }
.actions { display: flex; gap: 7px; }
.actions button { flex: 1; min-height: 42px; border-radius: 7px; padding: 7px 10px; font-weight: 650; font-size: .83rem; }
.primary { color: #17131e; background: var(--gold); border: 1px solid var(--gold); }
.primary:hover:not(:disabled) { background: #ffe7ad; }
.secondary { color: var(--fg); background: #1a2840; border: 1px solid #3b4a68; }
.secondary:hover:not(:disabled) { background: #283956; }
.confirmation { margin-top: 12px; padding: 11px; background: #0c1423; border: 1px solid #3b4a68; border-radius: 9px; }
.confirmation p { margin: 0 0 10px; font-size: .83rem; }
.status { margin: 0; color: var(--gold); font-size: .8rem; }
.status:not(:empty) { margin-top: 10px; }
.footer { margin-block: 25px; padding: 16px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.footer div { display: flex; flex-wrap: wrap; column-gap: .8rem; }
#contract-address { overflow-wrap: anywhere; }
@media (max-width: 920px) {
  .shell { width: calc(100% - 40px); }
  .workspace { grid-template-columns: 1fr; gap: 13px; }
  .panel { width: 100%; }
  .tiles button { min-height: 39px; aspect-ratio: auto; }
}
@media (max-width: 480px) {
  .shell { width: calc(100% - 28px); }
  .masthead { padding: 16px 0; }
  .masthead nav { gap: 14px; }
  .hero { padding: 25px 0 18px; }
  .proof { font-size: .76rem; }
  .atlas { padding: 9px; border-radius: 12px; }
  .panel { padding: 14px; border-radius: 12px; }
  .toolbar { padding-bottom: 8px; gap: 4px; }
  .tabs button, .text-button { padding: 6px 8px; }
  .legend { gap: 10px; }
  .footer { align-items: flex-start; }
  .footer nav { gap: 9px; }
}
