/* Proctor — AWS AI Practitioner prep. Mobile-first PWA. */
:root {
  --bg: #0E1525;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #1A2742 0%, #0E1525 60%);
  --surface: #16213A;
  --surface-2: #1E2D4D;
  --line: #2A3B5E;
  --text: #E6EDF7;
  --muted: #93A4C3;
  --accent: #FF8A3D;      /* lava */
  --accent-2: #FFCD00;    /* gold / XP */
  --ok: #34D399;
  --bad: #F87171;
  --info: #60A5FA;
  --r: 16px;
  --r-sm: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: calc(72px + var(--safe-b));
  line-height: 1.45;
}
h1,h2,h3 { line-height: 1.2; margin: 0 0 .4em; }
small { color: var(--muted); }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: rgba(14,21,37,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-weight: 800; font-size: 20px;
  color: #1a1205; background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 14px rgba(255,138,61,.4);
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); }
.header-stats { display: flex; gap: 14px; }
.hstat { text-align: center; }
.hstat span { font-weight: 800; font-size: 18px; display: block; }
.hstat small { font-size: 10px; }

/* Layout */
.view { padding: 18px 16px 8px; max-width: 720px; margin: 0 auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 22px 2px 10px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* Countdown hero */
.hero { display: flex; gap: 12px; }
.hero .card { text-align: center; }
.hero .big { font-size: 30px; font-weight: 800; }
.hero .big.warn { color: var(--accent); }
.hero .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }

/* Progress ring */
.ring-wrap { display: flex; align-items: center; gap: 14px; }
.ring { --p: 0; --size: 64px; width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p)*1%), var(--line) 0);
  display: grid; place-items: center; flex: 0 0 auto; }
.ring::before { content: ''; position: absolute; }
.ring b { width: calc(var(--size) - 14px); height: calc(var(--size) - 14px); border-radius: 50%;
  background: var(--surface); display: grid; place-items: center; font-size: 14px; font-weight: 800; }

/* Domain cards */
.domain { display: flex; align-items: center; gap: 14px; }
.domain .meta { flex: 1; min-width: 0; }
.domain .name { font-weight: 700; font-size: 15px; }
.domain .sub { font-size: 12px; color: var(--muted); }
.bar { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; transition: width .5s ease; }
.boss { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.boss.locked { background: #2A3B5E; color: var(--muted); }
.boss.open { background: rgba(255,138,61,.18); color: var(--accent); }
.boss.beaten { background: rgba(52,211,153,.18); color: var(--ok); }

/* Buttons */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 13px 16px; border-radius: var(--r-sm); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform .08s ease, background .15s ease; width: 100%;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff6a1a); border-color: transparent; color: #1a1205; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 12px; font-size: 13px; width: auto; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* Drill / questions */
.q-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.pill { background: var(--surface-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 20px; font-size: 11px; }
.q-stem { font-size: 17px; font-weight: 600; margin: 6px 0 16px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  background: var(--surface-2); border: 1.5px solid var(--line); color: var(--text);
  padding: 14px; border-radius: var(--r-sm); margin-bottom: 10px; cursor: pointer; font-size: 15px;
  transition: border-color .12s ease, background .12s ease;
}
.opt .key { font-weight: 800; color: var(--muted); flex: 0 0 auto; }
.opt.sel { border-color: var(--accent); background: rgba(255,138,61,.10); }
.opt.correct { border-color: var(--ok); background: rgba(52,211,153,.13); }
.opt.wrong { border-color: var(--bad); background: rgba(248,113,113,.12); }
.opt[disabled] { cursor: default; }
.explain { background: rgba(96,165,250,.08); border: 1px solid rgba(96,165,250,.3); border-radius: var(--r-sm); padding: 13px; font-size: 14px; margin-top: 4px; }
.explain .verdict { font-weight: 800; margin-bottom: 6px; }
.explain .verdict.ok { color: var(--ok); }
.explain .verdict.bad { color: var(--bad); }
.explain .anchor { margin-top: 8px; color: var(--muted); font-style: italic; font-size: 13px; }

/* Exam timer */
.exam-bar { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 64px; z-index: 10;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 14px; }
.timer { font-weight: 800; font-size: 18px; }
.timer.danger { color: var(--bad); }

/* Tracker */
.task { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 10px 0; }
.task.done { border-color: var(--ok); }
.task .t-name { font-weight: 600; font-size: 14px; }
.task .t-stat { font-size: 12px; color: var(--muted); }

/* Audio */
.track { display: flex; gap: 12px; align-items: center; }
.track .pi { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: 0 0 auto; color: var(--accent); font-size: 18px; }
.track .ti { flex: 1; min-width: 0; }
.track .tt { font-weight: 700; font-size: 14px; }
.track .td { font-size: 12px; color: var(--muted); }
.badge-soon { font-size: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); padding: 3px 8px; border-radius: 20px; }
audio { width: 100%; margin-top: 10px; }

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(14,21,37,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tab { background: none; border: none; color: var(--muted); padding: 9px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; font: inherit; }
.tab-ico { font-size: 19px; line-height: 1; }
.tab-label { font-size: 10px; font-weight: 600; }
.tab.active { color: var(--accent); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 11px 16px;
  border-radius: 24px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); z-index: 40;
  opacity: 0; transition: opacity .2s ease, transform .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* Install banner */
.install-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 10px 16px; font-size: 13px; }
.install-banner > div { display: flex; gap: 8px; }

.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 14px; }
.big-score { font-size: 44px; font-weight: 800; }
.pass { color: var(--ok); } .fail { color: var(--bad); }
