@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  font-family: Manrope, system-ui, sans-serif;
  color: #edf4ed;
  background: #111b18;
  font-synthesis: none;
  --muted: #9daea5;
  --line: #34443d;
  --accent: #c4fb73;
  --surface: #192520;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: radial-gradient(ellipse at 80% 0%, #22352d 0, transparent 40rem), #111b18; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .46; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.app-shell { width: min(100% - 36px, 760px); margin: 0 auto; padding: 54px 0 28px; }
.masthead { margin-bottom: 30px; }
.eyebrow, .question-meta, .round-count { font: 500 11px 'DM Mono', monospace; letter-spacing: .15em; color: var(--accent); }
h1 { margin: 14px 0 5px; font-size: clamp(38px, 8vw, 64px); line-height: 1; letter-spacing: -.07em; }
h1 span { color: var(--accent); }
.masthead p, .section-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: rgb(25 37 32 / 92%); box-shadow: 0 20px 70px rgb(0 0 0 / 18%); }
.setup { padding: 24px; }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.03em; }
.chart-heading { min-width: 0; flex: 1; }
.chart-path-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.chart-path-row p { min-width: 0; overflow-wrap: anywhere; }
.matrix-toggle { flex: 0 0 auto; min-height: 30px; padding: 0 9px; border: 1px solid #476553; border-radius: 7px; color: var(--accent); background: #23372b; font-size: 11px; font-weight: 700; }
.matrix-toggle:hover:not(:disabled) { border-color: var(--accent); background: #2c4636; }
.matrix-toggle:disabled { opacity: .4; }
.step-number { color: #6f8077; font: 500 12px 'DM Mono', monospace; }
.token-row { display: flex; gap: 10px; }
.forget-token { margin-top: 10px; padding: 0; border: 0; color: #aebdb4; background: none; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.forget-token:hover { color: var(--accent); }
input, select { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; color: #edf4ed; background: #121b17; }
input::placeholder { color: #65766c; }
.select-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.select-grid label { color: var(--muted); font-size: 12px; }
.select-grid select { display: block; margin-top: 7px; }
.folder-selectors { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.folder-selectors label, .chart-field { display: block; color: var(--muted); font-size: 12px; }
.folder-selectors select, .chart-field select { display: block; margin-top: 7px; }
.chart-field { margin-top: 12px; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; font-weight: 700; font-size: 13px; transition: transform .15s ease, background .15s ease; }
.button:not(:disabled):hover { transform: translateY(-1px); }
.button-primary { color: #152016; background: var(--accent); }
.button-muted { color: #edf4ed; background: #26352e; border-color: #3c5146; }
.start-button { width: 100%; margin-top: 16px; }
.status { min-height: 18px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.status[data-kind="error"] { color: #ff9e8e; }
.trainer { margin-top: 18px; padding: 24px; }
.trainer .section-heading { margin-bottom: 18px; }
.round-count { margin-left: auto; white-space: nowrap; color: var(--muted); }
.range-matrix-panel { margin: 0 0 16px; padding: 14px; border: 1px solid #34483b; border-radius: 12px; background: #142019; }
.matrix-legend { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.matrix-legend-item { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border: 1px solid rgb(255 255 255 / 13%); border-radius: 6px; color: #f2f5f0; font-size: 10px; }
.matrix-legend-swatch { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 3px; }
.matrix-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.range-matrix { display: grid; grid-template-columns: repeat(13, minmax(38px, 1fr)); gap: 2px; min-width: 520px; }
.matrix-cell { display: flex; min-width: 0; min-height: 43px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 3px 1px; border: 1px solid rgb(255 255 255 / 16%); border-radius: 4px; text-align: center; cursor: pointer; }
.matrix-cell:hover, .matrix-cell:focus-visible { z-index: 1; outline: 2px solid #fff; outline-offset: 1px; filter: brightness(1.15); }
.matrix-hand { font: 700 10px 'DM Mono', monospace; line-height: 1; }
.matrix-leading { max-width: 100%; overflow: hidden; font: 600 8px Manrope, sans-serif; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.matrix-detail { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.question-card { padding: 26px 18px; border: 1px solid #33463b; border-radius: 14px; text-align: center; background: linear-gradient(135deg, #23372c, #19251f); }
.question-meta { color: var(--muted); }
.hand-display { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 12px 0; line-height: 1; }
.playing-card { display: flex; width: clamp(76px, 22vw, 104px); height: clamp(108px, 31vw, 142px); flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid #d9dfd5; border-radius: 11px; background: #f3f5ed; box-shadow: 0 8px 18px rgb(0 0 0 / 24%); }
.playing-card.suit-spades { color: #17221d; }
.playing-card.suit-hearts { color: #cf344c; }
.playing-card.suit-diamonds { color: #246dd1; }
.playing-card.suit-clubs { color: #16804b; }
.card-rank { font-size: clamp(34px, 10vw, 48px); font-weight: 800; letter-spacing: -.07em; }
.card-suit { font-size: clamp(30px, 8vw, 39px); }
.hand-display small { flex-basis: 100%; margin-top: 4px; font: 500 13px 'DM Mono', monospace; letter-spacing: .15em; color: var(--muted); }
.question-hint { color: var(--muted); font-size: 13px; }
.answer-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.answer-button { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; border: 1px solid #506354; border-radius: 10px; color: #f0f5ef; background: #24352b; font-weight: 700; text-align: left; }
.answer-shortcut { flex: 0 0 auto; padding: 3px 5px; border: 1px solid rgb(255 255 255 / 25%); border-radius: 5px; color: inherit; background: rgb(0 0 0 / 15%); font: 600 10px 'DM Mono', monospace; opacity: .85; }
.answer-button:hover:not(:disabled) { border-color: var(--accent); background: #2b4032; }
.answer-button.fold { border-color: #53616a; background: #283037; }
.answer-button.is-correct, .answer-button:disabled.is-correct { border-color: #70f0a5; color: #fff; background: #14753f; box-shadow: 0 0 0 2px rgb(112 240 165 / 22%); opacity: 1; }
.answer-button.is-incorrect, .answer-button:disabled.is-incorrect { border-color: #ff7180; color: #fff; background: #a52d3e; box-shadow: 0 0 0 2px rgb(255 113 128 / 22%); opacity: 1; }
.answer-button:disabled.is-neutral { opacity: .42; }
.feedback { margin-top: 14px; padding: 14px 16px; border-radius: 10px; color: #eaf4e9; background: #26372d; font-size: 13px; line-height: 1.6; }
.feedback[data-correct="true"] { border: 1px solid #70f0a5; background: #1d4b31; }
.feedback[data-correct="false"] { border: 1px solid #ff7180; background: #57232b; }
.feedback strong { display: block; margin-bottom: 3px; font-size: 16px; }
.next-button { width: 100%; margin-top: 12px; }
footer { padding: 18px 4px 0; color: #83948b; font-size: 11px; line-height: 1.6; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
[hidden] { display: none !important; }

@media (max-width: 520px) {
  .app-shell { width: min(100% - 24px, 760px); padding-top: 32px; }
  .setup, .trainer { padding: 18px; }
  .token-row { flex-direction: column; }
  .select-grid { grid-template-columns: 1fr; }
  .folder-selectors { grid-template-columns: 1fr; }
  .section-heading { gap: 10px; }
  .range-matrix-panel { padding: 10px; }
  .round-count { align-self: flex-start; padding-top: 3px; }
  .round-count { font-size: 9px; }
  .answer-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
