:root{
  --bg:#070a08;
  --panel:#0c120e;
  --card:#0e1611;
  --border:rgba(150,255,190,.14);
  --text:#e9fff0;
  --muted:rgba(233,255,240,.68);
  --accent:#46ff9a;
  --accent2:#b7ff46;
  --danger:#ff5a6b;
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --radius:16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(70,255,154,.14), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(183,255,70,.10), transparent 60%),
    radial-gradient(900px 700px at 70% 120%, rgba(70,255,154,.08), transparent 60%),
    var(--bg);
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  line-height:1.35;
}

a{color:inherit}
kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  font-size:.85em;
  padding:.15rem .35rem;
  border:1px solid var(--border);
  border-bottom-color: rgba(150,255,190,.28);
  border-radius:8px;
  background: rgba(0,0,0,.25);
}

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; justify-content:space-between; align-items:center;
  padding:14px 18px;
  background: rgba(7,10,8,.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(150,255,190,.10);
}

.brand{display:flex; align-items:center; gap:12px}
.logo{
  width:38px;height:38px; display:grid; place-items:center;
  border:1px solid var(--border);
  border-radius:12px;
  background: linear-gradient(180deg, rgba(70,255,154,.12), rgba(0,0,0,.20));
  box-shadow: var(--shadow);
}
.brand-text .title{font-weight:800; letter-spacing:.4px}
.brand-text .subtitle{color:var(--muted); font-size:.92rem; display:flex; gap:10px; align-items:center}

.top-actions{display:flex; align-items:center; gap:10px}

.container{
  max-width:920px;
  margin:18px auto 28px;
  padding:0 16px;
  display:block;
}

.panel{
  background: rgba(12,18,14,.78);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}

.panel-head{
  display:flex; justify-content:space-between; align-items:baseline;
  margin-bottom:10px;
  gap:12px;
}
.panel-title{font-weight:800}
.panel-meta{color:var(--muted); font-size:.92rem}

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
  margin:12px 0;
}
@media (max-width: 520px){
  .grid{grid-template-columns: 1fr}
}

.field label{
  display:block;
  color:var(--muted);
  font-size:.9rem;
  margin-bottom:6px;
}
.field select{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.28);
  color:var(--text);
  outline:none;
}
.field select:focus{
  border-color: rgba(70,255,154,.45);
  box-shadow: 0 0 0 3px rgba(70,255,154,.12);
}

.row{display:flex; align-items:center; gap:10px}
.between{justify-content:space-between}
.spacer{flex:1}
.muted{color:var(--muted)}
.link{
  appearance:none; border:0; background:transparent; color:var(--accent);
  cursor:pointer; padding:6px 8px; border-radius:10px;
}
.link:hover{background: rgba(70,255,154,.08)}

.chips-wrap{display:flex; flex-wrap:wrap; gap:8px; margin-top:8px}

.chip{
  display:inline-flex; align-items:center; justify-content:center;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.28);
  color:var(--text);
  cursor:pointer;
  user-select:none;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.chip:hover{background: rgba(70,255,154,.07); border-color: rgba(70,255,154,.24)}
.chip:active{transform: translateY(1px)}
.chip[data-active="true"]{
  border-color: rgba(70,255,154,.55);
  background: rgba(70,255,154,.12);
}
.chip.ghost{background: transparent}

.btn{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  color:var(--text);
  cursor:pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{background: rgba(70,255,154,.07); border-color: rgba(70,255,154,.24)}
.btn:active{transform: translateY(1px)}
.btn:disabled, .chip:disabled{
  opacity:.55;
  cursor:not-allowed;
}
.btn.primary{
  border-color: rgba(70,255,154,.52);
  background: linear-gradient(180deg, rgba(70,255,154,.18), rgba(0,0,0,.22));
}
.btn.primary:hover{background: linear-gradient(180deg, rgba(70,255,154,.22), rgba(0,0,0,.22))}
.btn.ghost{background: transparent}

.hint{
  margin-top:10px;
  color:var(--muted);
  font-size:.92rem;
}

.stats{
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap:10px;
  margin:10px 0 12px;
}
@media (max-width: 520px){
  .stats{grid-template-columns: repeat(2, minmax(0,1fr))}
}
.stat{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
  background: rgba(0,0,0,.18);
}
.stat-label{color:var(--muted); font-size:.86rem}
.stat-value{font-weight:900; font-size:1.25rem; margin-top:2px}

.bar{
  height:10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.22);
  overflow:hidden;
}
.bar-fill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(70,255,154,.80), rgba(183,255,70,.65));
  transition: width .25s ease;
}

