:root {
  color-scheme: dark;
  --bg: #071326;
  --panel: rgba(14, 29, 53, .84);
  --panel-soft: rgba(14, 29, 53, .64);
  --ink: #f6f2e9;
  --muted: #a8b2c5;
  --line: rgba(255, 255, 255, .13);
  --gold: #e2b64d;
  --success: #87e4b7;
  --warning: #ffd58a;
  --danger: #ff9f9f;
  --shadow: 0 18px 48px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

html.i18n-pending body { visibility: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0, rgba(65, 105, 174, .24), transparent 38%),
    radial-gradient(circle at 92% 80%, rgba(226, 182, 77, .10), transparent 34%),
    var(--bg);
}

a { color: inherit; }
button, select { font: inherit; }

.shell { width: min(1120px, calc(100% - 32px)); margin: auto; padding: 30px 0 72px; }
.market-shell { width: min(1480px, calc(100% - 40px)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.back-link { color: #b9c8e2; text-decoration: none; }
.back-link:hover { color: var(--ink); }
.lang-switch {
  display: flex;
  min-width: 96px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}
.lang-switch button {
  min-width: 96px;
  padding: 0 2px;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: 16px;
  line-height: 1.2;
  text-align: right;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"], .lang-switch button.active { color: var(--gold); background: transparent; font-weight: 800; }
.lang-switch button:hover, .lang-switch button:focus-visible { color: var(--ink); }

.hero { margin-top: 54px; }
.market-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: clamp(28px, 6vw, 96px); }
.market-hero-copy { min-width: 0; }
.eyebrow, .kicker { color: var(--gold); letter-spacing: .16em; font-size: 12px; text-transform: uppercase; }
h1 { margin: 10px 0 12px; font-size: clamp(38px, 7vw, 70px); line-height: 1.04; }
.lead { max-width: 760px; margin: 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.75; }
.principles { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.pill { padding: 8px 12px; border: 1px solid rgba(226, 182, 77, .45); border-radius: 999px; color: #e9d69f; background: rgba(226, 182, 77, .07); font-size: 13px; }

.section { margin-top: 54px; padding-top: 34px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section h2 { margin: 7px 0 0; font-size: clamp(28px, 4vw, 42px); }
.section-note { max-width: 590px; margin: 0; color: var(--muted); line-height: 1.65; }

.module-grid, .contributor-grid, .result-grid { display: grid; gap: 18px; }
.module-grid { grid-template-columns: 1.35fr .65fr; }
.contributor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.result-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.card { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); }
.card h3 { margin: 22px 0 9px; font-size: 24px; }
.card p { margin: 0; color: var(--muted); line-height: 1.68; }
.primary-link { display: inline-flex; margin-top: 24px; padding: 11px 15px; border-radius: 11px; color: #17223b; background: var(--gold); text-decoration: none; font-weight: 800; }
.quiet-card { background: var(--panel-soft); box-shadow: none; }
.contributor-role { margin-top: 8px !important; color: #d9e2ef !important; }
.contributor-note { margin-top: 10px !important; font-size: 13px; }
.exclusion-note, .notice { margin-top: 18px; padding: 14px 16px; border-left: 3px solid var(--gold); background: rgba(226, 182, 77, .07); color: #dce4f2; line-height: 1.7; }

.period-quick-select {
  width: clamp(210px, 20vw, 292px);
  padding: 14px;
  border: 1px solid rgba(226, 182, 77, .38);
  border-radius: 14px;
  background: rgba(7, 19, 38, .62);
  box-shadow: var(--shadow);
}
.period-quick-select label { display: block; margin-bottom: 8px; color: #e9d69f; font-size: 12px; letter-spacing: .08em; }
.period-select {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(14, 29, 53, .9);
}
.period-select { color-scheme: dark; font-variant-numeric: tabular-nums; }
.period-select:invalid { color: var(--muted); }
.feed-state { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.feed-state[data-tone="success"] { color: var(--success); }
.feed-state[data-tone="warning"] { color: var(--warning); }

.verification { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin: 18px 0 0; }
.verification-item { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7, 19, 38, .36); }
.verification-item span { display: block; color: var(--muted); font-size: 12px; }
.verification-item code { display: block; overflow-wrap: anywhere; margin-top: 6px; color: #dce4f2; font-size: 12px; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.result-head h3 { margin: 0; font-size: 25px; }
.asset-code { display: block; margin-top: 5px; color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.status-badge { flex: 0 1 auto; max-width: 58%; padding: 6px 10px; border: 1px solid rgba(135, 228, 183, .34); border-radius: 999px; color: var(--success); background: rgba(135, 228, 183, .08); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; text-align: right; }
.status-badge.pending { color: var(--warning); border-color: rgba(255, 213, 138, .34); background: rgba(255, 213, 138, .08); }
.metrics { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin: 20px 0 0; }
.metrics dt, .metrics dd { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.metrics dt { color: var(--muted); }
.metrics dd { min-width: 0; max-width: 100%; padding-left: 18px; overflow-wrap: anywhere; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.metrics .primary { color: var(--gold); font-size: 19px; }
.metrics .success { color: var(--success); }
.metrics .not-predicted { color: var(--warning); }
.gewu-time { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.prediction-value { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; }
.verified-lock {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(135, 228, 183, .4);
  border-radius: 50%;
  color: var(--success);
  background: rgba(135, 228, 183, .08);
  font-size: 13px;
  line-height: 1;
}
.anchor-state { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.anchor-state.pending { color: var(--warning); }
.proof-details { position: relative; margin: 0; padding: 0; border: 0; }
.proof-details summary { width: fit-content; color: var(--success); cursor: pointer; font-size: 13px; list-style: none; }
.proof-details summary::-webkit-details-marker { display: none; }
.lock-summary:focus-visible { outline: 2px solid var(--success); outline-offset: 3px; border-radius: 50%; }
.proof-panel {
  position: fixed;
  z-index: 1000;
  right: auto;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  width: min(430px, calc(100vw - 24px));
  max-height: min(70vh, calc(100vh - 24px));
  padding: 16px;
  border: 1px solid rgba(135, 228, 183, .34);
  border-radius: 14px;
  color: var(--ink);
  background: #0c1c34;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
  overflow: auto;
  overscroll-behavior: contain;
  text-align: left;
  transform: translateX(-50%);
}
.proof-panel > strong { display: block; font-size: 13px; }
.proof-list { display: grid; grid-template-columns: minmax(90px, auto) minmax(0, 1fr); gap: 8px 12px; margin: 14px 0 0; }
.proof-list dt, .proof-list dd { margin: 0; min-width: 0; font-size: 12px; line-height: 1.5; }
.proof-list dt { color: var(--muted); }
.proof-list dd { overflow-wrap: anywhere; color: #dce4f2; }
.proof-list code { font: inherit; }
.proof-link { color: var(--success); text-underline-offset: 3px; }
.empty-state { grid-column: 1 / -1; padding: 28px; border: 1px dashed rgba(255, 213, 138, .42); border-radius: 18px; color: var(--warning); background: rgba(255, 213, 138, .04); line-height: 1.7; }
.noscript { display: block; margin-top: 18px; color: var(--danger); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

footer { margin-top: 52px; color: var(--muted); font-size: 13px; line-height: 1.7; }

@media (max-width: 820px) {
  .module-grid, .contributor-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .market-hero { grid-template-columns: 1fr; }
  .period-quick-select { width: min(100%, 360px); justify-self: end; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 560px); padding-top: 22px; }
  .hero { margin-top: 38px; }
  .market-hero { gap: 24px; }
  .period-quick-select { width: 100%; justify-self: stretch; }
  .verification { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .card { padding: 19px; }
  .result-head { flex-direction: column; }
  .status-badge { max-width: 100%; text-align: left; }
  .metrics { grid-template-columns: 1fr; }
  .metrics dt { padding-bottom: 4px; }
  .metrics dd { padding: 0 0 12px; border-top: 0; text-align: left; }
}
