@property --orb-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  --bg: #f3f1f8;
  --bg-accent: #ece8f6;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-2: rgba(255, 255, 255, 0.42);
  --ink: #0c0d14;
  --muted: #5d5a6a;
  --line: rgba(80, 70, 120, 0.14);
  --teal: #5b4dff;
  --teal-2: #2a2140;
  --teal-soft: rgba(124, 108, 255, 0.14);
  --clay: #c45cff;
  --clay-soft: rgba(196, 92, 255, 0.12);
  --ok: #1f7a45;
  --ok-soft: #e7f4ec;
  --warn: #9a6700;
  --warn-soft: #f7f0e2;
  --danger: #b42318;
  --danger-soft: #f8e8e6;
  --shadow: 0 18px 50px rgba(70, 50, 140, 0.1);
  --radius: 28px;
  --radius-sm: 18px;
  --sidebar: 248px;
  --font: "Inter Tight", "Manrope", "Segoe UI", sans-serif;
  --display: "Inter Tight", "Manrope", "Segoe UI", sans-serif;
  --glow: rgba(140, 120, 255, 0.22);
}

[data-theme="dark"] {
  --bg: #07080d;
  --bg-accent: #12131c;
  --surface: rgba(18, 18, 26, 0.64);
  --surface-2: rgba(28, 28, 40, 0.55);
  --ink: #f4f2ff;
  --muted: #aaa6b8;
  --line: rgba(180, 170, 220, 0.14);
  --teal: #c4b5fd;
  --teal-2: #ffffff;
  --teal-soft: rgba(167, 139, 250, 0.16);
  --clay: #f0abfc;
  --clay-soft: rgba(240, 171, 252, 0.12);
  --ok: #86d4a4;
  --ok-soft: #1d3428;
  --warn: #f0c079;
  --warn-soft: #3a2e1b;
  --danger: #f0a39c;
  --danger-soft: #3a2220;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --glow: rgba(160, 130, 255, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  isolation: isolate;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(520px circle at var(--mx, 70%) var(--my, 12%), var(--glow), transparent 58%);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
}
.skip:focus { left: 8px; background: var(--surface); padding: 8px 12px; z-index: 20; }

