:root {
  --bg: #040815;
  --panel: rgba(9, 18, 39, 0.74);
  --panel-strong: rgba(13, 24, 52, 0.9);
  --stroke: rgba(145, 185, 255, 0.18);
  --stroke-strong: rgba(145, 185, 255, 0.32);
  --text: #f6f8ff;
  --muted: #a8b2d6;
  --soft: #6f7da8;
  --blue: #38bdf8;
  --violet: #8b5cf6;
  --orange: #fb923c;
  --green: #22c55e;
  --danger: #fb7185;
  --shadow: 0 25px 80px rgba(0, 0, 0, 0.42);
  --radius: 22px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(37, 99, 235, 0.24), transparent 36%),
    radial-gradient(circle at 95% 30%, rgba(168, 85, 247, 0.22), transparent 32%),
    radial-gradient(circle at 80% 85%, rgba(249, 115, 22, 0.20), transparent 30%),
    var(--bg);
  overflow-x: hidden;
}

body.light-theme {
  --bg: #edf3ff;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --stroke: rgba(33, 69, 123, 0.13);
  --stroke-strong: rgba(33, 69, 123, 0.22);
  --text: #06132c;
  --muted: #52627f;
  --soft: #697692;
  color-scheme: light;
}

button, input, textarea, select { font: inherit; }
button, a, select { touch-action: manipulation; }
button {
  border: 0;
  border-radius: 14px;
  padding: 12px 17px;
  color: white;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 14px 35px rgba(37, 99, 235, 0.22);
  cursor: pointer;
  transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 18px 45px rgba(37, 99, 235, 0.28); }
