:root {
  --paper: #f5f0e6;
  --ink: #111111;
  --btc: #f7931a;
  --usd: #16a34a;
  --accent: #fde047;
  --blue: #2563eb;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --border: 3px solid var(--ink);
  --space-section: clamp(3rem, 2rem + 5vw, 6rem);
  --text-hero: clamp(2.5rem, 1rem + 8vw, 6rem);
  --font: "Inter", "Noto Sans Thai", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); line-height: 1.6; }
h1, h2 { line-height: 1.05; letter-spacing: -0.02em; font-weight: 900; }

.hero { padding: var(--space-section) 6vw; border-bottom: var(--border); }
.kicker { display: inline-block; background: var(--accent); border: var(--border); box-shadow: var(--shadow-sm); padding: .3rem .8rem; font-weight: 800; text-transform: uppercase; }
.hero h1 { font-size: var(--text-hero); margin: 1rem 0; }
.lead { font-size: clamp(1.1rem, 1rem + 1vw, 1.5rem); max-width: 40ch; }
.scroll-hint { margin-top: 2rem; font-weight: 700; }

.scene { max-width: 880px; margin: 0 auto; padding: var(--space-section) 6vw; border-bottom: var(--border); position: relative; }
.step-badge { position: absolute; top: calc(var(--space-section) - 1rem); left: 6vw; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; background: var(--btc); color: var(--ink); border: var(--border); box-shadow: var(--shadow-sm); font-weight: 900; font-size: 1.2rem; border-radius: 50%; }
.scene h2 { font-size: clamp(1.6rem, 1rem + 3vw, 2.6rem); margin: 0 0 1rem; padding-left: 3.4rem; }

.weight-bar { display: flex; height: 56px; border: var(--border); box-shadow: var(--shadow); overflow: hidden; font-weight: 800; }
.weight-bar .seg-btc { background: var(--btc); }
.weight-bar .seg-usd { background: var(--usd); color: #fff; }
.weight-bar .seg { display: grid; place-items: center; transition: flex-basis var(--d, 300ms) ease; white-space: nowrap; }

.controls { display: grid; gap: 1rem; background: #fff; border: var(--border); box-shadow: var(--shadow); padding: 1.2rem; margin-bottom: 1.5rem; }
.controls fieldset { border: var(--border); }
.controls legend { font-weight: 800; padding: 0 .4rem; }
input[type="range"] { width: 100%; accent-color: var(--btc); }
output { font-weight: 900; background: var(--accent); padding: 0 .4rem; border: 2px solid var(--ink); }

.chart { width: 100%; display: block; background: #fff; border: var(--border); box-shadow: var(--shadow); }
.trade-log { font-weight: 700; min-height: 1.6em; }
.stat-line { font-weight: 800; }

.era-switch { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.era-btn { background: #fff; border: var(--border); box-shadow: var(--shadow-sm); padding: .5rem .9rem; font-weight: 800; cursor: pointer; }
.era-btn[aria-pressed="true"] { background: var(--accent); transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.legend { display: flex; gap: 1.2rem; margin: .8rem 0; font-weight: 700; flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 1rem; height: 1rem; border: 2px solid var(--ink); vertical-align: middle; }

.summary { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.summary th, .summary td { border: 2px solid var(--ink); padding: .5rem .7rem; text-align: right; }
.summary th:first-child, .summary td:first-child { text-align: left; }
.summary thead th { background: var(--ink); color: var(--paper); }
.summary .win { background: var(--accent); font-weight: 900; }
.verdict { margin-top: 1rem; font-weight: 800; background: #fff; border: var(--border); box-shadow: var(--shadow-sm); padding: 1rem; }

.start-note { font-weight: 700; opacity: .75; margin: 0 0 1rem; }
.delta { font-size: .82em; font-weight: 700; }
.delta.up { color: var(--usd); }
.delta.down { color: #dc2626; }
.delta.flat { color: #78716c; }
.summary .holdings .total { font-weight: 900; display: inline-block; margin-top: .15rem; }

.strat-defs { border: var(--border); box-shadow: var(--shadow-sm); background: #fff; padding: .6rem 1rem; margin: 0 0 1.2rem; }
.strat-defs summary { font-weight: 800; cursor: pointer; }
.strat-defs ul { margin: .6rem 0 0; padding-left: 1.1rem; }
.strat-defs li { margin: .4rem 0; }

.caveats { padding-left: 1.2rem; }
.caveats li { margin: .6rem 0; }
.site-footer { padding: 2rem 6vw; font-size: .85rem; }

@media (max-width: 480px) {
  .scene h2 { padding-left: 0; margin-top: 3rem; }
  .step-badge { left: 6vw; top: calc(var(--space-section) - 0.5rem); }
  /* keep the 5-column summary inside narrow viewports (no horizontal overflow at 320px) */
  .summary { table-layout: fixed; font-size: .8rem; }
  .summary th, .summary td { padding: .35rem .25rem; word-break: break-word; }
  .summary .nowrap { word-break: normal; } /* don't split "$10,000" or "₿0.377" mid-number */
}
.nowrap { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .weight-bar .seg { transition: none; }
}
