/* Nordic Reels — deep fjord navy, frost cyan, warm gold */
:root {
  --fjord-950: #061423;
  --fjord-900: #0b1e33;
  --fjord-800: #102a45;
  --fjord-700: #173a5e;
  --fjord-600: #24517f;
  --frost: #8fe3f0;
  --frost-pale: #c9f4fa;
  --snow: #f3f8fb;
  --mist: #9fb6c9;
  --gold: #e8b84a;
  --gold-pale: #f5d98a;
  --berry: #ff8f8f;
  --line: rgba(143, 227, 240, .28);
  --font: "Segoe UI", "Helvetica Neue", "Gill Sans", Arial, sans-serif;
  --gap: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--fjord-900); color: var(--snow);
  font-family: var(--font); font-size: 16px; font-weight: 400; line-height: 1.6;
}
body:has(dialog[open]) { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, legend { font-weight: 300; letter-spacing: .04em; margin: 0; }
p { margin: 0 0 .8em; }
ul { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--gold-pale); outline-offset: 3px; border-radius: 4px; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.noscript { margin: 0; padding: 16px; text-align: center; background: var(--snow); color: var(--fjord-900); position: relative; z-index: 5; }

/* Northern lights backdrop */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg, var(--fjord-950), var(--fjord-800) 70%, var(--fjord-900)); }
.sky span { position: absolute; top: -20%; width: 55vw; height: 80vh; border-radius: 50%; filter: blur(70px); opacity: .32; animation: nf-drift 26s ease-in-out infinite alternate; }
.sky span:nth-child(1) { left: -10%; background: #37d6a0; }
.sky span:nth-child(2) { left: 30%; background: #4aa8f0; animation-duration: 34s; animation-delay: -8s; }
.sky span:nth-child(3) { left: 62%; background: #8a6cf0; animation-duration: 30s; animation-delay: -15s; }
@keyframes nf-drift { from { transform: translate(-4%, 0) scaleY(1); } to { transform: translate(6%, 8%) scaleY(1.25); } }

.page { width: min(100% - 28px, 1000px); margin: 0 auto; padding-bottom: 30px; }
.page.is-veiled { filter: blur(18px); opacity: .5; pointer-events: none; }

/* Shared button looks */
.ghost { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; font-size: .88rem; color: var(--snow); background: rgba(16, 42, 69, .5); transition: border-color .15s, background-color .15s; }
.ghost:hover:not(:disabled) { border-color: var(--frost); background: rgba(36, 81, 127, .6); }
.ghost[aria-pressed="true"].is-chosen { border-color: var(--gold); color: var(--gold-pale); }
.solid { padding: 11px 22px; border-radius: 999px; font-weight: 600; background: var(--gold); color: var(--fjord-950); transition: background-color .15s, transform .1s; }
.solid:hover:not(:disabled) { background: var(--gold-pale); }
.solid:active:not(:disabled) { transform: scale(.98); }
.solid.danger { background: #c94a4a; color: #fff; }
.age-mark { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border: 1.5px solid var(--berry); border-radius: 50%; font-size: .78rem; font-weight: 600; color: var(--berry); }

/* Header */
.bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 14px 0 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 300; letter-spacing: .08em; white-space: nowrap; }
.logo svg { width: 36px; height: 36px; }
.logo em { font-style: normal; font-weight: 600; color: var(--gold); }
.menu { display: flex; justify-content: center; gap: 4px; }
.menu button { padding: 6px 12px; font-size: .86rem; letter-spacing: .04em; color: var(--mist); border-bottom: 1px solid transparent; }
.menu button:hover { color: var(--snow); border-color: var(--frost); }
.meta { display: flex; align-items: center; gap: 10px; }
.meta-time { font-variant-numeric: tabular-nums; font-size: 1.05rem; white-space: nowrap; }
.meta-label { font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--mist); }

/* Disclaimer */
.banner { padding: 10px 18px; background: var(--snow); color: var(--fjord-950); border-radius: 10px; border-bottom: 4px solid var(--gold); }
.banner p { margin: 0; font-size: .82rem; line-height: 1.45; }
.banner strong { font-weight: 700; letter-spacing: .03em; }

/* Game */
.game { width: min(100%, 720px, max(310px, calc((100vh - 425px) * 1.67))); margin: 18px auto 0; display: grid; gap: var(--gap); }
.hud { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.hud div { padding: 8px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(11, 30, 51, .55); backdrop-filter: blur(6px); }
.hud dt { font-size: .64rem; letter-spacing: .2em; text-transform: uppercase; color: var(--mist); }
.hud dd { margin: 0; font-size: 1.55rem; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hud-win dd { color: var(--gold-pale); }

.reelbox { position: relative; padding: 10px; border-radius: 22px; border: 1px solid var(--gold); background: rgba(6, 20, 35, .7); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.reels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.lane { position: relative; aspect-ratio: 1 / 3; overflow: hidden; border-radius: 14px; background: linear-gradient(180deg, rgba(23, 58, 94, .9), rgba(16, 42, 69, .9)); border: 1px solid var(--line); }
.lane::before, .lane::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: var(--line); z-index: 1; }
.lane::before { top: 33.333%; }
.lane::after { top: 66.666%; }
.film { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; flex-direction: column; }
.pane { flex: 1 1 0; min-height: 0; padding: 11%; display: grid; place-items: center; transition: opacity .3s; }
.pane svg { width: 100%; height: 100%; }
.lane.is-rolling .film { filter: blur(1.5px); }
.reels.is-showing .pane { opacity: .28; }
.reels.is-showing .pane.is-lit { opacity: 1; }
.reels.is-showing .pane.is-lit svg { animation: nf-breathe 1.6s ease-in-out infinite; filter: drop-shadow(0 0 8px rgba(143, 227, 240, .8)); }
@keyframes nf-breathe { 50% { transform: scale(1.1); } }
.lines { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); pointer-events: none; }
.lines polyline { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px currentColor); }

.msg { margin: 0; min-height: 2.9em; display: grid; place-items: center; text-align: center; font-weight: 300; font-size: 1.02rem; color: var(--frost-pale); }
.msg[data-kind="win"] { color: var(--gold-pale); font-weight: 400; }
.msg[data-kind="stop"] { color: var(--berry); }

.controls { display: grid; grid-template-columns: 1fr auto; gap: var(--gap); align-items: stretch; }
.betbox { display: grid; gap: 2px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(11, 30, 51, .55); }
.betbox label { display: flex; justify-content: space-between; align-items: baseline; font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--mist); }
.betbox output { font-size: 1.3rem; letter-spacing: 0; color: var(--snow); font-variant-numeric: tabular-nums; }
.betbox input[type="range"] { width: 100%; height: 26px; margin: 0; accent-color: var(--gold); background: transparent; }
.bet-hint { font-size: .72rem; color: var(--mist); }
.spin { min-width: 190px; padding: 0 34px; border-radius: 999px; font-size: 1.25rem; font-weight: 300; letter-spacing: .3em; text-transform: uppercase; color: var(--fjord-950); background: linear-gradient(135deg, var(--frost-pale), var(--frost)); box-shadow: 0 0 0 1px #fff inset, 0 10px 30px rgba(143, 227, 240, .3); transition: transform .12s, box-shadow .12s; }
.spin:hover:not(:disabled) { box-shadow: 0 0 0 1px #fff inset, 0 10px 40px rgba(143, 227, 240, .55); }
.spin:active:not(:disabled) { transform: scale(.97); }
.refill { grid-column: 1 / -1; padding: 12px; border-radius: 999px; font-weight: 600; color: var(--fjord-950); background: var(--gold); animation: nf-pulse 1.6s ease-in-out infinite; }
@keyframes nf-pulse { 50% { box-shadow: 0 0 0 6px rgba(232, 184, 74, .3); } }

.rest { width: min(100%, 520px); margin: 30px auto 0; padding: 34px 24px; text-align: center; border: 1px solid var(--frost); border-radius: 22px; background: rgba(11, 30, 51, .7); }
.rest h2 { font-size: 1.6rem; margin-bottom: 10px; }
.rest-time { font-size: 2rem; font-weight: 300; color: var(--gold-pale); font-variant-numeric: tabular-nums; }
.rest-note { margin: 0; font-size: .86rem; color: var(--mist); }

/* Footer */
.foot { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); font-size: .86rem; font-weight: 300; color: #d5e2ec; }
.foot-grid { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 28px; }
.foot h2 { font-size: .72rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--frost); margin-bottom: 8px; }
.imprint li { margin-bottom: 4px; overflow-wrap: anywhere; }
.imprint b { font-weight: 600; color: var(--mist); }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.foot-links button { padding: 0; color: var(--gold-pale); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; font-size: .86rem; }
.foot-copy { margin: 20px 0 0; font-size: .76rem; color: var(--mist); text-align: center; }

/* Dialogs */
dialog { color: var(--snow); border: 0; padding: 0; }
dialog::backdrop { background: rgba(6, 20, 35, .8); }
.card-dialog { background: none; width: min(460px, calc(100vw - 28px)); max-width: none; max-height: none; overflow: visible; }
.gate::backdrop { background: linear-gradient(160deg, rgba(55, 214, 160, .25), rgba(138, 108, 240, .22)), rgba(6, 20, 35, .97); }
.card { display: grid; gap: 12px; justify-items: stretch; text-align: center; max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); overflow-y: auto; padding: 34px 28px 26px; border-radius: 26px; background: var(--fjord-800); border: 1px solid var(--frost); box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.card h2 { font-size: 1.6rem; }
.card p { margin: 0; font-weight: 300; }
.card .solid, .card .ghost { padding: 13px 18px; font-size: 1rem; }
.card-fine { font-size: .78rem; color: var(--mist); }
.gate-ring { justify-self: center; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; border: 2px solid var(--berry); color: var(--berry); font-size: 1.4rem; font-weight: 600 !important; }

.drawer { margin: 0 0 0 auto; width: min(580px, 100vw); max-width: none; height: 100vh; height: 100dvh; max-height: none; background: var(--fjord-800); border-left: 1px solid var(--frost); overflow: hidden; }
.drawer[open] { animation: nf-slide .28s ease-out; }
@keyframes nf-slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-in { display: flex; flex-direction: column; height: 100%; }
.drawer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.drawer-top h2 { font-size: 1.35rem; }
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px 30px; font-weight: 300; }
.drawer-body h3 { margin: 1.5em 0 .5em; font-size: .78rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--frost); }
.drawer-body b { font-weight: 600; }
.soft { color: var(--frost-pale); }
.text { font-size: .94rem; }
.dots { list-style: disc; padding-left: 1.2em; margin-bottom: .8em; }
.dots li { margin-bottom: .35em; }
.dots li::marker { color: var(--gold); }
code { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: .85em; color: var(--gold-pale); }

