:root{
  --bg: #070b16;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.09);
  --border: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);

  --good: #2ee59d;
  --mid:  #f6d34b;
  --warn: #ff9a3c;
  --bad:  #ff4d5e;

  --radius: 18px;
  --shadow: 0 16px 60px rgba(0,0,0,.45);

  --tap: 52px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 12% 10%, rgba(78,165,255,.18), transparent 60%),
    radial-gradient(1000px 600px at 90% 15%, rgba(110,255,187,.12), transparent 55%),
    radial-gradient(900px 600px at 40% 95%, rgba(255,155,78,.10), transparent 60%),
    var(--bg);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden{ display:none !important; }
.muted{ color:var(--muted); }
.big{ font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

.boot{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding: 24px;
}
.boot-card{
  width:min(520px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
  border:1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.logo{ display:flex; gap:14px; align-items:center; margin-bottom: 14px; }
.logo-mark{
  width:42px;height:42px;border-radius:14px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.28), rgba(255,255,255,.06));
  border:1px solid rgba(255,255,255,.14);
}
.logo-title{ font-weight: 800; font-size: 18px; }
.logo-sub{ color:var(--muted); font-size: 13px; }
.boot-bar{
  height:10px; border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow:hidden;
  border:1px solid rgba(255,255,255,.12);
}
.boot-fill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(78,165,255,.9), rgba(46,229,157,.9));
}
.boot-hint{ margin-top: 12px; color: var(--muted); font-size: 13px; }

.app{ min-height:100vh; display:flex; flex-direction:column; }

.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 18px;
  background: rgba(7,11,22,.65);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand{ display:flex; gap:10px; align-items:center; }
.brand-dot{
  width:12px;height:12px;border-radius:999px;
  background: linear-gradient(180deg, rgba(78,165,255,1), rgba(46,229,157,1));
  box-shadow: 0 0 0 4px rgba(46,229,157,.08);
}
.brand-name{ font-weight: 800; letter-spacing: -.02em; }
.brand-sub{ font-size: 12px; color: var(--muted); }

.badge{
  font-size: 12px;
  padding: 9px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(12px);
}

.main{
  flex: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.screen{ display:block; }

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
  backdrop-filter: blur(14px);
}
.card + .card{ margin-top: 14px; }
.card-title{ font-weight: 700; margin-bottom: 10px; color: rgba(255,255,255,.85); }

.grid2{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
}
.grid3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.hero h1{ margin: 0 0 8px; font-size: 28px; letter-spacing: -.03em; }
.hero p{ margin:0 0 12px; line-height: 1.45; }

.pill-row{ display:flex; flex-wrap:wrap; gap:8px; margin-top: 10px; }
.pill{
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}

.tabs{ display:flex; gap:8px; margin-bottom: 12px; }
.tab{
  flex: 1;
  height: var(--tap);
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-weight: 700;
  cursor:pointer;
}
.tab.active{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.18);
}

.form{ display:flex; flex-direction:column; gap:10px; }
.label{ font-size: 12px; color: var(--muted); }
.input{
  height: var(--tap);
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  color: var(--text);
  padding: 0 14px;
  outline:none;
}
.input:focus{
  border-color: rgba(78,165,255,.55);
  box-shadow: 0 0 0 4px rgba(78,165,255,.14);
}

.btn{
  height: var(--tap);
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight: 800;
  cursor:pointer;
  padding: 0 14px;
}
.btn.primary{
  background: linear-gradient(90deg, rgba(78,165,255,.95), rgba(46,229,157,.95));
  border-color: rgba(255,255,255,.12);
  color: rgba(0,0,0,.85);
}
.btn.secondary{ background: rgba(255,255,255,.10); }
.btn.ghost{ background: transparent; }
.btn:active{ transform: translateY(1px); }

.dash-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.dash-actions{ display:flex; gap:10px; }

.status{
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  line-height: 1.35;
}

.pct{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:800;
}
.dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--mid);
  box-shadow: 0 0 0 4px rgba(255,255,255,.06);
}

.table-wrap{ overflow:auto; border-radius: 14px; border:1px solid rgba(255,255,255,.10); }
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 720px;
}
.table th, .table td{
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align:left;
  font-size: 13px;
}
.table th{ color: rgba(255,255,255,.78); font-weight: 800; background: rgba(255,255,255,.04); }

.quiz-wrap{
  width: min(980px, 100%);
  margin: 0 auto;
}
.quiz-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.quiz-title{ flex: 1; min-width: 0; }
.quiz-subject{ font-weight: 900; font-size: 18px; letter-spacing: -.02em; }
.quiz-timer{ text-align:right; min-width: 88px; }
.timer{ font-weight: 900; font-size: 18px; letter-spacing: .02em; }

.qmeta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom: 10px;
}
.tag{
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.qtext{
  margin: 0 0 12px;
  line-height: 1.35;
  font-size: 18px;
}
.options{ display:flex; flex-direction:column; gap:10px; }
.option{
  display:flex;
  gap: 12px;
  align-items:flex-start;
  padding: 14px 14px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}
.option input{ margin-top: 3px; transform: scale(1.2); }
.option.correct{
  border-color: color-mix(in oklab, var(--good) 45%, rgba(255,255,255,.12));
  background: color-mix(in oklab, var(--good) 12%, rgba(255,255,255,.04));
}
.option.wrong{
  border-color: color-mix(in oklab, var(--bad) 45%, rgba(255,255,255,.12));
  background: color-mix(in oklab, var(--bad) 10%, rgba(255,255,255,.04));
}
.feedback{
  margin-top: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.feedback.good{ border-color: color-mix(in oklab, var(--good) 45%, rgba(255,255,255,.12)); }
.feedback.bad{ border-color: color-mix(in oklab, var(--bad) 45%, rgba(255,255,255,.12)); }

.quiz-actions{
  display:flex;
  gap:10px;
  margin-top: 12px;
}

/* Mobile IMBA */
@media (max-width: 860px){
  :root{ --tap: 56px; }
  .grid2{ grid-template-columns: 1fr; }
  .grid3{ grid-template-columns: 1fr; }
  .dash-head{ flex-direction:column; align-items:stretch; }
  .dash-actions .btn{ flex:1; }
  .hero h1{ font-size: 24px; }
  .main{ padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  .table-wrap{ display:none; }
  .history-cards{ display:flex; flex-direction:column; gap:10px; }
  .hcard{
    border:1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.05);
    border-radius: 16px;
    padding: 12px;
  }
  .hrow{ display:flex; justify-content:space-between; gap:10px; }
  .hrow .muted{ font-size: 12px; }
  .hbig{ font-weight: 900; }
  .hmeta{ margin-top: 6px; display:flex; flex-wrap:wrap; gap:8px; }

  .quiz-actions{
    position: sticky;
    bottom: 0;
    z-index: 40;
    background: rgba(7,11,22,.78);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 18px;
    padding: 10px;
    margin-top: 14px;
    margin-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .quiz-actions .btn{
    flex:1;
    height: 56px;
    border-radius: 16px;
    font-size: 15px;
  }
  .option{ padding: 16px; }
}

.footer{
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(7,11,22,.35);
}
