:root{
  --bg1:#0f1020;
  --bg2:#111c3a;
  --card:#15172a;
  --card2:#101227;
  --stroke:rgba(255,255,255,.10);
  --text:#eef1ff;
  --muted:rgba(238,241,255,.72);

  --a:#7c5cff;   /* purple */
  --b:#19d3ff;   /* cyan */
  --c:#42ffb3;   /* mint */
  --d:#ff4d8d;   /* pink */
  --warn:#ffcc66;
  --good:#45e39a;
  --bad:#ff5a7a;

  --shadow: 0 18px 40px rgba(0,0,0,.35);
  --radius: 18px;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(124,92,255,.40), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(25,211,255,.35), transparent 60%),
    radial-gradient(900px 500px at 20% 95%, rgba(255,77,141,.28), transparent 55%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  min-height:100vh;
}

.wrap{
  max-width: 1050px;
  margin: 0 auto;
  padding: 22px 16px 28px;
}

/* Utilities */
.mb8{ margin-bottom:8px; }
.mt8{ margin-top:8px; }
.mt10{ margin-top:10px; }
.mt12{ margin-top:12px; }
.spacer8{ height:8px; }
.spacer10{ height:10px; }
.spacer12{ height:12px; }
.spacer14{ height:14px; }

/* Top header */
.top{
  display:flex;
  gap:14px;
  align-items:stretch;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom: 14px;
}

.brand{
  flex:1;
  min-width: 280px;
  background: linear-gradient(135deg, rgba(124,92,255,.18), rgba(25,211,255,.14));
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px 16px;
  box-shadow: var(--shadow);
  position:relative;
  overflow:hidden;
}

.brand:before{
  content:"";
  position:absolute;
  inset:-2px;
  background: linear-gradient(90deg, rgba(124,92,255,.55), rgba(25,211,255,.45), rgba(66,255,179,.35));
  filter: blur(26px);
  opacity:.22;
  pointer-events:none;
}

h1{
  margin:0;
  font-size: 22px;
  letter-spacing:.2px;
  position:relative;
}

.sub{
  margin-top:6px;
  font-size: 13px;
  color: var(--muted);
  position:relative;
}

.stats{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:stretch;
}

.pill{
  background: rgba(21,23,42,.8);
  border:1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  display:flex;
  gap:8px;
  align-items:center;
  min-width: 160px;
}

.pillHidden{
  display:none;
}

.pillLabel{
  font-size:12px;
  color:var(--muted);
}

.pillValue{
  font-weight: 800;
  font-size: 14px;
  letter-spacing:.2px;
}

/* Layout */
.grid{
  display:grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 14px;
}

@media (max-width: 920px){
  .grid{ grid-template-columns: 1fr; }
}

/* Cards */
.card{
  background: linear-gradient(180deg, rgba(21,23,42,.92), rgba(16,18,39,.92));
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.cardHeader{
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}

.cardTitle{
  font-weight:800;
  font-size:14px;
  letter-spacing:.3px;
}

.tiny{
  font-size:12px;
  color: var(--muted);
  line-height:1.35;
}

.cardBody{
  padding: 14px;
}

.cardFooter{
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.modalFooter{
  justify-content:flex-end;
}

/* Buttons */
.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.btn{
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  cursor:pointer;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
  user-select:none;
}

.btn:hover{ background: rgba(255,255,255,.10); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity:.55; cursor:not-allowed; }

.btn.primary{
  border:none;
  background: linear-gradient(90deg, var(--a), var(--b));
  font-weight: 800;
  letter-spacing:.2px;
  box-shadow: 0 10px 24px rgba(124,92,255,.18);
}

.btn.primary:hover{ filter: brightness(1.02); }
.btn.disabled{ opacity:.40; }

/* Tabs */
.tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.10);
}

.tabBtn{
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  color: var(--text);
  cursor:pointer;
  font-size: 13px;
}

.tabBtn:hover{ background: rgba(255,255,255,.08); }

/* Category buttons */
.catRow .btn{
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}

.catRow .btn:hover{ background: rgba(255,255,255,.10); }

/* Toggles */
.toggle{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  width: 100%;
  max-width: 520px;
}

.toggle input{ transform: scale(1.1); }
.toggleText{ color: var(--text); }

/* Screens */
.screen{ display:none; }
.screen.active{ display:block; }

/* Game */
.chips{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.chip{
  padding: 7px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  font-size: 12px;
  color: var(--muted);
}

.chip strong{ color: var(--text); }

.timer{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--text);
  background: rgba(0,0,0,.20);
}

.progressWrap{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin: 8px 0 10px;
}

.progressOuter{
  flex:1;
  min-width: 220px;
  height: 12px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  overflow:hidden;
}

#progressBar{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--c), var(--b), var(--a));
}

.qnum{
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  white-space:nowrap;
}

.question{
  margin-top: 6px;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: .1px;
  white-space: pre-wrap;
}

#choices{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
  margin-top: 12px;
}

.choice{
  text-align:left;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
  font-size: 14px;
}

.choice:hover{ background: rgba(255,255,255,.10); }
.choice:active{ transform: translateY(1px); }

.choice.good{
  border-color: rgba(69,227,154,.55);
  background: rgba(69,227,154,.12);
}

.choice.bad{
  border-color: rgba(255,90,122,.55);
  background: rgba(255,90,122,.12);
}

.hint{
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border:1px dashed rgba(255,255,255,.22);
  background: rgba(0,0,0,.18);
  color: var(--muted);
  font-size: 13px;
  line-height:1.35;
  min-height: 44px;
}

/* Review items (end screen) */
#reviewList{ margin-top: 10px; }

.reviewItem{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  padding: 12px;
  border-radius: 14px;
  margin-top: 10px;
}

.reviewItem .meta{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.reviewItem .q{
  font-size: 13px;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.reviewItem .a{
  font-size: 13px;
  color: var(--text);
}

/* Modal */
.modalOverlay{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}

.modalOverlay.show{ display:flex; }

.modal{
  width: min(820px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(21,23,42,.98), rgba(16,18,39,.98));
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  overflow:hidden;
}

.modalHeader{
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.modalHeader h2{ margin:0; font-size: 16px; }

.modalBody{
  padding: 14px;
  display:grid;
  gap:10px;
}

.modalBlock{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius: 14px;
  padding: 10px 12px;
}

.modalLabel{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.modalText{
  font-size: 14px;
  color: var(--text);
}
