/* Styles of the web pages (home, game demos, guides). The Mini App has its own in app.html. */
:root {
  --bg: #0c0e13; --surface: #151922; --surface2: #1d2230; --line: #2a3142;
  --text: #f2f4f8; --muted: #a6afc0; --dim: #7d8799;
  --brand: #8b7bff; --brand-soft: rgba(139, 123, 255, .16);
  --cta: #ffb224; --cta-ink: #1c1200;
  --win: #35d49a; --loss: #ff6b81;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'Roboto Mono', monospace;
  --gutter: 20px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: #b9aeff; text-underline-offset: 3px; }
a:hover { color: #d5ceff; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(12, 14, 19, .9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 8px 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 8px; }
.main-nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { padding: 8px 11px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.main-nav a:hover { color: var(--text); background: var(--surface); }
.main-nav a[aria-current="page"] { color: var(--text); background: var(--surface2); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 11px 20px; border: 0; border-radius: 12px; font-weight: 750; font-size: 15px; text-decoration: none; text-align: center; background: var(--surface2); color: var(--text); transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(1.1); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.cta { background: var(--cta); color: var(--cta-ink); box-shadow: 0 8px 24px rgba(255, 178, 36, .22); }
.btn.cta:hover { color: var(--cta-ink); }
.btn.play { background: var(--brand); color: #0d0930; }
.btn.play:hover { color: #0d0930; }
.panel .btn.play { width: 100%; }
.panel > .btn + .btn { margin-top: 8px; }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.top .btn.cta { margin-left: 4px; box-shadow: none; }

/* ---------- hero */
.hero { padding: 44px 0 26px; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }
h1 { font-size: clamp(30px, 5.4vw, 46px); line-height: 1.1; letter-spacing: -.025em; font-weight: 850; margin: 0 0 14px; max-width: 18em; text-wrap: balance; }
.lead { font-size: clamp(16px, 2.2vw, 19px); color: var(--muted); max-width: 44em; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.fine { font-size: 13px; color: var(--dim); margin-top: 12px; }

/* ---------- demo */
.demo { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 16px; align-items: start; margin: 8px 0 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.panel h2 { font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin: 0 0 12px; }
.field { margin-bottom: 14px; }
.field label, .field .lbl { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.field label b, .field .lbl b { color: var(--text); font-family: var(--mono); font-variant-numeric: tabular-nums; }
input[type="number"], input[type="text"], select { width: 100%; min-height: 46px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font: 600 16px/1.2 var(--mono); outline: none; }
input:focus, select:focus { border-color: var(--brand); }
input[type="range"] { width: 100%; height: 30px; accent-color: var(--brand); margin: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.seg button { min-height: 38px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-weight: 700; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.quick { display: flex; gap: 6px; margin-top: 6px; }
.quick button { flex: 1; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--muted); font-weight: 700; font-size: 13px; }
.quick button:hover { color: var(--text); border-color: var(--dim); }
.wallet { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; margin-bottom: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.wallet span { display: block; font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.wallet b { font: 750 20px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.linkbtn { border: 0; background: none; padding: 6px; color: #b9aeff; font-weight: 650; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.auto { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.auto .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hint { font-size: 13px; color: var(--dim); margin: 8px 0 0; }

.stage { display: flex; flex-direction: column; min-height: 100%; }
.outcome { min-height: 92px; text-align: center; }
.outcome .value { font: 850 clamp(44px, 9vw, 68px)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.outcome .verdict { margin-top: 8px; font-weight: 700; font-size: 15px; color: var(--muted); }
.outcome.win .value, .outcome.win .verdict { color: var(--win); }
.outcome.loss .value, .outcome.loss .verdict { color: var(--loss); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 14px; }
.stats div { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stats span { display: block; font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); }
.stats b { display: block; margin-top: 2px; font: 700 17px/1.3 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats b.up { color: var(--win); } .stats b.down { color: var(--loss); }

/* dice */
.dice-track { position: relative; height: 16px; margin: 30px 10px 8px; border-radius: 8px; background: var(--surface2); }
.dice-zone { position: absolute; left: 0; width: 49.5%; top: 0; bottom: 0; border-radius: 8px; background: var(--brand); opacity: .85; }
.dice-marker { position: absolute; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 8px; background: var(--text); box-shadow: 0 4px 14px rgba(0, 0, 0, .5); transform: rotate(45deg); transition: left .35s cubic-bezier(.2, .8, .2, 1); }
.dice-marker.win { background: var(--win); } .dice-marker.loss { background: var(--loss); }
.ticks { display: flex; justify-content: space-between; margin: 0 4px; font: 600 12px var(--mono); color: var(--dim); }
.rule { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 14px; }

/* mines */
.mines-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 440px; width: 100%; margin: 0 auto; }
.tile { aspect-ratio: 1; border: 0; border-radius: 12px; background: var(--surface2); display: grid; place-items: center; font-size: clamp(20px, 5vw, 30px); line-height: 1; padding: 0; transition: transform .1s, background .15s; }
.tile:not([disabled]):hover { background: #2a3146; transform: translateY(-2px); }
.tile[disabled] { cursor: default; }
.tile.safe { background: rgba(53, 212, 154, .16); box-shadow: inset 0 0 0 2px rgba(53, 212, 154, .55); }
.tile.mine { background: rgba(255, 107, 129, .18); box-shadow: inset 0 0 0 2px rgba(255, 107, 129, .6); }
.tile.dim { opacity: .45; }
.status { text-align: center; min-height: 52px; margin-bottom: 14px; }
.status b { display: block; font: 800 26px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.status span { color: var(--muted); font-size: 14px; }
.status.win b { color: var(--win); } .status.loss b { color: var(--loss); }

/* plinko */
.plinko-board { display: block; width: 100%; max-width: 620px; height: auto; margin: 0 auto; }
.plinko-board .peg { fill: #56607a; }
.plinko-board .ball { fill: var(--cta); }
.plinko-board .bucket { fill: color-mix(in srgb, var(--brand) var(--heat, 0%), var(--surface2)); transition: fill .2s; }
.plinko-board .bucket.hit { fill: var(--cta); }
.plinko-board text { font-family: var(--mono); font-weight: 700; fill: var(--text); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.plinko-board .hit + text { fill: var(--cta-ink); }
.last { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 30px; margin-top: 12px; }
.last span { padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font: 700 13px var(--mono); color: var(--muted); }
.last span.up { color: var(--win); border-color: rgba(53, 212, 154, .4); }

/* simulation run */
.run { margin-top: 16px; }
.run h3 { font-size: 15px; margin: 0 0 2px; }
.run p { margin: 0; color: var(--muted); font-size: 14px; }
.chart { margin-top: 12px; }
.chart .plot { position: relative; touch-action: pan-y; cursor: crosshair; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .base { stroke: var(--dim); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart .cross { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.chart .axis { display: flex; justify-content: space-between; gap: 8px; font: 600 12px var(--mono); color: var(--dim); margin-top: 6px; }
.chart .yl { position: absolute; right: 0; transform: translateY(-50%); font: 600 11px var(--mono); color: var(--dim); background: var(--surface); padding-left: 6px; pointer-events: none; }
.tip { position: absolute; z-index: 2; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); color: var(--text); font-size: 13px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.tip b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- content */
.prose { max-width: 760px; padding: 18px 0 8px; }
.prose h2 { font-size: clamp(22px, 3.4vw, 28px); line-height: 1.2; letter-spacing: -.015em; margin: 38px 0 10px; text-wrap: balance; }
.prose h3 { font-size: 18px; margin: 26px 0 6px; }
.prose p, .prose li { color: #d3d8e2; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin: 6px 0; }
.prose code { font: 600 .92em var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }
.formula { font: 650 15px/1.5 var(--mono); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; overflow-x: auto; }
.table-scroll { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); background: var(--surface); }
td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 30px 0 6px; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(135deg, var(--brand-soft), transparent 60%), var(--surface); }
.callout h2 { margin: 0 0 4px; font-size: 20px; }
.callout p { margin: 0; color: var(--muted); font-size: 15px; }
.callout > div { flex: 1 1 280px; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0 16px; margin-bottom: 8px; }
.faq summary { padding: 14px 0; font-weight: 700; cursor: pointer; }
.faq details p { margin: 0 0 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 14px 0; padding: 0; list-style: none; }
.cards li { margin: 0; }
.card { display: block; height: 100%; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s, transform .1s; }
.card:hover { border-color: var(--brand); color: var(--text); transform: translateY(-2px); }
.card .ico { font-size: 26px; line-height: 1; }
.card b { display: block; margin: 10px 0 4px; font-size: 17px; }
.card span { color: var(--muted); font-size: 14px; }
.steps { counter-reset: step; list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.steps li { counter-increment: step; position: relative; padding: 14px 16px 14px 58px; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.steps li::before { content: counter(step); position: absolute; left: 16px; top: 13px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: #cfc7ff; font: 800 14px var(--mono); }
.crumbs { font-size: 13px; color: var(--dim); padding-top: 18px; }
.crumbs a { color: var(--muted); }

/* ---------- footer */
.foot { margin-top: 48px; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; }
.foot a { color: var(--muted); }
.foot p { margin: 0 0 8px; max-width: 70em; }

@media (max-width: 860px) {
  .demo { grid-template-columns: minmax(0, 1fr); }
  .main-nav { order: 3; flex-basis: 100%; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 8px; }
  .top .btn.cta { margin-left: auto; }
  .hero { padding: 30px 0 18px; }
  .plinko-board { width: calc(100% + 20px); max-width: none; margin: 0 -10px; }
}
@media (max-width: 380px) {
  :root { --gutter: 14px; }
  .panel { padding: 14px; }
  .mines-grid { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
