/* =====================================================================
   XQuiz · Aurora Glass design system
   ===================================================================== */
:root {
  --bg-0: #0a0b1a;
  --bg-1: #11132a;
  --ink-0: #f4f5ff;
  --ink-1: #d6d9f0;
  --ink-2: #9ea3c9;
  --ink-3: #6a6f95;
  --line: rgba(255,255,255,0.10);
  --line-strong: rgba(255,255,255,0.18);
  --glass: rgba(22,24,46,0.55);
  --glass-2: rgba(28,30,58,0.7);
  --accent: #8aa6ff;
  --accent-2: #c79bff;
  --accent-3: #7ee7ff;
  --good: #6ee7a4;
  --warn: #ffb86b;
  --bad: #ff7a90;
  --shadow-lg: 0 30px 80px -30px rgba(8,10,30,0.6),
               0 12px 30px -12px rgba(8,10,30,0.45);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(122,162,255,0.18), transparent 60%),
    radial-gradient(900px 700px at -10% 100%, rgba(199,155,255,0.17), transparent 55%),
    radial-gradient(800px 600px at 50% 110%, rgba(126,231,255,0.10), transparent 60%);
  pointer-events: none;
  z-index: -2;
}
button { font-family: inherit; }
a { color: inherit; }

/* Aurora animated background */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  filter: blur(80px);
  opacity: 0.55;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: float 22s var(--ease) infinite alternate;
}
.b1 { width: 520px; height: 520px; left: -10%; top: -15%;
  background: radial-gradient(circle at 30% 30%, #6e8bff, transparent 65%); }
.b2 { width: 640px; height: 640px; right: -20%; top: 20%;
  background: radial-gradient(circle at 60% 50%, #c084ff, transparent 65%);
  animation-delay: -7s; }
.b3 { width: 480px; height: 480px; left: 30%; bottom: -25%;
  background: radial-gradient(circle at 50% 50%, #6ed7ff, transparent 65%);
  animation-delay: -14s; }
@keyframes float {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(40px,30px) scale(1.08); }
  100% { transform: translate(-30px,20px) scale(0.96); }
}
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 30%, black 30%, transparent 75%);
}

/* Top bar */
#topbar {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  z-index: 50;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  background: linear-gradient(180deg, rgba(10,11,26,0.7), rgba(10,11,26,0.35));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(122,162,255,0.25), rgba(199,155,255,0.25));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 24px rgba(255,255,255,0.05);
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.2px; }
.brand-tag {
  font-size: 12px; color: var(--ink-2);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
}
.nav-actions { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  font-size: 13px; color: var(--ink-1);
}
.user-chip::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 3px rgba(138,166,255,0.18);
}
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.04);
  color: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s var(--ease);
  font-size: 13px;
}
.ghost-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--line-strong); }

/* Main */
main { max-width: 1180px; margin: 0 auto; padding: 28px; }
.hidden { display: none !important; }

/* ----- Auth screen ----- */
.auth-shell {
  min-height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: center;
  padding: 40px 0;
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; gap: 24px; padding: 24px 0; }
  .auth-hero { text-align: center; }
  .auth-hero .feat-row { justify-content: center; }
}
.auth-hero h1 {
  font-size: clamp(38px, 5.6vw, 64px);
  line-height: 1.05;
  font-weight: 800;
  margin: 0 0 18px;
  letter-spacing: -0.025em;
  background: linear-gradient(120deg, #ffffff 0%, #c8d3ff 35%, #d9b8ff 70%, #fff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-hero p.lead {
  font-size: 17px; color: var(--ink-2); margin: 0 0 28px; max-width: 560px;
}
.feat-row { display: flex; flex-wrap: wrap; gap: 10px; }
.feat-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-1);
}
.feat-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
}

/* Glass card */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.glass::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent 30%);
  pointer-events: none;
}

.auth-card { padding: 36px; max-width: 460px; width: 100%; justify-self: end; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
}
.auth-tab {
  padding: 10px 14px;
  text-align: center;
  border-radius: 9px;
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 500;
  transition: all .25s var(--ease);
}
.auth-tab.active {
  background: linear-gradient(135deg, rgba(122,162,255,0.30), rgba(199,155,255,0.30));
  color: var(--ink-0);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* Form */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 500; letter-spacing: 0.02em; }
