/* ========== CSS VARIABLES ========== */
:root {
  --bg: #08111f;
  --panel: #111d30;
  --panel2: #0d1728;
  --line: #28415e;
  --line2: #1e3352;
  --text: #e7eef7;
  --muted: #9bb0c8;
  --brand: #74b9ff;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f6c453;
  --ink: #102238;
  --gold: #f3d37a;
  --nav-h: 54px;
}

/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; }
html, body { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(96,165,250,.18), transparent 55%),
    radial-gradient(700px 360px at 100% 0, rgba(246,196,83,.08), transparent 45%),
    linear-gradient(180deg, #07111d, #08111f 48%, #091523);
  color: var(--text);
  min-height: 100vh;
}

a { color: #a9d0ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== LAYOUT ========== */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}
.wrap.has-nav { padding-top: calc(var(--nav-h) + 24px); }

/* ========== TOP NAVIGATION ========== */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 200;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  background: rgba(8, 17, 31, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(40, 65, 94, 0.7);
  box-shadow: 0 2px 20px rgba(0,0,0,.25);
}
.topnav-brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.topnav-brand .brand-emoji { font-size: 20px; }
.topnav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  transition: .18s background, .18s color;
}
.topnav-link:hover { background: rgba(116,185,255,.1); color: var(--text); text-decoration: none; }
.topnav-link.active { background: rgba(116,185,255,.15); color: var(--brand); }
.topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  white-space: nowrap;
}
.topnav-system-switcher {
  position: fixed;
  left: 18px;
  top: calc(var(--nav-h) + 50px);
  z-index: 220;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(8,17,31,.86);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 50px rgba(0,0,0,.3);
  width: 164px;
  max-height: calc(100vh - var(--nav-h) - 74px);
  overflow-y: auto;
  scrollbar-width: none;
}
.topnav-system-switcher::-webkit-scrollbar { display: none; }
.topnav-system-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 10px 12px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: .18s background, .18s color, .18s transform;
  text-align: left;
}
.topnav-system-btn:hover {
  background: rgba(116,185,255,.12);
  color: var(--text);
}
.topnav-system-btn.is-active {
  color: #fff;
  background: linear-gradient(135deg, #4c8fe8, #2e69c7);
  box-shadow: 0 10px 24px rgba(46,105,199,.25);
}
.topnav-system-btn.is-loading {
  opacity: .72;
  cursor: wait;
}
.topnav-user {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topnav-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2e69c7, #7ab8ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* ========== BREADCRUMB ========== */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); text-decoration: none; }
.breadcrumb-sep { color: var(--line); }

/* ========== HERO ========== */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #102038, #142744 58%, #0f1b31);
  border: 1px solid rgba(116,185,255,.24);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: 0 14px 40px rgba(0,0,0,.3);
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 80% 50%, rgba(116,185,255,.07), transparent 60%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute; right: -40px; top: -40px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(243,211,122,.18), transparent 65%);
  pointer-events: none;
}
.hero h1 {
  margin: 0 0 6px;
  font-size: 26px; font-weight: 800;
  background: linear-gradient(135deg, #e7f0ff, #a9d0ff 50%, #f3d37a);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
}
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ========== SECTION HEADING ========== */
.section-heading {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700; color: var(--text);
  margin: 20px 0 12px;
}
.section-heading::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line2), transparent);
}

/* ========== GRID ========== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* ========== CARDS ========== */
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  transition: .22s transform, .22s border-color, .22s box-shadow, .22s background;
  box-shadow: 0 6px 20px rgba(0,0,0,.14);
}
.card:hover {
  transform: translateY(-3px);
  border-color: #4c6f96;
  box-shadow: 0 14px 36px rgba(0,0,0,.22);
  background: linear-gradient(180deg, #14233a, #0f1a2e);
}
a.card:hover { text-decoration: none; }

/* Feature card — large icon + text */
.feature-card {
  display: flex; flex-direction: column;
  gap: 10px;
  padding: 20px;
}
.feature-card .card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(116,185,255,.18), rgba(116,185,255,.06));
  border: 1px solid rgba(116,185,255,.2);
  flex-shrink: 0;
}
.feature-card h3 { margin: 0; font-size: 15px; font-weight: 700; }
.feature-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }

/* KPI stat card */
.stat-card {
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: attr(data-icon);
  position: absolute; right: 14px; bottom: 10px;
  font-size: 36px; opacity: .12;
  pointer-events: none;
}
.stat-card .stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-card .stat-value { font-size: 32px; font-weight: 800; letter-spacing: .5px; line-height: 1.1; }
.stat-card .stat-sub { font-size: 12px; color: var(--muted); }

