:root{
  --bg0:#070b14;
  --bg1:#0b1220;
  --surface:#0f172a;
  --surface2:#101b34;
  --surface3:#0c152a;

  --text:#eaf0ff;
  --muted:#aebbd8;

  --border:rgba(255,255,255,.10);
  --border2:rgba(255,255,255,.06);

  --accent:#7dd3fc;
  --accent2:#a78bfa;
  --success:#22c55e;
  --warn:#fbbf24;
  --danger:#fb7185;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  --r12:12px;
  --r16:16px;
  --r20:20px;
  --shadow: 0 18px 60px rgba(0,0,0,.45);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--sans);
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(125,211,252,.14), transparent 55%),
    radial-gradient(900px 500px at 85% 10%, rgba(167,139,250,.10), transparent 55%),
    radial-gradient(900px 500px at 70% 110%, rgba(34,197,94,.08), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

a{ color:inherit; }

.page .shell{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:28px 14px;
}

.shell--wide{
  align-items:flex-start !important;
  justify-content:center !important;
}

.card{
  width:min(760px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid var(--border2);
  border-radius: var(--r20);
  box-shadow: var(--shadow);
  overflow:hidden;
  backdrop-filter: blur(14px);
}

.shell--wide .card{ width:min(1180px, 100%); }

.card__head{
  padding:18px 20px;
  border-bottom:1px solid var(--border2);
  background: linear-gradient(90deg, rgba(125,211,252,.12), transparent 55%);
}

.brand{ display:flex; gap:12px; align-items:center; }
.brand__logo{
  width:44px; height:44px;
  border-radius:14px;
  background: rgba(125,211,252,.14);
  border:1px solid rgba(125,211,252,.22);
  display:grid; place-items:center;
  font-weight:900;
  letter-spacing:.3px;
}
.brand__title{ font-size:18px; font-weight:900; letter-spacing:.2px; }
.brand__sub{ font-size:13px; color:var(--muted); margin-top:2px; }

.form{ padding:16px 20px 20px; display:grid; gap:10px; }
.label{ font-size:13px; color:var(--muted); }
.hint{ font-size:12px; opacity:.9; margin-left:6px; }

.input{
  width:100%;
  padding:12px 12px;
  background: rgba(15,23,42,.55);
  border:1px solid var(--border2);
  border-radius: 14px;
  color:var(--text);
  outline:none;
  transition: box-shadow .15s ease, border-color .15s ease, transform .05s ease;
}
.input:focus{
  border-color: rgba(125,211,252,.42);
  box-shadow:0 0 0 4px rgba(125,211,252,.10);
}

.btn{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  padding:11px 14px;
  border-radius: 14px;
  border:1px solid var(--border2);
  background: rgba(255,255,255,.04);
  color:var(--text);
  cursor:pointer;
  text-decoration:none;
  font-weight:800;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{ background: rgba(255,255,255,.06); }
.btn:active{ transform: translateY(1px); }

.btn--primary{
  background: linear-gradient(180deg, rgba(125,211,252,.20), rgba(125,211,252,.10));
  border-color: rgba(125,211,252,.30);
}
.btn--primary:hover{ background: linear-gradient(180deg, rgba(125,211,252,.26), rgba(125,211,252,.12)); }

.btn--ghost{ background: transparent; }

.btn--danger{
  background: rgba(251,113,133,.10);
  border-color: rgba(251,113,133,.26);
}
.btn--danger:hover{ background: rgba(251,113,133,.14); }

.btn--sm{
  padding:8px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}

.alert{
  margin:12px 20px 0;
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid var(--border2);
}
.alert--danger{
  background: rgba(251,113,133,.10);
  border-color: rgba(251,113,133,.22);
}

.smallnote{
  padding:0 20px 20px;
  color:var(--muted);
  font-size:13px;
}

.rules{ padding:14px 20px 6px; }
.rules__title{ font-weight:900; margin-bottom:8px; }
.rules ul{ margin:0; padding-left:18px; color:var(--muted); }
.rules li{ margin:6px 0; }
.check{ display:flex; gap:10px; align-items:flex-start; color:var(--muted); font-size:13px; }

/* ---------- EXAM ---------- */
body.exam{ background: linear-gradient(180deg, var(--bg0), var(--bg1)); }

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px;
  background: rgba(7,11,20,.82);
  border-bottom:1px solid var(--border2);
  backdrop-filter: blur(14px);
}

.topbar__left,.topbar__right{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

.chip{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--border2);
  background: rgba(255,255,255,.035);
  font-size:13px;
}
.chip--warn{ border-color: rgba(251,191,36,.28); background: rgba(251,191,36,.10); }
.chip--ok{ border-color: rgba(34,197,94,.26); background: rgba(34,197,94,.10); }

.fxbar{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-bottom:1px solid var(--border2);
  background: rgba(15,23,42,.68);
  position:sticky;
  top:56px;
  z-index:9;
  backdrop-filter: blur(14px);
}

.fxbar__fx{
  width:34px; height:34px;
  border-radius:12px;
  display:grid; place-items:center;
  font-weight:900;
  background: rgba(125,211,252,.14);
  border:1px solid rgba(125,211,252,.22);
}

.fxbar__input{
  flex:1;
  height:38px;
  border-radius: 14px;
  border:1px solid var(--border2);
  background: rgba(0,0,0,.18);
  color: var(--text);
  padding:0 12px;
  font-family: var(--mono);
}

.sheetWrap{ padding:14px 12px 28px; }

.sheet{
  border:1px solid var(--border2);
  border-radius: var(--r16);
  overflow:hidden;
  background: rgba(255,255,255,.02);
}

.sheet__row{
  display:grid;
  grid-template-columns: 56px 1fr 320px;
}

.sheet__row--head{
  background: rgba(255,255,255,.04);
}

.cell{
  border-right:1px solid rgba(255,255,255,.05);
  border-bottom:1px solid rgba(255,255,255,.05);
  padding:10px 10px;
  background: rgba(15,23,42,.50);
}

.sheet__row--head .cell{
  background: rgba(255,255,255,.04);
  font-weight:900;
  text-align:center;
  padding:10px 6px;
}

.cell--rownum{
  text-align:center;
  color: var(--muted);
  background: rgba(255,255,255,.03);
  font-family: var(--mono);
}

.cell--prompt{
  background: linear-gradient(90deg, rgba(125,211,252,.06), transparent 55%), rgba(15,23,42,.55);
}

.qmeta{
  display:flex;
  gap:10px;
  align-items:center;
  margin-bottom:6px;
  flex-wrap:wrap;
}

.qid{ font-family: var(--mono); font-weight:900; }
.topic{
  font-size:12px;
  color: var(--muted);
  border:1px solid var(--border2);
  padding:3px 8px;
  border-radius:999px;
  background: rgba(255,255,255,.03);
}

.qtext{ color: var(--text); font-size:13px; line-height:1.35; }

.cell--answer{ background: rgba(15,23,42,.46); }

.cellInput{
  width:100%;
  height:44px;
  border-radius: 12px;
  border:1px solid var(--border2);
  background: rgba(0,0,0,.20);
  color: var(--text);
  padding:0 10px;
  outline:none;
  font-family: var(--mono);
  font-size:14px;
  transition: box-shadow .15s ease, border-color .15s ease;
}

.cellInput:focus{
  border-color: rgba(125,211,252,.42);
  box-shadow:0 0 0 4px rgba(125,211,252,.10);
}

.noselect{ user-select:none; }

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid var(--border2);
  background: rgba(0,0,0,.52);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size:13px;
  opacity:0;
  pointer-events:none;
  transition: opacity .18s ease;
  z-index: 50;
}

.devtoolsLock{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.70);
  display:none;
  align-items:center;
  justify-content:center;
  z-index: 60;
}
.devtoolsLock__box{
  width:min(520px, 92%);
  background: rgba(15,23,42,.88);
  border:1px solid var(--border2);
  border-radius: var(--r20);
  padding:18px;
  backdrop-filter: blur(14px);
}
.devtoolsLock__title{ font-size:18px; font-weight:900; }
.devtoolsLock__text{ color: var(--muted); margin:10px 0 14px; }

