/* ---------------------------------------------------------------------------
   DKU Interview Practice (unofficial) — global styles.
   Light, professional, lots of whitespace. Deliberately NOT Duke/DKU branding:
   neutral slate ink + deep teal accent.
--------------------------------------------------------------------------- */
:root {
  --bg: #f7f9fa;
  --surface: #ffffff;
  --ink: #1c2733;
  --muted: #5d6c7b;
  --accent: #0e7569;
  --accent-ink: #0a5950;
  --accent-soft: #e4f2f0;
  --border: #e2e8ed;
  --danger: #b3362c;
  --danger-soft: #faeae8;
  --warn-soft: #fdf3e0;
  --warn-ink: #8a5a00;
  --rec: #d63b3b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 30, 44, 0.07), 0 6px 18px rgba(16, 30, 44, 0.05);
  --maxw: 1080px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}
main { flex: 1; }

h1, h2, h3 { line-height: 1.25; font-weight: 650; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0.5em 0; }
a { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* ---------- Header / footer ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 16px;
  min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px;
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.brand .tag {
  font-size: 0.7rem; font-weight: 600; color: var(--warn-ink);
  background: var(--warn-soft); border-radius: 99px; padding: 2px 8px;
  margin-left: 8px; vertical-align: 2px; white-space: nowrap;
}
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a, .site-nav button {
  font-size: 0.925rem; color: var(--ink); text-decoration: none;
  padding: 8px 12px; border-radius: 8px; background: none; border: none; cursor: pointer;
  font-family: inherit;
}
.site-nav a:hover, .site-nav button:hover { background: var(--bg); }

.disclaimer-bar {
  background: var(--warn-soft); color: var(--warn-ink);
  font-size: 0.85rem; text-align: center; padding: 7px 16px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 56px; padding: 28px 0;
  font-size: 0.85rem; color: var(--muted);
}
.site-footer .container { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 0.95rem; font-weight: 600;
  padding: 10px 20px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background-color 0.15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px;
}
.card + .card { margin-top: 20px; }

.page-title { margin: 40px 0 20px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 3px solid var(--accent-soft); border-color: var(--accent);
}
.field .hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.form-error {
  background: var(--danger-soft); color: var(--danger);
  border-radius: 8px; padding: 10px 14px; font-size: 0.9rem; margin-bottom: 16px;
}
.form-error:empty { display: none; }

.auth-card { max-width: 420px; margin: 64px auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  border-radius: 99px; padding: 2px 10px; white-space: nowrap;
}
.badge-green { background: var(--accent-soft); color: var(--accent-ink); }
.badge-gray { background: #eef1f4; color: var(--muted); }
.badge-amber { background: var(--warn-soft); color: var(--warn-ink); }

/* ---------- Landing ---------- */
.hero { padding: 88px 0 64px; text-align: center; }
.hero h1 { font-size: 2.6rem; margin: 0 0 16px; max-width: 720px; margin-inline: auto; }
.hero p.lede { font-size: 1.15rem; color: var(--muted); max-width: 620px; margin: 0 auto 32px; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin: 24px 0 56px; }
.feature h3 { margin-top: 0; }
.steps { counter-reset: step; display: grid; gap: 14px; margin: 24px 0; padding: 0; list-style: none; }
.steps li {
  counter-increment: step; display: flex; gap: 14px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px;
}
.steps li::before {
  content: counter(step);
  font-weight: 700; color: var(--accent-ink); background: var(--accent-soft);
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px;
  display: inline-flex; align-items: center; justify-content: center; transform: translateY(4px);
}

/* ---------- Dashboard ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat .num { font-size: 2.2rem; font-weight: 700; color: var(--accent-ink); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(18, 28, 38, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal { background: var(--surface); border-radius: var(--radius); max-width: 560px; width: 100%; padding: 28px; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }
[hidden] { display: none !important; }

/* ---------- Exam screen (desktop-first) ---------- */
.exam-body { background: #f1f4f6; }
.exam-topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.exam-topbar .container {
  display: flex; align-items: center; gap: 20px; min-height: 62px; flex-wrap: wrap; padding-block: 8px;
}
.exam-meta { display: flex; flex-direction: column; }
.exam-meta .section-label { font-weight: 650; font-size: 0.95rem; }
.exam-meta .q-count { font-size: 0.8rem; color: var(--muted); }
.timers { margin-left: auto; display: flex; gap: 24px; align-items: center; }
.timer { text-align: right; }
.timer .t-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.timer .t-value { font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 700; }
.timer.urgent .t-value { color: var(--danger); }

.rec-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 700; color: var(--rec);
  border: 1px solid currentColor; border-radius: 99px; padding: 4px 12px;
}
.rec-indicator .dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--rec);
  animation: rec-pulse 1.4s ease-in-out infinite;
}
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) {
  .rec-indicator .dot { animation: none; }
  * { transition: none !important; }
}

.progress-track { height: 5px; background: var(--border); }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width 0.4s ease; }

