:root {
  color-scheme: dark;
  --page: #0b141d;
  --surface: #111e2a;
  --surface-deep: #0e1924;
  --line: #2a3b4d;
  --control: #61778c;
  --ink: #f3efea;
  --muted: #b8c7d5;
  --blue: #8acaff;
  --blue-strong: #9fd3ff;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
p { margin: 0; line-height: 1.62; }
h1, h2, h3, h4 { margin: 0; }
h2, h3 { font: 400 2rem/1.12 var(--serif); }
h2 { font-size: clamp(2.25rem, 3.1vw, 3.12rem); letter-spacing: -.042em; }
h4 { font-size: 1rem; }
.shell { width: min(100% - 88px, 1216px); margin-inline: auto; }
.skip { position: fixed; z-index: 4; top: 10px; left: 12px; padding: 12px; background: #0b141d; transform: translateY(-170%); }
.skip:focus { transform: none; }

main { scroll-margin-top: var(--header-height, 75px); }
.site-header { position: sticky; top: 0; z-index: 3; background: var(--page); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 0; text-decoration: none; font: 700 1.29rem/1.2 var(--serif); letter-spacing: -.045em; white-space: nowrap; }
.brand > span:last-child { color: var(--blue); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 33px;
  height: 36px;
  margin-right: 11px;
  border: 1px solid #5785ac;
  border-radius: 8px;
  color: var(--blue);
  background: #13273a;
  font: 400 1.3rem/1 var(--serif);
}
.main-nav { display: flex; align-items: center; gap: 5px; }
.main-nav a { text-decoration: none; padding: 10px 14px; border: 1px solid transparent; color: var(--muted); font-size: .9rem; white-space: nowrap; border-radius: 8px; }
.main-nav a:hover { color: var(--ink); background: #162638; }
.main-nav a[aria-current='page'] { color: var(--ink); background: #192d3f; border-color: #355573; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.practice-badge { display: flex; align-items: center; gap: 8px; color: #ccdef2; font-size: .875rem; white-space: nowrap; border: 1px solid #3a546b; padding: 7px 11px; border-radius: 20px; }
.practice-badge i { display: inline-block; background: var(--blue); width: 6px; height: 6px; border-radius: 50%; }

.hero {
  min-height: 375px;
  display: flex;
  align-items: center;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid #29404f;
  border-radius: 21px;
  background: linear-gradient(90deg, #080f17a8, #080f1719 64%), #0a1926 url('./assets/kort-i-blaljus.webp') center 49% / cover no-repeat;
  box-shadow: 0 15px 50px #050c1354;
}
.hero-copy { width: min(53%, 640px); padding: 43px 0 43px clamp(30px, 5vw, 69px); }
.eyebrow { color: var(--blue); font-size: .815rem; font-weight: 700; letter-spacing: .145em; text-transform: uppercase; line-height: 1.4; }
.hero-kicker { display: flex; align-items: center; gap: 10px; }
.hero-kicker span { width: 24px; height: 1px; background: #6bb8f6; }
.hero h1 { margin-top: 14px; font: 400 clamp(3.25rem, 6vw, 5.2rem)/.94 var(--serif); letter-spacing: -.067em; }
.hero h1 em { color: #a5d5ff; font-weight: 400; }
.hero-copy > p:not(.eyebrow) { color: #d0dce7; margin-top: 19px; max-width: 29rem; font-size: 1.04rem; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 25px; }

.button {
  min-height: 45px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 15px;
  border: 1px solid var(--control);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: .93rem;
  font-weight: 650;
  line-height: 1.2;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.button.primary { background: var(--blue-strong); border-color: var(--blue-strong); color: #0b1826; }
.button.primary:hover:not(:disabled) { background: #c0e3ff; border-color: #c0e3ff; }
.button.outline { background: #132132; }
.button.outline:hover:not(:disabled) { background: #253b53; border-color: #97b6d2; }
.button:disabled { background: #121d27; border-color: #354657; color: #8596a8; }
.button.compact { min-height: 39px; padding: 7px 12px; }
.button[aria-pressed='true'] { background: #273f55; border-color: var(--blue); text-decoration: underline; text-underline-offset: 4px; }
kbd { display: inline-grid; min-width: 21px; height: 23px; place-items: center; font: .75rem/1 ui-monospace, monospace; padding: 1px 4px; border: 1px solid currentColor; border-radius: 4px; opacity: .8; }

.view { padding-top: 34px; scroll-margin-top: var(--header-height, 75px); }
.section-intro { display: flex; align-items: end; justify-content: space-between; gap: 16px 25px; margin-bottom: 19px; }
.section-intro h2 { margin-top: 5px; }
.section-intro > p { color: var(--muted); padding-bottom: 4px; }
.workspace { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(275px, 1fr); align-items: start; gap: 18px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 12px 28px #02070c35; }
.table { overflow: hidden; }
.table-header, .table-footer { padding-inline: 21px; }
.table-header { min-height: 55px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.table-name { display: flex; align-items: center; gap: 9px; font: 700 1.08rem var(--serif); }
.table-name > span { color: var(--blue); font-size: 1.2rem; }
.table-rules { color: var(--muted); font-size: .875rem; text-align: right; }
.table-rules > span { margin-inline: 4px; }
.felt {
  min-height: 306px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 20px 14px 24px;
  background: linear-gradient(#02101a38, #0415214a), #102c3c url('./assets/bordstyg.webp') center / cover;
  border-bottom: 1px solid #35576b;
}
.table-hand { max-width: 100%; min-width: 0; display: grid; justify-items: center; align-content: start; gap: 8px; }
.hand-label { min-height: 24px; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; justify-content: center; color: #e2ecf5; font-size: .815rem; text-transform: uppercase; letter-spacing: .11em; font-weight: 700; }
.total, .active-marker { color: #e0f0ff; border-radius: 20px; background: #19374c; border: 1px solid #5d7e96; padding: 2px 8px; font-size: .77rem; letter-spacing: 0; text-transform: none; }
.active-marker { background: #a5d5ff; color: #0b1826; border-color: #a5d5ff; }
.felt-divider { display: flex; align-items: center; gap: 12px; width: min(60%, 390px); color: #88abc0; }
.felt-divider::before, .felt-divider::after { content: ''; background: #668a9a82; height: 1px; flex: 1; }
.player-hands { width: 100%; display: flex; gap: 13px; justify-content: center; flex-wrap: wrap; }
.player-hands > .table-hand:not(:only-child) { padding: 5px 7px; border: 1px solid transparent; border-radius: 8px; }
.player-hands > .active-hand:not(:only-child) { border-color: #90c7f2; background: #0c1c2bd9; }
.cards { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
.playing-card {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  aspect-ratio: .70;
  width: clamp(3rem, 4.45vw, 4rem);
  border-radius: 7px;
  background: linear-gradient(145deg, #fffaf0, #e7e2d9);
  border: 1px solid #ece9e3;
  color: #111b27;
  box-shadow: 0 5px 13px #02060c88;
  font-family: Georgia, serif;
}
.playing-card.red-suit { color: #9a282b; }
.card-corner { position: absolute; top: 4px; left: 5px; font-size: .775rem; font-weight: 700; }
.card-corner-bottom { inset: auto 5px 4px auto; transform: rotate(180deg); }
.card-suit { font-size: clamp(1.55rem, 3vw, 2.2rem); }
.card-back {
  border: 2px solid #a8c6df;
  background: repeating-linear-gradient(45deg, #163852 0 3px, #234662 3px 4px, #163852 4px 7px);
  color: #bedaf2;
}
.card-back::before { position: absolute; content: ''; inset: 4px; border: 1px solid #a2bacf; border-radius: 3px; }
.back-suit { background: #112737; border: 1px solid #82a2bc; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.hand-result { font-size: .88rem; font-weight: 650; }
.table-footer { padding-block: 16px 19px; text-align: center; }
.table-status { color: #e3edf6; font-size: .93rem; margin-bottom: 12px; }
.action-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.action-row .button { min-width: 107px; }

.sidebar { display: grid; gap: 12px; }
.side-card { padding: 19px; }
.side-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.side-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 6px; border: 1px solid #365a77; color: var(--blue); font: 1.15rem var(--serif); background: #1b3146; }
.side-card h3 { margin-bottom: 7px; font-size: 1.66rem; letter-spacing: -.035em; }
.side-card > p:not(.eyebrow) { color: var(--muted); }
.side-card .button, .side-card .text-link { margin-top: 12px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 11px 0 12px; }
.metrics.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.metrics > div { background: var(--surface-deep); border: 1px solid #2c4053; border-radius: 8px; padding: 8px 6px; text-align: center; }
.metrics strong { display: block; font: 1.38rem/1.1 var(--serif); }
.metrics span { font-size: .815rem; color: var(--muted); }
details { color: var(--muted); }
summary { color: #e6eef7; padding: 6px 2px; font-size: .92rem; font-weight: 650; }
summary::marker { color: var(--blue); }
details > p, .rules, .history { margin-top: 6px; font-size: .94rem; }
.rules, .history { padding-left: 18px; margin-bottom: 0; line-height: 1.5; }
.rules li + li, .history li + li { margin-top: 6px; }
.text-link { display: inline-block; color: var(--blue-strong); text-underline-offset: 3px; }

.exercise { overflow: hidden; }
.exercise-top { display: flex; gap: 12px; align-items: center; padding: 14px 20px; flex-wrap: wrap; }
.exercise-top > span { margin-left: auto; color: var(--muted); }
select, input[type='number'] { color: var(--ink); background: #101e2c; border: 1px solid var(--control); border-radius: 7px; min-height: 42px; padding: 7px 10px; max-width: 100%; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, #bfdbf1 50%), linear-gradient(135deg, #bfdbf1 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px; background-repeat: no-repeat; }
.quiz-felt { flex-direction: row; min-height: 193px; gap: clamp(24px, 8vw, 116px); border-top: 1px solid var(--line); }
.exercise-bottom { padding: 18px 20px 22px; }
.exercise-bottom .action-row { justify-content: start; margin: 14px 0; }
#quiz-feedback:empty { display: none; }
#quiz-feedback { margin: 14px 0; padding: 12px 14px; border-radius: 8px; border: 1px solid #517c9f; background: #162c40; }
#quiz-feedback > strong { color: var(--blue-strong); display: block; margin-bottom: 5px; }
#quiz-feedback > p { color: #d3e2ee; }
.button.chosen { outline: 2px dashed #e5edf5; outline-offset: 1px; }
.button.correct-choice { color: #d9efff; background: #25455e; border-color: #9acfff; }

.strategy, .system-panel { padding: clamp(16px, 3vw, 29px); }
.strategy-controls { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.strategy-controls p, .system-panel > p, .source-line { color: var(--muted); }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; }
.strategy-picker, .system-controls, .count-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px 17px; margin-top: 17px; }
.strategy-picker label, .system-controls label { display: grid; gap: 5px; font-size: .91rem; color: #d4e1ec; }
.strategy-answer { margin-block: 13px; padding: 10px 13px; border-left: 3px solid var(--blue); background: #172b3e; }
.matrix-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.matrix, .outcomes { width: 100%; min-width: 615px; border-spacing: 0; font-size: .9rem; text-align: center; }
.matrix th, .outcomes th, .outcomes td { padding: 7px; background: #101e2c; border-bottom: 1px solid #2f4153; }
.matrix tbody th { position: sticky; left: 0; z-index: 1; white-space: nowrap; outline-offset: -3px; }
.matrix td { padding: 2px; }
.matrix button { width: 100%; min-height: 32px; border: 1px solid transparent; border-radius: 4px; font-weight: 700; }
.matrix button:hover, .matrix button[aria-pressed='true'] { border-color: #c3ddf7; text-decoration: underline; text-underline-offset: 4px; }
.matrix button[aria-pressed='true'] { box-shadow: inset 0 0 0 1px #c3ddf7; }
.tone-H { background: #233346; color: #e6eff6; }
.tone-S { background: #234557; color: #e0f7ff; }
.tone-D, .tone-d { background: #35496a; color: #edf5ff; }
.tone-P { background: #453d62; color: #f4ebff; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; list-style: none; padding: 0; margin: 16px 0; font-size: .9rem; color: #dbe8f4; }
.legend li { display: flex; align-items: center; gap: 5px; }
.legend span { display: inline-grid; place-items: center; width: 25px; min-height: 25px; border-radius: 4px; font-weight: 750; }
.source-line { margin-top: 13px; font-size: .88rem; }

.system-panel + .system-panel { margin-top: 16px; }
.system-panel > p { margin-top: 8px; max-width: 75ch; }
.chart-wrap { margin-top: 18px; padding: 10px; border-radius: 9px; border: 1px solid var(--line); background: #0c1824; }
#system-chart { display: block; width: 100%; height: 248px; }
.system-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.system-result { display: grid; align-content: start; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.system-result h4 { display: flex; gap: 10px; align-items: center; }
.system-result p, .system-result > span { color: var(--muted); font-size: .9rem; }
.system-result strong { font-size: 1.16rem; }
.series-key { display: inline-block; width: 27px; height: 0; border-top: 3px solid var(--series); }
.series-key.dashed { border-top-style: dashed; }
.series-key.dotted { border-top-style: dotted; }
.system-result .simulation-stop { color: #f8d3a8; }
.outcome-wrap { max-height: 310px; margin-top: 12px; }
.outcomes thead { position: sticky; top: 0; }
.count-cards { justify-content: start; margin-block: 15px; }
.count-form { align-items: center; }
.count-form input { width: 90px; }
#count-result { color: var(--blue-strong); }

.note { margin-top: 13px; padding: 10px; background: var(--surface); }
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); padding-block: 23px; display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between; align-items: center; color: var(--muted); font-size: .875rem; }
.site-footer > span { color: var(--ink); font: 700 1rem var(--serif); }
.site-footer > span > span { color: var(--blue); padding-right: 4px; }
.site-footer small { margin-left: 7px; color: var(--muted); font: .815rem -apple-system, sans-serif; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 15px; }
.site-footer a { text-underline-offset: 3px; }

@media (max-width: 900px) {
  .shell { width: calc(100% - 40px); }
  .brand { font-size: 1.15rem; }
  .header-inner { gap: 11px; }
  .main-nav a { padding-inline: 8px; }
  .practice-badge { padding-inline: 8px; }
  .workspace { grid-template-columns: minmax(0, 1.65fr) minmax(230px, 1fr); gap: 12px; }
  .side-card { padding: 15px; }
}
@media (max-width: 700px) {
  .header-inner { display: grid; gap: 8px; grid-template-columns: 1fr auto; padding-top: 11px; padding-bottom: 10px; }
  .practice-badge { grid-row: 1; grid-column: 2; justify-self: end; }
  .main-nav { grid-column: 1 / -1; flex-wrap: wrap; }
  .hero { margin-top: 16px; min-height: 352px; background-position: 59% 50%; }
  .hero-copy { width: min(72%, 460px); padding-left: 24px; }
  .hero-copy > p:not(.eyebrow) { max-width: 26ch; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); align-items: start; }
  .section-intro { flex-wrap: wrap; row-gap: 4px; }
}
@media (max-width: 480px) {
  .shell { width: calc(100% - 26px); }
  .hero { min-height: 366px; align-items: end; border-radius: 14px; background-image: linear-gradient(90deg, #080f17f0, #080f17c5 52%, #080f1710), linear-gradient(0deg, #08151ef5, #08151e00 60%), url('./assets/kort-i-blaljus.webp'); background-position: 59% center; }
  .hero-copy { width: 100%; padding: 20px 17px; }
  .hero h1 { font-size: clamp(2.85rem, 13vw, 3.6rem); }
  .hero-copy > p:not(.eyebrow) { margin-top: 13px; }
  .hero-actions { margin-top: 16px; }
  .hero-actions .button { padding-inline: 11px; }
  .section-intro { margin-bottom: 14px; }
  .view { padding-top: 25px; }
  .table-header, .table-footer { padding-inline: 13px; }
  .felt { min-height: 266px; }
  .cards { gap: 5px; }
  .action-row .button { min-width: 90px; flex: 1; }
  .exercise-bottom .action-row .button { min-width: 105px; }
  .system-results { grid-template-columns: minmax(0, 1fr); }
  .quiz-felt { min-height: 180px; }
  .count-form label { width: 100%; }
}
@media (max-width: 365px) {
  .main-nav { gap: 2px; }
  .main-nav a { font-size: .8rem; padding-inline: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