/* ---------- RESULTS / ADMIN ---------- */
.sectionTitle{ padding:0 20px; margin:10px 0 10px; font-weight:900; }

.scoreBox{
  display:grid;
  grid-template-columns: 300px 1fr;
  gap:14px;
  padding:16px 20px;
}

.scoreBox__main{
  border:1px solid var(--border2);
  border-radius: var(--r20);
  padding:14px;
  background: rgba(255,255,255,.03);
}

.scoreBig{ font-size:34px; font-weight:1000; letter-spacing:.3px; }
.scoreSub{ color: var(--muted); font-weight:800; margin-top:2px; }
.scoreBox__note{ color: var(--muted); display:grid; gap:6px; align-content:center; }

.grid{
  padding:0 20px 20px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
}

.topicCard{
  border:1px solid var(--border2);
  border-radius: var(--r16);
  padding:12px;
  background: rgba(255,255,255,.03);
}

.topicCard__top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.topicName{ font-weight:900; }
.pill{
  font-size:12px;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid var(--border2);
}

.pill--ok{ border-color: rgba(34,197,94,.28); background: rgba(34,197,94,.10); }
.pill--warn{ border-color: rgba(251,191,36,.28); background: rgba(251,191,36,.10); }
.pill--bad{ border-color: rgba(251,113,133,.28); background: rgba(251,113,133,.10); }

