:root {
  --bg: #0a1122;
  --bg2: #0e1830;
  --card: #131f3d;
  --card2: #182750;
  --line: #24356b;
  --text: #eef3ff;
  --muted: #93a3c8;
  --accent: #00a1e0;
  --accent2: #0176d3;
  --good: #2ecc71;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #15305e 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(10,17,34,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 17px; }
.brand-cloud { font-size: 22px; }
.brand-text b { color: var(--accent); font-weight: 700; }
.topbar-progress { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

main { max-width: 1060px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- Home ---------- */
.hero {
  background: linear-gradient(135deg, #123064 0%, #0d1c3f 60%, #0a1122 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 22px;
  margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: "☁️"; position: absolute; right: 14px; top: -18px; font-size: 110px; opacity: .12;
}
.hero h1 { font-size: 26px; line-height: 1.2; margin-bottom: 8px; }
.hero h1 b { color: var(--accent); }
.hero p { color: var(--muted); font-size: 14.5px; max-width: 560px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.stat {
  background: rgba(0,161,224,.1); border: 1px solid rgba(0,161,224,.35);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; color: #bfe9ff;
}
.continue-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 700; font-size: 15px;
  padding: 12px 22px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0,161,224,.35);
}
.continue-btn:active { transform: scale(.97); }

.section-title { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin: 26px 2px 12px; }

.day-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.day-card {
  background: linear-gradient(160deg, var(--card) 0%, var(--bg2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 128px;
  transition: transform .12s ease, border-color .12s ease;
}
.day-card.available:hover { border-color: var(--accent); transform: translateY(-2px); }
.day-num {
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.day-topic { font-size: 14px; font-weight: 600; line-height: 1.35; flex: 1; }
.day-meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.day-card.locked { opacity: .45; }
.day-card.locked .day-num { color: var(--muted); }
.day-progress {
  height: 5px; border-radius: 99px; background: #1d2c55; overflow: hidden;
}
.day-progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--good)); border-radius: 99px; }
.badge-done { color: var(--good); font-weight: 700; }
.badge-new {
  background: var(--accent); color: #04263a; font-size: 10.5px; font-weight: 800;
  border-radius: 6px; padding: 1px 6px; letter-spacing: .05em;
}

/* ---------- Day page ---------- */
.crumb { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; display: inline-block; }
.crumb:hover { color: var(--accent); }
.day-head { margin-bottom: 14px; }
.day-head .day-num { font-size: 13px; }
.day-head h1 { font-size: 22px; line-height: 1.25; margin-top: 2px; }
.day-head .day-meta { margin-top: 6px; justify-content: flex-start; gap: 14px; }

.player-wrap {
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
}
.player-stage { position: relative; background: #000; display: flex; justify-content: center; }
.player-stage video {
  width: 100%; max-height: 62vh; object-fit: contain; background: #000; display: block;
}
@media (min-width: 900px) {
  .player-stage video { max-height: 68vh; }
}
.player-title {
  padding: 10px 14px; font-size: 14.5px; font-weight: 600;
  background: var(--bg2); border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.player-title .pt-dur { color: var(--muted); font-weight: 400; font-size: 12.5px; }

.controls {
  background: var(--bg2); border-top: 1px solid var(--line);
  padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px;
}
.seek { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek input[type=range] { flex: 1; accent-color: var(--accent); height: 4px; }
.ctrl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ctrl-group { display: flex; align-items: center; gap: 8px; }
.cbtn {
  background: var(--card2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.cbtn:active { transform: scale(.95); }
.cbtn.play { background: linear-gradient(135deg, var(--accent), var(--accent2)); border: none; padding: 9px 18px; font-size: 15px; }
.speed-chips { display: flex; gap: 6px; }
.schip {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
}
.schip.on { background: var(--accent); border-color: var(--accent); color: #04263a; }

/* fullscreen */
.player-wrap:fullscreen { display: flex; flex-direction: column; border-radius: 0; border: none; }
.player-wrap:fullscreen .player-stage { flex: 1; min-height: 0; }
.player-wrap:fullscreen .player-stage video { max-height: none; height: 100%; width: 100%; }

/* playlist */
.playlist { margin-top: 18px; }
.pl-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; margin-bottom: 8px; width: 100%; text-align: left;
}
.pl-item:hover { border-color: var(--accent); }
.pl-item.playing { border-color: var(--accent); background: linear-gradient(135deg, rgba(0,161,224,.16), rgba(1,118,211,.06)); }
.pl-num {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--card2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--accent);
}
.pl-item.playing .pl-num { background: var(--accent); color: #04263a; border-color: var(--accent); }
.pl-text { flex: 1; min-width: 0; }
.pl-title { font-size: 14px; font-weight: 600; }
.pl-sub { font-size: 12px; color: var(--muted); }
.pl-state { font-size: 15px; flex: none; }
.pl-state .watched { color: var(--good); }

/* tabs */
.tabs { display: flex; gap: 6px; margin: 22px 0 12px; overflow-x: auto; padding-bottom: 2px; }
.tab {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px;
  font-size: 13.5px; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.tab.on { background: var(--card2); color: var(--text); border-color: var(--accent); }
.doc {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #d8e2f8; overflow-x: auto;
}
.doc:empty::before { content: "Loading…"; color: var(--muted); }
.doc-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.foot {
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 18px; border-top: 1px solid var(--line);
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--accent);
  padding: 9px 18px; border-radius: 999px; font-size: 13.5px; z-index: 50;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }
