/* BBC LETSGO ACADEMY — токены и компоненты. Один источник цвета для всего приложения. */
:root {
  --bg: #F6F4FB;
  --surface: #FFFFFF;
  --surface-2: #F5F2FD;
  --ink: #15112B;
  --body: #3B3652;
  --mute: #6A6482;
  --line: #E4DFF2;
  --accent: #5B2FD6;
  --accent-hover: #4A22BF;
  --accent-soft: #ECE5FE;
  --on-accent: #FFFFFF;
  --dark: #17122E;
  --dark-2: #241C45;
  --on-dark: #F4F1FF;
  --on-dark-mute: #B9B0DA;
  --gold: #F2C14E;
  --on-gold: #15112B;
  --ok: #1F7A4D;
  --ok-soft: #E2F3EA;
  --warn: #8A5A00;
  --warn-soft: #FFF3D6;
  --danger: #B42318;
  --danger-hover: #93190F;
  --danger-soft: #FDE7E5;
  --focus: #5B2FD6;
  --shadow: 0 8px 24px rgba(23, 18, 46, .10);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --display: "Unbounded", "Segoe UI", sans-serif;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --t-fast: 120ms;
  --nav-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F0C1F; --surface: #19142F; --surface-2: #211B3D; --ink: #F4F1FF; --body: #D5CFEA; --mute: #A39CC0;
    --line: #2E2752; --accent: #8E6BFF; --accent-hover: #A288FF; --accent-soft: #2A2150; --on-accent: #0F0C1F;
    --dark: #241C45; --dark-2: #2F2659; --ok: #4CC38A; --ok-soft: #173327; --warn: #F2C14E; --warn-soft: #3A2E10;
    --danger: #FF7A6E; --danger-hover: #FF968C; --danger-soft: #3D1916; --focus: #A288FF; --shadow: 0 8px 24px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0F0C1F; --surface: #19142F; --surface-2: #211B3D; --ink: #F4F1FF; --body: #D5CFEA; --mute: #A39CC0;
  --line: #2E2752; --accent: #8E6BFF; --accent-hover: #A288FF; --accent-soft: #2A2150; --on-accent: #0F0C1F;
  --dark: #241C45; --dark-2: #2F2659; --ok: #4CC38A; --ok-soft: #173327; --warn: #F2C14E; --warn-soft: #3A2E10;
  --danger: #FF7A6E; --danger-hover: #FF968C; --danger-soft: #3D1916; --focus: #A288FF; --shadow: 0 8px 24px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* каркас */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .02em; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
.top .sp { flex: 1; }
.lang { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-sm); padding: 4px 8px; font-size: 12px; font-weight: 700; color: var(--accent); }
main { max-width: 980px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 24px); }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-in { max-width: 980px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: var(--nav-h); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--mute); text-decoration: none; position: relative; transition: color var(--t-fast); }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a .dot { position: absolute; top: 8px; right: calc(50% - 18px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; display: grid; place-items: center; }

h1 { font-family: var(--display); font-size: 20px; line-height: 1.2; font-weight: 700; margin-bottom: 4px; }
h2 { font-family: var(--display); font-size: 15px; line-height: 1.3; font-weight: 700; margin: 22px 0 10px; }
h3 { font-size: 14px; font-weight: 700; }
.sub { color: var(--mute); font-size: 13px; }
.muted { color: var(--mute); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

/* кнопки: 8 состояний через hover/focus/active/disabled/aria-busy */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: var(--r-sm); padding: 9px 14px; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--accent); color: var(--on-accent); text-decoration: none; transition: background var(--t-fast), transform var(--t-fast); min-height: 40px; }
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.ghost:hover { background: var(--line); }
.btn.line { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.line:hover { background: var(--surface-2); }
.btn.gold { background: var(--gold); color: var(--on-gold); }
.btn.gold:hover { background: #E5B23C; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); }
.btn.danger-line { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn.danger-line:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn.full { width: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }

/* поля */
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--mute); margin-bottom: 4px; }
.in { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 9px 11px; min-height: 40px; transition: border-color var(--t-fast); }
.in:hover { border-color: var(--mute); }
.in:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
.in:disabled { background: var(--surface-2); color: var(--mute); }
.in[aria-invalid="true"] { border-color: var(--danger); }
.err { color: var(--danger); font-size: 12px; margin-top: 4px; }
textarea.in { min-height: 80px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* карточки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card.dark { background: var(--dark); border-color: var(--dark); color: var(--on-dark); }
.card.dark .muted, .card.dark .sub { color: var(--on-dark-mute); }
.card.soft { background: var(--surface-2); border-color: var(--surface-2); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.mute { background: var(--surface-2); color: var(--mute); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--mute); cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* курс */
.course { display: grid; grid-template-columns: 52px 1fr; gap: 12px; text-decoration: none; color: inherit; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
a.course:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.thumb { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.thumb svg.i { width: 24px; height: 24px; }
.thumb.violet { background: linear-gradient(135deg, #5B2FD6, #8E6BFF); }
.thumb.teal { background: linear-gradient(135deg, #0E7C86, #33B6A8); }
.thumb.gold { background: linear-gradient(135deg, #C2410C, #F2C14E); }
.thumb.dark { background: linear-gradient(135deg, #17122E, #4A3C8C); }
.course h3 { line-height: 1.3; }
.price { font-family: var(--display); font-weight: 700; font-size: 16px; }
.price small { font-family: var(--font); font-weight: 500; font-size: 12px; color: var(--mute); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.hero { background: var(--dark); color: var(--on-dark); border-radius: var(--r-lg); padding: 18px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(124,82,255,.5), rgba(124,82,255,0) 70%); pointer-events: none; }
.hero h1 { color: var(--on-dark); position: relative; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero p { color: var(--on-dark-mute); position: relative; font-size: 13px; }

.lesson { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.lesson > button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: none; border: 0; cursor: pointer; text-align: left; }
.lesson > button:hover { background: var(--surface-2); }
.lesson > button:disabled { cursor: default; background: none; }
.lesson .st { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--mute); }
.lesson .st.done { background: var(--ok-soft); color: var(--ok); }
.lesson .st.open { background: var(--accent-soft); color: var(--accent); }
.lesson .st svg.i { width: 14px; height: 14px; }
.lesson .body { padding: 0 12px 12px; }
.video { position: relative; padding-top: 56.25%; background: #000; border-radius: var(--r-sm); overflow: hidden; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.placeholder { border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 16px; text-align: center; color: var(--mute); font-size: 13px; }

.event { background: var(--dark); color: var(--on-dark); border-radius: var(--r); padding: 14px; }
.event .k { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.event h3 { margin: 4px 0; }
.event p { color: var(--on-dark-mute); font-size: 13px; }
.post .k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.eco { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.eco:first-of-type { border-top: 0; }
.eco .lg { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.lg.violet { background: linear-gradient(135deg, #5B2FD6, #8E6BFF); }
.lg.teal { background: linear-gradient(135deg, #0E7C86, #33B6A8); }
.lg.gold { background: linear-gradient(135deg, #C2410C, #F2C14E); }
.lg.dark { background: linear-gradient(135deg, #17122E, #4A3C8C); }

.bal .v { font-family: var(--display); font-size: 28px; font-weight: 700; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.split > div { background: var(--dark-2); border-radius: var(--r-sm); padding: 8px 10px; font-size: 12px; color: var(--on-dark-mute); }
.split b { display: block; color: var(--on-dark); font-size: 15px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stat .v { font-family: var(--display); font-size: 18px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.copy { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 10px; font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; }
.qr { background: #fff; border-radius: var(--r-sm); padding: 8px; display: inline-block; line-height: 0; }
.qr img { width: 132px; height: 132px; image-rendering: pixelated; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list > .li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.list > .li:first-child { border-top: 0; }
.amount-plus { color: var(--ok); font-weight: 700; white-space: nowrap; }
.cartbar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 15; padding: 0 16px 10px; }
.cartbar .in2 { max-width: 948px; margin: 0 auto; background: var(--dark); color: var(--on-dark); border-radius: var(--r); padding: 10px 12px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.empty { text-align: center; padding: 32px 16px; color: var(--mute); }
.empty svg.i { width: 32px; height: 32px; margin-bottom: 8px; color: var(--accent); }
.note { font-size: 12px; color: var(--mute); }
.banner { border-radius: var(--r); padding: 10px 12px; font-size: 13px; background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--accent-soft); color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.bad { background: var(--danger); color: #fff; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); height: 80px; }
@keyframes sk { to { background-position: -200% 0; } }

/* панель */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
table.t th, table.t td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
table.t th { background: var(--surface-2); font-size: 12px; color: var(--mute); font-weight: 600; border-top: 0; }
.tbl { overflow-x: auto; }
.modal-bg { position: fixed; inset: 0; z-index: 40; background: rgba(15, 12, 31, .5); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 16px; }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: var(--r-lg); } }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fgrid .wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .fgrid { grid-template-columns: 1fr; } }
.login { max-width: 420px; margin: 8vh auto 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
