/* Luyện phỏng vấn 25858B – dùng token của Bolt Robotics Design System. */
@font-face {
  font-family: 'Fredoka Bolt';
  src: url('../assets/fonts/Fredoka-Bolt-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  --bolt-purple: #5D22C6;
  --bolt-ink: #101820;
  --bolt-paper: #F4F7FF;
  --purple-50: #F2ECFF;
  --purple-100: #E4D7FE;
  --purple-200: #C8AEFC;
  --purple-600: #4D18AC;
  --purple-700: #3D1389;
  --ink-50: #ECEFF7;
  --ink-100: #DDE2EC;
  --ink-200: #C3C9D6;
  --ink-300: #9AA1B2;
  --ink-400: #6E7689;
  --ink-500: #4B5365;
  --ink-700: #222A38;
  --success: #1F9D6B;
  --success-strong: #167450;
  --success-soft: #E1F5EC;
  --warning: #E8A317;
  --warning-strong: #8A5D00;
  --warning-soft: #FCF1D8;
  --danger: #E0445B;
  --danger-strong: #B3263C;
  --danger-soft: #FCE4E8;

  --surface-page: var(--bolt-paper);
  --surface-card: #FFFFFF;
  --text-strong: var(--bolt-ink);
  --text-body: var(--ink-700);
  --text-muted: var(--ink-500);
  --border-subtle: var(--ink-100);
  --border-default: var(--ink-200);
  --ring-brand: color-mix(in srgb, var(--bolt-purple) 35%, transparent);

  --font-display: 'Fredoka Bolt', 'Fredoka', system-ui, sans-serif;
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.375rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.25rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3rem;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --border-width: 1.5px;
  --shadow-sm: 0 2px 6px rgba(16, 24, 32, 0.07);
  --shadow-md: 0 6px 18px rgba(16, 24, 32, 0.09);
  --focus-ring: 0 0 0 3px var(--ring-brand);
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --container: 1120px;
  --container-narrow: 720px;
  --hex: polygon(50% 0, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--text-strong); line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--purple-600); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
[hidden] { display: none !important; }

/* ---- Khung trang ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface-card);
  border-bottom: var(--border-width) solid var(--border-subtle);
}
.topbar__inner {
  max-width: var(--container); margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}
.topbar__logo { height: 28px; width: auto; }
.topbar__home { display: flex; align-items: center; min-height: 44px; border-radius: var(--radius-sm); }
.topbar__tag { font-family: var(--font-display); font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }
.threads { height: 10px; background: url('../assets/threads-strip.svg') left center / auto 100% repeat-x; opacity: 0.9; }
.page { max-width: var(--container); margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-8); }
.page--narrow { max-width: var(--container-narrow); }
.stack { display: grid; gap: var(--space-4); }
.stack--lg { gap: var(--space-5); }
.muted { color: var(--text-muted); }
.small { font-size: var(--text-sm); }
.eyebrow { font-family: var(--font-display); font-size: var(--text-sm); color: var(--bolt-purple); letter-spacing: 0.04em; }

/* ---- Nút ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-5);
  border: var(--border-width) solid transparent; border-radius: var(--radius-pill);
  font-family: var(--font-display); font-size: var(--text-base); text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--bolt-purple); color: var(--bolt-paper); }
.btn--primary:hover { background: var(--purple-600); }
.btn--ghost { background: var(--surface-card); border-color: var(--border-default); color: var(--text-strong); }
.btn--ghost:hover { background: var(--purple-50); border-color: var(--bolt-purple); }
.btn--block { width: 100%; }
.btn--sm { min-height: 44px; padding: 0 var(--space-4); font-size: var(--text-sm); }
.btn svg { width: 18px; height: 18px; flex: none; }
.linkbtn {
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-height: 44px; padding: 0 var(--space-2); margin-left: calc(-1 * var(--space-2));
  background: none; border: 0; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-size: var(--text-sm); color: var(--purple-600); text-decoration: none;
}
.linkbtn:hover { background: var(--purple-50); }
.linkbtn svg { width: 18px; height: 18px; }

/* ---- Thẻ ---- */
.card {
  background: var(--surface-card);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.hexnut {
  width: 56px; aspect-ratio: 1 / 1.1; flex: none;
  display: grid; place-items: center;
  clip-path: var(--hex);
  background: var(--bolt-purple); color: var(--bolt-paper);
  font-family: var(--font-display); font-size: var(--text-lg);
}
.hexnut--sm { width: 34px; font-size: var(--text-sm); }
.hexnut--soft { background: var(--purple-100); color: var(--purple-700); }

/* ---- Chọn tên ---- */
.namegrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.namecard {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: var(--space-5) var(--space-3);
  background: var(--surface-card); border: var(--border-width) solid var(--border-subtle); border-radius: var(--radius-lg);
  font-family: var(--font-display); font-size: var(--text-lg); color: var(--text-strong);
  transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.namecard:hover { transform: translateY(-3px); border-color: var(--bolt-purple); box-shadow: var(--shadow-md); }
.namecard:active { transform: scale(0.97); }
.userchip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-3) 0 var(--space-1);
  background: var(--surface-card); border: var(--border-width) solid var(--border-default); border-radius: var(--radius-pill);
  font-family: var(--font-display); font-size: var(--text-sm); color: var(--text-strong);
}
.userchip:hover { border-color: var(--bolt-purple); background: var(--purple-50); }
.userchip__switch { color: var(--text-muted); }

/* ---- Bộ câu hỏi, tiến độ ---- */
.setgrid { display: grid; gap: var(--space-4); }
.setcard { display: grid; gap: var(--space-4); }
.setcard__head { display: flex; align-items: center; gap: var(--space-3); }
.setcard__count { font-size: var(--text-sm); color: var(--text-muted); }
.meter { display: flex; height: 12px; background: var(--ink-50); border-radius: var(--radius-pill); overflow: hidden; }
.meter > span { display: block; height: 100%; }
.meter__good { background: var(--success); }
.meter__part { background: var(--warning); }
.meter__miss { background: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-size: var(--text-sm); color: var(--text-muted); }
.legend b { color: var(--text-strong); font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: var(--space-1); background: var(--ink-200); }
.dot--good { background: var(--success); }
.dot--part { background: var(--warning); }
.dot--miss { background: var(--danger); }
.sectionhead { font-family: var(--font-display); font-size: var(--text-sm); color: var(--text-muted); letter-spacing: 0.04em; margin-top: var(--space-3); }
.grouplist { display: grid; gap: var(--space-2); }
.grouprow {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--space-1) var(--space-3);
  width: 100%; min-height: 64px; padding: var(--space-3) var(--space-4); text-align: left;
  background: var(--surface-card); border: var(--border-width) solid var(--border-subtle); border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.grouprow:hover { border-color: var(--bolt-purple); background: var(--purple-50); }
.grouprow__title { font-family: var(--font-display); color: var(--text-strong); }
.grouprow__num { font-family: var(--font-display); font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }
.grouprow .meter { grid-column: 1 / -1; height: 6px; }
.badge {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 var(--space-2);
  border-radius: var(--radius-pill); font-family: var(--font-display); font-size: var(--text-xs);
  background: var(--purple-50); color: var(--purple-700);
}
.badge--hard { background: var(--danger-soft); color: var(--danger-strong); }
.badge--good { background: var(--success-soft); color: var(--success-strong); }

/* ---- Màn luyện tập ---- */
.practice { display: grid; gap: var(--space-4); }
.practice__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.practice__step { font-family: var(--font-display); font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }
.practice__main { display: grid; gap: var(--space-4); }
.practice__main:not(.practice__main--figure) { max-width: var(--container-narrow); }
.qcard { display: grid; gap: var(--space-3); }
.qcard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); }
.qcard__text { font-family: var(--font-display); font-size: var(--text-lg); color: var(--text-strong); line-height: 1.3; }
.speak { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding-top: var(--space-3); border-top: var(--border-width) solid var(--border-subtle); }
.speak__hint { flex: 1 1 200px; font-size: var(--text-sm); color: var(--text-muted); }
.timer { font-family: var(--font-display); font-size: var(--text-lg); color: var(--bolt-purple); font-variant-numeric: tabular-nums; min-width: 3.2em; }
.recorder { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); width: 100%; }
.recorder audio { height: 40px; max-width: 100%; }
.recdot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

