:root {
  --bg-primary: #070712;
  --bg-secondary: #0c0c1a;
  --bg-card: rgba(26, 26, 46, .78);
  --bg-hover: rgba(201, 163, 106, .12);
  --text-primary: #ffffff;
  --text-secondary: #c8c8d4;
  --accent: #c9a36a;
  --gold: #c9a36a;
  --success: #00d26a;
  --border: rgba(255, 255, 255, .08);
  --shadow: 0 24px 64px rgba(0, 0, 0, .45);
  --radius: 18px;
  --header-h: 68px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f3efe6;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, .88);
  --bg-hover: rgba(201, 163, 106, .12);
  --text-primary: #121226;
  --text-secondary: #5b5d72;
  --accent: #9a7540;
  --gold: #9a7540;
  --border: rgba(18, 18, 38, .08);
  --shadow: 0 12px 36px rgba(18, 18, 38, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }
body {
  font-family: var(--sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  position: relative;
  isolation: isolate;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }

.dash-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(201, 163, 106, .16), transparent 58%),
    radial-gradient(720px 480px at 100% 8%, rgba(201, 163, 106, .1), transparent 52%),
    radial-gradient(640px 420px at 50% 110%, rgba(88, 70, 140, .14), transparent 55%),
    linear-gradient(180deg, #0b0b18 0%, #070712 42%, #05050e 100%);
}
.dash-fx::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 20%, transparent 75%);
  opacity: .45;
}
.dash-fx::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -80px;
  top: -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 163, 106, .2), transparent 68%);
  animation: glowPulse 8s ease-in-out infinite;
}
.dash-fx .dash-embers { position: absolute; inset: 0; }
.dash-fx .dash-embers i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #d4b483;
  box-shadow: 0 0 12px rgba(212, 180, 131, .7);
  animation: ember 14s linear infinite;
}
.dash-fx .dash-embers i:nth-child(1) { left: 8%; bottom: 4%; }
.dash-fx .dash-embers i:nth-child(2) { left: 22%; bottom: 0; animation-delay: 1.6s; }
.dash-fx .dash-embers i:nth-child(3) { left: 41%; bottom: 8%; animation-delay: 3.2s; }
.dash-fx .dash-embers i:nth-child(4) { left: 63%; bottom: 2%; animation-delay: .8s; }
.dash-fx .dash-embers i:nth-child(5) { left: 81%; bottom: 12%; animation-delay: 2.4s; }
.dash-fx .dash-embers i:nth-child(6) { left: 93%; bottom: 6%; animation-delay: 4s; }
[data-theme="light"] .dash-fx {
  background:
    radial-gradient(800px 480px at 10% -10%, rgba(201, 163, 106, .14), transparent 58%),
    radial-gradient(640px 400px at 100% 0%, rgba(201, 163, 106, .08), transparent 50%),
    linear-gradient(180deg, #f7f3ea 0%, #f3efe6 100%);
}
[data-theme="light"] .dash-fx::before {
  background-image:
    linear-gradient(rgba(18, 18, 38, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 18, 38, .04) 1px, transparent 1px);
}
[data-theme="light"] .dash-fx::after { background: radial-gradient(circle, rgba(201, 163, 106, .12), transparent 68%); }
[data-theme="light"] .dash-fx .dash-embers { display: none; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "brand tools" "nav nav";
  align-items: center;
  column-gap: 20px;
  row-gap: 8px;
  padding: 10px 28px 12px;
  background: linear-gradient(180deg, rgba(26, 26, 46, .88), rgba(15, 15, 35, .72));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(28px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .06);
}
[data-theme="light"] .app-header {
  background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(243, 239, 230, .82));
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(201, 163, 106, .35);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; letter-spacing: -.03em; }
.brand-tag {
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.nav {
  grid-area: nav;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.nav a {
  flex: 1 1 0;
  text-align: center;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}
.nav a:hover, .nav a.active { color: var(--text-primary); background: var(--bg-hover); }
.nav a.active { box-shadow: inset 0 -2px 0 var(--gold); }
.header-tools {
  grid-area: tools;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.global-search { flex: 1 1 220px; min-width: 160px; max-width: 360px; }
.search, .field {
  width: 100%;
  background: rgba(7, 7, 18, .45);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 16px;
}
[data-theme="light"] .search,
[data-theme="light"] .field,
[data-theme="light"] .icon-btn { background: rgba(255, 255, 255, .8); }
.search:focus, .field:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 163, 106, .16);
}
.icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: rgba(7, 7, 18, .45);
  border-radius: 12px;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--gold); }