.exam-stage { max-width: 840px; margin: 48px auto; padding: 0 24px; }
.question-text { font-size: 1.5rem; font-weight: 600; line-height: 1.45; margin: 12px 0 8px; }
.followup-block {
  margin-top: 24px; border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; padding: 14px 18px;
}
.followup-block .fu-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-ink); }
.followup-block p { font-size: 1.15rem; font-weight: 550; margin: 4px 0 0; }
.exam-actions { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }

/* Tier picker on the dashboard */
.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 8px; }
.tier-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.tier-card .tier-name { font-weight: 700; font-size: 1.1rem; color: var(--accent-ink); }
.tier-card .tier-attempts { font-size: 1.8rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.tier-card .tier-desc { flex: 1; margin: 4px 0 12px; }
.tier-card.tier-empty { opacity: 0.6; }

/* Recording block — deliberately prominent so it's obvious we're recording. */
.rec-block {
  margin-top: 28px; border: 2px solid var(--rec); border-radius: 12px;
  background: #fff6f5; padding: 18px 20px;
}
.rec-block-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rec-live { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--rec); }
.rec-live .dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--rec);
  animation: rec-pulse 1.4s ease-in-out infinite;
}
.rec-seg { text-align: right; }
.rec-seg-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.rec-seg-timer { font-variant-numeric: tabular-nums; font-size: 1.6rem; font-weight: 750; color: var(--ink); }
.rec-seg-timer.urgent { color: var(--danger); }
.rec-wave {
  display: block; width: 100%; height: 64px; margin: 14px 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.rec-hint { font-size: 0.9rem; color: var(--muted); margin: 0 0 16px; }

/* AI-generated follow-up banner */
.ai-banner {
  margin: 12px 0; padding: 12px 16px; border: 1px solid var(--accent);
  background: var(--accent-soft); border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.ai-tag { font-weight: 700; color: var(--accent-ink); margin-right: 8px; }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Follow-up indicator dot: green = has a follow-up, yellow = none. */
.fu-dot {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  vertical-align: middle; border: 1px solid rgba(0,0,0,0.12);
}
.fu-dot.has { background: #2e9e5b; }
.fu-dot.none { background: #e6b800; }
.rec-next { width: 100%; }
@media (prefers-reduced-motion: reduce) { .rec-live .dot { animation: none; } }

.countdown-hero { text-align: center; padding: 24px 0; }
.countdown-hero .big { font-size: 4rem; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--accent-ink); }

.notice-box { background: var(--warn-soft); color: var(--warn-ink); border-radius: 8px; padding: 12px 16px; font-size: 0.95rem; }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 12px 16px; }

/* Animated ellipsis for "AI scoring in progress…" while the report auto-polls. */
.dots::after { content: ''; animation: dots-cycle 1.4s steps(4, end) infinite; }
@keyframes dots-cycle { 0% { content: ''; } 25% { content: '·'; } 50% { content: '··'; } 75%, 100% { content: '···'; } }
@media (prefers-reduced-motion: reduce) { .dots::after { content: '···'; animation: none; } }

/* ---------- Report ---------- */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 18px 0; }
.score-dim { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.score-dim .dim-label { font-size: 0.82rem; color: var(--muted); }
.score-dim .dim-value { font-size: 1.45rem; font-weight: 700; }
.score-dim .dim-value .dim-max { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.chart-wrap { position: relative; max-width: 480px; margin: 12px auto; }
.chart-empty-note {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); font-size: 0.9rem; padding: 32px;
}
.report-q { margin-top: 20px; }
.report-q video { width: 100%; max-width: 560px; border-radius: 8px; background: #000; display: block; margin-top: 12px; }
.report-q .fu-list { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 24px 0; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-weight: 600; font-size: 0.95rem; color: var(--muted);
  background: none; border: none; border-bottom: 3px solid transparent;
  padding: 10px 16px; cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent-ink); }
th.sortable[aria-sort="asc"]::after { content: " ▲"; font-size: 0.7em; }
th.sortable[aria-sort="desc"]::after { content: " ▼"; font-size: 0.7em; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.pager button { font: inherit; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.pager button:disabled { opacity: 0.5; cursor: not-allowed; }
.cred-field input { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.att-rows { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.att-label { font-weight: 600; }
.att-stepper { display: inline-flex; align-items: center; gap: 6px; }
.att-stepper input { width: 64px; text-align: center; padding: 8px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.att-btn { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.att-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
tr.qgroup td { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 0.95rem; padding-top: 12px; }
tr.qsub td { background: var(--bg); font-weight: 600; color: var(--ink); }
#qd-followups .followup-block { margin-top: 10px; }
.signal-pill { display: inline-block; background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 8px 12px; margin: 4px 8px 4px 0; font-size: 0.85rem; }
.signal-pill.ok { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .hero { padding: 56px 0 40px; }
  .hero h1 { font-size: 1.9rem; }
  .question-text { font-size: 1.25rem; }
  .timers { gap: 14px; }
  .timer .t-value { font-size: 1.1rem; }
  .card { padding: 20px; }
  .exam-stage { margin: 24px auto; }
}