button:active { transform: translateY(0); }
button.ghost, .ghost-link {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  box-shadow: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 12px 17px;
}
button.danger { background: linear-gradient(135deg, #e11d48, #fb7185); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

input, textarea, select {
  width: 100%;
  color: var(--text);
  background: rgba(1, 8, 24, 0.45);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  outline: 0;
  padding: 12px 13px;
}
textarea { resize: vertical; line-height: 1.55; }
select { cursor: pointer; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
code, pre { font-family: var(--mono); }
pre { white-space: pre-wrap; word-break: break-word; }
a { color: #7dd3fc; }
.hidden { display: none !important; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; }

.aurora {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  filter: blur(70px);
  opacity: .30;
  pointer-events: none;
  z-index: -1;
}
.aurora-one { top: -150px; right: 8%; background: #2563eb; }
.aurora-two { bottom: -170px; right: 0; background: #fb923c; }

.app-shell {
  width: min(1380px, calc(100% - 34px));
  margin: 0 auto;
  padding: 34px 0 60px;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 28px;
}

.rail {
  position: sticky;
  top: 28px;
  height: calc(100vh - 56px);
  padding: 18px 14px;
  border-radius: 28px;
  background: rgba(4, 12, 30, 0.78);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  backdrop-filter: blur(22px);
}
.rail-logo, .rail-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid transparent;
  color: #b9c5f4;
  box-shadow: none;
  display: grid;
  place-items: center;
  font-weight: 900;
}
.rail-logo, .rail-btn.active, .rail-btn:hover {
  color: white;
  background: linear-gradient(135deg, rgba(56, 189, 248, .92), rgba(99, 102, 241, .92));
  border-color: rgba(255,255,255,.18);
}
.rail-theme { margin-top: auto; }

.main-wrap { display: grid; gap: 22px; }
.glass-card, .soft-card {
  border: 1px solid var(--stroke);
  background: linear-gradient(145deg, rgba(13, 23, 49, 0.82), rgba(6, 12, 28, 0.58));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}
body.light-theme .glass-card, body.light-theme .soft-card { background: rgba(255,255,255,.72); }
.soft-card { padding: 20px; box-shadow: none; background: rgba(255,255,255,.045); }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 22px;
}
.hero-card, .today-card, .course-card, .progress-card { padding: 28px; }
.hero-card {
  min-height: 260px;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 20px;
  align-items: end;
}
.mini-label {
  margin: 0 0 10px;
  color: #9edcff;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(34px, 5vw, 62px); line-height: .95; margin-bottom: 14px; }
h2 { font-size: clamp(21px, 2.4vw, 32px); margin-bottom: 10px; }
h3 { font-size: 18px; margin-bottom: 10px; }
.hero-card p, .today-card p { color: var(--muted); line-height: 1.6; }
.hero-actions, .editor-actions, .upload-row, .admin-top-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-graph {
  height: 130px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 20px;
}
.hero-graph span {
  flex: 1;
  min-width: 18px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, #38bdf8, #4f46e5);
  box-shadow: 0 0 30px rgba(56,189,248,.4);
  animation: barFloat 3s ease-in-out infinite;
}
.hero-graph span:nth-child(1) { height: 32%; }
.hero-graph span:nth-child(2) { height: 48%; animation-delay: .1s; }
.hero-graph span:nth-child(3) { height: 38%; animation-delay: .2s; }
.hero-graph span:nth-child(4) { height: 68%; animation-delay: .3s; }
.hero-graph span:nth-child(5) { height: 84%; animation-delay: .4s; }
.hero-graph span:nth-child(6) { height: 56%; animation-delay: .5s; }
@keyframes barFloat { 50% { transform: translateY(-12px); filter: brightness(1.25); } }

.today-card { min-height: 260px; }
.metric-row {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 7px 10px;
  align-items: baseline;
  margin-top: 26px;
}
.metric-row strong { font-size: 34px; }
.metric-row span { color: var(--muted); }
.course-card { grid-column: span 1; }
.progress-card { grid-column: span 1; }
.section-head, .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.mobile-menu { display: none; }
.course-list { display: grid; gap: 12px; }
.course-item {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 15px;
  color: var(--text);
  background: rgba(255,255,255,.045);
  border: 1px solid var(--stroke);
  box-shadow: none;
}
.course-item.active, .course-item:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent, #38bdf8) 28%, transparent), rgba(255,255,255,.07));
  border-color: color-mix(in srgb, var(--accent, #38bdf8) 65%, transparent);
}
.course-icon {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: color-mix(in srgb, var(--accent, #38bdf8) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #38bdf8) 38%, transparent);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
}
.course-main { display: grid; gap: 6px; }
.course-main small { color: var(--muted); }
.course-arrow { color: var(--muted); }
.progress-line {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
  margin: 18px 0 22px;
}
.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  width: 0;
  background: linear-gradient(90deg, #38bdf8, #8b5cf6, #fb923c);
}
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick-stats div { padding: 14px; border-radius: 16px; background: rgba(255,255,255,.045); border: 1px solid var(--stroke); }
.quick-stats strong { display: block; font-size: 18px; }
.quick-stats span { color: var(--muted); font-size: 12px; }

.reader-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: start; }
.lesson-map { position: sticky; top: 28px; padding: 22px; }
.lesson-map nav { display: grid; gap: 10px; margin: 16px 0; }
.lesson-map a {
  color: var(--muted);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid transparent;
}
.lesson-map a:hover { color: var(--text); border-color: var(--stroke); }
.lesson-pane { padding: 30px; min-height: 360px; }
.lesson-title-card {
  border-radius: 22px;
  padding: 26px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(56,189,248,.13), rgba(139,92,246,.10));
  border: 1px solid var(--stroke);
}
.lesson-title-card p { color: var(--muted); line-height: 1.65; }
.lesson-block {
  padding: 24px;
  border-radius: 22px;
  background: rgba(255,255,255,.042);
  border: 1px solid var(--stroke);
  margin: 16px 0;
}
.lesson-block h2 { margin-bottom: 8px; }
.lesson-block .block-description { color: #b9c5f4; line-height: 1.6; }
.lesson-body { color: #dbe5ff; line-height: 1.78; }
body.light-theme .lesson-body { color: #1b2a44; }
.lesson-body h2, .lesson-body h3, .lesson-body h4 { color: var(--text); margin-top: 26px; }
.lesson-body p { margin-bottom: 14px; }
.lesson-body ul { padding-left: 22px; }
.lesson-body li { margin-bottom: 8px; }
.lesson-body hr { border: 0; border-top: 1px solid var(--stroke); margin: 28px 0; }
.standalone-line { color: #d8e3ff; font-weight: 650; }

.code-card {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(125, 211, 252, .24);
  background: rgba(2, 8, 23, .72);
  margin: 16px 0;
}
.code-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(125, 211, 252, .14);
  color: #bae6fd;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}
.code-card pre { margin: 0; padding: 18px; color: #dbeafe; overflow: auto; }
.tiny-btn {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: none;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
}
.block-preview { margin-top: 14px; }
.block-preview iframe {
  width: 100%;
  height: 220px;
  border: 0;
  border-radius: 16px;
  background: white;
}
.lesson-media { max-width: 100%; border-radius: 18px; border: 1px solid var(--stroke); margin-top: 14px; }
video.lesson-media { width: 100%; }
.pdf-link, .media-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  text-decoration: none;
  margin-top: 12px;
}
.empty { padding: 26px; color: var(--muted); text-align: center; }

.practice-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr); gap: 22px; }
.editor-panel, .preview-panel { padding: 24px; }
.compact-select { min-width: 200px; }
#codeEditor {
  min-height: 430px;
  font-family: var(--mono);
  line-height: 1.55;
  tab-size: 2;
  background: rgba(2, 6, 23, .76);
  color: #e0f2fe;
  border-color: rgba(125,211,252,.18);
}

.editor-shell {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(125,211,252,.22);
  background:
    linear-gradient(180deg, rgba(15,23,42,.94), rgba(2,6,23,.96)),
    radial-gradient(circle at 20% 0%, rgba(56,189,248,.12), transparent 32%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 18px 60px rgba(0,0,0,.24);
}
.editor-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 13px;
  border-bottom: 1px solid rgba(125,211,252,.13);
  background: rgba(255,255,255,.035);
}
.window-dots { display: flex; gap: 7px; align-items: center; }
.window-dots span {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #fb7185;
  box-shadow: 0 0 14px rgba(251,113,133,.34);
}
.window-dots span:nth-child(2) { background: #fbbf24; box-shadow: 0 0 14px rgba(251,191,36,.25); }
.window-dots span:nth-child(3) { background: #34d399; box-shadow: 0 0 14px rgba(52,211,153,.25); }
.editor-file-tab {
  color: #dbeafe;
  background: rgba(15,23,42,.72);
  border: 1px solid rgba(125,211,252,.15);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}
.editor-meta {
  margin-left: auto;
  color: #93a4c7;
  font-family: var(--mono);
  font-size: 12px;
}
.code-editor-wrap {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 430px;
  position: relative;
}
.line-numbers {
  padding: 18px 10px 18px 0;
  color: #526179;
  font: 13px/1.65 var(--mono);
  text-align: right;
  user-select: none;
  overflow: hidden;
  background: rgba(2,6,23,.44);
  border-right: 1px solid rgba(125,211,252,.10);
}
.line-numbers span { display: block; height: 1.65em; }
.code-editor-wrap #codeEditor {
  min-height: 430px;
  height: 430px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #e5f3ff;
  caret-color: #7dd3fc;
  padding: 18px 18px 18px 16px;
  font: 14px/1.65 var(--mono);
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  box-shadow: none;
}
.code-editor-wrap #codeEditor:focus { outline: none; }
.editor-shell:focus-within {
  border-color: rgba(125,211,252,.42);
  box-shadow: 0 0 0 3px rgba(56,189,248,.10), inset 0 1px 0 rgba(255,255,255,.08), 0 20px 70px rgba(0,0,0,.28);
}
.editor-help {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 12px;
}
body.light-theme .editor-shell { background: #0f172a; }
body.light-theme .code-editor-wrap #codeEditor { color: #e5f3ff; }
#previewFrame {
  width: 100%;
  height: 430px;
  border: 0;
  border-radius: 18px;
  background: white;
}
#runStatus {
  color: #bbf7d0;
  background: rgba(34, 197, 94, .10);
  border: 1px solid rgba(34, 197, 94, .24);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}
.preview-note { color: var(--muted); font-size: 13px; line-height: 1.55; margin-top: 12px; }

.ad-slot { margin: 0; }
.ad-slot.hidden { display: none !important; }
.ad-shell {
  position: relative;
  padding: 18px;
  border-radius: 20px;
  border: 1px dashed rgba(125,211,252,.26);
  background: rgba(255,255,255,.04);
  overflow: hidden;
}
.ad-label {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.06);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ad-html { min-height: inherit; }
.ad-side { margin-top: 18px; }
.ad-top { grid-column: 1 / -1; }

.admin-page-body { padding: 34px 0 60px; }
.admin-shell { width: min(1260px, calc(100% - 34px)); margin: 0 auto; display: grid; gap: 18px; }
.admin-login { max-width: 520px; margin: 7vh auto 0; padding: 30px; display: grid; gap: 16px; }
.admin-panel { display: grid; gap: 18px; }
.admin-top { padding: 22px 24px; display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.admin-top h1, .admin-login h1 { margin-bottom: 0; }
.admin-tabs { padding: 10px; display: flex; gap: 10px; flex-wrap: wrap; position: sticky; top: 12px; z-index: 5; }
.admin-tab { background: rgba(255,255,255,.06); box-shadow: none; border: 1px solid transparent; }
.admin-tab.active { background: linear-gradient(135deg, #2563eb, #7c3aed); border-color: rgba(255,255,255,.16); }
.admin-section { display: none; padding: 24px; }
.admin-section.active { display: block; }
.admin-two-col { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(360px, 1.1fr); gap: 22px; align-items: start; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.admin-section label, .admin-login label { margin-bottom: 14px; }
.checkbox-row { display: flex; flex-direction: row; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--stroke); border-radius: 14px; background: rgba(255,255,255,.035); }
.checkbox-row input { width: auto; }
.admin-list { display: grid; gap: 12px; }
.admin-item {
  padding: 15px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.045);
  display: grid;
  gap: 10px;
}
.admin-item h3 { margin: 0; }
.admin-item p { color: var(--muted); margin: 0; line-height: 1.5; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.item-actions button { padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.block-editor-grid { display: grid; grid-template-columns: minmax(340px, .9fr) minmax(420px, 1.1fr); gap: 18px; margin: 18px 0; }
.block-list { display: grid; gap: 12px; max-height: 760px; overflow: auto; padding-right: 4px; }
.block-list-item { padding: 15px; border-radius: 16px; border: 1px solid var(--stroke); background: rgba(255,255,255,.045); }
.block-list-item strong { display: block; margin-bottom: 6px; }
.block-list-item small { color: var(--muted); line-height: 1.5; }
.compact-head { margin-bottom: 12px; }
.sticky-actions { position: sticky; bottom: 16px; z-index: 4; padding: 12px; border-radius: 18px; background: rgba(5, 12, 28, .75); border: 1px solid var(--stroke); backdrop-filter: blur(18px); }

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 1fr; padding-top: 18px; }
  .rail {
    position: sticky;
    top: 10px;
    z-index: 10;
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: center;
    border-radius: 22px;
  }
  .rail-theme { margin-top: 0; margin-left: auto; }
  .dashboard, .reader-layout, .practice-section, .admin-two-col, .block-editor-grid { grid-template-columns: 1fr; }
  .lesson-map { position: static; }
  .hero-card { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell, .admin-shell { width: min(100% - 20px, 560px); }
  .rail { gap: 8px; padding: 10px; overflow-x: auto; justify-content: flex-start; }
  .rail-logo, .rail-btn { width: 42px; height: 42px; min-width: 42px; }
  .dashboard { gap: 14px; }
  .hero-card, .today-card, .course-card, .progress-card, .lesson-pane, .editor-panel, .preview-panel, .admin-section, .admin-login { padding: 18px; }
  .hero-card { min-height: auto; }
  .hero-graph { display: none; }
  .mobile-menu { display: inline-flex; }
  .course-list:not(.mobile-open) { max-height: 190px; overflow: hidden; }
  .course-item { grid-template-columns: 48px 1fr; }
  .course-arrow { display: none; }
  .quick-stats, .metric-row, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .section-head, .panel-head, .admin-top { flex-direction: column; align-items: stretch; }
  #previewFrame { min-height: 320px; height: 320px; }
  .code-editor-wrap, .code-editor-wrap #codeEditor { min-height: 320px; height: 320px; }
  .code-editor-wrap { grid-template-columns: 44px minmax(0, 1fr); }
  .line-numbers { font-size: 12px; padding-right: 8px; }
  .block-preview iframe { height: 180px; }
}

/* v4 flexibility polish */
:root {
  --accent-one: #38bdf8;
  --accent-two: #8b5cf6;
  --accent-three: #fb923c;
  --card-radius: 22px;
}
button { background: linear-gradient(135deg, var(--accent-one), var(--accent-two)); }
button.danger { background: linear-gradient(135deg, #e11d48, #fb7185); }
.rail-logo, .rail-btn.active, .rail-btn:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--accent-one) 92%, #fff 0%), color-mix(in srgb, var(--accent-two) 92%, #fff 0%)); }
.glass-card, .soft-card { border-radius: var(--card-radius); }
.progress-line span, .hero-graph span { background: linear-gradient(180deg, var(--accent-one), var(--accent-two)); }
.progress-line span { background: linear-gradient(90deg, var(--accent-one), var(--accent-two), var(--accent-three)); }
.rail-logo img { width: 72%; height: 72%; object-fit: contain; border-radius: 12px; display: block; }
.rail-logo span { display: grid; place-items: center; width: 100%; height: 100%; }
.inner-card { margin: 18px 0; }
.small-text { font-size: 13px; }
.code-textarea { font-family: var(--mono); font-size: 13px; line-height: 1.55; background: rgba(2,6,23,.76); color: #dbeafe; }
.block-badge { margin-bottom: 8px; }
.block-layout-compact { padding: 16px; }
.block-layout-wide { margin-left: -8px; margin-right: -8px; }
.block-layout-highlight,
.block-type-note,
.block-type-task,
.block-type-quiz {
  background: linear-gradient(135deg, rgba(56,189,248,.10), rgba(139,92,246,.08));
  border-color: rgba(125,211,252,.24);
}
.block-type-task { border-left: 4px solid var(--accent-three); }
.block-type-quiz { border-left: 4px solid var(--accent-two); }
.block-type-note { border-left: 4px solid var(--accent-one); }
.block-divider { border: 0; border-top: 1px solid var(--stroke); margin: 12px 0; }
.empty-block { min-height: 74px; opacity: .75; }
details summary { cursor: pointer; font-weight: 800; margin-bottom: 14px; }
.embed-block { margin-top: 14px; overflow: auto; }
.embed-block iframe { max-width: 100%; border: 0; border-radius: 16px; }
.lesson-title-card h3 { color: var(--muted); font-weight: 650; }
.admin-tabs { max-height: 72vh; overflow: auto; }
.admin-top-actions .ghost-link { min-height: 45px; }
#rawJsonEditor { min-height: 520px; }
@media (max-width: 720px) {
  .admin-tabs { position: static; }
  #rawJsonEditor { min-height: 360px; }
}

/* v5 lazy loading, footer, account, storage polish */
.track-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.track-chip {
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255,255,255,.055);
  color: var(--muted);
  border: 1px solid var(--stroke);
  box-shadow: none;
}
.track-chip.active, .track-chip:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-one), var(--accent-two));
}
.site-footer {
  padding: 26px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}
.site-footer p { color: var(--muted); line-height: 1.65; }
.social-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.social-links a {
  text-decoration: none;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  border-radius: 999px;
  padding: 10px 13px;
  color: var(--text);
}
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, .72);
  backdrop-filter: blur(16px);
}
.auth-card {
  width: min(480px, 100%);
  padding: 26px;
  position: relative;
  display: grid;
  gap: 12px;
}
.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  box-shadow: none;
}
.storage-stats { margin: 16px 0; }
.admin-quick { margin-bottom: 14px; }
.admin-quick div { min-height: 86px; }
.admin-tabs { max-height: 44vh; overflow: auto; }
#adminPanel.hidden { display: none !important; }
#adminPanel:not(.hidden) { display: grid; }
.admin-page-body #adminLogin.hidden { display: none !important; }
.admin-page-body #adminLogin:not(.hidden) { display: grid; }
@media (max-width: 720px) {
  .site-footer { flex-direction: column; }
  .social-links { justify-content: flex-start; }
  .track-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .track-chip { white-space: nowrap; min-width: max-content; }
}

/* v6 stable rail navigation */
#dashboard, #readerSection, #practiceSection { scroll-margin-top: 26px; }
.rail-btn.active { outline: 2px solid rgba(255,255,255,.24); }
@media (max-width: 1040px) {
  #dashboard, #readerSection, #practiceSection { scroll-margin-top: 98px; }
}

/* v8 practice, lesson search and ID management polish */
.lesson-search-wrap {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 8px;
  align-items: end;
  width: min(360px, 100%);
}
.lesson-search-wrap input { min-height: 43px; }
.lesson-search-wrap button { min-height: 43px; padding: 8px 14px; }
.progress-card .section-head { align-items: end; }
.progress-card .section-head select { width: min(360px, 100%); }
.editor-panel, .preview-panel { min-width: 0; }
.editor-shell { isolation: isolate; }
.code-editor-wrap { max-width: 100%; }
.code-editor-wrap #codeEditor {
  width: 100%;
  max-width: 100%;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.line-numbers span { line-height: 1.65; }
.preview-panel { display: flex; flex-direction: column; }
#previewFrame {
  flex: 1;
  width: 100%;
  min-height: 430px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 18px;
}
.admin-small-search { max-width: 230px; min-height: 42px; }
.user-list-head { margin-top: 22px; }
#adminUserList, #frontUserList { margin-bottom: 18px; }
#changePasswordMessage { min-height: 20px; }
@media (max-width: 720px) {
  .lesson-search-wrap, .progress-card .section-head select { width: 100%; }
  .lesson-search-wrap { grid-template-columns: 1fr; }
  .admin-small-search { max-width: 100%; width: 100%; }
}

/* v9 purchase access, claim links and safer refresh polish */
.course-item { cursor: pointer; }
.course-item.locked { opacity: .94; }
.course-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.course-buy-btn { padding: 8px 11px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.course-access { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; border: 1px solid var(--stroke); background: rgba(255,255,255,.055); }
.course-access.active { color: #86efac; border-color: rgba(34,197,94,.28); }
.course-access.locked { color: #fed7aa; border-color: rgba(251,146,60,.30); }
.purchase-card { display: grid; gap: 14px; }
.purchase-card h1 { font-size: clamp(30px, 4vw, 52px); }
.purchase-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.purchase-meta span { padding: 9px 12px; border-radius: 999px; border: 1px solid var(--stroke); background: rgba(255,255,255,.06); color: var(--text); font-weight: 800; }
.claim-modal { position: fixed; inset: 0; z-index: 998; display: grid; place-items: center; padding: 18px; background: rgba(2,6,23,.72); backdrop-filter: blur(16px); }
.claim-url-text { word-break: break-all; font-family: var(--mono); font-size: 12px; }
#accountBtn { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .course-actions { justify-content: flex-start; grid-column: 1 / -1; }
  .course-buy-btn { width: auto; }
}


/* v10 launch polish: softer course rows, ad popup and purchase-safe ads */
.course-item { border-radius: 22px; overflow: hidden; min-height: 72px; }
.course-icon { border-radius: 20px; box-shadow: inset 0 1px 0 rgba(255,255,255,.14); }
.course-item.active { box-shadow: 0 14px 34px rgba(56,189,248,.10), inset 0 1px 0 rgba(255,255,255,.08); }
.ad-login-modal { position: fixed; inset: 0; z-index: 997; display: grid; place-items: center; padding: 18px; background: rgba(2,6,23,.58); backdrop-filter: blur(14px); }
.ad-popup-card { border-color: rgba(125,211,252,.25); }
.ad-popup-card h2 { font-size: clamp(26px, 4vw, 42px); }
#adPopupText { line-height: 1.7; }
#adLoginModal.hidden { display: none !important; }
.admin-login { min-height: 320px; }
.admin-login h1 { margin-bottom: 12px; }
#adAudience, #adPopupTitleInput, #adPopupTextInput { width: 100%; }
@media (max-width: 720px) { .course-item { grid-template-columns: 52px 1fr; border-radius: 20px; } .course-icon { width: 50px; height: 50px; border-radius: 18px; } }

/* v11: robust practice language picker in admin */
.practice-pick-wrap {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}
.no-margin { margin: 0; }
.quick-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-pill-row button {
  width: auto;
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .62);
  border: 1px solid rgba(148, 163, 184, .22);
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
}
.quick-pill-row button.active,
.quick-pill-row button:hover {
  color: #fff;
  border-color: rgba(56, 189, 248, .55);
  background: linear-gradient(135deg, rgba(56, 189, 248, .22), rgba(99, 102, 241, .22));
}
select option {
  background: #0b1224;
  color: #f8fafc;
}

/* v12: hard-fixed admin practice mode picker */
.practice-picker-btn {
  width: 100%;
  margin-top: 8px;
  justify-content: space-between;
  text-align: left;
  background: rgba(1, 8, 24, 0.58);
  border: 1px solid rgba(125, 211, 252, .28);
  box-shadow: none;
  color: var(--text);
}
.practice-picker-btn::after {
  content: "Select";
  font-size: 12px;
  color: #93c5fd;
  margin-left: auto;
}
.practice-picker-menu {
  margin-top: 8px;
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(125, 211, 252, .22);
  border-radius: 18px;
  background: rgba(3, 10, 26, .96);
  box-shadow: 0 24px 60px rgba(0,0,0,.36);
  z-index: 30;
}
.practice-picker-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(148, 163, 184, .18);
  color: var(--text);
  box-shadow: none;
}
.practice-picker-menu button small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}
.practice-picker-menu button.active,
.practice-picker-menu button:hover {
  border-color: rgba(56, 189, 248, .55);
  background: linear-gradient(135deg, rgba(56, 189, 248, .18), rgba(124, 58, 237, .18));
}
#blockPracticeMode {
  min-height: 48px;
  background-image: linear-gradient(45deg, transparent 50%, #dbeafe 50%), linear-gradient(135deg, #dbeafe 50%, transparent 50%);
  background-position: calc(100% - 20px) 20px, calc(100% - 14px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* v14: selected lesson card spacing fix */
.progress-card {
  min-width: 0;
}
.progress-card .section-head {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 16px;
}
.progress-card .section-head > div:first-child {
  min-width: 0;
}
.progress-card .section-head #courseTitle {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  line-height: 1.08;
}
.progress-card .lesson-search-wrap {
  width: 100%;
  max-width: none;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}
.progress-card .lesson-search-wrap input,
.progress-card .lesson-search-wrap button,
.progress-card .section-head select {
  min-height: 50px;
}
.progress-card .section-head select {
  width: 100%;
  max-width: none;
  padding-right: 42px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-card .quick-stats {
  margin-top: 2px;
}
@media (min-width: 1180px) {
  .progress-card .lesson-search-wrap {
    grid-template-columns: minmax(0, 1fr) 64px;
  }
}
@media (max-width: 720px) {
  .progress-card .lesson-search-wrap {
    grid-template-columns: 1fr;
  }
}

/* v15: course row padding and card height polish */
.course-card {
  align-self: start;
}
.course-list {
  align-content: start;
}
.course-item {
  box-sizing: border-box;
  padding: 14px 18px;
  grid-template-columns: 58px minmax(0, 1fr) max-content;
  gap: 18px;
}
.course-main {
  min-width: 0;
}
.course-main strong,
.course-main small {
  overflow-wrap: anywhere;
}
.course-actions {
  min-width: max-content;
  padding-left: 12px;
}
.course-arrow {
  padding-right: 2px;
  white-space: nowrap;
}
.course-icon {
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .course-item {
    padding: 12px 14px;
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 12px;
  }
  .course-actions {
    min-width: 0;
    padding-left: 0;
  }
}

/* v17 clean account flow */
.auth-card-v17 {
  width: min(540px, 100%);
  gap: 14px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: rgba(255,255,255,.045);
}
.auth-tabs button {
  min-height: 48px;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border: 1px solid transparent;
}
.auth-tabs button.active {
  color: #fff;
  border-color: rgba(102, 217, 255, .36);
  background: linear-gradient(135deg, rgba(65, 177, 255, .9), rgba(126, 87, 255, .92));
}
.auth-fields {
  display: grid;
  gap: 12px;
}
.auth-actions-v17 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.auth-actions-v17 #authSubmitBtn {
  min-width: 150px;
}
.auth-link-btn {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
  padding-inline: 4px;
}
.auth-link-btn:hover {
  color: #fff;
  background: transparent;
}
.auth-switch-wide {
  width: 100%;
  min-height: 54px;
  border-radius: 18px;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--stroke);
  box-shadow: none;
  color: var(--text);
}
.auth-switch-wide:hover {
  border-color: rgba(102, 217, 255, .42);
  background: rgba(102, 217, 255, .10);
}
#resendCodeBtn:not(.hidden) {
  display: inline-flex;
}
@media (max-width: 560px) {
  .auth-card-v17 { padding: 22px; }
  .auth-actions-v17 { display: grid; grid-template-columns: 1fr; }
  .auth-actions-v17 #authSubmitBtn,
  .auth-actions-v17 button { width: 100%; }
}
.success-text { color: #86efac !important; }
.danger-text { color: #fca5a5 !important; }

.advanced-email-card summary {
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 4px 0 14px;
}
.advanced-email-card[open] summary {
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.muted-item {
  opacity: 0.68;
}

/* v24 simple Gmail OTP setup guide */
.setup-guide-card {
  border-style: solid;
}
.guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.guide-steps span {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, .52);
  border: 1px solid rgba(148, 163, 184, .14);
  color: rgba(226, 232, 240, .92);
  font-size: 13px;
  line-height: 1.35;
}
#emailTestTo {
  border-color: rgba(56, 189, 248, .25);
}

.soft-warning {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 16px;
  background: rgba(251, 191, 36, 0.08);
  color: #fde68a;
  line-height: 1.55;
}
.soft-warning strong { color: #fbbf24; }

/* =========================================================
   Cyber Security Lab v1 — purpose-built visual system
   ========================================================= */
:root {
  --bg: #02070b;
  --panel: rgba(5, 17, 24, .88);
  --panel-strong: rgba(7, 23, 31, .96);
  --stroke: rgba(99, 245, 181, .16);
  --stroke-strong: rgba(72, 215, 255, .34);
  --text: #eafff7;
  --muted: #91aeb0;
  --soft: #67858a;
  --blue: #48d7ff;
  --violet: #5d8dff;
  --orange: #ffd166;
  --green: #63f5b5;
  --danger: #ff6b7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, .48);
  --radius: var(--card-radius, 18px);
}

body {
  background:
    linear-gradient(rgba(99,245,181,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,245,181,.028) 1px, transparent 1px),
    radial-gradient(circle at 12% 0%, rgba(20, 139, 111, .22), transparent 31%),
    radial-gradient(circle at 91% 18%, rgba(30, 118, 160, .18), transparent 28%),
    radial-gradient(circle at 75% 92%, rgba(255, 209, 102, .08), transparent 25%),
    #02070b;
  background-size: 42px 42px, 42px 42px, auto, auto, auto, auto;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255,255,255,.018), transparent 18%, transparent 82%, rgba(99,245,181,.028));
}
body.light-theme {
  --bg: #edf8f4;
  --panel: rgba(255,255,255,.88);
  --panel-strong: rgba(255,255,255,.96);
  --stroke: rgba(5, 82, 68, .14);
  --stroke-strong: rgba(10, 126, 109, .3);
  --text: #09211d;
  --muted: #52716c;
  --soft: #6d8782;
  background:
    linear-gradient(rgba(12,106,84,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12,106,84,.035) 1px, transparent 1px),
    radial-gradient(circle at 10% 0%, rgba(72,215,255,.16), transparent 35%),
    #edf8f4;
  background-size: 42px 42px, 42px 42px, auto, auto;
}

.aurora { opacity: .2; filter: blur(95px); }
.aurora-one { background: #19c889; }
.aurora-two { background: #1aa6d8; }

button {
  color: #03140f;
  background: linear-gradient(135deg, var(--accent-one, #63f5b5), var(--accent-two, #48d7ff));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 12px 34px rgba(35, 213, 162, .14);
  font-weight: 800;
}
button:hover { box-shadow: 0 16px 40px rgba(35, 213, 162, .22); }
button.ghost, .ghost-link {
  color: var(--text);
  background: rgba(99,245,181,.045);
  border-color: rgba(99,245,181,.16);
}
button.ghost:hover, .ghost-link:hover { background: rgba(99,245,181,.09); border-color: rgba(99,245,181,.34); }
button.danger { color: white; background: linear-gradient(135deg, #d92f56, #ff6b7a); }

input, textarea, select {
  background: rgba(1, 9, 13, .76);
  border-color: rgba(118, 184, 177, .18);
  border-radius: 10px;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(72,215,255,.7);
  box-shadow: 0 0 0 3px rgba(72,215,255,.09);
}
body.light-theme input, body.light-theme textarea, body.light-theme select { background: rgba(250,255,253,.96); }

.glass-card, .soft-card {
  background: linear-gradient(150deg, rgba(8, 25, 33, .93), rgba(3, 12, 17, .84));
  border-color: rgba(105, 202, 183, .14);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.025);
}
body.light-theme .glass-card, body.light-theme .soft-card { background: rgba(255,255,255,.84); }

.rail {
  background: linear-gradient(180deg, rgba(4,17,23,.98), rgba(3,10,14,.94));
  border-color: rgba(99,245,181,.18);
  border-radius: 18px;
}
.rail-logo, .rail-btn { border-radius: 12px; color: #84aaa6; }
.rail-logo {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -.05em;
  color: #03140f;
  background: linear-gradient(135deg, #63f5b5, #48d7ff);
}
.rail-btn.active, .rail-btn:hover {
  color: #bffff0;
  background: rgba(99,245,181,.11);
  border-color: rgba(99,245,181,.24);
  box-shadow: inset 3px 0 0 #63f5b5;
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 288px;
  background:
    linear-gradient(120deg, rgba(8,30,37,.97), rgba(3,14,20,.92)),
    radial-gradient(circle at 80% 30%, rgba(72,215,255,.15), transparent 30%);
}
.hero-card::before {
  content: "AUTHORIZED TRAINING ENVIRONMENT";
  position: absolute;
  top: 17px;
  right: 20px;
  color: rgba(99,245,181,.18);
  font: 700 10px/1 var(--mono);
  letter-spacing: .16em;
}
.hero-card h1 { max-width: 760px; font-size: clamp(34px, 5vw, 68px); line-height: .98; letter-spacing: -.045em; }
.hero-card #siteTagline { max-width: 760px; font-size: 16px; color: #a9c9c5; }
.mini-label {
  color: var(--accent-one, #63f5b5);
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: .14em;
}
.cyber-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}
.cyber-status-strip span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(99,245,181,.13);
  border-radius: 999px;
  background: rgba(99,245,181,.035);
  color: #91b6b0;
  font: 700 11px/1 var(--mono);
}
.cyber-status-strip i { width: 6px; height: 6px; border-radius: 50%; background: #63f5b5; box-shadow: 0 0 10px #63f5b5; }

.cyber-radar {
  position: relative;
  width: min(230px, 100%);
  aspect-ratio: 1;
  justify-self: end;
  border: 1px solid rgba(72,215,255,.2);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 24%, rgba(72,215,255,.15) 25% 25.7%, transparent 26% 49%, rgba(72,215,255,.12) 50% 50.7%, transparent 51% 74%, rgba(72,215,255,.1) 75% 75.7%, transparent 76%),
    linear-gradient(rgba(72,215,255,.12), rgba(72,215,255,.12)) center/1px 100% no-repeat,
    linear-gradient(90deg, rgba(72,215,255,.12), rgba(72,215,255,.12)) center/100% 1px no-repeat,
    rgba(4,20,26,.72);
  overflow: hidden;
}
.cyber-radar::before {
  content: "";
  position: absolute;
  inset: 50% 0 0 50%;
  transform-origin: 0 0;
  background: conic-gradient(from 270deg, rgba(99,245,181,.38), transparent 34deg);
  animation: radarSweep 4.8s linear infinite;
}
.cyber-radar::after {
  content: "";
  position: absolute;
  width: 7px; height: 7px; border-radius: 50%;
  top: 31%; left: 63%;
  background: #ffd166;
  box-shadow: -67px 65px 0 #63f5b5, 45px 84px 0 #48d7ff, 0 0 14px #ffd166;
}
.cyber-radar > span { display: none; }
@keyframes radarSweep { to { transform: rotate(360deg); } }

.today-card { border-top: 2px solid rgba(99,245,181,.35); }
.metric-row strong { color: #63f5b5; font-family: var(--mono); }
.track-chip {
  background: rgba(99,245,181,.035);
  color: #a9c8c4;
  border-color: rgba(99,245,181,.12);
}
.track-chip.active, .track-chip:hover { color: #02110d; background: #63f5b5; border-color: #63f5b5; }

.course-item {
  background: linear-gradient(100deg, rgba(7,22,29,.94), rgba(3,13,18,.88));
  border-color: rgba(107, 190, 175, .12);
  border-radius: 14px;
}
.course-item::before { content: ""; width: 3px; align-self: stretch; background: var(--accent); border-radius: 99px; box-shadow: 0 0 14px var(--accent); }
.course-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 18px 38px rgba(0,0,0,.2); }
.course-icon { background: rgba(99,245,181,.06); border: 1px solid rgba(99,245,181,.12); border-radius: 12px; }
.course-arrow { color: #63f5b5; font-family: var(--mono); }
.progress-line { background: rgba(99,245,181,.07); }
.progress-line span { background: linear-gradient(90deg, #63f5b5, #48d7ff); box-shadow: 0 0 18px rgba(99,245,181,.45); }

.lesson-map { border-top: 2px solid rgba(72,215,255,.28); }
.lesson-map nav a { border-left: 2px solid rgba(72,215,255,.15); border-radius: 0 9px 9px 0; }
.lesson-map nav a:hover { border-left-color: #48d7ff; background: rgba(72,215,255,.07); color: #d5f8ff; }
.lesson-title-card { background: linear-gradient(130deg, rgba(13,40,45,.9), rgba(5,18,25,.92)); border-color: rgba(99,245,181,.18); }
.lesson-block { border-color: rgba(119,181,173,.13); background: rgba(4,16,22,.7); }
.lesson-block.layout-highlight, .range-task, .mission-brief { border-color: rgba(99,245,181,.26); background: linear-gradient(135deg, rgba(23,71,59,.25), rgba(5,20,25,.85)); }
.lesson-body code { color: #88f6cf; background: rgba(99,245,181,.08); border: 1px solid rgba(99,245,181,.12); }
.lesson-body strong { color: #c9fff0; }
.lesson-body li::marker { color: #63f5b5; }

.editor-shell { border-color: rgba(72,215,255,.22); background: #02090d; }
.editor-toolbar { background: #07141b; border-color: rgba(72,215,255,.12); }
.editor-file-tab { color: #63f5b5; font-family: var(--mono); }
.code-editor-wrap, #codeEditor { background: #02090d; }
#lineNumbers, .line-numbers { color: #365d62; background: #041016; border-color: rgba(72,215,255,.1); }
#codeEditor { color: #c9fff0; caret-color: #63f5b5; font-family: var(--mono); }
.preview-panel { border-top: 2px solid rgba(72,215,255,.3); }
#previewFrame { background: white; border-color: rgba(72,215,255,.16); border-radius: 12px; }
#runStatus { color: #63f5b5; background: rgba(99,245,181,.07); border-color: rgba(99,245,181,.16); font-family: var(--mono); }

.auth-card, .admin-login { border-top: 2px solid #63f5b5; }
.admin-top { border-left: 3px solid #63f5b5; }
.admin-tabs { background: rgba(3,13,18,.94); }
.admin-tab.active { color: #02110d; background: #63f5b5; }
.admin-section h2, .admin-section h3 { letter-spacing: -.025em; }
.admin-list > *, .block-item { border-color: rgba(99,245,181,.12); background: rgba(4,17,22,.7); }
.storage-stats > div { border-color: rgba(72,215,255,.15); background: rgba(72,215,255,.04); }

@media (max-width: 920px) {
  .cyber-radar { width: 180px; }
  .hero-card h1 { font-size: clamp(34px, 8vw, 58px); }
}
@media (max-width: 720px) {
  .hero-card { min-height: auto; }
  .cyber-radar { width: 150px; justify-self: start; }
  .cyber-status-strip span { width: 100%; justify-content: flex-start; }
  .course-item::before { display: none; }
  .course-item { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .cyber-radar::before { animation: none; }
}

/* =========================================================
   Cyber Security Lab v2 — high-contrast UI rework
   This final layer intentionally overrides older visual rules.
   ========================================================= */
:root {
  --bg: #020609;
  --panel: #071319;
  --panel-strong: #0a1b22;
  --panel-raised: #0d222a;
  --surface: #0b1c23;
  --surface-hover: #102a32;
  --stroke: rgba(145, 231, 211, .24);
  --stroke-strong: rgba(111, 229, 255, .56);
  --text: #f4fffc;
  --muted: #bfd4cf;
  --soft: #91aaa5;
  --link: #8ee8ff;
  --focus: #69e6ff;
  --success-text: #9dffd8;
  --warning-text: #ffe39a;
  --danger-text: #ffc0c8;
  --shadow: 0 22px 60px rgba(0, 0, 0, .52);
}

html { color-scheme: dark; }
body {
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.light-theme {
  --bg: #eef8f5;
  --panel: #ffffff;
  --panel-strong: #f8fffc;
  --panel-raised: #edf8f4;
  --surface: #f5fbf9;
  --surface-hover: #e9f6f2;
  --stroke: rgba(18, 91, 78, .25);
  --stroke-strong: rgba(0, 118, 136, .48);
  --text: #071d19;
  --muted: #365e57;
  --soft: #55756f;
  --link: #006b82;
  --focus: #007d94;
  --success-text: #0b674c;
  --warning-text: #765100;
  --danger-text: #9b1932;
  color-scheme: light;
}

h1, h2, h3, h4, h5, h6,
strong, b { color: var(--text); }
p, li, td, th, summary { color: inherit; }
a { color: var(--link); text-underline-offset: 3px; }
.muted, .hint, .small-text,
.admin-item p, .block-list-item small,
.course-main small, .metric-row span,
.quick-stats span, .site-footer p,
.preview-note, .editor-help {
  color: var(--muted);
}
.hint { line-height: 1.55; }
::selection { color: #03140f; background: #78f2c7; }

.glass-card, .soft-card {
  color: var(--text);
  background: linear-gradient(150deg, rgba(10, 29, 37, .985), rgba(4, 15, 20, .97));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .045);
}
.soft-card {
  background: rgba(12, 31, 39, .96);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
body.light-theme .glass-card,
body.light-theme .soft-card {
  color: var(--text);
  background: rgba(255, 255, 255, .97);
  border-color: var(--stroke);
  box-shadow: 0 18px 45px rgba(16, 70, 61, .10), inset 0 1px 0 #fff;
}
body.light-theme .soft-card { background: var(--surface); }

/* Clear button hierarchy: readable regardless of custom accent colors. */
button {
  color: #ffffff;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent-one, #28c89b) 66%, #073229),
    color-mix(in srgb, var(--accent-two, #25afd1) 62%, #082c3b)
  );
  border: 1px solid rgba(145, 244, 224, .38);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .26), inset 0 1px 0 rgba(255,255,255,.12);
  text-shadow: 0 1px 2px rgba(0,0,0,.36);
  font-weight: 850;
}
button:hover {
  filter: brightness(1.13);
  border-color: rgba(188, 255, 240, .66);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .34), 0 0 0 1px rgba(99,245,181,.12);
}
button.ghost, .ghost-link,
.auth-switch-wide, .practice-picker-btn {
  color: var(--text);
  background: var(--surface);
  border-color: var(--stroke);
  text-shadow: none;
  box-shadow: none;
}
button.ghost:hover, .ghost-link:hover,
.auth-switch-wide:hover, .practice-picker-btn:hover {
  color: #ffffff;
  background: var(--surface-hover);
  border-color: var(--stroke-strong);
  filter: none;
}
body.light-theme button.ghost:hover,
body.light-theme .ghost-link:hover,
body.light-theme .auth-switch-wide:hover,
body.light-theme .practice-picker-btn:hover { color: var(--text); }
button.danger { color: #fff; border-color: rgba(255, 173, 185, .44); }
button:disabled {
  color: rgba(244,255,252,.66);
  background: #25363a;
  border-color: rgba(255,255,255,.1);
  opacity: .78;
}

button:focus-visible, a:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

label {
  color: #d7ebe6;
  font-size: 13px;
  letter-spacing: .01em;
}
body.light-theme label { color: #244d46; }
input, textarea, select {
  color: var(--text);
  background: #041015;
  border: 1px solid rgba(153, 211, 200, .31);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
input:hover, textarea:hover, select:hover { border-color: rgba(143, 231, 214, .48); }
input:focus, textarea:focus, select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(105, 230, 255, .14);
}
input::placeholder, textarea::placeholder { color: #718e89; opacity: 1; }
select option { color: #f4fffc; background: #071319; }
body.light-theme input,
body.light-theme textarea,
body.light-theme select {
  color: var(--text);
  background: #ffffff;
  border-color: rgba(24, 95, 83, .3);
}
body.light-theme input::placeholder,
body.light-theme textarea::placeholder { color: #6b8781; }
body.light-theme select option { color: #071d19; background: #fff; }

/* Navigation */
.rail {
  background: #061219;
  border-color: rgba(127, 231, 210, .3);
}
.rail-logo, .rail-btn {
  color: #c2d9d4;
  background: #0b2028;
  border-color: rgba(150, 215, 203, .13);
}
.rail-logo {
  color: #042018;
  background: linear-gradient(135deg, #6ff2c0, #79e5ff);
  text-shadow: none;
}
.rail-btn.active, .rail-btn:hover {
  color: #effffc;
  background: #123039;
  border-color: rgba(111, 242, 202, .48);
  box-shadow: inset 3px 0 0 #6ff2c0, 0 0 18px rgba(99,245,181,.10);
}

/* Learner dashboard */
.hero-card {
  background:
    linear-gradient(115deg, rgba(10, 34, 40, .99), rgba(3, 15, 20, .985)),
    radial-gradient(circle at 78% 22%, rgba(72,215,255,.18), transparent 33%);
  border-color: rgba(122, 231, 210, .28);
}
.hero-card #siteTagline,
.hero-card p, .today-card p { color: #c5dbd6; }
.mini-label { color: #78f2c7; text-shadow: 0 0 14px rgba(99,245,181,.14); }
body.light-theme .mini-label { color: #006d55; text-shadow: none; }
.cyber-status-strip span {
  color: #c1d9d4;
  background: #0a2027;
  border-color: rgba(133, 221, 204, .24);
}
body.light-theme .cyber-status-strip span { color: #29544c; background: #eef8f5; }
.metric-row strong { color: #88ffd0; }
body.light-theme .metric-row strong { color: #087359; }

.quick-stats div {
  color: var(--text);
  background: var(--surface);
  border-color: var(--stroke);
}
.quick-stats strong { color: var(--text); }
.track-chip {
  color: #cee0dc;
  background: #0b2027;
  border-color: rgba(147, 218, 204, .22);
}
.track-chip:hover, .track-chip.active {
  color: #042018;
  background: #7cf2c7;
  border-color: #9affd9;
  text-shadow: none;
}
body.light-theme .track-chip { color: #315d54; background: #f3faf8; }
body.light-theme .track-chip:hover,
body.light-theme .track-chip.active { color: #05251e; background: #9be9cf; }

.course-item {
  color: var(--text);
  background: linear-gradient(100deg, #0a1e25, #06151b);
  border-color: rgba(137, 220, 204, .22);
}
.course-item:hover {
  color: var(--text);
  background: #0e2931;
  border-color: rgba(135, 236, 215, .52);
}
.course-item.active {
  color: var(--text);
  background: linear-gradient(100deg, #12332f, #092029);
  border-color: color-mix(in srgb, var(--accent, #63f5b5) 68%, white 5%);
}
.course-main strong { color: #f5fffc; }
.course-main small { color: #b9d0cb; }
.course-icon {
  color: #f1fffb;
  background: #102a31;
  border-color: rgba(144, 229, 211, .25);
}
.course-access {
  color: #dcece8;
  background: #0c242b;
  border-color: rgba(146, 220, 206, .25);
}
.course-access.active { color: var(--success-text); }
.course-access.locked { color: var(--warning-text); }
.course-arrow { color: #8cf5cf; }
body.light-theme .course-item,
body.light-theme .course-item:hover,
body.light-theme .course-item.active {
  color: var(--text);
  background: #f7fcfa;
}
body.light-theme .course-main strong { color: var(--text); }
body.light-theme .course-main small { color: var(--muted); }
body.light-theme .course-icon { color: #123e36; background: #e7f5f1; }
body.light-theme .course-access { color: #315d54; background: #edf7f4; }

/* Lesson reader */
.lesson-map nav a {
  color: #c0d5d0;
  background: #091d24;
  border-color: rgba(143, 216, 202, .2);
}
.lesson-map nav a:hover,
.lesson-map nav a.active {
  color: #ffffff;
  background: #103039;
  border-color: #6ddfd1;
}
.lesson-title-card {
  background: linear-gradient(130deg, #12332f, #081b22);
  border-color: rgba(126, 230, 208, .3);
}
.lesson-title-card p, .lesson-title-card h3 { color: #c4d9d4; }
.lesson-block {
  color: var(--text);
  background: #08191f;
  border-color: rgba(143, 213, 200, .23);
}
.lesson-block .block-description { color: #c8ddd8; }
.lesson-body { color: #e4f2ee; }
.lesson-body p, .lesson-body li { color: #e0efeb; }
.lesson-body strong { color: #ffffff; }
.standalone-line { color: #effbf8; }
.lesson-body code {
  color: #a9ffdf;
  background: #0d2926;
  border-color: rgba(125, 239, 204, .25);
}
.code-card { background: #030d12; border-color: rgba(117, 219, 255, .28); }
.code-card-head { color: #d6f6ff; background: #0a1d25; }
.code-card pre { color: #e1f8ff; }
.empty { color: #bdd2cd; background: rgba(13, 34, 42, .66); border-radius: 14px; }
body.light-theme .lesson-map nav a { color: #315b54; background: #f3faf8; }
body.light-theme .lesson-map nav a:hover,
body.light-theme .lesson-map nav a.active { color: #092a24; background: #e1f4ee; }
body.light-theme .lesson-title-card { background: #eef9f5; }
body.light-theme .lesson-title-card p,
body.light-theme .lesson-title-card h3 { color: #41665f; }
body.light-theme .lesson-block { background: #fff; }
body.light-theme .lesson-body,
body.light-theme .lesson-body p,
body.light-theme .lesson-body li { color: #173b34; }
body.light-theme .lesson-body strong { color: #071d19; }
body.light-theme .standalone-line { color: #173b34; }
body.light-theme .empty { color: #486a63; background: #f0f8f5; }

/* Practice lab */
.editor-panel, .preview-panel { border-color: rgba(122, 224, 211, .28); }
.editor-shell { background: #020a0e; border-color: rgba(111, 229, 255, .38); }
.editor-toolbar { color: #d5ebe6; background: #091b22; }
.editor-meta { color: #aac4bf; }
.editor-file-tab { color: #91ffd7; }
.line-numbers, #lineNumbers {
  color: #73908b;
  background: #07161c;
  border-color: rgba(125, 198, 187, .18);
}
#codeEditor, .code-editor-wrap #codeEditor { color: #e6fff7; }
#runStatus {
  color: var(--success-text);
  background: #0c2923;
  border-color: rgba(117, 242, 199, .28);
}
.preview-note { color: #bed2ce; }
.practice-picker-menu {
  color: var(--text);
  background: #06151b;
  border-color: var(--stroke-strong);
}
.practice-picker-menu button,
.quick-pill-row button {
  color: #cfdfdc;
  background: #0d2229;
  border-color: rgba(143, 211, 199, .24);
  text-shadow: none;
}
.practice-picker-menu button small { color: #a9c0bc; }
.practice-picker-menu button:hover,
.practice-picker-menu button.active,
.quick-pill-row button:hover,
.quick-pill-row button.active {
  color: #ffffff;
  background: #15343c;
  border-color: #72dceb;
}
body.light-theme .practice-picker-menu { background: #fff; }
body.light-theme .practice-picker-menu button,
body.light-theme .quick-pill-row button { color: #315d54; background: #f1f8f6; }
body.light-theme .practice-picker-menu button:hover,
body.light-theme .practice-picker-menu button.active,
body.light-theme .quick-pill-row button:hover,
body.light-theme .quick-pill-row button.active { color: #092a24; background: #dff3ee; }

/* Authentication, popups and access cards */
.auth-modal, .claim-modal, .ad-login-modal { background: rgba(0, 6, 9, .84); }
.auth-card, .claim-modal .glass-card, .ad-popup-card, .purchase-card {
  color: var(--text);
  background: #081a20;
  border-color: rgba(126, 232, 210, .34);
}
.auth-tabs { background: #041218; border-color: var(--stroke); }
.auth-tabs button {
  color: #b9ceca;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  text-shadow: none;
}
.auth-tabs button:hover { color: #ffffff; background: #102a31; }
.auth-tabs button.active {
  color: #ffffff;
  background: linear-gradient(135deg, #167d69, #176d89);
  border-color: rgba(151, 246, 226, .42);
}
.auth-link-btn { color: #a9c5c0; background: transparent; }
.auth-link-btn:hover { color: #8ee8ff; background: transparent; }
.purchase-meta span { color: var(--text); background: #0d242b; }
.success-text { color: var(--success-text) !important; }
.danger-text { color: var(--danger-text) !important; }
.soft-warning { color: var(--warning-text); background: #30270f; border-color: rgba(255, 211, 102, .42); }
.soft-warning strong { color: #ffe08a; }
body.light-theme .auth-card,
body.light-theme .claim-modal .glass-card,
body.light-theme .ad-popup-card,
body.light-theme .purchase-card { background: #fff; }
body.light-theme .auth-tabs { background: #eef7f4; }
body.light-theme .auth-tabs button { color: #456b64; }
body.light-theme .auth-tabs button:hover { color: #173b34; background: #e4f3ef; }
body.light-theme .auth-tabs button.active { color: #fff; }
body.light-theme .purchase-meta span { color: var(--text); background: #edf7f4; }
body.light-theme .soft-warning { color: #684900; background: #fff7dc; }

/* Admin dashboard */
.admin-page-body { color: var(--text); }
.admin-login, .admin-top, .admin-tabs, .admin-section { border-color: rgba(133, 225, 207, .28); }
.admin-top { background: linear-gradient(120deg, #0b2229, #06161c); }
.admin-tabs {
  background: rgba(5, 18, 24, .985);
  box-shadow: 0 16px 36px rgba(0,0,0,.32);
}
.admin-tab {
  color: #c4d8d4;
  background: #0b2027;
  border-color: rgba(139, 209, 196, .16);
  box-shadow: none;
  text-shadow: none;
}
.admin-tab:hover { color: #ffffff; background: #123039; border-color: rgba(116, 226, 205, .35); }
.admin-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, #147662, #176f87);
  border-color: rgba(162, 250, 232, .45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.admin-item, .block-list-item, .admin-list > *, .block-item {
  color: var(--text);
  background: #0a1d24;
  border-color: rgba(139, 218, 203, .23);
}
.admin-item:hover, .block-list-item:hover { border-color: rgba(122, 232, 211, .48); }
.admin-item h3, .block-list-item strong { color: #f4fffc; }
.admin-item p, .block-list-item small { color: #b8cfca; }
.checkbox-row {
  color: #d8ebe7;
  background: #0a1e25;
  border-color: rgba(143, 216, 202, .24);
}
.sticky-actions {
  background: rgba(5, 20, 26, .97);
  border-color: rgba(125, 229, 209, .34);
  box-shadow: 0 -12px 30px rgba(0,0,0,.28);
}
.storage-stats > div, .guide-steps span {
  color: #d8ebe7;
  background: #0b2229;
  border-color: rgba(124, 218, 202, .24);
}
.code-textarea, #rawJsonEditor { color: #e4fff8; background: #020b0f; }
body.light-theme .admin-top { background: #fff; }
body.light-theme .admin-tabs { background: rgba(255,255,255,.98); box-shadow: 0 10px 30px rgba(16,70,61,.10); }
body.light-theme .admin-tab { color: #315d54; background: #f1f8f6; }
body.light-theme .admin-tab:hover { color: #173b34; background: #e4f3ef; }
body.light-theme .admin-tab.active { color: #fff; }
body.light-theme .admin-item,
body.light-theme .block-list-item,
body.light-theme .admin-list > *,
body.light-theme .block-item { color: var(--text); background: #f8fcfb; }
body.light-theme .admin-item h3,
body.light-theme .block-list-item strong { color: var(--text); }
body.light-theme .admin-item p,
body.light-theme .block-list-item small { color: var(--muted); }
body.light-theme .checkbox-row { color: #244d46; background: #f2f9f7; }
body.light-theme .sticky-actions { background: rgba(255,255,255,.98); }
body.light-theme .storage-stats > div,
body.light-theme .guide-steps span { color: #244d46; background: #f1f8f6; }

/* Ads and footer */
.ad-shell { color: var(--text); background: #081b21; border-color: rgba(134, 216, 201, .22); }
.ad-label { color: #c1d4d0; background: #10252c; }
.social-links a { color: #e8f7f3; background: #0d2229; border-color: var(--stroke); }
.social-links a:hover { color: #fff; border-color: var(--stroke-strong); background: #133039; }
body.light-theme .ad-shell { background: #fff; }
body.light-theme .ad-label { color: #315d54; background: #eef7f4; }
body.light-theme .social-links a { color: #244d46; background: #f3faf8; }

/* Mobile readability */
@media (max-width: 720px) {
  body { background-size: 30px 30px, 30px 30px, auto, auto, auto, auto; }
  .app-shell, .admin-shell { width: min(100% - 16px, 600px); }
  .rail { border-radius: 14px; }
  .hero-card, .today-card, .course-card, .progress-card,
  .lesson-pane, .lesson-map, .editor-panel, .preview-panel,
  .admin-section, .admin-login, .admin-top { padding: 17px; }
  h1 { font-size: clamp(32px, 11vw, 48px); line-height: 1.02; }
  h2 { line-height: 1.15; }
  button { min-height: 44px; }
  input, textarea, select { min-height: 46px; font-size: 16px; }
  .course-item { min-height: 82px; }
  .auth-card { max-height: calc(100vh - 24px); overflow: auto; }
}

/* v2.1 mobile overlap correction */
@media (max-width: 720px) {
  .hero-card::before { display: none; }
  .metric-row { grid-template-columns: auto 1fr; align-items: center; }
  .metric-row strong { font-size: 30px; }
}