.wrap {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.page-head h1::after {
  content: "";
  display: block;
  width: 42px;
  height: 1px;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.muted { color: var(--text-secondary); }
.mono { font-family: var(--mono); }

.hero {
  padding: 22px 24px;
  margin-bottom: 16px;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.hero h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.03em; }
.lead { margin: 0; max-width: 62ch; color: var(--text-secondary); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(26, 26, 46, .88), rgba(15, 15, 35, .78));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(22px);
  animation: cardIn .75s cubic-bezier(.16, 1, .3, 1) both;
}
[data-theme="light"] .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(243, 239, 230, .88));
}
.kpi { padding: 16px 18px; }
.kpi .label {
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.kpi .value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  margin: 6px 0 0;
  letter-spacing: -.03em;
}
.grid-2 { display: grid; grid-template-columns: 1.35fr .65fr; gap: 12px; }
.table-card, .side-card { padding: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 16px; }
.card-head a { color: var(--gold); font-size: 13px; font-weight: 600; }
.table-scroll { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
table.data th {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}
table.data th[data-key] { cursor: pointer; user-select: none; }
table.data th[data-key]::after { content: " ↕"; opacity: .35; font-size: 11px; }
table.data th.sorted { color: var(--gold); }
table.data th.sorted[data-sort="desc"]::after { content: " ↓"; opacity: 1; }
table.data th.sorted[data-sort="asc"]::after { content: " ↑"; opacity: 1; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data td.word { font-weight: 650; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 1.4fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.bar-row:last-child { border-bottom: 0; }
.bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
}
[data-theme="light"] .bar { background: rgba(18, 18, 38, .06); }
.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8d6a3a, var(--gold));
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.toolbar .search { max-width: 420px; }
.toolbar .field { width: auto; min-width: 160px; }
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.lesson-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  min-height: 168px;
}
.lesson-card:hover { background: linear-gradient(180deg, rgba(36, 32, 52, .92), rgba(15, 15, 35, .82)); }
[data-theme="light"] .lesson-card:hover { background: #fff; }
.lesson-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.lesson-no { font-weight: 700; letter-spacing: -.02em; }
.lesson-count { font-family: var(--mono); font-size: 13px; color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span {
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  font-size: 13px;
}
.subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.subnav a {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
}
.block { padding: 16px 18px; margin-bottom: 12px; }
.block h2 { margin: 0 0 10px; font-size: 16px; }
.block p { margin: 0 0 10px; }
.point-list { display: grid; gap: 8px; margin-top: 8px; }
.point {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 1.2fr 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.sentence { padding: 8px 0; border-bottom: 1px solid var(--border); }
.hw-list { margin: 8px 0 0; padding-left: 1.2rem; }
.hw-list li { margin: 10px 0; }
.stack { display: grid; gap: 12px; }
[data-theme="light"] .chips span { background: rgba(18, 18, 38, .04); }
.empty {
  padding: 28px 8px;
  text-align: center;
  color: var(--text-secondary);
}
.empty strong { display: block; margin-bottom: 6px; color: var(--text-primary); font-size: 16px; }
.site-foot {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 28px;
  color: var(--text-secondary);
  font-size: 13px;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes glowPulse {
  0%, 100% { opacity: .55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}
@keyframes ember {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: .9; }
  100% { transform: translateY(-70vh); opacity: 0; }
}

@media (max-width: 980px) {
  .kpi-grid, .lesson-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app-header { padding: 10px 14px 12px; column-gap: 10px; }
  .kpi-grid, .lesson-grid { grid-template-columns: 1fr; }
  .wrap { width: calc(100% - 24px); }
  .page-head { align-items: start; flex-direction: column; }
  .toolbar .search, .toolbar .field { width: 100%; max-width: none; }
  .point { grid-template-columns: 1fr; gap: 2px; }
  .global-search { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
