/* Study club design system. Loaded last; trainer DOM contracts remain unchanged. */
:root {
  --bg: #101116;
  --surface: #191b23;
  --surface-2: #222530;
  --border: #30323e;
  --text: #f0f1f6;
  --muted: #9a9cae;
  --accent: #b6f7cf;
  --best: #b6f7cf;
  --correct: #a9e6b8;
  --inaccuracy: #f3c779;
  --mistake: #f28289;
  --lavender: #c4b8fd;
  --felt: #23493e;
  --felt-dark: #172e28;
  --rail: #2c3433;
  --club-rail-width: 222px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
body { -webkit-font-smoothing: antialiased; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
button:disabled { cursor: wait; }
.primary-btn, .study-primary { background: var(--accent); color: #172c21; box-shadow: 0 3px 0 #74ae89; border-radius: 11px; transition: background .15s, transform .15s, box-shadow .15s; }
.primary-btn:hover:not(:disabled), .study-primary:hover:not(:disabled) { background: #cffcde; }
.primary-btn:active:not(:disabled), .study-primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #74ae89; }
.ghost, .seg { border-color: var(--border); border-radius: 10px; }
.ghost:hover { border-color: #727787; }
.seg button, .seg a { padding: 8px 12px; font-size: 13px; }
.panel, .stat-card, .lb-scoring { border-radius: 16px; background: var(--surface); }
.panel { padding: 18px; }
.panel h3 { letter-spacing: .8px; }
input, select { min-height: 38px; }
dialog { border-radius: 20px; padding: 24px; box-shadow: 0 30px 100px #0009; }
dialog::backdrop { background: #080a12b8; backdrop-filter: blur(6px); }
.club-skip { position: fixed; top: 8px; left: 238px; z-index: 100; transform: translateY(-160%); background: var(--accent); color: #172c21; padding: 10px 16px; border-radius: 10px; font-weight: 700; }
.club-skip:focus { transform: translateY(0); }

/* Desktop app rail and contextual training setup. */
.club-app { min-width: 0; min-height: 100vh; padding-left: var(--club-rail-width); background: radial-gradient(ellipse at 70% 0%, #2020304d 0%, transparent 48%), var(--bg); }
.club-app .club-rail { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--club-rail-width); display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 22px; padding: 30px 18px 22px; background: #14151b; border: 0; border-right: 1px solid var(--border); overflow-y: auto; }
.club-brand { display: flex; gap: 10px; align-items: center; font-size: 18px; letter-spacing: -.6px; white-space: nowrap; }
.club-brand div > span { color: var(--text); font-weight: 400; }
.club-brand small { display: block; margin-top: 5px; font-size: 9px; letter-spacing: 1.6px; color: var(--muted); font-weight: 600; }
.club-mark { display: grid; place-items: center; flex: 0 0 36px; height: 42px; background: var(--accent); color: #172c21 !important; border-radius: 9px; font-size: 28px; transform: rotate(-7deg); }
.club-app #section { align-self: stretch; padding: 4px; gap: 2px; background: #0e0f14; border-color: #242631; }
.club-app #section a { flex: 1; justify-content: center; border: 0; font-size: 12px; border-radius: 7px; }
.club-app #section a[aria-current='page'] { background: #2b2e38; color: var(--accent); }
.club-app #mode { display: flex; flex-direction: column; gap: 7px; border: 0; overflow: visible; }
.club-app #mode button { position: relative; display: flex; gap: 12px; align-items: center; padding: 12px 14px; min-height: 46px; border: 1px solid transparent; border-radius: 11px; font-size: 14px; text-align: left; font-weight: 600; }
.club-app #mode button + button { border-left: 1px solid transparent; }
.club-app #mode button:hover { background: #20222b; color: var(--text); }
.club-app #mode button[aria-checked='true'] { color: var(--accent); background: #b6f7cf10; border-color: #b6f7cf35; }
.nav-icon { display: inline-grid; place-items: center; width: 20px; font-size: 21px; line-height: 1; font-weight: 400; }
.club-rail-note { margin: 8px 10px 0; font-size: 10px; color: var(--lavender); font-weight: 650; letter-spacing: .2px; }
.club-live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--lavender); margin-right: 4px; }
.club-rail-note p { margin: 10px 0 0; color: var(--muted); font-size: 13px; font-weight: 400; line-height: 1.7; }
.club-app .club-rail .spacer { min-height: 0; }
.club-app .club-library-button { display: flex; gap: 7px; padding: 10px; justify-content: center; font-size: 12px; margin-top: auto; }
.club-library-button > span { font-size: 19px; line-height: 1; }
.club-app .account { border-top: 1px solid var(--border); padding-top: 16px; margin-top: -10px; }
.club-app .account summary { display: flex; align-items: center; gap: 8px; border: 0; padding: 0; color: var(--text); min-height: 36px; }
.club-app .account summary::after { margin-left: auto; color: var(--muted); }
.club-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #c4b8fd20; color: var(--lavender); font-size: 17px; }
.club-app .account-name { font-size: 13px; max-width: 114px; }
.club-app .account-menu { bottom: calc(100% + 8px); top: auto; left: 0; right: auto; min-width: 190px; }
.club-app .training-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 1340px; margin: 0 auto; padding: 22px 32px 0; }
.training-toolbar-label { flex-basis: 100%; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1.8px; margin-bottom: 4px; }
.training-toolbar select { max-width: 340px; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 30px 8px 12px; font-size: 13px; }
.training-toolbar .ghost { font-size: 12px; padding: 8px 11px; }
.club-app > main { max-width: 1340px; padding: 30px 32px 50px; outline: none; }
.club-app > .notice, .club-app > .upload-status { margin: 18px 32px 0; max-width: 1276px; }
.club-app .empty { margin: 34px auto; padding: 60px 24px; max-width: 700px; border: 1px dashed #4a4b5c; border-radius: 22px; background: #191b2370; }
.club-app .empty h2 { font-size: 26px; letter-spacing: -.6px; }
.club-app .empty p { line-height: 1.7; max-width: 440px; margin: 12px auto 24px; }

/* Dashboard components: all numbers and progress are supplied by server data. */
.study-view:not([hidden]) { display: flex; flex-direction: column; gap: 25px; }
.study-hero { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 28px; padding: 32px; border: 1px solid #c4b8fd36; border-radius: 22px; overflow: hidden; background: radial-gradient(ellipse at 100% 100%, #c4b8fd13 0, transparent 66%), linear-gradient(110deg, #232330 0%, #1a1c26 70%); }
.study-hero::after { position: absolute; right: 16px; top: -16px; content: '♠'; font-size: 170px; line-height: 1.2; color: #c4b8fd09; pointer-events: none; transform: rotate(-15deg); }
.study-hero > * { position: relative; z-index: 1; }
.study-kicker { display: block; margin: 0 0 14px; font-size: 10px; font-weight: 750; letter-spacing: 2px; text-transform: uppercase; color: var(--lavender); }
.study-hero h1 { margin: 0 0 12px; font-size: clamp(27px, 3.1vw, 42px); line-height: 1.13; font-weight: 750; letter-spacing: -1.5px; }
.study-hero p { margin: 0; color: var(--muted); line-height: 1.7; font-size: 14px; max-width: 540px; }
.study-primary, .study-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 11px 17px; border: 0; font-size: 13px; font-weight: 750; cursor: pointer; text-decoration: none; white-space: nowrap; }
.study-secondary { border: 1px solid var(--border); border-radius: 11px; background: #252833; color: var(--text); }
.study-secondary:hover:not(:disabled) { background: #30333f; }
.study-primary:disabled, .study-secondary:disabled { opacity: .5; cursor: default; box-shadow: none; }
.study-hero .study-primary { margin-top: 20px; }
.study-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.study-metric { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.study-metric > strong, .study-metric > b, .study-metric .study-value { display: block; margin: 6px 0; font-size: 29px; font-weight: 750; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.study-metric > span, .study-metric > label { font-size: 11px; color: var(--muted); }
.study-metric small { display: block; color: var(--muted); font-size: 11px; margin-top: 7px; line-height: 1.5; }
.study-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; gap: 18px; }
.study-card { min-width: 0; border: 1px solid var(--border); border-radius: 18px; padding: 24px; background: var(--surface); }
.study-card > h2, .study-card-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.4px; }
.study-card > p { margin: 9px 0 18px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.study-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; }
.study-card-head > span, .study-card-head > small { color: var(--muted); font-size: 11px; }
.study-card-head button { font-size: 11px; }
.study-progress { display: block; width: 100%; height: 8px; margin: 14px 0; border: 0; border-radius: 10px; overflow: hidden; background: #2a2d38; accent-color: var(--accent); }
progress.study-progress::-webkit-progress-bar { background: #2a2d38; border-radius: 10px; }
progress.study-progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
progress.study-progress::-moz-progress-bar { background: var(--accent); border-radius: 10px; }
.study-progress > span, .study-progress > i { display: block; height: 100%; background: var(--accent); border-radius: 10px; }
.study-quest { display: flex; align-items: center; gap: 13px; padding: 15px 0; border-top: 1px solid #2c2e39; }
.study-quest:first-of-type { border-top: 0; padding-top: 0; }
.study-quest-icon { display: grid; place-items: center; width: 38px; min-width: 38px; height: 38px; border-radius: 11px; background: #c4b8fd14; color: var(--lavender); font-size: 19px; }
.study-quest-copy { min-width: 0; flex: 1; }
.study-quest-copy h3, .study-quest-copy strong { display: block; font-size: 13px; font-weight: 650; margin: 0 0 5px; line-height: 1.4; }
.study-quest-copy p, .study-quest-copy small { color: var(--muted); font-size: 11px; margin: 0; line-height: 1.5; }
.study-quest-copy .study-progress { margin: 9px 0 0; height: 5px; }
.study-quest .study-secondary, .study-quest .study-primary { font-size: 11px; padding: 8px 12px; min-height: 34px; }
.study-pill { display: inline-flex; align-items: center; min-height: 26px; gap: 5px; padding: 5px 9px; border: 1px solid #b6f7cf30; border-radius: 7px; color: var(--accent); background: #b6f7cf0c; font-size: 10px; font-weight: 650; white-space: nowrap; }
.study-pill.lavender { color: var(--lavender); background: #c4b8fd10; border-color: #c4b8fd30; }
.study-level { display: flex; align-items: center; gap: 12px; color: var(--lavender); font-size: 13px; font-weight: 700; }
.study-level > span:first-child { font-size: 26px; }
.study-rank { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); font-size: 13px; }
.study-rank:first-of-type { border-top: 0; }
.study-rank > :first-child { display: grid; place-items: center; width: 25px; min-width: 25px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.study-rank > strong { min-width: 0; overflow-wrap: anywhere; flex: 1; font-weight: 650; }
.study-rank > span:last-child { margin-left: auto; color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; }
.study-rank.me { padding-left: 8px; padding-right: 8px; background: #b6f7cf0a; border-radius: 8px; }
.study-activity { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; min-height: 90px; margin: 20px 0 0; }
.study-activity > div { display: flex; align-items: center; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.study-activity .study-bar, .study-activity i { display: block; width: 100%; max-width: 26px; border-radius: 6px 6px 2px 2px; background: #c4b8fd; min-height: 4px; }
.study-activity small { font-size: 10px; color: var(--muted); }
.study-goal-form, .study-mission-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.study-goal-form label, .study-mission-form label { display: flex; flex: 1; min-width: 100px; flex-direction: column; gap: 7px; font-size: 11px; color: var(--muted); }
.study-goal-form input, .study-mission-form input, .study-mission-form select { width: 100%; min-width: 0; min-height: 39px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; color: var(--text); font-size: 13px; }
.study-goal-form { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--border); }
.study-mission-form { margin-top: 18px; }
.study-empty { padding: 24px 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.study-error { color: #f6a8ad; background: #f2828910; border: 1px solid #f2828930; border-radius: 12px; padding: 14px 18px; font-size: 13px; }
.study-page-head { display: flex; justify-content: space-between; align-items: end; gap: 22px; }
.study-page-head h1 { margin: 0; font-size: clamp(24px, 2.8vw, 33px); font-weight: 700; letter-spacing: -1px; line-height: 1.25; }
.study-page-head .study-kicker { margin-bottom: 10px; color: var(--muted); font-size: 9px; }
.study-head-tools { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: 10px; }
.study-head-tools .study-pill { color: var(--muted); border-color: var(--border); background: var(--surface); }
.study-head-tools .study-secondary { min-height: 32px; padding: 7px 11px; font-size: 11px; }
.study-status { padding: 12px 16px; margin: 0; border: 1px solid #b6f7cf35; border-radius: 10px; background: #b6f7cf10; color: var(--accent); font-size: 12px; }
.study-status:empty { display: none; }
.study-hero-copy { flex: 1; min-width: 0; }
.study-hero h2 { margin: 0 0 12px; font-size: clamp(26px, 2.9vw, 37px); font-weight: 750; letter-spacing: -1px; line-height: 1.2; }
.study-hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 23px; }
.study-hero-actions .study-primary { margin-top: 0; }
.study-goal-ring { display: grid; place-items: center; flex: 0 0 166px; width: 166px; height: 166px; border-radius: 50%; background: conic-gradient(var(--accent) var(--progress, 0%), #3b3c48 0); box-shadow: 0 0 0 8px #b6f7cf04; }
.study-goal-ring-inner { display: flex; flex-direction: column; justify-content: center; align-items: center; width: 151px; height: 151px; background: #1f212b; border-radius: 50%; }
.study-goal-ring-inner .study-kicker { margin: 0 0 10px; font-size: 8px; letter-spacing: 1.4px; }
.study-goal-ring-inner strong { font-size: 39px; font-weight: 750; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.study-goal-ring-inner > span:last-child { margin-top: 9px; color: var(--muted); font-size: 10px; }
.study-metric.mint > strong { color: var(--accent); }
.study-metric.lavender > strong { color: var(--lavender); }
.study-column { display: flex; flex-direction: column; min-width: 0; gap: 18px; }
.study-quests { list-style: none; padding: 0; margin: 0; }
.study-quest-title { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 7px 12px; }
.study-quest-title h3 { margin: 0; font-size: 13px; font-weight: 650; }
.study-quest-title .study-pill { font-size: 9px; }
.study-quest.complete .study-quest-icon { color: var(--accent); background: #b6f7cf13; }
.study-quest-copy .study-progress { margin-top: 11px; }
.study-card .study-footnote { font-size: 10px; color: var(--muted); line-height: 1.65; margin: 14px 0 0; }
.study-policy { font-size: 10px; line-height: 1.7; color: var(--muted); margin: 0; padding: 0 2px; }
.study-mission { padding: 19px 0; border-top: 1px solid var(--border); }
.study-mission > .study-card-description { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.study-mission-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.study-mission-actions .study-secondary { margin-left: auto; min-height: 36px; font-size: 11px; }
.study-mission-editor { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 14px; }
.study-mission-editor > summary { list-style: none; }
.study-mission-editor > summary::-webkit-details-marker { display: none; }
.study-mission-editor > summary.study-secondary { width: 100%; font-size: 12px; }
.study-mission-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.study-mission-form > label:first-child, .study-mission-form > label:nth-child(4) { grid-column: 1 / -1; }
.study-mission-form > .study-primary { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }
.study-goal-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.study-goal-form > label:nth-child(3), .study-goal-form > .link { grid-column: 1 / -1; }
.study-goal-form > .link { text-align: left; font-size: 10px; line-height: 1.5; padding: 4px 0; color: var(--lavender); }
.study-goal-form > .study-secondary { justify-self: start; margin-top: 5px; }
.study-goal-form label, .study-mission-form label { min-width: 0; }
.study-focus-title { font-size: 20px; line-height: 1.4; margin: 16px 0 10px; letter-spacing: -.4px; overflow-wrap: anywhere; }
.study-focus-title + .study-card-description { margin-top: 0; }
.study-league-table { width: 100%; border-collapse: collapse; margin: 17px 0; font-size: 12px; table-layout: fixed; }
.study-league-table th { text-align: left; color: var(--muted); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; padding: 8px 6px 12px; border-bottom: 1px solid var(--border); }
.study-league-table th:first-child { width: 40px; }
.study-league-table th:last-child { text-align: right; width: 70px; }
.study-league-table td { padding: 14px 6px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.study-league-table tr:last-child td { border-bottom: 0; }
.study-league-table td.study-rank { display: table-cell; color: var(--muted); width: 40px; text-align: center; font-size: 12px; }
.study-league-table td strong { display: block; font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.study-league-table td small { display: block; color: var(--muted); font-size: 9px; line-height: 1.5; margin-top: 5px; }
.study-league-table .study-league-xp { text-align: right; color: var(--accent); font-size: 14px; font-weight: 700; }
.study-league-table .is-me td { background: #b6f7cf08; }
.study-level .study-level-badge { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 46px; border-radius: 12px; background: #c4b8fd16; border: 1px solid #c4b8fd30; font-size: 22px; }
.study-level > div { font-size: 12px; line-height: 1.6; }

/* Bring the existing trainer, browser, history and league into the same system. */
.club-app .game { gap: 20px 26px; }
.club-app .table-area { padding: 22px 12px 12px; }
.club-app .table { padding: 10px; border: 1px solid #4b6257; box-shadow: 0 18px 60px #0004, inset 0 1px 0 #ffffff12; }
.club-app .felt { background: radial-gradient(ellipse at 50% 45%, #2b5747 0%, #1a3a30 100%); }
.club-app .actions { margin-top: 14px; }
.club-app .act { border-width: 1px; border-bottom-width: 3px; border-radius: 12px; background: #242832; }
.club-app .act-group { background: #20232c; }
.club-app .side > .panel { background: #181a22; }
.club-app .stats { gap: 8px; }
.club-app .stats span { font-size: 17px; }
.club-app .recent-row { border-radius: 7px; padding-top: 5px; padding-bottom: 5px; }
.club-app .lb { max-width: 1100px; gap: 20px; }
.club-app .lb-me { padding: 24px; border-radius: 18px; border-color: #b6f7cf50; background: linear-gradient(110deg, #b6f7cf10, #191b23); }
.club-app .lb-me span { color: var(--accent); font-size: 27px; margin-bottom: 7px; }
.club-app .lb-table { border-radius: 16px; }
.club-app .lb-table th { padding-top: 17px; padding-bottom: 17px; }
.club-app .lb-table td { padding-top: 18px; padding-bottom: 18px; }
.club-app .lb-table td.player { font-weight: 650; }
.club-app .br-top, .club-app .br-tools { border-radius: 13px; }
.club-app .br-cols { gap: 14px; }
.club-app .br-col { border-radius: 14px; }
.club-app .lib-chip { border-radius: 9px; }
.club-app .history-view > .cards .stat-card { padding: 20px; }
.club-app .detail-head h2 { font-size: 23px; letter-spacing: -.6px; }
.club-app .hand-item { border-radius: 12px; }
.club-app .hand-item summary { padding-top: 12px; padding-bottom: 12px; }

/* Sign-in and admin use the same palette without changing their page structure. */
.login-page { background: radial-gradient(ellipse at 50% 25%, #c4b8fd13 0%, transparent 50%), var(--bg); }
.login { max-width: 410px; padding: 40px 24px; }
.login-logo { width: 68px; height: 68px; margin-bottom: 16px; }
.login h1 { font-size: 30px; letter-spacing: -.8px; }
.club-login-kicker { color: var(--lavender); margin: 16px 0 10px; font-size: 9px; letter-spacing: 2px; font-weight: 700; }
.login-sub { font-size: 13px; margin-bottom: 28px; }
.login-card { padding: 25px; gap: 19px; border-radius: 20px; box-shadow: 0 20px 80px #0003; }
.login-card .primary-btn { gap: 12px; min-height: 45px; }
.login-card input { border-radius: 10px; min-height: 45px; }
.login-note { font-size: 12px; line-height: 1.65; }
.admin .topbar { padding: 18px 24px; background: #14151b; }
.admin .brand { letter-spacing: -.4px; }
.admin-main { padding-top: 28px; }
.admin table.users td { padding-top: 12px; padding-bottom: 12px; }

/* At laptop sizes the rail remains, while the trainer stacks early enough to stay usable. */
@media (min-width: 901px) and (max-width: 1190px) {
  .club-app .game { grid-template-columns: 1fr; grid-template-rows: none; grid-template-areas: 'table' 'actions' 'side'; }
  .club-app .side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .club-app .side > .panel { grid-area: auto; grid-row: auto; }
  .club-app .feedback { grid-column: 1 / -1; }
  .club-app .table-area { max-width: 760px; width: 100%; margin: 0 auto; }
}
@media (min-width: 761px) and (max-height: 800px) {
  .club-app .club-rail { padding-top: 22px; padding-bottom: 18px; gap: 18px; }
  .club-app .club-rail-note { display: none; }
  .club-app #mode { gap: 5px; }
  .club-app #mode button { min-height: 43px; padding-top: 10px; padding-bottom: 10px; }
}
@media (max-width: 1080px) {
  :root { --club-rail-width: 190px; }
  .club-app .club-rail { padding-left: 12px; padding-right: 12px; }
  .club-brand { font-size: 16px; gap: 8px; }
  .club-mark { flex-basis: 31px; height: 36px; font-size: 24px; }
  .club-app > main { padding-left: 24px; padding-right: 24px; }
  .club-app .training-toolbar { padding-left: 24px; padding-right: 24px; }
  .study-hero { padding: 26px; }
  .study-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .study-card { padding: 20px; }
  .study-metric { padding: 17px; }
}
@media (min-width: 761px) and (max-width: 950px) {
  .study-page-head { align-items: start; flex-direction: column; gap: 14px; }
  .study-head-tools { justify-content: start; }
  .study-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-grid { grid-template-columns: minmax(0, 1fr); }
  .study-hero { gap: 20px; }
  .study-goal-ring { flex-basis: 140px; width: 140px; height: 140px; }
  .study-goal-ring-inner { width: 126px; height: 126px; }
}
/* Mobile navigation scrolls inside its own surface, never the body. */
@media (max-width: 760px) {
  .club-app { padding-left: 0; }
  .club-app .club-rail { position: relative; inset: auto; width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 17px 12px; padding: 20px 20px 0; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .club-brand { font-size: 17px; }
  .club-brand small { font-size: 8px; letter-spacing: 1.4px; }
  .club-app #section { width: 130px; align-self: center; }
  .club-app #section a { font-size: 10px; padding: 6px 7px; min-height: 30px; }
  .club-app #mode { grid-column: 1 / -1; grid-row: 3; flex-direction: row; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; width: calc(100% + 40px); margin-left: -20px; padding: 0 6px 8px; gap: 2px; border-radius: 0; user-select: none; }
  .club-app #mode button { flex: 1 0 auto; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px 4px; gap: 0; font-size: 11px; white-space: nowrap; border-radius: 8px; }
  .club-app #mode .nav-icon { display: none; }
  .club-app #mode.is-dragging, .club-app #mode.is-dragging button { cursor: grabbing; }
  .nav-icon { font-size: 17px; width: 16px; }
  .club-rail-note, .club-app .club-rail .spacer { display: none; }
  .club-app .club-library-button { grid-column: 1; grid-row: 2; justify-self: start; padding: 7px 11px; margin: 0; font-size: 11px; }
  .club-app .account { grid-column: 2; grid-row: 2; border: 0; padding: 0; margin: 0; align-self: center; }
  .club-app .account-name { max-width: 90px; font-size: 12px; }
  .club-avatar { width: 26px; height: 26px; font-size: 14px; }
  .club-app .account-menu { top: calc(100% + 10px); bottom: auto; left: auto; right: 0; }
  .club-app > main { padding: 24px 20px 38px; }
  .club-app .training-toolbar { padding: 22px 20px 0; gap: 7px; }
  .training-toolbar select { flex: 1; max-width: 100%; font-size: 12px; }
  .training-toolbar #solution { flex: 1 0 100%; }
  .club-app > .notice, .club-app > .upload-status { margin-left: 20px; margin-right: 20px; }
  .study-view:not([hidden]) { gap: 18px; }
  .study-page-head { flex-direction: column; align-items: start; gap: 14px; }
  .study-page-head h1 { font-size: 27px; }
  .study-head-tools { justify-content: start; }
  .study-head-tools .study-pill { white-space: normal; overflow-wrap: anywhere; }
  .study-hero { padding: 25px; flex-wrap: wrap; gap: 18px; }
  .study-hero h1 { font-size: 30px; letter-spacing: -1px; }
  .study-hero p { font-size: 13px; }
  .study-hero h2 { font-size: 28px; }
  .study-goal-ring { flex-basis: 136px; width: 136px; height: 136px; }
  .study-goal-ring-inner { width: 123px; height: 123px; }
  .study-goal-ring-inner strong { font-size: 32px; }
  .study-hero-copy { flex-basis: 100%; }
  .study-goal-ring { margin: 8px auto 0; }
  .study-hero > .study-primary { margin-top: 0; }
  .study-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .study-metric > strong, .study-metric > b, .study-metric .study-value { font-size: 26px; }
  .study-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .study-card { padding: 21px; }
  .study-card-head { margin-bottom: 18px; }
  .study-quest { flex-wrap: wrap; gap: 10px; }
  .study-quest-copy { flex: 1; min-width: 120px; }
  .study-quest .study-secondary, .study-quest .study-primary { min-height: 38px; }
  .club-app .table-area { padding: 28px 0 12px; }
  .club-app .actions { gap: 7px; margin-top: 13px; }
  .club-app .act { min-width: 105px; font-size: 14px; padding: 12px 9px; }
  .club-app .act-size { min-height: 40px; }
  .club-app .lb-me { padding: 18px; gap: 17px 8px; }
  .club-app .lb-me span { font-size: 23px; }
  .club-app .lb-table th, .club-app .lb-table td { padding-left: 6px; padding-right: 6px; font-size: 11px; }
  .club-app .lb-table td { padding-top: 15px; padding-bottom: 15px; }
  .club-skip { left: 12px; }
  .admin .topbar { padding: 16px; }
}
@media (max-width: 390px) {
  .club-app .club-rail { padding-left: 14px; padding-right: 14px; }
  .club-app > main { padding-left: 14px; padding-right: 14px; }
  .club-app .training-toolbar { padding-left: 14px; padding-right: 14px; }
  .club-brand { font-size: 15px; gap: 7px; }
  .club-app #section { width: 116px; }
  .club-app #mode { width: calc(100% + 28px); margin-left: -14px; }
  .study-hero { padding: 22px; }
  .study-metric { padding: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .primary-btn, .study-primary { transition: none; }
}