.card{
  margin-top:12px;
  border:1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(14,22,17,.85);
  padding:14px;
}
.card-top{
  display:flex; gap:8px; flex-wrap:wrap;
  margin-bottom:10px;
}
.pill{
  display:inline-flex; align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.22);
  color:var(--text);
  font-size:.9rem;
}
.pill.ghost{color:var(--muted)}

.q{
  margin:0 0 12px;
  font-size:1.28rem;
  letter-spacing:.2px;
}

.options{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}
.option{
  text-align:left;
  width:100%;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.22);
  padding:12px 12px;
  cursor:pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.option:hover{background: rgba(70,255,154,.07); border-color: rgba(70,255,154,.24)}
.option:active{transform: translateY(1px)}
.option[disabled]{opacity:.6; cursor:not-allowed}
.option.correct{
  border-color: rgba(70,255,154,.70);
  background: rgba(70,255,154,.14);
}
.option.wrong{
  border-color: rgba(255,90,107,.70);
  background: rgba(255,90,107,.10);
}

.feedback{
  margin-top:12px;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.22);
}
.feedback-title{font-weight:900}
.feedback-meta{color:var(--muted); margin-top:4px; font-size:.92rem}
.feedback-text{color:var(--muted); margin-top:6px}

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

/* Toggle */
.toggle-row{display:flex; align-items:stretch; gap:12px}
.toggle{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: rgba(0,0,0,.18);
  cursor:pointer;
  user-select:none;
}

/* The actual switch */
.switch{
  -webkit-appearance:none;
  appearance:none;
  width:42px;
  height:24px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  position:relative;
  flex:none;
  cursor:pointer;
  outline:none;
}
.switch::after{
  content:"";
  position:absolute;
  top:50%;
  left:4px;
  width:18px;
  height:18px;
  transform: translateY(-50%);
  border-radius:999px;
  background: rgba(233,255,240,.88);
  transition: left .18s ease, background .18s ease;
}
.switch:checked{
  border-color: rgba(70,255,154,.55);
  background: rgba(70,255,154,.12);
}
.switch:checked::after{
  left:20px;
  background: rgba(70,255,154,.95);
}
.switch:focus-visible{
  box-shadow: 0 0 0 3px rgba(70,255,154,.14);
}

.toggle-text{
  display:block;
  min-width:0;
  color:var(--text);
  font-size:.95rem;
  line-height:1.25;
}


.footer{
  max-width:920px;
  margin:0 auto 22px;
  padding:0 16px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  color:var(--muted);
  font-size:.92rem;
}
.footer-links{display:flex; align-items:center; gap:10px}
.dot{opacity:.7}


/* UI polish v1.2.0 */
.brand-text .title{font-size:1.04rem}
.panel{padding:16px}
.card{padding:16px}
.q{font-size:1.36rem; line-height:1.25}
.options .option{padding:13px 12px}
.btn{padding:10px 14px}
.btn.primary{box-shadow: 0 10px 26px rgba(0,0,0,.32)}
.stats .stat{background: rgba(0,0,0,.20)}
.stat.big .stat-value{font-size:1.45rem}
.pill{backdrop-filter: blur(6px)}
.panel-head{margin-bottom:12px}