/* ========== NUMBERS ========== */
.num { font-size: 30px; font-weight: 800; letter-spacing: .5px; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid #466992;
  background: linear-gradient(180deg, #132641, #102238);
  color: #e2eefc; cursor: pointer;
  font-size: 13px; font-weight: 500;
  transition: .2s transform, .2s box-shadow, .2s filter, .2s border-color;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px); text-decoration: none;
  box-shadow: 0 8px 20px rgba(17,66,128,.3);
  border-color: #5b84b0;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(180deg, #4c8fe8, #2e69c7);
  border-color: #86baff; color: #fff;
  box-shadow: 0 8px 20px rgba(76,143,232,.25);
}
.btn.primary:hover { box-shadow: 0 10px 24px rgba(76,143,232,.38); }
.btn.success {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  border-color: #4ade80; color: #fff;
}
.btn.danger {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  border-color: #f87171; color: #fff;
}
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 11px 20px; font-size: 15px; border-radius: 12px; }
.btn.ghost {
  background: transparent; border-color: transparent;
  color: var(--muted);
}
.btn.ghost:hover { background: rgba(116,185,255,.08); color: var(--text); }

/* ========== TAGS / BADGES ========== */
.badge {
  display: inline-block; padding: 4px 9px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(243,211,122,.22), rgba(243,211,122,.12));
  border: 1px solid rgba(243,211,122,.28);
  color: #f6deb1; font-size: 12px;
}
.tag {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  border: 1px solid;
}
.tag.blue { background: rgba(116,185,255,.12); border-color: rgba(116,185,255,.3); color: #a9d0ff; }
.tag.gold { background: rgba(243,211,122,.12); border-color: rgba(243,211,122,.3); color: #f3d37a; }
.tag.green { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: #4ade80; }
.tag.red { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #f87171; }

/* ========== TABLE ========== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border: 1px solid #32445d; padding: 9px 12px; vertical-align: top; }
.table th { background: #0f223f; font-size: 13px; color: var(--muted); font-weight: 600; }
.table tr:hover td { background: rgba(116,185,255,.04); }

/* ========== FORM ELEMENTS ========== */
.field { margin: 10px 0; }
.field label { display: block; font-size: 13px; color: #d7e6fb; margin-bottom: 6px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], textarea, select {
  padding: 9px 12px; border-radius: 10px;
  border: 1px solid #5f7ea6;
  background: rgba(21,34,54,.96);
  color: #f4f8ff; outline: none;
  font-family: inherit; font-size: 14px;
  transition: .18s border-color, .18s box-shadow, .18s background;
}
input[type="text"]:focus, input[type="password"]:focus,
input[type="email"]:focus, textarea:focus, select:focus {
  border-color: #9fcbff;
  background: rgba(26,41,64,.98);
  box-shadow: 0 0 0 3px rgba(96,165,250,.24);
}
input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="email"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
  color: #9fb3cd;
}
select { cursor: pointer; }

/* ========== OPTIONS (quiz) ========== */
.opt {
  display: block; padding: 10px 12px; border-radius: 12px;
  border: 1px solid #32445d; margin: 6px 0; cursor: pointer;
  transition: .18s border-color, .18s background;
  font-size: 14px;
}
.opt input { margin-right: 8px; }
.opt:hover { border-color: #4c6d97; background: rgba(59,130,246,.08); }
.ok  { border-color: var(--ok)!important; background: rgba(34,197,94,.13)!important; }
.bad { border-color: var(--bad)!important; background: rgba(239,68,68,.13)!important; }
.miss { outline: 2px dashed var(--warn); }

/* ========== META & TEXT ========== */
.meta { color: var(--muted); font-size: 12px; }
.kpi  { display: flex; justify-content: space-between; align-items: flex-end; }

/* ========== PROGRESS BAR ========== */
.progress {
  height: 8px; background: rgba(11,22,39,.8); border-radius: 999px;
  overflow: hidden; border: 1px solid #28415e;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #7ab8ff, #f3d37a);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ========== DIVIDER ========== */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line2), transparent);
  margin: 16px 0;
}

/* ========== RECENT ACTIVITY LIST ========== */
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid rgba(40,65,94,.5);
  font-size: 13px;
}
.recent-list li:last-child { border-bottom: none; }
.recent-list .ri-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); flex-shrink: 0; margin-top: 4px;
}
.recent-list .ri-title { color: var(--text); font-weight: 500; }
.recent-list .ri-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ========== LEARN SHELL ========== */
.learn-shell {
  background: linear-gradient(180deg, rgba(18,34,56,.97), rgba(14,25,43,.99));
  border-color: rgba(122,184,255,.22);
}
.learn-card {
  padding: 22px 20px;
  background:
    radial-gradient(420px 180px at 100% 0, rgba(243,211,122,.16), transparent 58%),
    radial-gradient(440px 220px at 0 100%, rgba(116,185,255,.12), transparent 62%),
    linear-gradient(180deg, #162946, #11213a);
  border-color: rgba(243,211,122,.24);
}
.learn-card-text {
  font-size: 24px; line-height: 1.75; font-weight: 700; letter-spacing: .2px;
  margin: 14px 0 18px; white-space: pre-wrap; color: #f7fbff;
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
}
.learn-card-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.study-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}
.study-list li {
  color: var(--text);
  line-height: 1.65;
}
.study-list li b {
  display: block;
  margin-bottom: 3px;
  color: #a9d0ff;
  font-size: 13px;
}
.study-list li span {
  color: #edf4ff;
}
.study-list-warn li span {
  color: #ffe39f;
}

/* ========== SOURCE / READING ========== */
.source-player {
  background: linear-gradient(180deg, #172945, #122237);
  border-color: rgba(243,211,122,.24);
}
.source-paragraph { font-size: 17px; }
.source-sentence {
  display: inline; padding: 2px 3px; border-radius: 6px;
  transition: background .18s, color .18s, box-shadow .18s;
}
.source-sentence.active {
  background: linear-gradient(180deg, rgba(246,196,83,.95), rgba(243,211,122,.82));
  color: #2e2412;
  box-shadow: 0 0 0 1px rgba(243,211,122,.28), 0 6px 20px rgba(243,211,122,.12);
}

/* ========== REVEAL ANIMATION ========== */
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.show { opacity: 1; transform: none; transition: .4s ease; }

.site-record-footer {
  padding: 18px 16px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.site-record-footer a {
  color: inherit;
  text-decoration: none;
}

.site-record-footer a:hover {
  text-decoration: underline;
}

/* ========== LOGIN ========== */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: min(460px, 96vw);
  background: linear-gradient(180deg, #162133, #101a2c);
  border: 1px solid #4f6c92; border-radius: 18px; padding: 28px 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.login-card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.err { margin: 8px 0 0; color: #fca5a5; font-size: 13px; }
.tip { margin-top: 10px; color: #93a3b8; font-size: 12px; }

/* ========== STEP INDICATOR ========== */
.steps { display: flex; gap: 0; margin: 16px 0; }
.step {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px; position: relative;
}
.step::after {
  content: ''; position: absolute;
  top: 14px; left: 50%; right: -50%;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), transparent);
}
.step:last-child::after { display: none; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #2e69c7, #4c8fe8);
  border: 2px solid rgba(116,185,255,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  position: relative; z-index: 1;
}
.step-label { font-size: 11px; color: var(--muted); text-align: center; }

/* ========== GLOW ACCENT ========== */
.glow-blue { box-shadow: 0 0 24px rgba(116,185,255,.2) !important; }
.glow-gold { box-shadow: 0 0 24px rgba(243,211,122,.2) !important; }

/* ========== RESPONSIVE ========== */
@media (max-width: 720px) {
  :root { --nav-h: 48px; }
  .wrap { padding: 14px; }
  .wrap.has-nav { padding-top: calc(var(--nav-h) + 44px); }
  .hero { padding: 16px; }
  .hero h1 { font-size: 20px; }
  .btn { padding: 7px 11px; font-size: 13px; }
  .btn.lg { padding: 9px 16px; font-size: 14px; }
  .learn-card-text { font-size: 19px; line-height: 1.65; }
  .source-paragraph { font-size: 16px; line-height: 1.85; }
  .topnav-links { display: none; }
  .topnav {
    height: auto;
    min-height: var(--nav-h);
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .topnav-right {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .topnav-system-switcher {
    position: static;
    transform: none;
    flex-direction: row;
    width: auto;
    max-width: 100%;
    flex: 1;
    order: -1;
    padding: 4px;
    border-radius: 999px;
    box-shadow: none;
  }
  .topnav-system-btn { text-align: center; }
  .stat-card .stat-value { font-size: 26px; }
}