.input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-0);
  font-size: 15px;
  outline: none;
  transition: all .2s var(--ease);
  font-family: inherit;
}
.input:focus, textarea:focus, select:focus {
  border-color: rgba(138,166,255,0.6);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 4px rgba(138,166,255,0.12);
}
.input::placeholder { color: var(--ink-3); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  color: #0a0b1a;
  background: linear-gradient(135deg, #b9caff 0%, #d7b8ff 60%, #a5e7ff 110%);
  box-shadow: 0 10px 30px -10px rgba(149,176,255,0.6),
              inset 0 0 0 1px rgba(255,255,255,0.6);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 16px 40px -12px rgba(149,176,255,0.7),
              inset 0 0 0 1px rgba(255,255,255,0.8);
}
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--ink-0);
  border-color: var(--line);
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.10); }
.btn-danger {
  background: rgba(255,122,144,0.12);
  color: #ffb1c0;
  border-color: rgba(255,122,144,0.35);
}
.btn-danger:hover:not(:disabled) { background: rgba(255,122,144,0.22); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

/* Spinner */
.spin { display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Domain list ----- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin: 6px 0 26px;
  gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: clamp(28px, 3.4vw, 38px); font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.page-sub { color: var(--ink-2); margin: 6px 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.card {
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
  cursor: pointer;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 24px 50px -20px rgba(8,10,30,0.6);
}
.card .ribbon {
  position: absolute; inset: 0 auto auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  opacity: 0.7;
}
.card-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(122,162,255,0.22), rgba(199,155,255,0.22));
  border: 1px solid var(--line-strong);
  color: var(--accent);
}
.card-title h3 { margin: 0; font-size: 17px; font-weight: 600; }
.card-meta { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.card-cta { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }

.card-add {
  display: grid; place-items: center;
  border: 1.5px dashed var(--line-strong);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  min-height: 180px;
  color: var(--ink-2);
  text-align: center;
  transition: all .25s var(--ease);
}
.card-add:hover {
  border-color: var(--accent);
  color: var(--ink-0);
  background: rgba(122,162,255,0.06);
  transform: translateY(-2px);
}
.card-add .plus {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0b1a;
  font-size: 22px; font-weight: 700;
  margin-bottom: 10px;
}

/* ----- Detail screens ----- */
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; margin-bottom: 14px; }
.crumbs button {
  background: none; border: none; padding: 4px 6px; color: var(--accent); cursor: pointer; font-size: 13px;
  border-radius: 6px;
}
.crumbs button:hover { background: rgba(138,166,255,0.1); }

.section { margin-top: 28px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.section-title { font-size: 18px; font-weight: 600; margin: 0; }

.list {
  display: flex; flex-direction: column; gap: 10px;
}
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: all .2s var(--ease);
}
.list-item:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.06); }
.list-item .ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(138,166,255,0.12);
  color: var(--accent);
  flex-shrink: 0;
}
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta .name { font-weight: 500; }
.list-item .meta .sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* Stats */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.stat .label { font-size: 12px; color: var(--ink-2); }
.stat .value {
  font-size: 26px; font-weight: 700; margin-top: 4px;
  background: linear-gradient(135deg, #fff, #c8d3ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .delta { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

.bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.bar > div {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  border-radius: 999px; transition: width .6s var(--ease);
}

/* Quiz setup */
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 700px) { .setup-grid { grid-template-columns: 1fr; } }
.counter {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 18px 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  border: 1px solid var(--line);
}
.counter .num {
  font-size: 36px; font-weight: 700; min-width: 56px; text-align: center;
  background: linear-gradient(135deg, #fff, #c8d3ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.counter button {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.05);
  color: var(--ink-0); font-size: 18px; cursor: pointer;
  transition: all .15s var(--ease);
}
.counter button:hover { background: rgba(255,255,255,0.12); transform: scale(1.05); }

/* Quiz screen */
.quiz-shell { max-width: 760px; margin: 0 auto; }
.quiz-progress {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 22px; font-size: 13px; color: var(--ink-2);
}
.quiz-progress .bar { flex: 1; }
.q-card { padding: 28px; }
.q-tag {
  display: inline-block; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(138,166,255,0.15); color: #b9caff;
  border: 1px solid rgba(138,166,255,0.3);
  margin-bottom: 14px;
}
.q-text { font-size: 22px; font-weight: 600; line-height: 1.4; margin: 0 0 22px; letter-spacing: -0.01em; }
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: all .2s var(--ease);
  font-size: 15px;
  text-align: left;
  width: 100%;
  color: var(--ink-0);
  font-family: inherit;
}
.option:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.07); }
.option .pick {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-1);
}
.option.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(122,162,255,0.14), rgba(199,155,255,0.10));
  box-shadow: 0 0 0 4px rgba(138,166,255,0.12);
}
.option.selected .pick {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0b1a; border-color: transparent;
}
.option.correct {
  border-color: var(--good);
  background: rgba(110,231,164,0.12);
}
.option.correct .pick { background: var(--good); color: #0a1a10; border-color: transparent; }
.option.wrong {
  border-color: var(--bad);
  background: rgba(255,122,144,0.10);
}
.option.wrong .pick { background: var(--bad); color: #1a0a0e; border-color: transparent; }

.explain {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-1);
  font-size: 14px; line-height: 1.6;
}
.explain strong { color: var(--accent-3); }

.quiz-foot {
  margin-top: 22px;
  display: flex; justify-content: space-between; gap: 12px;
}

/* ----- Report ----- */
.report-card { padding: 36px; text-align: center; }
.score-ring {
  position: relative; width: 180px; height: 180px; margin: 6px auto 22px;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring .track { stroke: rgba(255,255,255,0.08); }
.score-ring .meter {
  stroke: url(#sgrad);
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s var(--ease);
}
.score-ring .num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 48px; font-weight: 800;
  background: linear-gradient(135deg, #fff, #c8d3ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.report-foot { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

.review-item {
  text-align: left;
  padding: 18px;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.review-item .q { font-weight: 600; margin-bottom: 8px; }
.review-item .a { font-size: 13px; color: var(--ink-2); margin: 4px 0; }
.review-item .a.good { color: var(--good); }
.review-item .a.bad { color: var(--bad); }

/* ----- Toasts ----- */
#toasts {
  position: fixed; right: 20px; top: 80px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200; max-width: 360px; width: calc(100vw - 40px);
}
.toast {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow-lg);
  animation: toastIn .4s var(--ease);
}
.toast.success { border-left-color: var(--good); }
.toast.error   { border-left-color: var(--bad); }
.toast.warning { border-left-color: var(--warn); }
.toast .body { flex: 1; min-width: 0; }
.toast .title { font-weight: 600; font-size: 14px; margin: 0 0 2px; }
.toast .msg { font-size: 13px; color: var(--ink-2); margin: 0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ----- Modal ----- */
.modal-root {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8,10,28,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.modal-card {
  position: relative;
  width: 100%; max-width: 460px;
  background: var(--glass-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  box-shadow: var(--shadow-lg);
  animation: modalIn .35s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-card h3 { margin: 0 0 14px; font-size: 19px; font-weight: 600; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ----- Generation overlay ----- */
.gen-overlay {
  position: fixed; inset: 0; z-index: 250;
  display: grid; place-items: center;
  background: rgba(8,10,28,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn .3s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.gen-card {
  width: min(440px, 92vw);
  background: var(--glass-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 32px 28px 28px;
  text-align: center;
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  box-shadow: var(--shadow-lg);
}
.gen-spinner {
  position: relative; width: 110px; height: 110px; margin: 0 auto 16px;
}
.gen-spinner .ring {
  width: 100%; height: 100%;
  animation: spin 2s linear infinite;
}
.gen-spinner .ring circle {
  fill: none;
  stroke: url(#sgrad);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 80, 200;
}
.gen-pct {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700;
  color: var(--ink-0);
}
.gen-card h3 { margin: 0 0 6px; font-size: 18px; }
.gen-step { color: var(--ink-2); font-size: 13px; margin: 0 0 16px; min-height: 18px; }
.gen-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; margin-bottom: 8px; }
.gen-bar > div { height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  border-radius: 999px; transition: width .5s var(--ease); }
.gen-count { font-size: 12px; color: var(--ink-3); margin: 0; }

/* ----- File input ----- */
.upload-zone {
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  background: rgba(255,255,255,0.02);
  transition: all .2s var(--ease);
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag {
  border-color: var(--accent);
  background: rgba(138,166,255,0.06);
}
.upload-zone .ic {
  width: 48px; height: 48px; margin: 0 auto 8px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(122,162,255,0.22), rgba(199,155,255,0.22));
  border: 1px solid var(--line-strong);
  color: var(--accent);
}
.upload-zone p { margin: 6px 0; }
.upload-zone .hint { font-size: 12px; color: var(--ink-3); }
.upload-zone input[type="file"] { display: none; }

/* Empty state */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-2);
}
.empty .icon {
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(122,162,255,0.18), rgba(199,155,255,0.18));
  border: 1px solid var(--line);
  color: var(--accent);
}

/* Skeleton */
.skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: skel 1.4s linear infinite;
  border-radius: 8px;
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Utilities */
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.gap-sm { gap: 6px; }
.gap-md { gap: 14px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-mute { color: var(--ink-2); }
.text-sm { font-size: 13px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink-1);
}
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,0.06); color: var(--ink-1);
  border: 1px solid var(--line);
}
.tag.good { background: rgba(110,231,164,0.12); color: var(--good); border-color: rgba(110,231,164,0.3); }
.tag.warn { background: rgba(255,184,107,0.12); color: var(--warn); border-color: rgba(255,184,107,0.3); }
.tag.info { background: rgba(122,162,255,0.12); color: var(--accent); border-color: rgba(122,162,255,0.3); }

/* Hide native scrollbars on small areas politely */
.scroll-y { overflow-y: auto; }
.scroll-y::-webkit-scrollbar { width: 8px; }
.scroll-y::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 8px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }

/* SVG defs (re-usable gradient) — put in JS-rendered SVG when needed */

/* ----- Mobile (<=720px) ----- */
@media (max-width: 720px) {
  main { padding: 16px; }
  #topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .brand-tag { display: none; }
  .brand-name { font-size: 16px; }
  .logo-mark { width: 32px; height: 32px; border-radius: 9px; }
  .nav-actions { gap: 8px; }
  .user-chip {
    padding: 5px 10px; font-size: 12px;
    max-width: 120px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .ghost-btn { padding: 7px 10px; font-size: 12px; }

  .page-head { margin-bottom: 18px; }
  .page-title { font-size: 26px; }
  .page-sub { font-size: 14px; }

  /* Auth */
  .auth-shell { padding: 16px 0; gap: 18px; }
  .auth-hero h1 { font-size: 36px; line-height: 1.1; margin-bottom: 14px; }
  .auth-hero p.lead { font-size: 15px; margin-bottom: 18px; }
  .auth-card { padding: 22px; border-radius: 18px; }
  .auth-tabs { margin-bottom: 18px; }
  .feat-pill { font-size: 12px; padding: 6px 11px; }

  /* Cards */
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card { padding: 18px; border-radius: 18px; }
  .card-add { min-height: 140px; }

  /* Stats */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px 14px; border-radius: 12px; }
  .stat .value { font-size: 22px; }

  /* Setup */
  .setup-grid { grid-template-columns: 1fr; gap: 14px; }
  .counter { padding: 14px 12px; gap: 14px; }
  .counter .num { font-size: 30px; }
  .counter button { width: 40px; height: 40px; font-size: 20px; }

  /* Quiz */
  .quiz-shell { padding: 0; }
  .quiz-progress { font-size: 12px; gap: 10px; margin-bottom: 16px; }
  .q-card { padding: 20px; border-radius: 18px; }
  .q-text { font-size: 19px; margin-bottom: 18px; }
  .q-tag { font-size: 10px; }
  .options { gap: 10px; }
  .option {
    padding: 14px 14px;
    font-size: 15px;
    border-radius: 12px;
    /* Larger touch target for mobile */
    min-height: 56px;
  }
  .option .pick { width: 26px; height: 26px; font-size: 12px; }
  .quiz-foot {
    /* Sticky footer on mobile so the next button is always reachable */
    position: sticky;
    bottom: 0;
    margin: 22px -16px 0;
    padding: 12px 16px env(safe-area-inset-bottom);
    background: linear-gradient(180deg, transparent, rgba(10,11,26,0.85) 30%, rgba(10,11,26,0.95));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .quiz-foot .btn { flex: 1; }

  /* Buttons (slightly larger touch) */
  .btn { padding: 12px 16px; min-height: 44px; }
  .btn-sm { min-height: 36px; padding: 8px 12px; }

  /* Report */
  .report-card { padding: 26px 20px; border-radius: 18px; }
  .score-ring { width: 150px; height: 150px; }
  .score-ring svg { width: 150px; height: 150px; }
  .score-ring .num { font-size: 40px; }
  .review-item { padding: 14px; border-radius: 12px; }

  /* Toasts */
  #toasts {
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    right: 12px; left: 12px; max-width: none;
    width: auto;
  }
  .toast { padding: 12px 14px; }
  @keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Modal */
  .modal-card { padding: 22px 20px; border-radius: 18px; }
  .modal-foot { gap: 8px; }
  .modal-foot .btn { flex: 1; }

  /* Generation overlay */
  .gen-card { padding: 26px 22px 22px; border-radius: 18px; }
  .gen-spinner { width: 96px; height: 96px; }

  /* List items */
  .list-item { padding: 12px 14px; border-radius: 12px; gap: 12px; }
  .list-item .ico { width: 32px; height: 32px; border-radius: 9px; }
  .list-item .meta .name { font-size: 14px; }

  /* Upload zone */
  .upload-zone { padding: 22px 18px; border-radius: 12px; }
  .upload-zone .ic { width: 40px; height: 40px; border-radius: 11px; }

  /* Crumbs */
  .crumbs { font-size: 12px; gap: 5px; flex-wrap: wrap; }
}

/* ----- Extra small phones (<=380px) ----- */
@media (max-width: 380px) {
  .auth-hero h1 { font-size: 30px; }
  .page-title { font-size: 22px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 20px; }
  .q-text { font-size: 17px; }
  .option { padding: 12px; font-size: 14px; }
  .ghost-btn span, .ghost-btn:not(:has(svg)) { display: none; }
}
