/* StudyDeck — unified frontend */

:root {
  --primary: #635bff;
  --primary-dark: #5148e5;
  --primary-soft: #efedff;
  --background: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafafe;
  --text: #171822;
  --secondary: #676b78;
  --muted: #969aa6;
  --border: #e5e7ee;
  --success: #159957;
  --success-soft: #e9f8ef;
  --warning: #c47a00;
  --warning-soft: #fff4d7;
  --danger: #d94249;
  --danger-soft: #ffebed;
  --shadow: 0 12px 34px rgba(23, 24, 34, 0.08);
  --shadow-lg: 0 22px 70px rgba(23, 24, 34, 0.16);
  --radius: 16px;
  --radius-lg: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
img { max-width: 100%; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.text-secondary { color: var(--secondary); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 68px;
  padding: 10px 26px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
}

.brand-button {
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
}
.brand-logo { width: 150px; max-height: 42px; object-fit: contain; }
.brand-fallback { display: none; color: var(--primary); font-size: 21px; font-weight: 850; }

.nav-links, .nav-actions, .hero-actions, .table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-links { justify-content: flex-start; }
.nav-actions { justify-content: flex-end; }
.nav-link {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--secondary);
  border-radius: 9px;
  font-weight: 700;
}
.nav-link:hover { background: #f0f1f6; color: var(--text); }
.admin-nav { color: var(--primary); }
.nav-email { font-size: 13px; color: var(--secondary); }

.btn {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 800;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 6px 18px rgba(99,91,255,.22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--text); border-color: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning-soft); color: #805000; border-color: #f0d38c; }
.btn-danger { background: var(--danger); color: white; }
.btn-small { min-height: 34px; padding: 0 11px; font-size: 13px; }
.btn-large { min-height: 50px; }
.btn-tiny { min-height: 30px; padding: 0 9px; font-size: 12px; }

.app-root { min-height: calc(100vh - 68px); }
.page-shell, .study-shell {
  width: min(1180px, calc(100% - 38px));
  margin: 0 auto;
  padding: 38px 0 70px;
}
.study-shell.narrow { width: min(820px, calc(100% - 38px)); }

.loading-card {
  width: min(560px, calc(100% - 40px));
  margin: 90px auto;
  padding: 34px;
  text-align: center;
  color: var(--secondary);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero, .page-header, .set-hero, .admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}
.hero-compact, .set-hero {
  padding: 30px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.hero h1, .page-header h1, .set-hero h1, .admin-header h1 {
  margin: 3px 0 8px;
  font-size: clamp(31px, 5vw, 48px);
  letter-spacing: -.045em;
}
.hero p, .page-header p, .set-hero p, .admin-header p {
  margin: 0;
  color: var(--secondary);
  line-height: 1.6;
}
.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: 11px;
  font-weight: 900;
}
.eyebrow.light { color: rgba(255,255,255,.75); }
.centered { justify-content: center; }

.section { margin: 34px 0; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 16px;
}
.section-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.section-heading p { margin: 4px 0 0; color: var(--secondary); }

.panel {
  padding: 23px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(23,24,34,.05);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 18px;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.set-card {
  width: 100%;
  padding: 20px;
  text-align: left;
  color: inherit;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 15px rgba(23,24,34,.045);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.set-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #d5d1ff; }
.set-card h3 { margin: 15px 0 7px; font-size: 19px; }
.set-card p { margin: 0 0 14px; min-height: 39px; color: var(--secondary); line-height: 1.5; }
.set-card small { color: var(--muted); }
.set-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-count { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}
.badge-success, .role-student { color: #137844; background: var(--success-soft); }
.badge-warning { color: #8c5a00; background: var(--warning-soft); }
.badge-danger { color: #9f2b31; background: var(--danger-soft); }
.badge-primary, .role-admin { color: var(--primary); background: var(--primary-soft); }
.role-teacher { color: #0869a7; background: #e9f5ff; }
.badge-muted { color: #666b78; background: #eff0f4; }

.announcement-strip {
  margin: 0 0 24px;
  display: grid;
  gap: 8px;
}
.announcement-strip > div {
  padding: 12px 16px;
  color: #554fbc;
  background: var(--primary-soft);
  border: 1px solid #dcd8ff;
  border-radius: 11px;
}

.list-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  text-align: left;
}
.list-row:last-child { border-bottom: 0; }
.list-row:not(.static):hover strong { color: var(--primary); }
.list-row span:first-child { display: flex; flex-direction: column; gap: 3px; }
.list-row small { color: var(--muted); }

.auth-page {
  min-height: calc(100vh - 68px);
  display: grid;
  place-items: center;
  padding: 42px 20px;
}
.auth-card {
  width: min(460px, 100%);
  padding: 32px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 26px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.auth-tab {
  min-height: 39px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--secondary);
  font-weight: 800;
}
.auth-tab.active { color: var(--primary); background: white; box-shadow: 0 2px 8px rgba(20,20,40,.07); }
.auth-heading { text-align: center; margin-bottom: 21px; }
.auth-heading h1 { margin: 8px 0 7px; font-size: 25px; letter-spacing: -.035em; }
.auth-heading p { margin: 0; color: var(--secondary); line-height: 1.55; font-size: 13px; }
.auth-logo { width: 54px; height: 54px; object-fit: contain; border-radius: 12px; }

.form, .modal-body { display: flex; flex-direction: column; gap: 15px; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 750; }
input, textarea, select {
  width: 100%;
  min-height: 45px;
  padding: 10px 13px;
  color: var(--text);
  background: white;
  border: 1px solid #dfe1e8;
  border-radius: 10px;
  outline: none;
}
textarea { min-height: 105px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,91,255,.11);
}

.auth-divider {
  position: relative;
  margin: 22px 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: var(--border);
}
.auth-divider span { position: relative; padding: 0 10px; background: white; }
.google-button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 11px;
  font-weight: 800;
}
.google-button:hover { background: #fafafa; }
.google-g { color: #4285f4; font-size: 18px; font-weight: 900; }
.link-button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 750;
}

.alert {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.alert-danger { color: #992d33; background: var(--danger-soft); border: 1px solid #f4c4c7; }
.alert-warning { color: #815300; background: var(--warning-soft); border: 1px solid #f0daa1; }
.alert-success { color: #12723f; background: var(--success-soft); border: 1px solid #c9ebd8; }

.empty-state {
  min-height: 220px;
  padding: 35px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--secondary);
  background: white;
  border: 1px dashed #d9dbe4;
  border-radius: var(--radius);
}
.empty-state.small { min-height: 100px; padding: 20px; }
.empty-state h3, .empty-state h2 { margin: 0 0 6px; color: var(--text); }
.empty-state p { margin: 0 0 15px; }

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 22px;
}

.back-button {
  margin-bottom: 15px;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--secondary);
  font-weight: 800;
}
.back-button:hover { color: var(--primary); }

.set-status-line { display: flex; gap: 8px; }
.study-mode-grid {
  margin-bottom: 25px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 13px;
}
.mode-card {
  min-height: 145px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 7px;
  text-align: left;
  color: inherit;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mode-card:hover:not(:disabled) { border-color: var(--primary); box-shadow: var(--shadow); }
.mode-card strong { font-size: 18px; }
.mode-card small { color: var(--secondary); }
.mode-icon { color: var(--primary); font-size: 25px; font-weight: 900; }

.card-list { display: grid; }
.term-row {
  display: grid;
  grid-template-columns: 42px minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 15px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.term-row:last-child { border-bottom: 0; }
.term-number { color: var(--muted); font-size: 12px; font-weight: 850; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(15,16,25,.56);
  backdrop-filter: blur(7px);
}
.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.modal-header, .modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 21px;
}
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--border); background: #fbfbfd; }
.modal-header h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 21px; }
.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  color: var(--secondary);
  font-size: 20px;
}
.danger-icon { color: var(--danger); }
.danger-box {
  padding: 16px;
  color: #8d292e;
  background: var(--danger-soft);
  border: 1px solid #efbec2;
  border-radius: 12px;
}
.danger-box p { margin-bottom: 0; }
.danger-box code { display: block; margin-top: 10px; overflow-wrap: anywhere; }

.editor-heading { display: flex; justify-content: space-between; align-items: center; }
.editor-cards { display: grid; gap: 11px; }
.editor-card {
  display: grid;
  grid-template-columns: 34px 1fr 1.25fr 38px;
  gap: 9px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.editor-card textarea { min-height: 70px; }
.editor-number {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 850;
  font-size: 12px;
}

.study-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px;
}
.study-topbar > div { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.study-topbar > div span, .study-topbar > span { color: var(--secondary); font-size: 12px; }
.study-topbar > :last-child { justify-self: end; }

.progress-track {
  height: 7px;
  margin-bottom: 25px;
  overflow: hidden;
  background: #e6e7ee;
  border-radius: 999px;
}
.progress-fill { height: 100%; background: var(--primary); border-radius: inherit; transition: width .25s ease; }

/* Entire flashcard rotates: the faces do not separately rotate in place. */
.flashcard {
  width: min(850px, 100%);
  height: 430px;
  margin: 20px auto;
  padding: 0;
  border: 0;
  background: transparent;
  perspective: 1400px;
}
.flashcard-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .48s cubic-bezier(.2,.75,.3,1);
}
.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  padding: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}
.flashcard-face small { color: var(--primary); font-weight: 900; letter-spacing: .1em; }
.flashcard-face > span { max-width: 720px; font-size: clamp(28px, 4vw, 46px); font-weight: 800; line-height: 1.2; text-align: center; }
.flashcard-face em { color: var(--muted); font-size: 12px; font-style: normal; }
.flashcard-back { transform: rotateY(180deg); background: #fbfaff; }

.flash-nav, .rating-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.rating-row { margin-top: 25px; color: var(--secondary); }
.rating {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  font-weight: 800;
}
.rating.again { color: var(--danger); }
.rating.hard { color: #b36b00; }
.rating.good { color: #2379bc; }
.rating.easy { color: var(--success); }

.question-card {
  margin: 30px 0 18px;
  padding: 32px;
  text-align: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.question-card small { color: var(--primary); font-weight: 900; letter-spacing: .1em; }
.question-card h2 { margin: 13px 0 0; font-size: clamp(26px, 4vw, 38px); }
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; margin-bottom: 18px; }
.answer-option {
  min-height: 86px;
  padding: 16px;
  text-align: left;
  color: var(--text);
  background: white;
  border: 1px solid var(--border);
  border-radius: 13px;
  font-weight: 750;
}
.answer-option:hover { border-color: var(--primary); background: #fbfaff; }
.feedback {
  margin-top: 18px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 12px;
}
.feedback.correct { background: var(--success-soft); color: #126f3e; }
.feedback.wrong { background: var(--danger-soft); color: #8f2d33; }
.feedback .btn { margin-left: auto; }

.test-list { display: grid; gap: 16px; margin: 25px 0; }
.test-question {
  padding: 22px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.test-question h3 { margin: 8px 0 18px; font-size: 20px; }
.question-number { color: var(--primary); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.tf-statement { padding: 12px; background: var(--surface-2); border-radius: 10px; }
.test-options { display: grid; gap: 8px; }
.test-options.two { grid-template-columns: 1fr 1fr; }
.radio-option {
  flex-direction: row;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.radio-option input { width: auto; min-height: 0; box-shadow: none; }
.written-answer { margin-top: 4px; }

.result-card {
  padding: 42px 28px;
  text-align: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.result-card h1 { margin: 12px 0 8px; font-size: 34px; }
.result-card p { color: var(--secondary); }
.result-logo { width: 65px; height: 65px; object-fit: contain; }
.score-ring {
  width: 155px;
  height: 155px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  align-content: center;
  border: 10px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
}
.score-ring strong { font-size: 35px; }
.score-ring span { color: var(--secondary); font-size: 12px; }
.review-list { margin-top: 18px; display: grid; gap: 8px; }
.review-item { padding: 14px 16px; display: flex; justify-content: space-between; gap: 15px; border-radius: 10px; }
.review-correct { background: var(--success-soft); }
.review-wrong { background: var(--danger-soft); }

.blast-stats, .game-code-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.blast-stats > div, .game-code-banner > div {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.blast-stats small, .game-code-banner small { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .09em; }
.blast-stats strong { font-size: 29px; }
.game-code-banner strong { margin-top: 4px; font-size: 17px; }

.scoreboard { display: grid; }
.score-row {
  display: grid;
  grid-template-columns: 32px 1fr auto 80px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.score-row:last-child { border-bottom: 0; }
.score-row b { text-align: right; font-size: 18px; }

.admin-header {
  padding: 28px;
  color: white;
  background: linear-gradient(135deg, #5950ec, #746dff);
  border-radius: var(--radius-lg);
  box-shadow: 0 17px 40px rgba(99,91,255,.22);
}
.admin-header p { color: rgba(255,255,255,.8); }
.admin-badge {
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  background: rgba(255,255,255,.13);
  font-size: 12px;
  font-weight: 900;
}
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 20px 0; }
.stats-grid.five { grid-template-columns: repeat(5, minmax(0,1fr)); }
.stat-card {
  padding: 20px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.stat-card small { color: var(--secondary); font-weight: 800; }
.stat-card strong { display: block; margin-top: 7px; font-size: 30px; }

.command-panel {
  margin: 22px 0;
  overflow: hidden;
  color: #dfe1e7;
  background: #111219;
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.command-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  background: #191a22;
  border-bottom: 1px solid #2c2e39;
}
.terminal-help { border: 0; background: transparent; color: #aaa6ff; font-family: monospace; }
.command-output {
  height: 300px;
  margin: 0;
  padding: 17px;
  overflow: auto;
  white-space: pre-wrap;
  font: 13px/1.6 "Cascadia Code", Consolas, monospace;
}
.command-input {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #181920;
}
.command-input span { color: #918aff; font: 12px monospace; }
.command-input input {
  color: white;
  background: #23252e;
  border-color: #373946;
  font-family: monospace;
}

.table-container { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--secondary); background: #fafafd; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
td small { display: block; margin-top: 3px; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.danger-zone { margin-top: 22px; border-color: #efc7ca; }
.danger-zone h2 { color: var(--danger); }

.toast-stack {
  position: fixed;
  z-index: 2000;
  right: 18px;
  bottom: 18px;
  width: min(360px, calc(100% - 36px));
  display: grid;
  gap: 9px;
}
.toast {
  padding: 13px 15px;
  opacity: 0;
  transform: translateY(8px);
  border: 1px solid var(--border);
  border-radius: 11px;
  background: white;
  box-shadow: var(--shadow-lg);
  transition: .2s ease;
  font-size: 13px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: #bfe5ce; }
.toast-warning { border-color: #ead39a; }
.toast-danger { border-color: #edbdc0; }

@media (max-width: 950px) {
  .set-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .study-mode-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats-grid.five { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .topbar { grid-template-columns: auto 1fr; padding: 9px 14px; }
  .nav-links { order: 3; grid-column: 1 / -1; overflow-x: auto; flex-wrap: nowrap; }
  .nav-email { display: none; }
  .hero, .page-header, .set-hero, .admin-header { align-items: stretch; flex-direction: column; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .editor-card { grid-template-columns: 30px 1fr 38px; }
  .editor-card textarea { grid-column: 2 / 4; }
  .term-row { grid-template-columns: 32px 1fr; }
  .term-row > div:last-child { grid-column: 2; }
  .flashcard { height: 360px; }
  .answer-grid { grid-template-columns: 1fr; }
  .stats-grid, .stats-grid.five { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .brand-logo { width: 120px; }
  .page-shell, .study-shell { width: min(100% - 24px, 1180px); padding-top: 24px; }
  .set-grid, .study-mode-grid, .stats-grid, .stats-grid.five { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 18px; }
  .modal-backdrop { padding: 8px; }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }
  .study-topbar { grid-template-columns: 1fr auto; }
  .study-topbar > :last-child { display: none; }
  .flashcard { height: 330px; }
  .flashcard-face { padding: 24px; }
  .flashcard-face > span { font-size: 27px; }
  .game-code-banner, .blast-stats { grid-template-columns: 1fr 1fr 1fr; }
  .score-row { grid-template-columns: 28px 1fr 65px; }
  .score-row .badge { display: none; }
  .command-input { grid-template-columns: 1fr auto; }
  .command-input span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* --- 2026 feature pass: recommendations, richer editor, sharing and images --- */
.dashboard-search-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.dashboard-search-wrap .search-icon { color: var(--muted); font-size: 22px; line-height: 1; }
.dashboard-search {
  min-width: 0;
  padding: 8px 4px;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 15px;
}
.recommend-reason { color: var(--primary) !important; font-weight: 800; }

.modal { width: min(920px, 100%); }
.set-editor-form { gap: 18px; }
.editor-help {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  color: var(--secondary);
  background: var(--primary-soft);
  border: 1px solid #dad0ff;
  border-radius: 12px;
}
.editor-help strong { color: var(--primary); }
.editor-card.editor-card-expanded {
  display: block;
  padding: 15px;
  background: #fcfcff;
}
.editor-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}
.editor-card-actions { display: flex; gap: 6px; }
.editor-card-actions .icon-button { width: 32px; height: 32px; font-size: 16px; }
.editor-main-fields { display: grid; grid-template-columns: 1fr 1.15fr; gap: 11px; }
.editor-main-fields label, .editor-image-block, .distractor-block { min-width: 0; }
.editor-image-block, .distractor-block {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}
.editor-image-block { display: grid; gap: 10px; }
.editor-image-block > div:first-child,
.distractor-heading { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.editor-image-block small, .distractor-heading small { color: var(--muted); }
.optional-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.editor-image-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.editor-image-preview img {
  width: 150px;
  height: 95px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
}
.file-button {
  width: fit-content;
  padding: 9px 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #d8ceff;
  border-radius: 9px;
  font-weight: 850;
  cursor: pointer;
}
.file-button input { display: none; }
.distractor-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 9px; }

.term-row.has-card-image { grid-template-columns: 42px 72px minmax(0,.75fr) minmax(0,1.15fr); align-items: center; }
.card-thumb {
  width: 68px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.flashcard-image {
  max-width: min(360px, 80%);
  max-height: 190px;
  object-fit: contain;
  border-radius: 12px;
}
.question-image, .test-question-image {
  display: block;
  width: auto;
  max-width: min(420px, 100%);
  max-height: 240px;
  margin: 14px auto;
  object-fit: contain;
  border-radius: 12px;
}
.test-question-image { max-height: 170px; }
.written-study-answer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 18px;
}
.four-options .answer-option { min-height: 82px; }

.publish-options { display: grid; gap: 10px; }
.publish-option {
  padding: 16px;
  display: grid;
  gap: 5px;
  text-align: left;
  color: var(--text);
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.publish-option:hover, .publish-option.selected { border-color: var(--primary); background: #fbfaff; }
.publish-option strong { font-size: 16px; }
.publish-option span { color: var(--secondary); line-height: 1.45; }
.publish-option.danger-option strong { color: var(--danger); }

.share-panel { display: grid; gap: 18px; }
.share-link-card, .share-add-user, .collaborator-list {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.share-link-card p { margin-bottom: 0; color: var(--secondary); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.share-add-user h3, .collaborator-list h3 { margin: 0 0 10px; }
.share-user-form { display: grid; grid-template-columns: minmax(0,1fr) 130px auto; gap: 8px; }
.collab-actions { display: flex; align-items: center; gap: 7px; }

.icon-button:disabled { opacity: .38; cursor: default; }

@media (max-width: 760px) {
  .dashboard-search-wrap { grid-template-columns: auto 1fr; }
  .dashboard-search-wrap .btn { grid-column: 1 / -1; width: 100%; }
  .editor-main-fields, .distractor-grid { grid-template-columns: 1fr; }
  .editor-image-block > div:first-child, .distractor-heading { align-items: flex-start; flex-direction: column; }
  .term-row.has-card-image { grid-template-columns: 32px 62px 1fr; }
  .term-row.has-card-image > div:last-child { grid-column: 3; }
  .card-thumb { width: 58px; height: 48px; }
  .share-user-form, .copy-row, .written-study-answer { grid-template-columns: 1fr; }
  .collab-actions { align-items: flex-end; flex-direction: column; }
}


/* StudyDeck v4 — signup, live games, classroom join reveal */
.verification-card { text-align: center; }
.verification-card .btn, .verification-card .link-button { margin-top: 10px; }
.game-access-actions { display: inline-flex; align-items: center; gap: 10px; }
.game-access-actions small { color: var(--muted); font-weight: 800; white-space: nowrap; }
.game-host-header { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; margin-bottom: 18px; }
.game-code-card { min-width: 260px; padding: 22px 28px; text-align: center; background: white; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.game-code-card small { display: block; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.game-code-card strong { display: block; margin: 8px 0 14px; font-size: clamp(42px, 7vw, 76px); line-height: .95; letter-spacing: .08em; color: var(--primary); }
.game-host-actions { margin: 8px 0 20px; }
.compact-result { padding: 18px; margin-bottom: 18px; }
.players-panel { margin-top: 18px; }
.joined-players { display: grid; gap: 8px; }
.joined-player { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.player-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--success); }
.student-game-header { padding: 24px; margin-bottom: 18px; border-radius: 20px; background: linear-gradient(135deg, var(--primary-soft), white); border: 1px solid #d9d5ff; }
.student-game-header h1 { margin: 6px 0 8px; }
.student-lobby { margin-top: 0; }
.join-code-modal { width: 100vw !important; max-width: none !important; height: 100vh; max-height: none !important; border-radius: 0 !important; display: flex; flex-direction: column; }
.join-code-modal .modal-body { flex: 1; display: grid; place-items: center; overflow: auto; }
.join-code-screen { width: min(850px, 92vw); text-align: center; display: grid; gap: 18px; justify-items: center; }
.join-code-screen > small { color: var(--muted); font-weight: 900; letter-spacing: .14em; }
.join-code-screen > strong { font-size: clamp(64px, 14vw, 150px); line-height: .9; letter-spacing: .08em; color: var(--primary); }
.join-code-screen .copy-row { width: min(720px, 100%); }
@media (max-width: 700px) {
  .game-host-header { grid-template-columns: 1fr; }
  .game-code-card { min-width: 0; width: 100%; }
  .joined-player { grid-template-columns: 12px 1fr; }
  .joined-player .badge { grid-column: 2; justify-self: start; }
}

.join-code-backdrop { padding: 0 !important; }


/* StudyDeck playtest live-game dashboard + classroom users */
.classroom-content { display: block; }
.classroom-users-list { display: grid; gap: 9px; }
.classroom-user-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.classroom-user-row.teacher-row { background: var(--primary-soft); }
.classroom-user-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.classroom-user-main > span:last-child { min-width: 0; display: grid; }
.classroom-user-main strong, .classroom-user-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.classroom-user-main small { color: var(--muted); }

.game-host-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.game-stat-card { min-width: 0; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: white; display: grid; gap: 5px; }
.game-stat-card small { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .09em; }
.game-stat-card strong { font-size: 28px; line-height: 1.05; color: var(--text); }
.game-stat-card strong.stat-name { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-stat-card span { color: var(--secondary); font-size: 13px; }
.overall-progress-card { padding: 17px 18px; margin: 14px 0 18px; display: grid; grid-template-columns: minmax(170px, auto) 1fr; align-items: center; gap: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.overall-progress-card > div:first-child { display: grid; gap: 3px; }
.overall-progress-card span { color: var(--muted); font-size: 13px; }
.game-progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e8e9f0; }
.game-progress-track.large { height: 12px; }
.game-progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s ease; }
.round-complete-card { margin: 18px 0; padding: 22px; border: 1px solid #cde9d8; border-radius: 16px; background: #f5fff8; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.round-complete-card h2 { margin: 3px 0 5px; }
.round-complete-card p { margin: 0; color: var(--secondary); }
.round-complete-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.game-leaderboard-panel { margin-top: 18px; overflow: hidden; }
.game-leaderboard { display: grid; gap: 8px; }
.leaderboard-row { display: grid; grid-template-columns: 42px minmax(150px, 1.2fr) minmax(160px, 1fr) 82px 82px 92px; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.leaderboard-row.leader { border-color: #cbc7ff; background: #faf9ff; }
.leaderboard-rank { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: white; border: 1px solid var(--border); font-weight: 900; }
.leaderboard-player { min-width: 0; display: grid; gap: 4px; }
.leaderboard-player > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-player > span { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.leaderboard-player small, .leaderboard-progress small { color: var(--muted); }
.leaderboard-progress { min-width: 0; display: grid; gap: 5px; }
.leaderboard-stat { text-align: right; display: grid; gap: 1px; }
.leaderboard-stat strong { font-size: 15px; }
.leaderboard-stat small { color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 800; }
.game-status-pill { display: inline-flex; width: fit-content; padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.game-status-pill.finished { background: #e6f8ed; color: #19723a; }
.game-status-pill.playing { background: var(--primary-soft); color: var(--primary); }
.game-status-pill.waiting { background: #eef0f4; color: var(--secondary); }
.game-team-panel { margin-top: 14px; }
.team-leaderboard { display: grid; gap: 8px; }
.team-leaderboard-row { display: grid; grid-template-columns: minmax(120px, 1fr) repeat(3, minmax(90px, auto)) 90px; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.team-leaderboard-row.leader { border-color: #cbc7ff; background: #faf9ff; }
.team-leaderboard-row span { color: var(--secondary); font-size: 13px; }
.team-leaderboard-row b { text-align: right; }
.student-round-progress { margin-bottom: 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; font-weight: 800; }
.student-round-progress .game-progress-track { grid-column: 1 / -1; }
.student-result-stats { margin: 18px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.student-result-stats > span { padding: 12px 8px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); display: grid; gap: 2px; text-align: center; }
.student-result-stats strong { font-size: 20px; }
.student-result-stats small { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }

@media (max-width: 980px) {
  .game-host-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leaderboard-row { grid-template-columns: 38px minmax(130px, 1fr) minmax(130px, .9fr) 70px 76px; }
  .leaderboard-row .leaderboard-stat:last-child { display: none; }
  .team-leaderboard-row { grid-template-columns: minmax(120px, 1fr) repeat(2, auto); }
  .team-leaderboard-row span:nth-of-type(3) { display: none; }
}
@media (max-width: 700px) {
  .classroom-user-row { align-items: flex-start; }
  .game-host-stats { grid-template-columns: 1fr 1fr; }
  .overall-progress-card { grid-template-columns: 1fr; }
  .round-complete-card { align-items: stretch; flex-direction: column; }
  .round-complete-actions .btn { flex: 1; }
  .leaderboard-row { grid-template-columns: 34px minmax(0, 1fr) 70px; gap: 8px; }
  .leaderboard-progress { grid-column: 2 / -1; grid-row: 2; }
  .leaderboard-row .leaderboard-stat:nth-last-child(2), .leaderboard-row .leaderboard-stat:last-child { display: none; }
  .team-leaderboard-row { grid-template-columns: 1fr auto; }
  .team-leaderboard-row span { display: none; }
  .student-result-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
  .game-host-stats { grid-template-columns: 1fr; }
}


/* StudyDeck playtest v6 — board leaderboard + editor bottom add */
.editor-add-card-bottom {
  display: flex;
  justify-content: center;
  padding: 18px 0 2px;
}
.editor-add-card-bottom .btn {
  min-width: min(260px, 100%);
}

.game-board-shell {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}
.game-board-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
}
.game-board-title { min-width: 0; }
.game-board-title h1 {
  margin: 3px 0 5px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
}
.game-board-title p { margin: 0; color: var(--secondary); font-size: clamp(15px, 1.5vw, 20px); }
.game-board-code {
  min-width: 190px;
  text-align: center;
  padding: 13px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}
.game-board-code small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
}
.game-board-code strong {
  display: block;
  margin-top: 3px;
  color: var(--primary);
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1;
  letter-spacing: .08em;
}
.board-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.board-summary-strip > div {
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  display: grid;
  gap: 2px;
}
.board-summary-strip small { color: var(--muted); font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.board-summary-strip strong { font-size: clamp(24px, 3vw, 38px); line-height: 1.05; }
.board-summary-strip strong.board-fastest-name { font-size: clamp(18px, 2.3vw, 30px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.board-summary-strip span { color: var(--secondary); }

.board-leaderboard {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
}
.board-leaderboard-head,
.board-rank-row {
  display: grid;
  grid-template-columns: 72px minmax(200px, 1.6fr) minmax(210px, 1.2fr) 110px 120px;
  gap: 16px;
  align-items: center;
}
.board-leaderboard-head {
  padding: 10px 18px;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.board-rank-row {
  min-height: 86px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.board-rank-row:last-child { border-bottom: 0; }
.board-rank-row.first { background: #faf9ff; }
.board-rank-row.finished .board-player-name span { color: var(--success); }
.board-place {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 24px;
  font-weight: 950;
}
.board-rank-row.first .board-place {
  color: var(--primary);
  border-color: #cfc9ff;
  background: var(--primary-soft);
}
.board-player-name { min-width: 0; display: grid; gap: 3px; }
.board-player-name strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: clamp(20px, 2.1vw, 32px);
  line-height: 1.05;
}
.board-player-name span { color: var(--secondary); font-size: 14px; }
.board-progress { min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.board-progress small { min-width: 42px; color: var(--muted); font-weight: 850; text-align: right; }
.board-score, .board-accuracy { display: grid; justify-items: end; line-height: 1; }
.board-score strong, .board-accuracy strong { font-size: clamp(22px, 2.6vw, 36px); }
.board-score span, .board-accuracy span { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.board-empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 20px; }

.board-team-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 9px;
  margin: 0 0 14px;
}
.board-team-card {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: white;
}
.board-team-card.first { border-color: #cfc9ff; background: #faf9ff; }
.board-team-card > span { font-weight: 900; color: var(--primary); }
.board-team-card > strong { font-size: 18px; }
.board-team-card > b { text-align: right; }
.board-team-card > small { grid-column: 2 / -1; color: var(--muted); }

.board-round-complete {
  margin-top: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid #cde9d8;
  border-radius: 14px;
  background: #f5fff8;
}
.board-round-complete strong { color: #176f39; font-size: 20px; }
.board-round-complete span { color: var(--secondary); }

@media (max-width: 980px) {
  .game-board-header { grid-template-columns: 1fr auto; }
  .board-back-button { grid-column: 1 / -1; width: 100%; }
  .board-summary-strip { grid-template-columns: 1fr 1fr; }
  .board-leaderboard { overflow-x: auto; }
  .board-leaderboard-head, .board-rank-row { min-width: 860px; }
}
@media (max-width: 620px) {
  .game-board-shell { width: min(100% - 18px, 1480px); padding-top: 10px; }
  .game-board-header { grid-template-columns: 1fr; padding: 16px; }
  .game-board-code { width: 100%; }
  .board-summary-strip { grid-template-columns: 1fr 1fr; }
  .board-summary-strip > div { padding: 12px; }
}

/* -------------------------------------------------
   StudyDeck final showcase landing page
-------------------------------------------------- */
.landing-page {
  width: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 8%, rgba(99,91,255,.10), transparent 26rem),
    linear-gradient(180deg, #ffffff 0, #f7f7fc 34%, #ffffff 100%);
}

.landing-hero {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(58px, 8vw, 106px) 0 clamp(62px, 8vw, 100px);
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(440px, 1.08fr);
  align-items: center;
  gap: clamp(38px, 7vw, 86px);
}

.landing-kicker,
.landing-section-heading > span,
.landing-final-cta > div:first-child > span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 11px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #ddd9ff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.landing-hero-copy h1 {
  max-width: 690px;
  margin: 18px 0 20px;
  font-size: clamp(49px, 7vw, 82px);
  line-height: .97;
  letter-spacing: -.065em;
}
.landing-hero-copy h1 span { color: var(--primary); }

.landing-lead {
  max-width: 650px;
  margin: 0;
  color: var(--secondary);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.65;
}

.landing-actions {
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
}
.landing-primary,
.landing-secondary { min-height: 52px; padding: 0 20px; }
.landing-text-link {
  min-height: 46px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 850;
}

.landing-proof {
  margin-top: 27px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.landing-proof i { opacity: .45; font-style: normal; }

.landing-product-preview {
  min-width: 0;
  padding: 17px;
  overflow: hidden;
  background: white;
  border: 1px solid #dedfe8;
  border-radius: 27px;
  box-shadow: 0 32px 80px rgba(34, 31, 77, .16);
  transform: rotate(1.1deg);
}
.preview-window-bar {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 5px 13px;
  color: var(--muted);
  font-size: 12px;
}
.preview-window-bar strong { margin-left: 8px; color: var(--secondary); }
.preview-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d9dae2;
}
.preview-game-head {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  color: white;
  background: linear-gradient(135deg, #625aff, #7e76ff);
  border-radius: 18px;
}
.preview-game-head small {
  display: block;
  margin-bottom: 5px;
  color: rgba(255,255,255,.72);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .13em;
}
.preview-game-head strong {
  font-size: clamp(35px, 5vw, 56px);
  line-height: .95;
  letter-spacing: .09em;
}
.preview-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}
.preview-live-pill i {
  width: 8px;
  height: 8px;
  background: #8cf4b9;
  border-radius: 50%;
}

.preview-progress-block { padding: 18px 4px 14px; }
.preview-progress-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  font-size: 12px;
}
.preview-progress-title span { color: var(--muted); }
.preview-progress-track {
  height: 8px;
  overflow: hidden;
  background: #ececf3;
  border-radius: 999px;
}
.preview-progress-track span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.preview-leaderboard {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
}
.preview-row {
  min-height: 68px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 35px 1fr auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.preview-row:last-child { border-bottom: 0; }
.preview-row.preview-first { background: #faf9ff; }
.preview-row > b {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: 9px;
}
.preview-first > b { color: var(--primary); background: var(--primary-soft); }
.preview-row > span { min-width: 0; display: grid; gap: 2px; }
.preview-row > span strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-row > span small { color: var(--muted); }
.preview-row > em {
  color: var(--primary);
  font-size: 22px;
  font-style: normal;
  font-weight: 900;
}
.preview-footer {
  padding: 13px 3px 2px;
  display: flex;
  justify-content: space-between;
  gap: 8px 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}
.preview-footer strong { color: var(--text); }

.landing-section {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(68px, 8vw, 100px) 0;
}
.landing-section-heading {
  max-width: 760px;
  margin-bottom: 36px;
}
.landing-section-heading h2,
.landing-role-card h2,
.landing-final-cta h2 {
  margin: 15px 0 10px;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.03;
  letter-spacing: -.055em;
}
.landing-section-heading p {
  margin: 0;
  color: var(--secondary);
  font-size: 17px;
  line-height: 1.6;
}

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 17px;
}
.landing-feature-card {
  min-width: 0;
  padding: 28px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(23,24,34,.05);
}
.landing-feature-card.feature-large { grid-row: span 2; }
.landing-feature-card.feature-wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  align-items: center;
  gap: 25px;
}
.feature-number {
  margin-bottom: 30px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .12em;
}
.landing-feature-card h3 {
  margin: 0 0 9px;
  font-size: 25px;
  letter-spacing: -.035em;
}
.landing-feature-card p {
  margin: 0;
  color: var(--secondary);
  line-height: 1.65;
}

.feature-mini-stack {
  margin-top: 27px;
  padding: 14px;
  display: grid;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.feature-mini-stack span {
  padding: 11px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 750;
}
.feature-mini-stack span + span { color: var(--secondary); font-weight: 600; }
.feature-mini-stack button {
  min-height: 42px;
  border: 1px dashed #cbc7ff;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 10px;
  font-weight: 850;
  pointer-events: none;
}
.feature-tags {
  margin-top: 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.feature-tags span {
  padding: 8px 10px;
  color: #524db7;
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}
.feature-scoreline {
  margin-top: 26px;
  padding: 15px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 13px;
}
.feature-scoreline strong { color: var(--primary); font-size: 23px; }
.feature-scoreline span { color: var(--secondary); font-weight: 750; }
.feature-scoreline em { font-style: normal; font-weight: 900; }
.feature-classroom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.feature-classroom > div {
  padding: 17px;
  display: grid;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 13px;
}
.feature-classroom small { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.feature-classroom strong { font-size: 18px; }

.landing-role-section {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 clamp(76px, 9vw, 120px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.landing-role-card {
  padding: clamp(28px, 4vw, 42px);
  background: #f5fff8;
  border: 1px solid #d8ecdf;
  border-radius: 24px;
}
.landing-role-card.teacher-card {
  background: #f7f6ff;
  border-color: #dfdcff;
}
.role-pill {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.role-pill.student { color: #137844; background: #e3f8eb; }
.role-pill.teacher { color: #5148e5; background: #e9e6ff; }
.landing-role-card h2 { font-size: clamp(32px, 4vw, 46px); }
.landing-role-card > p { color: var(--secondary); line-height: 1.65; }
.landing-role-card ul {
  margin: 22px 0 28px;
  padding: 0;
  display: grid;
  gap: 11px;
  list-style: none;
}
.landing-role-card li {
  position: relative;
  padding-left: 26px;
  color: #373946;
}
.landing-role-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 950;
}

.landing-final-cta {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 72px;
  padding: clamp(28px, 5vw, 50px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  background: #171822;
  color: white;
  border-radius: 26px;
}
.landing-final-cta h2 {
  max-width: 720px;
  margin-bottom: 0;
  color: white;
  font-size: clamp(31px, 4vw, 47px);
}
.landing-final-cta > div:first-child > span {
  color: #dcd8ff;
  background: rgba(99,91,255,.22);
  border-color: rgba(255,255,255,.12);
}
.landing-final-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.landing-final-cta .btn-secondary { border-color: #3b3d49; background: #262833; color: white; }

.landing-footer {
  padding: 44px max(20px, calc((100% - 1180px) / 2));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  background: white;
  border-top: 1px solid var(--border);
}
.landing-footer-brand img {
  width: 145px;
  max-height: 40px;
  object-fit: contain;
}
.landing-footer-brand p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.landing-footer-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 18px;
  flex-wrap: wrap;
}
.landing-footer-links a,
.landing-footer-links button {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
}
.landing-footer-links a:hover,
.landing-footer-links button:hover { color: var(--primary); }
.landing-footer-bottom {
  grid-column: 1 / -1;
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 12px;
}

@media (max-width: 930px) {
  .landing-hero {
    grid-template-columns: 1fr;
    padding-top: 56px;
  }
  .landing-hero-copy { text-align: center; }
  .landing-hero-copy h1,
  .landing-lead { margin-left: auto; margin-right: auto; }
  .landing-actions,
  .landing-proof { justify-content: center; }
  .landing-product-preview {
    width: min(700px, 100%);
    margin: 0 auto;
    transform: none;
  }
  .landing-role-section { grid-template-columns: 1fr; }
  .landing-final-cta { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 700px) {
  .landing-hero,
  .landing-section,
  .landing-role-section,
  .landing-final-cta { width: min(100% - 26px, 1180px); }
  .landing-hero-copy h1 { font-size: clamp(44px, 14vw, 65px); }
  .landing-feature-grid { grid-template-columns: 1fr; }
  .landing-feature-card.feature-large { grid-row: auto; }
  .landing-feature-card.feature-wide {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
  .feature-classroom { grid-template-columns: 1fr 1fr; }
  .landing-footer { grid-template-columns: 1fr; }
  .landing-footer-links { justify-content: flex-start; }
  .landing-footer-bottom { grid-column: 1; flex-direction: column; }
}

@media (max-width: 520px) {
  .landing-hero { padding-top: 38px; }
  .landing-actions { align-items: stretch; flex-direction: column; }
  .landing-actions .btn,
  .landing-text-link { width: 100%; }
  .landing-proof { font-size: 12px; }
  .landing-proof i { display: none; }
  .landing-proof span {
    padding: 5px 8px;
    background: rgba(255,255,255,.65);
    border: 1px solid var(--border);
    border-radius: 999px;
  }
  .landing-product-preview { padding: 11px; border-radius: 20px; }
  .preview-game-head { padding: 15px; }
  .preview-row { grid-template-columns: 31px 1fr auto; }
  .preview-footer { display: grid; }
  .landing-feature-card { padding: 22px; }
  .feature-classroom { grid-template-columns: 1fr; }
  .landing-final-actions { width: 100%; flex-direction: column; }
  .landing-final-actions .btn { width: 100%; }
}

/* Better signed-out nav wrapping on small screens */
@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 9px 14px;
  }
  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 3;
    justify-content: center;
    padding-top: 2px;
  }
  .nav-actions { gap: 6px; }
}