.pays { display: grid; gap: 6px; }
.pays li { display: grid; grid-template-columns: 52px 1fr repeat(3, minmax(52px, auto)); align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 14px; }
.pays svg { width: 52px; height: 52px; }
.pays .pay-name { font-weight: 400; }
.pays .pay-cell { text-align: right; font-variant-numeric: tabular-nums; }
.pays .pay-cell small { display: block; font-size: .62rem; letter-spacing: .12em; color: var(--mist); }
.pays .pay-cell:last-child { color: var(--gold-pale); }
.linegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 12px; }
.linegrid li { font-size: .72rem; letter-spacing: .1em; color: var(--mist); text-align: center; }
.linegrid svg { display: block; width: 100%; height: auto; margin-bottom: 2px; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 18px; }
.summary li { display: grid; padding: 8px; border-radius: 12px; border: 1px solid var(--line); text-align: center; }
.summary span { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--mist); }
.summary b { font-size: 1.15rem; font-weight: 300 !important; font-variant-numeric: tabular-nums; }
.block { margin: 0 0 16px; padding: 6px 18px 16px; border: 1px solid var(--line); border-radius: 18px; min-width: 0; }
.block legend { padding: 0 8px; font-size: 1.05rem; color: var(--gold-pale); }
.block p { font-size: .9rem; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.options label { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: .9rem; }
.options input { width: 18px; height: 18px; margin: 0; accent-color: var(--gold); }
.options label:has(input:checked) { border-color: var(--gold); background: rgba(232, 184, 74, .1); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row label { font-size: .84rem; color: var(--mist); }
.row input { width: 8.5em; padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--fjord-950); color: var(--snow); }
.row .solid { padding: 9px 18px; font-size: .9rem; }
.hint { min-height: 1.4em; margin: 10px 0 0 !important; font-size: .86rem !important; color: var(--frost); }
.hint.is-no { color: var(--berry); }
.sure { margin-top: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--berry); background: rgba(201, 74, 74, .12); }
.help { display: grid; gap: 2px; margin-bottom: .8em; }
.help li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.help b { grid-column: 1 / -1; font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--mist); }
.help span { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.keylist { display: grid; gap: 6px; margin-bottom: .9em; }
.keylist li { padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; }
.keylist code { display: block; }

.bye { min-height: 100vh; display: grid; place-content: center; gap: 8px; padding: 24px; text-align: center; font-weight: 300; }

/* Responsive */
@media (max-width: 860px) {
  .bar { grid-template-columns: 1fr auto; }
  .menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(6, 20, 35, .94); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
  .menu button { padding: 8px 4px; font-size: .74rem; flex: 1; }
  .page { padding-bottom: 76px; }
  .foot-grid { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 600px) {
  .page { width: calc(100% - 16px); }
  .bar { padding: 8px 0; gap: 8px; }
  .logo { font-size: .92rem; letter-spacing: .02em; gap: 6px; }
  .logo svg { width: 26px; height: 26px; }
  .meta { gap: 6px; }
  .meta .age-mark { display: none; }
  .meta .ghost { padding: 5px 10px; font-size: .72rem; }
  .meta-label { display: none; }
  .banner { padding: 6px 10px; border-bottom-width: 3px; }
  .banner p { font-size: .68rem; line-height: 1.32; }
  .game { width: min(100%, max(290px, calc((100vh - 370px) * 1.67))); margin-top: 10px; gap: 8px; }
  .hud { gap: 6px; }
  .hud div { padding: 5px 9px; border-radius: 10px; }
  .hud dt { font-size: .54rem; letter-spacing: .12em; }
  .hud dd { font-size: 1.15rem; }
  .reelbox { padding: 6px; border-radius: 16px; }
  .reels { gap: 4px; }
  .lane { border-radius: 9px; }
  .lines { inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); }
  .msg { font-size: .9rem; min-height: 2.6em; }
  .controls { grid-template-columns: 1fr; gap: 8px; }
  .spin { grid-row: 1; min-height: 54px; }
  .betbox { padding: 8px 12px; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .options { grid-template-columns: 1fr; }
  .drawer-top { padding: 12px 14px; }
  .drawer-body { padding: 14px 14px 26px; }
  .pays li { grid-template-columns: 40px 1fr repeat(3, minmax(40px, auto)); gap: 6px; padding: 5px 8px; font-size: .86rem; }
  .pays svg { width: 40px; height: 40px; }
  .card { padding: 26px 18px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