.figure { display: grid; gap: var(--space-2); padding: var(--space-3); }
.figure__frame {
  position: relative; display: block; width: 100%; padding: 0; overflow: hidden;
  max-height: 260px; background: var(--ink-50);
  border: var(--border-width) solid var(--border-subtle); border-radius: var(--radius-md);
}
.figure__frame img { width: 100%; }
.figure__zoom {
  position: absolute; right: var(--space-2); bottom: var(--space-2);
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill);
  background: var(--bolt-ink); color: var(--bolt-paper); font-family: var(--font-display); font-size: var(--text-xs);
}
.figure__zoom svg { width: 14px; height: 14px; }
.figure__nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.figure__caption { font-family: var(--font-display); font-size: var(--text-sm); color: var(--text-strong); text-align: center; flex: 1; }
.iconbtn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  background: var(--surface-card); border: var(--border-width) solid var(--border-default); border-radius: 50%;
}
.iconbtn:hover:not(:disabled) { border-color: var(--bolt-purple); background: var(--purple-50); }
.iconbtn:disabled { opacity: 0.35; cursor: default; }
.iconbtn svg { width: 20px; height: 20px; }

.answer { display: grid; gap: var(--space-3); border-color: var(--purple-200); }
.answer__label { font-family: var(--font-display); font-size: var(--text-sm); color: var(--bolt-purple); letter-spacing: 0.04em; }
.answer__text { font-size: var(--text-md); color: var(--text-strong); max-width: 65ch; }
.callout { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--purple-50); font-size: var(--text-sm); }
.callout b { font-family: var(--font-display); font-weight: 600; color: var(--purple-700); }
.callout--note { background: var(--warning-soft); }
.callout--note b { color: var(--warning-strong); }
.rate { display: grid; gap: var(--space-2); }
.rate__title { font-family: var(--font-display); color: var(--text-strong); }
.rate__options { display: grid; gap: var(--space-2); }
.ratebtn {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 56px; padding: var(--space-2) var(--space-4); text-align: left;
  background: var(--surface-card); border: var(--border-width) solid var(--border-default); border-radius: var(--radius-md);
  font-family: var(--font-display); color: var(--text-strong);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.ratebtn:active { transform: scale(0.97); }
.ratebtn small { display: block; font-family: var(--font-body); font-size: var(--text-sm); color: var(--text-muted); }
.ratebtn__mark { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.ratebtn--0 .ratebtn__mark { background: var(--danger); }
.ratebtn--1 .ratebtn__mark { background: var(--warning); }
.ratebtn--2 .ratebtn__mark { background: var(--success); }
.ratebtn--0:hover { border-color: var(--danger); background: var(--danger-soft); }
.ratebtn--1:hover { border-color: var(--warning); background: var(--warning-soft); }
.ratebtn--2:hover { border-color: var(--success); background: var(--success-soft); }

.summary { text-align: center; justify-items: center; }
.summary__stats { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-5); }
.summary__stat b { display: block; font-family: var(--font-display); font-size: var(--text-2xl); color: var(--text-strong); line-height: 1.1; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--warning-soft); color: var(--warning-strong); font-size: var(--text-sm); }

