:root {
  --bg: #101126;
  --surface: #1b1d3b;
  --surface-2: #272a52;
  --line: rgba(255,255,255,.09);
  --text: #edf5ef;
  --muted: #95a59b;
  --accent: #ffd166;
  --accent-2: #58e6c2;
  --accent-3: #ff7aa2;
  --violet: #a78bfa;
  --danger: #ff8278;
  --shadow: 0 20px 50px rgba(0,0,0,.28);
  --progress: 0deg;
  --tg-bg: var(--bg);
  --tg-text: var(--text);
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 82% -8%, rgba(255,122,162,.23), transparent 30%), radial-gradient(circle at 8% 18%, rgba(88,230,194,.18), transparent 28%), linear-gradient(160deg,#101126 0%,#171438 55%,#101126 100%); color: var(--text); font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, textarea, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-2); }
.hidden { display: none !important; }
.screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.loading-screen { color: var(--muted); text-align: center; }
.spinner { width: 42px; height: 42px; margin: auto; border: 3px solid rgba(255,255,255,.1); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-card { max-width: 420px; padding: 40px 30px; border: 1px solid var(--line); border-radius: 30px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.logo-mark { width: 64px; height: 64px; margin: auto; display: grid; place-items: center; border-radius: 20px; background: var(--accent); color: #13200f; font-weight: 900; font-size: 30px; transform: rotate(-4deg); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; min-height: 78px; padding: 12px clamp(16px,4vw,38px); border-bottom: 1px solid var(--line); background: rgba(13,18,16,.9); backdrop-filter: blur(18px); }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.eyebrow { display: block; margin-bottom: 3px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); cursor: pointer; }
.progress-ring { margin-left: auto; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) var(--progress), rgba(255,255,255,.08) 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 5px; border-radius: inherit; background: var(--surface); }
.progress-ring span { position: relative; font-size: 11px; font-weight: 800; }
.layout { max-width: 1500px; margin: auto; display: grid; grid-template-columns: 280px minmax(0,1fr); gap: 28px; padding: 28px; }
.sidebar { position: sticky; top: 106px; align-self: start; max-height: calc(100vh - 126px); overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 24px; background: rgba(21,28,25,.88); box-shadow: var(--shadow); }
.sidebar-head { display: none; }
.nav-item, .week-link { width: 100%; padding: 13px 14px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.nav-item:hover, .week-link:hover, .nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item.active { color: var(--accent); }
.nav-divider { height: 1px; margin: 14px 0; background: var(--line); }
.month-label { padding: 8px 14px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.week-link { font-size: 14px; }
.future-card { margin-top: 20px; padding: 16px; border: 1px dashed rgba(184,243,106,.25); border-radius: 16px; color: var(--muted); font-size: 13px; }
.future-card span { color: var(--accent); font-weight: 800; }
.future-card p { margin: 6px 0 0; }
.content { min-width: 0; }
.hero-card { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: clamp(24px,4vw,44px); border-radius: 30px; background: linear-gradient(135deg, rgba(255,209,102,.20), rgba(255,122,162,.13) 48%, rgba(88,230,194,.10)), var(--surface); border: 1px solid rgba(255,209,102,.22); box-shadow: var(--shadow); }
.hero-card h2 { margin: 0; font-size: clamp(28px,5vw,50px); line-height: 1.04; letter-spacing: -.045em; }
.hero-card p { margin: 12px 0 0; color: var(--muted); }
.drive-button, .youtube-button { display: inline-flex; align-items: center; min-height: 42px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.04); color: var(--text); text-decoration: none; white-space: nowrap; }
.lesson-media { display: grid; gap: 16px; margin-top: 26px; }
.player-card, .audio-card { overflow: hidden; padding: 16px; border: 1px solid rgba(167,139,250,.25); border-radius: 20px; background: linear-gradient(135deg,rgba(167,139,250,.12),rgba(88,230,194,.05)); }
.audio-card { border-color: rgba(255,122,162,.24); background: linear-gradient(135deg,rgba(255,122,162,.12),rgba(255,209,102,.05)); }
.player-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.player-title span, .training-description, .training-count { display: block; color: var(--muted); font-size: 13px; }
.player-title strong { display: block; color: var(--text); }
.mini-link { color: var(--accent); font-size: 13px; text-decoration: none; white-space: nowrap; }
video, audio { display: block; width: 100%; }
video { max-height: min(68vh,720px); border-radius: 14px; background: #080914; }
.extra-player { margin-top: 16px; }
.day-strip { display: flex; gap: 10px; padding: 18px 2px; overflow-x: auto; scrollbar-width: none; }
.day-chip { min-width: 78px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--muted); cursor: pointer; }
.day-chip span { display: block; color: var(--text); font-size: 18px; font-weight: 900; }
.day-chip small { font-size: 10px; text-transform: uppercase; }
.day-chip.completed { border-color: rgba(105,217,176,.35); }
.day-chip.completed span { color: var(--accent-2); }
.day-chip.available, .day-chip.in_progress, .day-chip.selected { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(184,243,106,.2) inset; }
.day-chip.locked { opacity: .38; cursor: not-allowed; }
.view-panel { display: grid; gap: 20px; }
.lesson-card, .checklist-card { padding: clamp(20px,4vw,38px); border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); }
.lesson-head, .section-title, .action-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.lesson-head h2, .section-title h2, .lesson-card > h2 { margin: 0; font-size: clamp(24px,3.5vw,36px); letter-spacing: -.035em; }
.prose { margin-top: 30px; color: #d5dfd8; }
.prose h2, .prose h3, .prose h4, .prose h5 { margin: 32px 0 12px; color: var(--text); line-height: 1.2; }
.prose p { margin: 13px 0; }
.prose li { margin: 8px 0; }
.prose strong { color: var(--text); }
.prose pre { overflow: auto; padding: 18px; border-radius: 15px; background: #0b100e; border: 1px solid var(--line); white-space: pre-wrap; }
.prose code { padding: 2px 6px; border-radius: 5px; background: rgba(255,255,255,.07); }
.prose hr { height: 1px; border: 0; margin: 28px 0; background: var(--line); }
.table-wrap { overflow-x: auto; margin: 20px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px; border: 1px solid var(--line); vertical-align: top; text-align: left; }
th { color: var(--accent); background: rgba(255,255,255,.03); }
.counter { padding: 6px 10px; border-radius: 99px; background: rgba(184,243,106,.12); color: var(--accent); font-weight: 800; }
#checklist, #optional-checklist { display: grid; gap: 10px; margin-top: 22px; }
.check-item { position: relative; display: grid; grid-template-columns: 24px 28px 1fr auto; gap: 10px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.02); cursor: pointer; }
.check-item input { position: absolute; opacity: 0; }
.check-box { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.24); border-radius: 8px; color: transparent; }
.check-item.checked { border-color: rgba(105,217,176,.3); opacity: .72; }
.check-item.checked .check-box { color: #102015; background: var(--accent-2); border-color: var(--accent-2); }
.check-copy strong { display: block; font-size: 15px; }
.check-copy small { display: block; margin-top: 5px; color: var(--muted); }
.check-item em { color: var(--muted); font-size: 11px; font-style: normal; }
.note-field { display: grid; gap: 8px; margin-top: 24px; color: var(--muted); font-size: 13px; font-weight: 700; }
textarea { width: 100%; resize: vertical; padding: 15px; border: 1px solid var(--line); border-radius: 16px; outline: none; background: #0e1512; color: var(--text); }
textarea:focus { border-color: var(--accent-2); }
.action-row { margin-top: 18px; justify-content: flex-end; }
.primary-button, .secondary-button { min-height: 46px; padding: 11px 18px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; }
.primary-button { border-color: var(--accent); background: var(--accent); color: #13200f; font-weight: 900; }
.primary-button:disabled { opacity: .35; cursor: not-allowed; }
.secondary-button { background: transparent; color: var(--text); }
.completion-hint { margin: 12px 0 0; color: var(--muted); text-align: right; font-size: 13px; }
.materials-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 12px; margin-top: 24px; }
.material-card { display: grid; gap: 7px; min-height: 130px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); color: var(--text); text-decoration: none; }
.material-card span, .material-card em { color: var(--muted); font-size: 11px; font-style: normal; }
.material-card strong { align-self: center; }
.material-card em { align-self: end; color: var(--accent-2); }
.training-book > h2 { margin: 2px 0 8px; }
.training-controls { display: grid; grid-template-columns: auto minmax(240px,1fr); gap: 18px; align-items: end; margin: 24px 0 10px; }
.training-sexes { display: flex; gap: 9px; }
.sex-chip { min-height: 44px; padding: 9px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.sex-chip.active { border-color: var(--accent); background: linear-gradient(135deg,var(--accent),#ffb85c); color: #33220b; font-weight: 900; }
.training-search { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.training-search input { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; outline: none; background: #12142d; color: var(--text); }
.training-search input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(88,230,194,.10); }
.training-groups { display: grid; gap: 12px; margin-top: 18px; }
.training-group { border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); }
.training-group summary { display: flex; justify-content: space-between; gap: 14px; padding: 16px 18px; cursor: pointer; list-style: none; }
.training-group summary::-webkit-details-marker { display: none; }
.training-group summary strong { color: var(--accent); }
.training-group summary span { color: var(--muted); font-size: 13px; }
.exercise-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); gap: 10px; padding: 0 14px 14px; }
.exercise-card { display: grid; gap: 12px; min-height: 112px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg,rgba(255,122,162,.08),rgba(88,230,194,.04)); color: var(--text); text-decoration: none; }
.exercise-card:hover { border-color: rgba(88,230,194,.45); transform: translateY(-1px); }
.exercise-card span { align-self: end; color: var(--accent-2); font-size: 12px; }
.optional-card { margin-top: 20px; }
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 100; transform: translate(-50%, 20px); max-width: min(90vw, 430px); padding: 12px 18px; border: 1px solid var(--line); border-radius: 14px; background: #26342d; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.sidebar-backdrop { display: none; }

@media (max-width: 840px) {
  .layout { display: block; padding: 16px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(86vw, 340px); max-height: none; border-radius: 0 24px 24px 0; transform: translateX(-105%); transition: transform .22s ease; }
  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); }
  .menu-open .sidebar-backdrop { display: block; }
  .hero-card { align-items: start; flex-direction: column; }
  .lesson-head, .section-title { align-items: start; flex-direction: column; }
  .youtube-button { width: 100%; justify-content: center; }
  .action-row { align-items: stretch; flex-direction: column-reverse; }
  .primary-button, .secondary-button { width: 100%; }
  .completion-hint { text-align: left; }
  .check-item { grid-template-columns: 24px 1fr auto; }
  .check-item input + .check-box { grid-column: 1; }
  .check-copy { grid-column: 2; }
  .player-title, .training-controls { align-items: stretch; grid-template-columns: 1fr; }
  .player-title { flex-direction: column; }
  .training-sexes { width: 100%; }
  .sex-chip { flex: 1; }
}
