/* Mobile-first Dark UI + sticky-hide header + bottom bar */
:root{
  --bg1:#0b1220;
  --bg2:#071024;
  --card: rgba(255,255,255,.06);
  --border: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);
  --muted2: rgba(255,255,255,.45);
  --accent: rgba(120,210,255,.95);
  --good: rgba(80,220,160,.95);
  --bad: rgba(255,105,155,.95);
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans TC", Arial, sans-serif;
  background: radial-gradient(1200px 900px at 20% 20%, rgba(120,210,255,.08), transparent 60%),
              radial-gradient(1000px 800px at 80% 30%, rgba(255,105,155,.07), transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg2));
}

.hidden{ display:none !important; }

.topbar{
  position: sticky;
  top:0;
  z-index: 50;
  padding: calc(12px + var(--safe-top)) 14px 12px 14px;
  backdrop-filter: blur(16px);
  background: rgba(10,16,34,.72);
  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: transform .22s ease, opacity .22s ease;
}
.topbar.hidden{ transform: translateY(-115%); opacity: .2; }
.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:46px; height:46px; border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.10);
  font-weight: 800;
}
.titles{ min-width:0; }
.h1{ font-size: 18px; font-weight: 900; line-height:1.2; }
.h2{ font-size: 12px; color: var(--muted); margin-top: 4px; }

.top-actions{
  margin-top: 10px;
  display:flex; gap:10px; align-items:center; flex-wrap: wrap;
}
.sync-pill{
  padding:8px 10px; border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--muted);
  font-size: 12px;
  display:flex; gap:6px; align-items:center;
}
.ok{ color: var(--good); }

.wrap{
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 14px calc(170px + var(--safe-bottom)) 14px;
}

.panel{
  background: var(--card);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.row{ display:grid; grid-template-columns: 1fr; gap: 14px; }
@media(min-width:900px){ .row{ grid-template-columns: 1fr 1fr; } }

.field .label{ font-size: 12px; color: var(--muted); margin-bottom: 6px; }
select{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.10);
  outline: none;
}
.hint{ margin-top: 8px; font-size: 12px; color: var(--muted2); }
.hint.warn{ color: rgba(255,200,120,.9); }
.hint.tiny{ font-size: 11px; color: var(--muted2); }

.modebar{ margin-top: 14px; display:flex; flex-direction: column; gap: 12px; }
.mode{
  display:flex;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  overflow:hidden;
}
.modebtn{
  flex:1; padding: 12px 10px;
  background: transparent;
  color: var(--muted);
  border: none;
  font-weight: 800;
}
.modebtn.active{ background: rgba(255,255,255,.08); color: var(--text); }

.stats{ display:grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media(min-width:520px){ .stats{ grid-template-columns: repeat(4, 1fr); } }
.stat{
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 12px;
}
.big{ font-size: 22px; font-weight: 900; }
.small{ font-size: 12px; color: var(--muted); margin-top: 4px; }

.card{
  background: var(--card);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 22px;
  padding: 16px;
  margin-top: 14px;
  box-shadow: var(--shadow);
}
.qhead{ display:flex; justify-content: space-between; align-items:center; gap: 10px; margin-bottom: 8px; }
.qno{ font-size: 22px; font-weight: 900; }
.badge{
  padding: 6px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 900;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--muted);
}
.badge.medium{ color: var(--accent); }
.badge.hard{ color: rgba(255,200,120,.95); }

.qtext{ font-size: 18px; line-height: 1.45; margin: 10px 0 12px 0; word-break: break-word; }
.options{ display:flex; flex-direction: column; gap: 10px; }
.opt{
  display:flex; align-items:center; gap: 12px;
  padding: 14px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  cursor:pointer;
}
.opt input{ width: 18px; height: 18px; }
.opt.correct{ border-color: rgba(80,220,160,.55); background: rgba(80,220,160,.10); }
.opt.wrong{ border-color: rgba(255,105,155,.55); background: rgba(255,105,155,.10); }

.feedback{ margin-top: 14px; border-top: 1px dashed rgba(255,255,255,.10); padding-top: 12px; }
.row2{ display:flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pill{
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
}
.pill.good{ color: var(--good); border-color: rgba(80,220,160,.35); }
.pill.bad{ color: var(--bad); border-color: rgba(255,105,155,.35); }
.explain,.extra{ color: var(--muted); font-size: 14px; line-height: 1.55; margin-top: 8px; }

.footnote{ margin-top: 18px; color: var(--muted2); font-size: 12px; line-height: 1.5; }

.btn{
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}
.btn.ghost{ background: transparent; }
.btn.primary{ background: rgba(120,210,255,.14); border-color: rgba(120,210,255,.25); }
.btn.danger{ border-color: rgba(255,105,155,.25); color: rgba(255,185,215,.95); }

.bottombar{
  position: fixed; left:0; right:0; bottom:0;
  padding: 10px 12px calc(10px + var(--safe-bottom)) 12px;
  z-index: 60;
  backdrop-filter: blur(16px);
  background: rgba(10,16,34,.76);
  border-top: 1px solid rgba(255,255,255,.08);
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.triage{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.triagebtn{
  padding: 12px 8px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight: 900;
  font-size: 16px;
}
.triagebtn.active{ outline: 2px solid rgba(120,210,255,.35); }
.triagebtn.nope.active{ outline-color: rgba(255,105,155,.40); }
.triagebtn.know.active{ outline-color: rgba(80,220,160,.40); }

.navbtns{ display:grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; }

.modal{
  position: fixed; inset:0;
  background: rgba(0,0,0,.45);
  display:flex; align-items:center; justify-content:center;
  z-index: 80;
  padding: 16px;
}
.modal-card{
  width:min(720px, 100%);
  border-radius: 22px;
  background: rgba(10,16,34,.92);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow);
}
.modal-head{ display:flex; justify-content: space-between; align-items:center; padding: 14px 14px 10px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.modal-title{ font-weight: 900; font-size: 18px; }
.modal-body{ padding: 14px; }
.input{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.10);
  outline: none;
  margin-top: 6px;
}
.modal-actions{ display:grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
@media(min-width:700px){ .modal-actions{ grid-template-columns: repeat(4, 1fr); } }