/* ---- Xem trang notebook cỡ lớn ---- */
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr; background: var(--bolt-ink); }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); color: var(--bolt-paper); font-family: var(--font-display); font-size: var(--text-sm); }
.lightbox__tools { display: flex; gap: var(--space-2); }
.lightbox .iconbtn { background: transparent; border-color: var(--ink-400); color: var(--bolt-paper); }
.lightbox .iconbtn:hover:not(:disabled) { background: var(--ink-700); border-color: var(--bolt-paper); }
.lightbox__scroll { overflow: auto; -webkit-overflow-scrolling: touch; }
.lightbox__scroll img { width: 100%; max-width: 1240px; margin: 0 auto; background: #fff; }
.lightbox__scroll.is-zoomed img { width: 220%; max-width: none; }

/* ---- Trang HLV ---- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-family: var(--font-display); font-weight: 600; color: var(--text-muted); padding: var(--space-2) var(--space-3); border-bottom: var(--border-width) solid var(--border-default); white-space: nowrap; }
.table td { padding: var(--space-3); border-bottom: var(--border-width) solid var(--border-subtle); vertical-align: middle; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover, .table tbody tr.is-open { background: var(--purple-50); }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .meter { min-width: 120px; height: 8px; margin-top: var(--space-1); }
.who { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; font-family: var(--font-display); font-size: var(--text-base); color: var(--text-strong); background: none; border: 0; padding: 0; }
.tablewrap { overflow-x: auto; padding: var(--space-2) 0; }
.days { display: flex; align-items: flex-end; gap: var(--space-1); max-width: 420px; }
.days__bar { flex: 1; display: grid; gap: var(--space-1); text-align: center; font-size: var(--text-xs); color: var(--text-muted); }
.days__bar i { display: block; background: var(--purple-200); border-radius: 4px 4px 0 0; min-height: 2px; }
.detail { display: grid; gap: var(--space-5); }
.cells { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.cell {
  min-width: 44px; padding: 2px var(--space-2); border-radius: 6px; text-align: center;
  font-size: var(--text-xs); font-variant-numeric: tabular-nums;
  background: var(--ink-50); color: var(--text-muted); border: var(--border-width) solid transparent;
}
.cell--0 { background: var(--danger-soft); color: var(--danger-strong); border-color: var(--danger); }
.cell--1 { background: var(--warning-soft); color: var(--warning-strong); border-color: var(--warning); }
.cell--2 { background: var(--success-soft); color: var(--success-strong); }
.grouphead { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); margin-bottom: var(--space-1); }
.weaklist { display: grid; gap: var(--space-2); padding: 0; margin: 0; list-style: none; }
.weaklist li { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-3); align-items: start; font-size: var(--text-sm); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }

@media (min-width: 640px) {
  h1 { font-size: var(--text-2xl); }
  .namegrid { grid-template-columns: repeat(4, 1fr); }
  .setgrid { grid-template-columns: 1fr 1fr; }
  .rate__options { grid-template-columns: repeat(3, 1fr); }
  .ratebtn { flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) var(--space-4); }
  .page { padding-top: var(--space-6); }
}
@media (min-width: 960px) {
  .practice__main--figure { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto 1fr; align-items: start; }
  .practice__main--figure .figure { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 84px; }
  .practice__main--figure .qcard { grid-column: 2; grid-row: 1; }
  .practice__main--figure .practice__after { grid-column: 2; grid-row: 2; }
  .figure__frame { max-height: min(70vh, 640px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