.display { font-family: var(--display); letter-spacing: -0.055em; line-height: 1.05; font-weight: 600; }
.page, .hero, .messages, .mobile-nav { position: relative; z-index: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.page {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(28px) saturate(1.5);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}
.logo, .orb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: transparent;
  background: conic-gradient(from var(--orb-angle), #7dd3fc, #c4b5fd, #fb7185, #fdba74, #67e8f9, #a78bfa, #7dd3fc);
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.45), 0 0 28px rgba(125, 211, 252, 0.22);
  animation: orb-spin 9s linear infinite;
  position: relative;
  overflow: hidden;
}
.logo::after, .orb::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.9), rgba(255,255,255,.12) 42%, transparent 70%);
}
.orb-lg {
  --orb-size: 240px;
  width: var(--orb-size);
  height: var(--orb-size);
  animation-duration: 14s;
  box-shadow:
    0 0 40px rgba(167, 139, 250, 0.45),
    0 0 90px rgba(125, 211, 252, 0.28),
    0 0 140px rgba(251, 113, 133, 0.18);
}
.orb-lg::before {
  content: "";
  position: absolute;
  inset: -38%;
  border-radius: 50%;
  background: conic-gradient(from var(--orb-angle), #67e8f9, #c4b5fd, #fb7185, #fdba74, #67e8f9);
  filter: blur(32px);
  opacity: 0.55;
  animation: orb-spin 18s linear infinite reverse;
  z-index: -1;
}
.aurora {
  position: fixed;
  inset: -15%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.aurora-blob {
  position: absolute;
  width: 48vw;
  height: 48vw;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  mix-blend-mode: multiply;
  animation: blob-drift 18s ease-in-out infinite;
}
[data-theme="dark"] .aurora-blob { mix-blend-mode: screen; opacity: 0.42; }
.aurora-blob.a { background: #c4b5fd; top: -8%; right: -6%; }
.aurora-blob.b { background: #7dd3fc; bottom: -10%; left: -8%; animation-delay: -6s; }
.aurora-blob.c { background: #fb7185; top: 32%; left: 28%; width: 32vw; height: 32vw; animation-delay: -11s; }
.hero-stage {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 32px;
  min-height: 58vh;
}
.hero-orb {
  display: grid;
  place-items: center;
  min-height: 320px;
}
.brand strong { display: block; font-size: 16px; }
.brand span { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a, .nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--muted);
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav a:hover, .nav-btn:hover, .nav a.active {
  background: var(--teal-soft);
  color: var(--ink);
}
.nav a.active { font-weight: 700; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.main { padding: 22px 28px 48px; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 24px rgba(90, 70, 180, 0.05);
}
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(16px);
  display: grid;
  place-items: center;
}
.userchip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(16px);
}
.avatar, .avatar-lg {
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; }
img.avatar, img.avatar-lg { object-fit: cover; display: block; padding: 0; }

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.35);
}
.kpi {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-family: var(--display); font-size: 34px; letter-spacing: -0.06em; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.pad { padding: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 11px 18px;
  border: 1px solid transparent;
  font-weight: 650;
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1), background 280ms ease;
}
.btn {
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 10px 28px rgba(90, 70, 200, 0.22), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn:hover { transform: translateY(-1px); }
.btn-secondary { background: var(--surface); border-color: var(--line); backdrop-filter: blur(16px); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }

.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data th { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
table.data tr:hover td { background: var(--surface-2); }

.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: 12px 14px;
  outline: none;
}
.input:focus { border-color: #a78bfa; box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.18); }
label.field, .field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-weight: 500; }
.field ul label { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }

.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}
.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.progress > span { display: block; height: 100%; background: var(--teal); }
.progress.glow > span {
  background: linear-gradient(90deg, #67e8f9, #a78bfa, #fb7185);
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.35);
}
.meter-cell {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
  min-width: 120px;
}
.chart-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 16px;
  margin-top: 16px;
}
.chart-box { position: relative; min-height: 260px; }
.att-dots { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.att-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface-2);
}
.att-dot.on { background: #86d4a4; box-shadow: 0 0 10px rgba(134, 212, 164, 0.45); }
.att-dot.off { background: #f0a39c; }

.messages { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 12px 14px;
  border-radius: 18px;
  min-width: 240px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.menu-toggle { display: none; }
.mobile-nav { display: none; }

.hero {
  min-height: 100vh;
  padding: 28px 7vw 80px;
  background: transparent;
  overflow: hidden;
}
.hero-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(40px, 7vw, 76px);
  max-width: 12ch;
  font-weight: 600;
  margin: 72px 0 18px;
}
.hero p.lead { max-width: 46ch; font-size: 18px; color: var(--muted); }
.bento {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
  margin-top: 48px;
}
.bento .card { padding: 22px; min-height: 170px; }
.bento h3 { margin: 8px 0 6px; font-size: 20px; }
.section { padding: 72px 7vw; }
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.exercise-board {
  display: grid;
  gap: 12px;
}
.choice, .chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
}
.choice:hover, .chip:hover { border-color: var(--teal); }
.choice.selected, .chip.selected { background: var(--teal-soft); border-color: var(--teal); }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.words { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; }
.reading { font-size: 17px; line-height: 1.7; }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 18px;
  border: 1.5px dashed var(--line);
  border-radius: 24px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
}
.dropzone.over, .dropzone:hover { border-color: var(--teal); background: var(--teal-soft); }
.dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.file-chip button { margin: 0; }

.checkin-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 8px;
}
.checkin-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#qr-box {
  padding: 12px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; }
@media (max-width: 860px) {
  .checkin-panel { grid-template-columns: 1fr; justify-items: center; }
  .copy-row { flex-direction: column; }
}