.topicAdvice{ color: var(--muted); margin-top:8px; font-size:13px; }

.details{
  margin:0 20px 20px;
  border:1px solid var(--border2);
  border-radius: var(--r16);
  padding:10px 12px;
  background: rgba(255,255,255,.02);
}

.details summary{ cursor:pointer; font-weight:900; }

.actions{ padding:0 20px 20px; }

/* Professional tables */
.tableWrap{
  margin: 0 20px 20px;
  border:1px solid var(--border2);
  border-radius: var(--r16);
  overflow:hidden;
  background: rgba(255,255,255,.02);
}

.dataTable{
  width:100%;
  border-collapse: collapse;
  min-width: 860px;
}

.dataTable thead th{
  text-align:left;
  font-size:12px;
  letter-spacing:.4px;
  text-transform: uppercase;
  color: rgba(234,240,255,.85);
  background: rgba(255,255,255,.035);
  border-bottom:1px solid rgba(255,255,255,.06);
  padding:12px 12px;
}

.dataTable tbody td{
  padding:12px 12px;
  border-bottom:1px solid rgba(255,255,255,.05);
  color: rgba(234,240,255,.92);
  vertical-align: middle;
}

.dataTable tbody tr:hover{
  background: rgba(125,211,252,.05);
}

.tableScroll{
  overflow:auto;
}

.mono{ font-family: var(--mono); font-size:13px; }
.muted{ color: var(--muted); }

.rowActions{ display:flex; gap:8px; flex-wrap:wrap; }

/* Responsive */
@media (max-width: 980px){
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scoreBox{ grid-template-columns: 1fr; }
}

@media (max-width: 720px){
  .sheet__row{ grid-template-columns: 46px 1fr 240px; }
}

@media (max-width: 560px){
  .sheetWrap{ padding:10px 10px 22px; }
  .sheet__row{ grid-template-columns: 44px 1fr; }
  .sheet__row--head{ display:none; }
  .cell--answer{ grid-column: 1 / -1; }
  .cell--prompt{ grid-column: 1 / -1; }
  .cell--rownum{ display:none; }
  .cellInput{ height:48px; font-size:14px; }
  .tableWrap{ margin: 0 12px 18px; }
}
