:root {
  color-scheme: dark;
  --page: #0b111c;
  --surface: #111b2a;
  --surface-raised: #172437;
  --border: #2b3b52;
  --control-border: #617893;
  --text: #eff4fb;
  --muted: #adbed4;
  --blue: #9bd0ff;
  --blue-strong: #add8ff;
  --on-blue: #0b2037;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: 'Avenir Next', Avenir, 'Segoe UI', system-ui, sans-serif;
  font-size: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 1rem; scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(ellipse at 55% 30rem, #102137 0, transparent 44rem), var(--page); color: var(--text); line-height: 1.55; }
[hidden] { display: none !important; }
button, select { font: inherit; }
a { color: var(--blue); text-underline-offset: .22em; }
a:hover { color: #c6e5ff; }
button, select, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--blue-strong); outline-offset: 3px; }
button:disabled { cursor: default; opacity: .5; }
p, h1, h2, h3, dl, dd, figure { margin: 0; }
button:not(:disabled) { cursor: pointer; }
.shell { width: min(100% - 48px, 1200px); margin-inline: auto; }
.subtle { color: var(--muted); font-size: .9rem; }
.skip-link { position: fixed; z-index: 4; top: .75rem; left: .75rem; padding: .75rem; background: var(--surface); transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid #253246; background: #0c121e; }
.topbar { min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; white-space: nowrap; color: var(--text); font-family: var(--serif); font-size: 1.26rem; text-decoration: none; letter-spacing: -.025em; }
.brand-wheel {
  display: inline-block; flex: 0 0 29px; height: 29px; border-radius: 50%; border: 1px solid #819fbf;
  box-shadow: inset 0 0 0 3px var(--page), inset 0 0 0 4px #819fbf;
  background: radial-gradient(circle, #add8ff 0 2px, #0d1829 2.5px 5px, transparent 5.5px),
              repeating-conic-gradient(from 15deg, #6e9ac2 0deg 2deg, #101b2c 3deg 30deg);
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { min-height: 44px; display: grid; place-items: center; white-space: nowrap; color: var(--muted); font-size: .9rem; font-weight: 650; padding: .4rem .82rem; text-decoration: none; border-radius: 7px; }
.nav a:hover { background: var(--surface-raised); color: var(--text); }
.nav a[aria-current] { color: var(--blue); background: #1a2b42; text-decoration: underline; text-underline-offset: .38em; }
.mode { justify-self: end; display: flex; align-items: center; gap: 8px; padding: 6px 11px; border: 1px solid #334964; border-radius: 999px; white-space: nowrap; font-size: .865rem; color: #c3d8ef; }
.mode span, .hero .eyebrow span { width: 7px; height: 7px; background: var(--blue); border-radius: 50%; box-shadow: 0 0 12px #77baff80; }

.hero {
  display: flex; align-items: center; min-height: 385px; margin-top: 28px; overflow: hidden;
  border-radius: 18px; border: 1px solid #3b4657; background-color: #101927;
  background-image: linear-gradient(90deg, #0e1828 0%, #0e1828ef 27%, #0e182885 50%, #0e182818 75%),
                    url('assets/roulett-hjul.webp');
  background-size: cover; background-position: center, right 51%;
  box-shadow: 0 22px 70px #0005, inset 0 -1px 0 #95a7bd1f;
}
.hero-content { padding: 42px clamp(22px, 5vw, 64px); max-width: 650px; }
.eyebrow { color: var(--blue); text-transform: uppercase; letter-spacing: .15em; font-size: .81rem; font-weight: 750; }
.hero .eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.04em; line-height: 1.04; }
h1 { font-size: clamp(3.05rem, 6vw, 5.55rem); text-wrap: balance; }
.hero-lede { color: #d6e2f2; font-size: clamp(1rem, 1.55vw, 1.19rem); max-width: 27rem; margin-top: 19px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 25px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; font-size: .86rem; color: #bdcee3; }
.hero-meta span { color: var(--blue); }

.button {
  min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: .58rem .95rem;
  border: 1px solid var(--control-border); background: transparent; color: var(--text); border-radius: 8px;
  text-decoration: none; font-weight: 700; font-size: .9rem; text-align: center;
}
.button.primary { background: var(--blue-strong); border-color: var(--blue-strong); color: var(--on-blue); }
.button.primary:hover:not(:disabled) { background: #d0e9ff; border-color: #d0e9ff; }
.button.secondary { background: #15243be8; color: var(--text); }
.button.secondary:hover:not(:disabled), .button.quiet:hover:not(:disabled) { background: #233956; color: #fff; }
.button.quiet { color: var(--muted); background: #0d1726; }
.hero .button { min-height: 48px; padding-inline: 1.12rem; }

.section { margin-top: 57px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.section-heading h2 { font-size: clamp(2rem, 4vw, 3rem); }
.section-heading p { color: var(--muted); margin-top: 7px; }
.notice { margin-top: 16px; border: 1px solid var(--control-border); padding: 12px; border-radius: 9px; }

.panel { background: linear-gradient(150deg, #172437, #121c2c 60%); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 15px 30px #0002; min-width: 0; }
.play-grid { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(250px, 1fr); gap: 14px; }
.table-panel { padding: clamp(12px, 2vw, 23px); }
.account { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--border); padding-bottom: 15px; gap: 8px; }
.account > div { padding-left: clamp(6px, 2.6vw, 30px); border-left: 1px solid var(--border); }
.account > div:first-child { border: 0; padding-left: 0; }
.account dt { color: var(--muted); font-size: .88rem; }
.account dd { font-size: clamp(1.2rem, 2.1vw, 1.85rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.account dd span { font-size: .88rem; color: var(--muted); font-weight: 600; }
.bet-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 13px; }
.chips, .edit-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-width: 44px; height: 44px; padding: 0; background: #18263a; color: var(--text); border-radius: 50%; border: 2px dashed #8296ae; font-weight: 750; font-size: .89rem; }
.chip[aria-pressed="true"] { background: #acd5f8; color: #102640; border: 3px double #102640; box-shadow: 0 0 0 1px var(--blue-strong); }
.chip:hover:not([aria-pressed="true"]) { background: #233b59; }
.edit-actions .button { padding-inline: .6rem; }

.board {
  display: grid; grid-template-columns: .9fr repeat(12, minmax(0, 1fr)) 1.05fr;
  grid-template-rows: repeat(5, minmax(44px, auto)); gap: 5px;
  border-radius: 10px; border: 1px solid #416960; background: #102b2b; padding: 7px;
}
.bet {
  grid-area: var(--row) / var(--col) / span 1 / span var(--span);
  position: relative; display: grid; align-content: center; justify-items: center; min-width: 0;
  padding: .25rem 0; border-radius: 5px; border: 1px solid #73948f;
  color: #f5f8fc; background: #17413c; font-size: .88rem; font-weight: 750; line-height: 1.2;
}
.bet.zero { grid-row: 1 / span 3; }
.bet.red, .history .red { background: #7e3143; border-color: #bb8390; }
.bet.black, .history .black { background: #131c29; border-color: #8d9cb2; }
.bet.green, .history .green { background: #17634e; border-color: #79ac9a; }
.bet:hover:not(:disabled) { box-shadow: inset 0 0 0 2px #d7e8fa; }
.bet.placed { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.bet.hit::after { content: ''; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); outline: 1px solid var(--page); }
.bet-amount { padding: 1px 4px; margin-top: 2px; border-radius: 10px; background: var(--blue-strong); color: var(--on-blue); font-size: .73rem; font-variant-numeric: tabular-nums; }
.bet-guide { min-height: 2.15em; margin-top: 11px; color: var(--muted); font-size: .88rem; }

.wheel-panel { display: flex; flex-direction: column; align-items: center; padding: 17px clamp(14px, 2vw, 24px); background: radial-gradient(ellipse at 50% 22%, #2a323c, #182334 50%, #10192a 90%); }
.wheel-frame { position: relative; width: min(100%, 224px); aspect-ratio: 1; }
#wheel { display: block; width: 100%; height: auto; border-radius: 50%; filter: drop-shadow(0 5px 12px #0009); }
.pointer { position: absolute; left: calc(50% - 7px); top: 1px; border-inline: 7px solid transparent; border-top: 14px solid #c8e5fc; filter: drop-shadow(0 1px 2px #000); }
.result { display: grid; place-items: center; min-height: 2.75em; text-align: center; font-size: .925rem; color: #e5effb; font-weight: 650; }
.spin { width: 100%; margin: 4px 0 13px; }
.spin span { font-size: 1.22rem; line-height: 1; }
.history { width: 100%; padding-top: 10px; border-top: 1px solid var(--border); }
.history h3 { color: var(--muted); font-size: .875rem; margin-bottom: 5px; }
.history p { color: var(--muted); font-size: .84rem; }
.history ol { display: flex; flex-wrap: wrap; gap: 5px; padding: 0; margin: 0; list-style: none; }
.history li { display: grid; place-items: center; min-width: 27px; height: 27px; padding: 0 3px; border: 1px solid; border-radius: 5px; font-size: .8rem; font-weight: 750; }

.lesson-layout { display: grid; grid-template-columns: minmax(240px, .9fr) minmax(0, 2.2fr); gap: 14px; }
.lesson-list { padding: 17px; align-self: start; }
.lesson-list h3 { font-size: 1rem; margin: 0 0 10px 5px; }
#lesson-list { display: grid; gap: 5px; }
.lesson-link { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 9px; min-height: 46px; padding: 7px 8px; text-align: left; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: .9rem; }
.lesson-link:hover { background: #203451; color: var(--text); }
.lesson-link[aria-current] { background: #1d3653; border-color: #7996b9; color: var(--text); font-weight: 750; }
.lesson-indicator { width: 6px; height: 6px; border: 1px solid #8fa4c0; border-radius: 50%; }
.lesson-link[aria-current] .lesson-indicator { background: var(--blue); border-radius: 2px; }
.lesson-state { color: var(--blue); font-size: .8rem; font-weight: 750; }
#lesson-progress { margin: 9px 5px 0; }
.question-banner {
  padding: 22px clamp(14px, 3vw, 32px) 25px; border-bottom: 1px solid var(--border); border-radius: 13px 13px 0 0;
  background: linear-gradient(90deg, #111d2cf9 0%, #111d2cd0 52%, #111d2c42 100%), url('assets/roulett-kula.webp') right 54% / cover;
}
.question-banner h3 { font: 400 clamp(1.45rem, 3.5vw, 2.25rem)/1.1 var(--serif); letter-spacing: -.035em; margin-top: 7px; width: fit-content; }
.question-body { padding: 18px clamp(14px, 3vw, 32px) 21px; }
#question { font-weight: 650; }
.answers { display: grid; gap: 7px; margin-top: 13px; }
.answer { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; min-height: 44px; padding: 8px 11px; border-radius: 7px; border: 1px solid var(--control-border); background: #121e2e; color: var(--text); font-size: .95rem; }
.answer:hover, .answer[aria-pressed="true"] { background: #203a57; }
.answer[aria-pressed="true"] { border-color: var(--blue); }
.answer span:last-child { font-size: .875rem; font-weight: 750; color: var(--blue); }
.lesson-actions, .lesson-actions > div { display: flex; flex-wrap: wrap; gap: 8px; }
.lesson-actions { justify-content: space-between; margin-top: 15px; }
.feedback, .hint-text { margin-top: 12px; padding: 9px 11px; border-left: 3px solid var(--blue); background: #1c304a; color: #e1edf9; font-size: .94rem; }

.system-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.system-card, .comparison, .rules-table, .edge { padding: clamp(14px, 2.3vw, 23px); }
.system-card h3 { font: 400 1.42rem/1.2 var(--serif); }
.system-card p { margin-top: 8px; }
.sim-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 11px; }
.sim-controls label { display: grid; gap: 5px; color: var(--muted); font-size: .88rem; font-weight: 650; }
.sim-controls label span { display: contents; }
.sim-controls select { color: var(--text); background-color: #0f1b2b; border: 1px solid var(--control-border); border-radius: 7px; min-height: 44px; width: 100%; padding: 6px 10px; }
.sim-method { margin: 13px 0 6px; }
#sim-status { margin-top: 9px; color: var(--text); }
.chart { margin: 14px 0 18px; padding: 13px; border: 1px solid var(--border); background: #0e1929; border-radius: 10px; }
.chart figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 10px; }
.chart figcaption span { color: var(--muted); font-size: .88rem; }
#sim-chart { display: block; width: 100%; height: clamp(180px, 22vw, 250px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 17px; list-style: none; margin: 4px 0 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--text); }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; text-align: left; width: 100%; font-size: .92rem; }
caption { text-align: left; color: var(--text); font-weight: 750; margin-bottom: 5px; }
td, th { padding: 10px 9px; border-bottom: 1px solid var(--border); }
th { color: var(--text); }
thead th { background: #16263d; }
td { color: #d4e0ee; font-variant-numeric: tabular-nums; }
#simulation-summary td { white-space: nowrap; }

.rules-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; }
.rule-note { margin-top: 11px; }
.edge { background: radial-gradient(ellipse at top right, #234767, #142337 62%); }
.edge strong { display: block; color: var(--blue); font: 400 3.3rem/1.08 var(--serif); margin: 5px 0 8px; }
.edge strong span { font-size: .62em; }
.edge p + p { margin-top: 9px; }
.site-footer { margin-top: 55px; border-top: 1px solid var(--border); }
.site-footer .shell { padding-block: 17px; display: flex; justify-content: space-between; gap: 6px 20px; flex-wrap: wrap; }
.site-footer p, .site-footer a { font-size: .88rem; color: var(--muted); }
.site-footer nav { display: flex; gap: 15px; flex-wrap: wrap; }
.site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; }
.site-footer p { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

@media (max-width: 940px) {
  .play-grid { grid-template-columns: minmax(0, 1fr); }
  .wheel-panel { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); gap: 0 16px; }
  .wheel-frame { grid-row: span 3; }
  .result { justify-content: start; text-align: left; }
  .spin { margin-block: 4px 8px; }
}
@media (max-width: 740px) {
  .shell { width: calc(100% - 32px); }
  .topbar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px; padding-top: 11px; }
  .nav { width: 100%; order: 3; margin-bottom: 5px; flex-wrap: wrap; }
  .nav a { flex: 1; padding-inline: 6px; }
  .hero { margin-top: 17px; min-height: 340px; background-position: center, 67% center; }
  .hero-content { padding-block: 27px; }
  .section { margin-top: 44px; }
  .lesson-layout, .rules-grid { grid-template-columns: minmax(0, 1fr); }
  #lesson-list, .system-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  .hero {
    align-items: end; min-height: 395px;
    background-image: linear-gradient(0deg, #0e1828 8%, #0e1828f2 28%, #0e18289c 61%, #0e182830 100%), url('assets/roulett-hjul.webp');
    background-position: center, 64% center;
  }
  .section-heading { align-items: start; flex-direction: column; }
  .section-heading .quiet { align-self: start; }
  .board { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: repeat(11, minmax(44px, auto)); }
  .bet, .bet.zero { grid-area: var(--mobile-row) / var(--mobile-col) / span 1 / span var(--mobile-span); }
  .wheel-panel { grid-template-columns: minmax(105px, 38%) minmax(0, 1fr); gap: 0 10px; }
  .sim-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart { padding: 9px; }
  td, th { padding: 8px 6px; }
}
@media (max-width: 365px) {
  .shell { width: calc(100% - 22px); }
  .hero-content { padding-inline: 15px; }
  .bet-controls { gap: 8px; }
  .nav a { font-size: .81rem; }
  .mode { font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