/* Results */
.card.results{border-color: rgba(70,255,154,.22); background: rgba(14,22,17,.92)}
.results-head{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:12px}
.results-title{font-weight:900; font-size:1.15rem; letter-spacing:.2px}
.results-subtitle{margin-top:4px}
.results-actions{display:flex; gap:10px; flex-wrap:wrap}
.results-grid{display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; margin:10px 0 12px}
@media (max-width: 640px){.results-grid{grid-template-columns: 1fr}}

.results-split{display:grid; grid-template-columns: 1.1fr .9fr; gap:12px; margin-top:10px}
@media (max-width: 860px){.results-split{grid-template-columns: 1fr}}

.results-section{border:1px solid var(--border); border-radius: var(--radius); padding:12px; background: rgba(0,0,0,.16)}
.section-title{font-weight:900; margin-bottom:2px}
.section-hint{font-size:.92rem; margin-bottom:10px}

.table{display:grid; gap:8px}
.table-row{display:grid; grid-template-columns: 1fr 80px 80px; gap:8px; align-items:center;
  padding:10px 10px; border:1px solid var(--border); border-radius:14px; background: rgba(0,0,0,.18)}
.table-row .name{font-weight:700; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.table-row .num{text-align:right; font-variant-numeric: tabular-nums; color: var(--text)}
.table-row .pct{text-align:right; font-variant-numeric: tabular-nums; color: var(--muted)}

.missed{display:grid; gap:10px}
.missed-item{padding:10px 10px; border:1px solid var(--border); border-radius:14px; background: rgba(0,0,0,.18)}
.missed-q{font-weight:800; margin-bottom:6px}
.missed-a{color:var(--muted); line-height:1.25}
.missed-a b{color:var(--text)}

.toast{
  position:fixed; left:50%; bottom:20px; transform:translateX(-50%);
  padding:10px 12px; border-radius:999px;
  border:1px solid rgba(70,255,154,.35);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  color: var(--text);
  box-shadow: var(--shadow);
  z-index: 999;
}

.chip{font-weight:650}



/* Mobile-first polish v1.3.0 */
@media (max-width: 640px){
  .topbar{flex-direction:column; align-items:stretch; gap:10px}
  .brand{min-width:0}
  .top-actions{width:100%; justify-content:flex-end}
  .container{padding:12px}
  .panel{padding:14px}
  .card{padding:14px}

  /* Config footer row (Start) */
  .row.between{flex-direction:column; align-items:stretch}
  .row.between .btn{width:100%}
  #eligibleMeta{order:2}

  /* Quiz */
  .stats{grid-template-columns: repeat(2, minmax(0,1fr))}
  .q{font-size:1.22rem}
  .option{padding:14px 12px}

  /* Keep actions reachable */
  .card-actions{
    position: sticky;
    bottom: 10px;
    z-index: 5;
    padding:10px;
    border-radius:16px;
    border:1px solid var(--border);
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
  }
  .card-actions .spacer{display:none}
  .card-actions .btn{flex:1; min-width: 140px}
  #skipBtn{order:1}
  #restartBtn{order:2}
  #nextBtn{order:3}

  /* Results */
  .results-actions .btn{flex:1}
  .table-row{grid-template-columns: 1fr 60px 60px}
}

@media (max-width: 380px){
  .card-actions .btn{min-width: 0}
  .option{font-size:.98rem}
  .table-row{grid-template-columns: 1fr 54px 54px}
}



/* History & stats (local) v1.4.0 */
.btn.sm{padding:8px 12px; font-size:.92rem}
.btn.danger{
  border-color: rgba(255,90,90,.35);
  color: rgba(255,210,210,.95);
  background: rgba(255,90,90,.08);
}
.btn.danger:hover{background: rgba(255,90,90,.12)}
.history-card{margin-top:12px}
.history-head{display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:10px}
.history-actions{display:flex; gap:10px; flex-wrap:wrap}
.history-grid{display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:10px; margin-bottom:10px}
.history-split{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
.history-section{border:1px solid var(--border); border-radius: var(--radius); padding:12px; background: rgba(0,0,0,.16)}
.history-list{display:grid; gap:10px}
.history-item{
  display:flex; gap:10px; align-items:flex-start; justify-content:space-between;
  padding:10px 10px; border:1px solid var(--border); border-radius:14px; background: rgba(0,0,0,.18)
}
.history-main{min-width:0}
.history-top{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:6px}
.history-date{font-weight:800}
.history-metrics{display:flex; gap:10px; flex-wrap:wrap; font-variant-numeric: tabular-nums}
.history-filters{margin-top:6px; font-size:.92rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width: 640px}
.pill.sm{padding:4px 10px; font-size:.82rem}

/* Mobile */
@media (max-width: 860px){
  .history-grid{grid-template-columns: repeat(2, minmax(0,1fr))}
  .history-split{grid-template-columns: 1fr}
  .history-filters{white-space:normal}
}
@media (max-width: 640px){
  .history-actions{width:100%}
  .history-actions .btn{flex:1}
  .history-item{flex-direction:column}
  .history-item .btn{width:100%}
}



/* v1.5.0 Dashboard + A11y */
.input{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline: none;
}
.input::placeholder{color: var(--muted)}
.input:focus-visible{
  outline: 2px solid rgba(70,255,154,.55);
  outline-offset: 2px;
}

.btn:focus-visible,
.option:focus-visible,
.chip:focus-visible,
.link:focus-visible,
select:focus-visible,
.switch:focus-visible{
  outline: 2px solid rgba(70,255,154,.65);
  outline-offset: 3px;
}

.sr-only{
  position:absolute !important;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0);
  white-space:nowrap; border:0;
}

/* Progress heatmap */
.history-heatmap{margin-top:12px; border:1px solid var(--border); border-radius: var(--radius); padding:12px; background: rgba(0,0,0,.14)}
.heatmap{display:grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap:10px; margin-top:10px}
@media (max-width: 860px){.heatmap{grid-template-columns: repeat(4, minmax(0,1fr))}}
@media (max-width: 480px){.heatmap{grid-template-columns: repeat(3, minmax(0,1fr))}}

.hm{
  border:1px solid var(--border);
  border-radius:16px;
  padding:10px 10px;
  background: rgba(0,0,0,.18);
  display:flex;
  flex-direction:column;
  gap:6px;
  min-height:72px;
}
.hm .k{display:flex; align-items:center; justify-content:space-between; gap:8px}
.hm .tag{font-weight:900}
.hm .pct{font-variant-numeric: tabular-nums; color: var(--text)}
.hm .bar{height:10px; border-radius:999px; background: rgba(0,0,0,.22); border:1px solid rgba(70,255,154,.15); overflow:hidden}
.hm .fill{height:100%; width:0%; background: rgba(70,255,154,.35)}
.hm .meta{font-size:.9rem; color: var(--muted)}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  *{scroll-behavior:auto !important; transition:none !important; animation:none !important;}
}


/* v1.5.1 Category directory */
.cats-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:10px 0 6px;
}
.btn.small{padding:8px 10px; border-radius:12px; font-size:.95rem}
.cat-list{
  border:1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0,0,0,.14);
  padding:10px;
  max-height: 260px;
  overflow:auto;
  margin:10px 0 10px;
}
.cat-row{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 10px;
  border-radius:14px;
  cursor:pointer;
  user-select:none;
  text-align:left;
  background: transparent;
  border:1px solid transparent;
  color: var(--text);
}
.cat-row:hover{background: rgba(255,255,255,.04)}
.cat-row[aria-pressed="true"]{background: rgba(70,255,154,.10); border-color: rgba(70,255,154,.18)}
.cat-left{display:flex; align-items:center; gap:10px; min-width:0}
.cat-dot{
  width:10px; height:10px; border-radius:999px;
  background: rgba(70,255,154,.45);
  flex:0 0 auto;
  box-shadow: 0 0 0 2px rgba(70,255,154,.08);
}
.cat-name{
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 100%;
}
.cat-count{
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  flex:0 0 auto;
}
@media (max-width: 480px){
  .cat-list{max-height: 320px;}
  .cat-row{padding:12px 10px;}
}