.builder {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
}
.builder-nav .nav-btn.active {
  background: var(--teal-soft);
  color: var(--ink);
  font-weight: 700;
}
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.type-chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 10px 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.type-chip span { color: var(--muted); font-size: 12px; }
.type-chip:hover { border-color: var(--teal); }
.q-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ielts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0 28px;
  align-items: start;
}
.ielts-passage {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 140px);
  overflow: auto;
}
#audio-slot { position: absolute; width: 0; height: 0; overflow: hidden; }

.qedit-hd { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.q-card.nested { background: var(--surface); margin-top: 8px; }
.option-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.opt-letter {
  flex: 0 0 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; font-weight: 700; font-size: 12px;
}
.notes-body { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; }
.notes-preview { margin-top: 8px; opacity: .92; }

.q-group-prompt {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  border-radius: 12px;
  white-space: pre-line;
}
.q-group-prompt strong { display: block; margin-bottom: 4px; }
.q-group-intro { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.q-num { font-family: var(--display); font-style: italic; color: var(--clay); font-weight: 650; margin-right: 6px; }

.notes-block {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px 22px;
  line-height: 2.35;
  font-size: 15px;
  border-radius: 14px;
}
.notes-block .nb-title {
  font-family: var(--display);
  font-size: 20px;
  text-align: center;
  margin-bottom: 14px;
  font-weight: 650;
}
.notes-block .nb-section { font-weight: 700; margin: 14px 0 8px; }
.notes-block .nb-section:first-child { margin-top: 0; }
.notes-block .nb-line { margin-bottom: 6px; line-height: 1.9; }
.notes-block .nb-bullet::before { content: "• "; color: var(--clay); margin-right: 4px; }
.notes-block .nb-input, .nb-ghost {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--ink);
  background: var(--surface);
  min-width: 118px;
  text-align: center;
  border-radius: 4px 4px 0 0;
}
.nb-ghost { min-height: 22px; vertical-align: middle; background: var(--surface-2); }
.notes-block .nb-input:focus {
  outline: none;
  border-color: var(--clay);
  box-shadow: 0 0 0 3px var(--clay-soft);
}
.notes-block .nb-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  background: var(--ink);
  color: var(--surface);
  font-size: 11px;
  font-weight: 700;
  margin-right: 5px;
  vertical-align: middle;
  border-radius: 4px;
}

.tfng-item { margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; }
.tfng-item .tfng-stmt { margin: 0 0 10px; }

.exam-shell { display: flex; flex-direction: column; min-height: calc(100vh - 110px); }
.exam-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.exam-body { flex: 1; padding-bottom: 84px; }
.exam-nav {
  position: sticky;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  z-index: 12;
}
.qnav { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.qnav-btn {
  min-width: 32px; height: 32px; padding: 0 7px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font-size: 12.5px; font-weight: 600;
}
.qnav-btn.answered {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.enav-submit { margin-left: auto; flex: 0 0 auto; }

@media (max-width: 1100px) {
  .kpis, .grid-2, .grid-3, .bento, .roles, .form-grid, .hero-stage, .chart-grid { grid-template-columns: 1fr 1fr; }
  .builder, .ielts, .type-grid { grid-template-columns: 1fr; }
  .ielts-passage { position: static; max-height: none; }
}
@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-110%);
    z-index: 40;
    width: min(86vw, 320px);
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: grid; }
  .kpis, .grid-2, .grid-3, .bento, .roles, .form-grid, .match-grid, .hero-stage, .chart-grid { grid-template-columns: 1fr; }
  .orb-lg { --orb-size: 180px; width: 180px; height: 180px; }
  .main { padding: 16px 14px 88px; }
  .hero { padding: 18px 20px 56px; }
  .hero h1 { margin-top: 42px; }
  .section { padding: 48px 20px; }
  .mobile-nav {
    display: flex;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    backdrop-filter: blur(22px) saturate(1.4);
    box-shadow: var(--shadow);
    justify-content: space-around;
    padding: 8px;
    z-index: 20;
  }
}

@keyframes orb-spin {
  to { --orb-angle: 360deg; }
}
@keyframes blob-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6%, -8%) scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .logo, .orb, .orb-lg::before, .aurora-blob { animation: none !important; }
}
