/* Quizlet-analog — Modern Quizlet Design Language & Dark Mode */
:root,
html,
body {
  --blue: #2374e1;
  --blue-dark: #1a5db5;
  --blue-50: #eef5fd;
  --blue-100: #dcebfb;
  --ink: #172b4d;
  --ink-2: #3e4c63;
  --ink-3: #6b778c;
  --bg: #f6f7fb;
  --background: #f6f7fb;
  --surface: #ffffff;
  --surface-hover: #f5f7fa;
  --border: #d5dbe3;
  --border-light: #e8ecf1;
  --gray-100: #f5f7fa;
  --gray-200: #e8ecf1;
  --gray-300: #d5dbe3;
  --gray-400: #9aa5b1;
  --white: #ffffff;
  --green: #16a34a;
  --green-50: #f0fdf4;
  --red: #dc2626;
  --red-50: #fef2f2;
  --orange: #f59e0b;
  --orange-50: #fffbeb;
  --gold: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(23, 43, 77, .08);
  --shadow-md: 0 4px 16px rgba(23, 43, 77, .12);
  --shadow-lg: 0 12px 40px rgba(23, 43, 77, .16);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--font);
}

:root.dark,
html.dark,
body.dark {
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --ink-3: #94a3b8;
  --bg: #0b1329;
  --background: #0b1329;
  --surface: #152238;
  --surface-hover: #1e314f;
  --border: #263854;
  --border-light: #1c2b42;
  --gray-100: #121c2e;
  --gray-200: #1e314f;
  --gray-300: #334764;
  --gray-400: #64748b;
  --blue-50: #172a4c;
  --blue-100: #1d3560;
  --white: #152238;
  --green-50: #064e3b;
  --red-50: #7f1d1d;
  --orange-50: #78350f;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--bg);
  color: var(--ink);
  box-sizing: border-box;
}
body {
  min-height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  transition: background-color .2s ease, color .2s ease;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); font-weight: 700; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 50;
  transition: background .2s, border-color .2s;
}
.topbar .logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 20px; color: var(--blue); letter-spacing: -.3px;
  cursor: pointer; user-select: none;
}
.topbar .logo:hover { text-decoration: none; }
.topbar .nav-links {
  display: flex; align-items: center; gap: 12px; margin-left: 12px;
}
.topbar .nav-link {
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  padding: 6px 12px; border-radius: 8px; transition: background .15s;
}
.topbar .nav-link:hover { background: var(--gray-100); text-decoration: none; color: var(--ink); }
.topbar .nav-link.active { background: var(--blue-50); color: var(--blue); }

.topbar .search {
  flex: 1; max-width: 500px; margin: 0 auto;
  position: relative;
}
.topbar .search input {
  width: 100%; height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 14px 0 40px;
  font-size: 14px;
  background: var(--gray-100);
  color: var(--ink);
  transition: border-color .15s, background .15s;
  font-family: var(--font);
}
.topbar .search input:focus {
  outline: none; border-color: var(--blue); background: var(--surface);
  box-shadow: 0 0 0 3px var(--blue-100);
}
.topbar .search .icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); pointer-events: none;
}

.topbar-actions {
  display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0;
}

/* Theme toggle */
.theme-toggle-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
}
.theme-toggle-btn:hover { background: var(--gray-100); transform: scale(1.05); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 8px; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  padding: 9px 18px; transition: background .15s, transform .05s, box-shadow .15s;
  text-decoration: none; line-height: 1.2; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); text-decoration: none; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--gray-100); text-decoration: none; color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; text-decoration: none; }
.btn-lg { padding: 13px 26px; font-size: 16px; border-radius: 10px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Audio button */
.btn-audio {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--blue-50); color: var(--blue);
  cursor: pointer; transition: all .15s ease; flex-shrink: 0;
}
.btn-audio:hover { background: var(--blue-100); transform: scale(1.1); }
.btn-audio.sm { width: 30px; height: 30px; font-size: 12px; }
.btn-audio.lg { width: 48px; height: 48px; font-size: 18px; }

/* Star button */
.btn-star {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: transparent; color: var(--gray-300);
  cursor: pointer; transition: all .15s ease; font-size: 17px;
}
.btn-star:hover { color: var(--gold); transform: scale(1.15); }
.btn-star.starred { color: var(--gold); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: background .2s, border-color .2s, box-shadow .2s;
}

/* ---------- Home ---------- */
.hero {
  background: linear-gradient(180deg, var(--blue-50) 0%, var(--bg) 100%);
  padding: 56px 24px 44px;
  text-align: center;
}
.hero h1 { font-size: 38px; margin: 0 0 10px; letter-spacing: -.6px; }
.hero p { color: var(--ink-2); font-size: 18px; margin: 0 0 26px; max-width: 640px; margin-left: auto; margin-right: auto; }
.hero-badges { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.hero .hero-cta {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--blue); color: #fff;
  font-size: 17px; font-weight: 700;
  padding: 14px 34px; border-radius: 12px;
  box-shadow: var(--shadow-md); transition: transform .12s, background .15s;
}
.hero .hero-cta:hover { background: var(--blue-dark); text-decoration: none; transform: translateY(-2px); }

main,
.section { width: 100%; max-width: 1160px; margin: 0 auto; padding: 32px 24px; box-sizing: border-box; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.section-head h2 { font-size: 24px; margin: 0; }

/* Filter Tabs */
.filter-tabs {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.filter-tab {
  padding: 7px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-2);
  cursor: pointer; transition: all .15s;
}
.filter-tab:hover { background: var(--surface-hover); color: var(--ink); }
.filter-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.set-card {
  cursor: pointer;
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.set-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--blue); }
.set-card .set-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.set-card .set-title { font-size: 18px; font-weight: 700; line-height: 1.3; }
.set-card .set-desc {
  color: var(--ink-2); font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; flex: 1; line-height: 1.45;
}
.set-card .sample-card {
  background: var(--gray-100); border-radius: 8px; padding: 10px 12px;
  font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px;
}
.set-card .sample-card b { color: var(--blue); }
.set-card .set-meta {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--gray-400); font-size: 12px; padding-top: 6px; border-top: 1px solid var(--border-light);
}
.set-card .del-btn {
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: transparent; color: var(--gray-400); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.set-card .del-btn:hover { background: var(--red-50); color: var(--red); }

/* CEFR Level Badges */
.badge-level {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
}
.badge-a1 { background: #dcfce7; color: #15803d; }
.badge-b1 { background: #e0e7ff; color: #4338ca; }
.badge-c1 { background: #fae8ff; color: #86198f; }
.badge-tag { background: var(--gray-100); color: var(--ink-2); border: 1px solid var(--border-light); }
.badge-enrolled {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; background: #dcfce7; color: #15803d;
}
body.dark .badge-enrolled { background: #064e3b; color: #86efac; }

/* Set Card Word Progress */
.card-progress-box {
  background: var(--gray-100); border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; margin: 4px 0;
}
.card-progress-header {
  display: flex; justify-content: space-between; align-items: center;
}
.card-progress-label {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.card-progress-pct {
  font-size: 13px; font-weight: 700; color: var(--blue);
}
.card-progress-bar {
  width: 100%; height: 6px; background: var(--border-light);
  border-radius: 999px; overflow: hidden;
}
.card-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--blue) 0%, #38bdf8 100%);
  border-radius: 999px; transition: width .3s ease;
}
.card-progress-stats {
  font-size: 11.5px; color: var(--gray-400); font-weight: 500;
}

/* ---------- Set page ---------- */
.set-page {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
}
.set-page .footer {
  margin-top: auto;
  padding: 40px 0 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}
.set-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.set-head h1 { font-size: 32px; margin: 0; line-height: 1.25; }
.set-head .desc { color: var(--ink-2); font-size: 15px; margin-bottom: 16px; max-width: 800px; }
.set-head .head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.meta-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  color: var(--ink-2); font-size: 13.5px; margin-bottom: 24px;
}
.pill {
  background: var(--gray-100); border-radius: 999px;
  padding: 5px 14px; font-size: 12.5px; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500;
}
.pill.blue { background: var(--blue-50); color: var(--blue); }
.pill.green { background: var(--green-50); color: var(--green); }

/* mode bar (Quizlet "Study" circle row) */
.mode-bar {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 18px 0 24px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}
.mode-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; width: 84px; text-align: center;
}
.mode-circle {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; transition: transform .15s, box-shadow .15s;
}
.mode-item:hover .mode-circle { transform: translateY(-3px) scale(1.06); box-shadow: var(--shadow-md); }
.mode-item:hover { text-decoration: none; }
.mode-item:focus-visible { outline: 3px solid var(--blue); outline-offset: 5px; border-radius: 8px; }
.mode-item span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.mode-item.primary .mode-circle { outline: 3px solid var(--blue-100); }

.mode-flashcards { background: #2374e1; }
.mode-learn { background: #7c3aed; }
.mode-write { background: #0ea5e9; }
.mode-spell { background: #f59e0b; }
.mode-test { background: #dc2626; }
.mode-match { background: #16a34a; }
.mode-gravity { background: #f43f5e; }

/* Set card table list */
.card-list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 28px 0 14px;
}
.card-list { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-light); }
.card-row {
  display: grid; grid-template-columns: 44px 1fr 1fr 100px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface); transition: background .15s;
}
.card-row:hover { background: var(--surface-hover); }
.card-row:last-child { border-bottom: none; }
.card-row .grip {
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400); cursor: grab;
}
.card-row .cell {
  padding: 14px 18px; font-size: 14.5px;
}
.card-row .cell.front { font-weight: 600; color: var(--ink); }
.card-row .cell.back { border-left: 1px solid var(--border-light); color: var(--ink-2); }
.card-row .cell .transcription {
  color: var(--blue); font-size: 13px; font-weight: 500; margin-top: 3px;
}
.card-row .cell .example {
  color: var(--ink-3); font-size: 12.5px; font-style: italic; margin-top: 4px; line-height: 1.35;
}
.card-row .acts {
  display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 0 12px;
}

/* ---------- Flashcards Mode ---------- */
.study-screen {
  flex: 1;
  width: 100%;
  min-height: calc(100vh - 60px);
  min-height: calc(100svh - 60px);
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}
.study-screen.fullscreen {
  position: fixed; inset: 0; z-index: 1000; min-height: 100vh; min-height: 100svh;
}
.study-top {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border-light); flex-wrap: wrap;
}
.study-top .title { font-weight: 700; font-size: 17px; flex: 1; min-width: 160px; }
.study-top-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.study-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 16px;
}

/* 3D Flip Card */
.flip-wrap { perspective: 1200px; width: 100%; max-width: 660px; height: 380px; }
.flip-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .5s cubic-bezier(.4, 0, .2, 1);
}
.flip-inner.flipped { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  background: var(--surface); border-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 32px; cursor: pointer; user-select: none;
}
.flip-face.back { transform: rotateY(180deg); }
.flip-face .card-text {
  font-size: 28px; font-weight: 600; line-height: 1.35;
  color: var(--ink); margin-bottom: 8px;
}
.flip-face .transcription {
  font-size: 16px; color: var(--blue); font-weight: 500;
  letter-spacing: .5px; margin-bottom: 10px;
}
.flip-face .example {
  font-size: 14px; font-style: italic; color: var(--ink-2);
  background: var(--gray-100); border-left: 3px solid var(--blue);
  padding: 8px 14px; border-radius: 6px; max-width: 520px; margin-top: 10px;
}
.flip-face .label-tag {
  position: absolute; top: 18px; left: 22px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--gray-400); font-weight: 700;
}
.flip-face .top-right-tools {
  position: absolute; top: 16px; right: 20px;
  display: flex; align-items: center; gap: 8px;
}
.flip-face .hint {
  position: absolute; bottom: 16px; font-size: 12px; color: var(--gray-400);
}

/* Card image styles */
.card-img-wrap {
  margin-bottom: 12px; max-height: 140px; display: flex; align-items: center; justify-content: center;
}
.card-img {
  max-height: 130px; max-width: 90%; border-radius: 10px; object-fit: contain;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12); transition: transform 0.2s ease;
}
.card-img:hover { transform: scale(1.04); }

.prompt-img-wrap {
  margin-bottom: 14px; display: flex; justify-content: center;
}
.prompt-img {
  max-height: 120px; max-width: 80%; border-radius: 8px; object-fit: contain;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.card-list-thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border-light); margin-right: 12px; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.img-preview-box {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 8px; border: 1.5px solid var(--border);
  overflow: hidden; background: var(--gray-100); flex-shrink: 0;
}
.img-thumb {
  width: 100%; height: 100%; object-fit: cover; cursor: pointer;
}
.img-rm-btn {
  position: absolute; top: 1px; right: 1px; width: 16px; height: 16px;
  border-radius: 50%; background: rgba(220, 38, 38, 0.9); color: #fff;
  border: none; font-size: 9px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.btn-img {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: 1.5px dashed var(--border);
  background: var(--surface); color: var(--ink-2); cursor: pointer; transition: all .15s;
  flex-shrink: 0;
}
.btn-img:hover {
  border-color: var(--blue); color: var(--blue); background: var(--blue-50);
}

.study-controls {
  display: flex; align-items: center; gap: 14px; margin-top: 24px;
}
.nav-arrow {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--ink); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
}
.nav-arrow:hover { background: var(--gray-100); transform: scale(1.05); }
.nav-arrow:disabled { opacity: .4; cursor: default; transform: none; }
.counter { color: var(--ink-2); font-size: 15px; font-weight: 600; min-width: 90px; text-align: center; }

/* Slideshow indicator */
.slideshow-active {
  background: var(--orange-50) !important; color: var(--orange) !important; border-color: var(--orange) !important;
}

/* ---------- Learn Mode (SRS) ---------- */
.quiz-wrap {
  flex: 1; width: 100%; max-width: 740px; margin: 0 auto;
  padding: 32px 20px;
}
.learn-columns {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
  margin-bottom: 16px;
}
.learn-col {
  border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border-light);
}
.learn-col .dot { width: 9px; height: 9px; border-radius: 50%; }
.learn-col.new .dot { background: #f59e0b; }
.learn-col.studying .dot { background: #2374e1; }
.learn-col.known .dot { background: #16a34a; }
.learn-col b { margin-left: auto; font-size: 15px; }

.quiz-progress {
  height: 8px; background: var(--border-light); border-radius: 999px; overflow: hidden;
  margin-bottom: 12px;
}
.quiz-progress .bar {
  height: 100%; background: var(--blue); border-radius: 999px; transition: width .3s;
}
.quiz-progress-label { font-size: 13px; color: var(--ink-2); margin-bottom: 16px; font-weight: 500; }

.quiz-prompt {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  padding: 36px 28px; text-align: center; font-size: 24px; font-weight: 600;
  min-height: 170px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; margin-bottom: 24px;
  position: relative;
}
.quiz-prompt .prompt-kind {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--gray-400); font-weight: 700;
}
.quiz-prompt .transcription {
  font-size: 15px; color: var(--blue); font-weight: 500;
}
.quiz-prompt .example {
  font-size: 13.5px; font-style: italic; color: var(--ink-3); margin-top: 4px;
}
.quiz-prompt .prompt-audio {
  position: absolute; top: 16px; right: 18px;
}

.quiz-answers { display: grid; gap: 12px; }
.quiz-answer {
  border: 1.5px solid var(--border); background: var(--surface);
  border-radius: 12px; padding: 16px 20px; cursor: pointer;
  font-size: 15px; text-align: left; font-family: var(--font); color: var(--ink);
  transition: border-color .12s, background .12s, transform .08s;
  white-space: pre-wrap; font-weight: 500;
}
.quiz-answer:hover { border-color: var(--blue); background: var(--blue-50); transform: translateX(2px); }
.quiz-answer.correct { border-color: var(--green); background: var(--green-50); color: #166534; }
.quiz-answer.wrong { border-color: var(--red); background: var(--red-50); color: #991b1b; }
.quiz-answer:disabled { cursor: default; transform: none; }

.quiz-input {
  width: 100%; font-size: 18px; padding: 14px 18px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font-family: var(--font); background: var(--surface); color: var(--ink);
  margin-bottom: 12px;
}
.quiz-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }

.quiz-feedback {
  margin-top: 16px; padding: 14px 18px; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; display: none; line-height: 1.4;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.ok { background: var(--green-50); color: #166534; border: 1px solid #bbf7d0; }
.quiz-feedback.bad { background: var(--red-50); color: #991b1b; border: 1px solid #fecaca; }

/* Override button */
.btn-override {
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--border);
  font-size: 13px; padding: 7px 14px; border-radius: 8px; cursor: pointer;
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
}
.btn-override:hover { background: var(--gray-100); color: var(--ink); }

/* ---------- Spell Mode (Audio Dictation) ---------- */
.spell-audio-box {
  background: var(--surface); border-radius: 16px; border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md); padding: 40px 24px; text-align: center;
  margin-bottom: 24px;
}
.spell-audio-big {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--orange); color: #fff; border: none;
  font-size: 28px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(245, 158, 11, .4);
  transition: transform .15s, box-shadow .15s; margin-bottom: 14px;
}
.spell-audio-big:hover { transform: scale(1.08); box-shadow: 0 8px 24px rgba(245, 158, 11, .5); }
.spell-tools { display: flex; justify-content: center; gap: 12px; margin-top: 10px; }

/* ---------- Match Mode ---------- */
.match-area {
  flex: 1; width: 100%; max-width: 900px; margin: 0 auto;
  padding: 24px; display: flex; flex-direction: column;
}
.match-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-top: 18px;
}
.match-tile {
  min-height: 96px; border: 1.5px solid var(--border);
  border-radius: 12px; background: var(--surface);
  cursor: pointer; font-size: 14.5px; font-weight: 500; font-family: var(--font);
  padding: 14px; text-align: center; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .12s, background .12s, transform .1s;
  user-select: none;
}
.match-tile:hover { border-color: var(--blue); background: var(--blue-50); }
.match-tile.selected { border-color: var(--blue); background: var(--blue-100); box-shadow: 0 0 0 3px var(--blue-100); }
.match-tile.matched {
  border-color: var(--green); background: var(--green-50); color: #166534;
  cursor: default; opacity: .7;
}
.match-tile.error { border-color: var(--red); background: var(--red-50); color: #991b1b; animation: shake .3s; }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-6px);} 75% { transform: translateX(6px);} }
.match-stats { display: flex; align-items: center; gap: 20px; }
.match-stats .timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 19px; color: var(--blue); }
.match-stats .mismatches { color: var(--ink-2); font-size: 13px; }

/* ---------- Gravity Mode ---------- */
.gravity-area {
  flex: 1; position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 50% 120%, #1e3a8a 0%, #0f1e4a 60%, #0a1330 100%);
}
.gravity-stars { position: absolute; inset: 0; pointer-events: none; }
.g-block {
  position: absolute; width: 130px;
  background: #ffffff; color: #0f172a;
  border-radius: 10px; text-align: center;
  font-size: 13.5px; font-weight: 600; padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
  transition: background .2s, color .2s;
}
.g-block.hit { background: #16a34a; color: #fff; }
.g-block.miss { background: #dc2626; color: #fff; }
.g-ship {
  position: absolute; bottom: 0; width: 90px; height: 34px;
  background: #f8fafc; border-radius: 14px 14px 6px 6px;
  box-shadow: 0 0 24px rgba(255,255,255,.5);
}
.g-ship .window {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 12px; border-radius: 8px; background: #2374e1;
}
.g-hud {
  position: absolute; top: 18px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 32px;
  color: #fff; font-size: 16px; font-weight: 700;
}
.g-hud span small { display: block; font-size: 11px; font-weight: 400; color: #94a3b8; text-align: center; }
.g-controls { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #94a3b8; font-size: 13px; }
.g-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: rgba(10, 19, 48, .85); color: #fff; text-align: center; padding: 24px;
}
.g-overlay h2 { font-size: 32px; margin: 0; color: #fff; }
.g-overlay .score { font-size: 46px; font-weight: 800; color: #fbbf24; }

/* ---------- Test Mode ---------- */
.test-config-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: 16px; padding: 32px; box-shadow: var(--shadow-md);
  max-width: 560px; margin: 40px auto;
}
.test-config-card h2 { margin: 0 0 16px; }
.test-result { text-align: center; padding: 40px 24px; }
.test-result .score-circle {
  width: 150px; height: 150px; border-radius: 50%;
  margin: 0 auto 20px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--blue-50); color: var(--blue);
  box-shadow: 0 8px 24px rgba(35, 116, 225, .15);
}
.test-result .score-circle .pct { font-size: 42px; font-weight: 800; }
.test-result .score-circle .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.test-review-item {
  display: grid; grid-template-columns: 36px 1fr 1fr; gap: 12px;
  padding: 16px; border: 1px solid var(--border-light); border-radius: 10px;
  margin-bottom: 10px; font-size: 14.5px; background: var(--surface); text-align: left;
}
.test-review-item .ic { font-size: 20px; }
.test-review-item .your { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }
.test-review-item .correct-ans { color: #166534; font-weight: 600; }

/* ---------- Modals & Editors ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .6);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 1000; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  width: 100%; max-width: 600px; padding: 28px;
}
.modal h2 { margin: 0 0 18px; font-size: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input:not([type="checkbox"]):not([type="radio"]), .field textarea, .field select {
  width: 100%; font-family: var(--font); font-size: 15px;
  border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 12px;
  background: var(--surface); color: var(--ink);
}
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100);
}

/* Global Checkbox and Radio styling */
input[type="checkbox"], input[type="radio"] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  accent-color: var(--blue);
  cursor: pointer;
  margin: 0 !important;
  flex-shrink: 0 !important;
  display: inline-block;
  vertical-align: middle;
}

.checkbox-card {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  border: 1.5px solid var(--border-light) !important;
  border-radius: 12px !important;
  background: var(--surface) !important;
  cursor: pointer !important;
  transition: all .15s ease !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  color: var(--ink) !important;
  user-select: none !important;
  margin: 0 !important;
}
.checkbox-card:hover {
  border-color: var(--blue) !important;
  background: var(--surface-hover) !important;
}
.checkbox-card:has(input:checked) {
  border-color: var(--blue) !important;
  background: var(--blue-50) !important;
}
body.theme-soft .checkbox-card {
  border-radius: 14px !important;
}

.checkbox-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  color: var(--ink) !important;
  user-select: none !important;
  margin: 0 !important;
  padding: 4px 0 !important;
}
.checkbox-row input[type="checkbox"] {
  margin: 0 !important;
}

.paste-box {
  border: 1.5px dashed var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 18px; background: var(--gray-100);
}
.paste-box .hint { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.paste-box textarea {
  width: 100%; font-family: var(--font); font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  resize: vertical; min-height: 100px; background: var(--surface); color: var(--ink);
}

/* ---------- Quizlet-Style Card Editor ---------- */
.editor-page-container {
  max-width: 960px; margin: 0 auto; padding: 24px 20px 80px;
}
.editor-top-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap; gap: 12px;
}
.editor-top-bar h1 {
  font-size: 24px; font-weight: 700; margin: 0;
}
.editor-meta-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 20px 24px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.editor-meta-card input.title-input {
  width: 100%; font-size: 20px; font-weight: 600; padding: 10px 0;
  border: none; border-bottom: 2px solid var(--border); border-radius: 0;
  background: transparent; color: var(--ink); outline: none;
  transition: border-color .15s; font-family: var(--font);
}
.editor-meta-card input.title-input:focus { border-color: var(--blue); }
.editor-meta-card textarea.desc-input {
  width: 100%; font-size: 14px; padding: 8px 0;
  border: none; border-bottom: 2px solid var(--border); border-radius: 0;
  background: transparent; color: var(--ink); outline: none;
  resize: vertical; min-height: 48px; transition: border-color .15s;
  font-family: var(--font);
}
.editor-meta-card textarea.desc-input:focus { border-color: var(--blue); }
.field-sublabel {
  font-size: 11px; font-weight: 700; color: var(--gray-400);
  letter-spacing: .6px; text-transform: uppercase; margin-top: 4px;
}

/* Quizlet .ecard */
.editor-cards-wrap {
  display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px;
}
.editor-cards-wrap .ecard {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: 12px; padding: 16px 20px 20px 20px; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}
.editor-cards-wrap .ecard:hover,
.editor-cards-wrap .ecard:focus-within {
  box-shadow: var(--shadow-md); border-color: var(--border);
}
.ecard-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border-light);
}
.ecard-num {
  font-size: 16px; font-weight: 700; color: var(--ink-2);
}
.ecard-actions {
  display: flex; align-items: center; gap: 8px;
}
.ecard-btn {
  width: 32px; height: 32px; border: 1px solid var(--border-light);
  border-radius: 8px; background: var(--surface); color: var(--ink-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all .15s;
}
.ecard-btn:hover {
  background: var(--gray-100); color: var(--ink); transform: translateY(-1px);
}
.ecard-btn.danger:hover {
  background: var(--red-50); color: var(--red); border-color: var(--red);
}
.ecard-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto; gap: 20px; align-items: flex-start;
}
.ecard-field {
  display: flex; flex-direction: column; min-width: 0;
}
.ecard-field input,
.ecard-field textarea {
  width: 100%; font-size: 15px; font-weight: 500; padding: 8px 2px 6px 2px;
  border: none; border-bottom: 2px solid var(--border); border-radius: 0;
  background: transparent; color: var(--ink); outline: none;
  transition: border-color .15s; font-family: var(--font);
  box-sizing: border-box;
}
.ecard-field textarea {
  resize: none;
  line-height: 1.45;
  overflow-y: hidden;
  word-break: break-word;
  white-space: pre-wrap;
  min-height: 36px;
  display: block;
}
.ecard-field input:focus,
.ecard-field textarea:focus { border-color: var(--blue); }

/* Translation Suggestions in Card Editor */
.ecard-sugg-wrap {
  margin-top: 8px;
  min-height: 0;
  transition: opacity .2s ease, transform .2s ease;
}
.ecard-sugg-loading {
  font-size: 12px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
}
.ecard-sugg-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: var(--gray-50, #f8fafc);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 10px;
}
.ecard-sugg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ecard-sugg-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--blue, #4255ff);
}
.ecard-sugg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.sugg-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  padding: 5px 12px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(66, 85, 255, 0.25);
  background: rgba(66, 85, 255, 0.08);
  color: var(--blue, #4255ff);
  cursor: pointer;
  outline: none;
  transition: all .15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sugg-pill:hover {
  background: var(--blue, #4255ff);
  color: #fff;
  border-color: var(--blue, #4255ff);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(66, 85, 255, 0.25);
}
.sugg-pill:active {
  transform: translateY(0);
}
.sugg-pill.active {
  background: var(--blue, #4255ff);
  color: #fff;
  border-color: var(--blue, #4255ff);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(66, 85, 255, 0.3);
}
.sugg-pill .sugg-check {
  font-size: 11px;
  font-weight: 800;
}

/* Dark mode */
body.dark .ecard-sugg-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}
body.dark .ecard-sugg-label {
  color: var(--blue);
}
body.dark .sugg-pill {
  background: rgba(88, 101, 242, 0.16);
  border-color: rgba(88, 101, 242, 0.35);
  color: #a5b4fc;
}
body.dark .sugg-pill:hover,
body.dark .sugg-pill.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* Theme Soft */
body.theme-soft .ecard-sugg-box {
  background: #fdfaf6;
  border: 1px solid #ebd9c8;
  border-radius: 12px;
}
body.theme-soft .ecard-sugg-label {
  color: #b05e26;
}
body.theme-soft .sugg-pill {
  background: rgba(176, 94, 38, 0.08);
  border-color: rgba(176, 94, 38, 0.25);
  color: #a0521e;
}
body.theme-soft .sugg-pill:hover,
body.theme-soft .sugg-pill.active {
  background: #a0521e;
  color: #fff;
  border-color: #a0521e;
}

/* Theme Studio */
body.theme-studio .ecard-sugg-box {
  background: rgba(223, 228, 242, 0.4);
  border: 1px solid rgba(8, 9, 9, 0.12);
  border-radius: 10px;
}
body.theme-studio .ecard-sugg-label {
  color: #080909;
}
body.theme-studio .sugg-pill {
  background: rgba(8, 9, 9, 0.06);
  border-color: rgba(8, 9, 9, 0.18);
  color: #080909;
}
body.theme-studio .sugg-pill:hover,
body.theme-studio .sugg-pill.active {
  background: #080909;
  color: #dfe4f2;
  border-color: #080909;
}

/* Mobile fine-tuning */
@media (max-width: 640px) {
  .ecard-sugg-box {
    padding: 8px 10px;
  }
  .sugg-pill {
    font-size: 13px;
    padding: 6px 13px;
    min-height: 32px;
  }
}

.ecard-img-slot {
  width: 72px; height: 60px; display: flex; align-items: center; justify-content: center;
}
.ecard-img-thumb-wrap {
  position: relative; width: 72px; height: 56px; border-radius: 6px;
  overflow: hidden; border: 1px solid var(--border);
}
.ecard-img-thumb {
  width: 100%; height: 100%; object-fit: cover; cursor: pointer;
}
.ecard-img-thumb-wrap .img-rm-btn {
  position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.7);
  color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px;
  font-size: 12px; line-height: 1; display: flex; align-items: center;
  justify-content: center; cursor: pointer;
}
.ecard-img-add {
  width: 72px; height: 56px; border: 1.5px dashed var(--border); border-radius: 8px;
  background: var(--gray-100); color: var(--ink-3); font-size: 10px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; transition: all .15s;
}
.ecard-img-add i { font-size: 15px; }
.ecard-img-add:hover {
  border-color: var(--blue); color: var(--blue); background: var(--blue-50);
}
.add-card-quizlet {
  width: 100%; padding: 16px; border: 2px dashed var(--border);
  background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 700;
  border-radius: 12px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 10px; transition: all .15s; margin-bottom: 24px;
}
.add-card-quizlet:hover {
  border-color: var(--blue); color: var(--blue); background: var(--blue-50);
}
.editor-bottom-bar {
  display: flex; justify-content: flex-end; align-items: center; gap: 12px;
  padding-top: 16px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #172b4d; color: #fff; padding: 12px 22px;
  border-radius: 10px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; z-index: 2000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* Keyboard hint */
.kbd {
  display: inline-block; padding: 2px 7px; border-radius: 5px;
  background: var(--gray-100); border: 1px solid var(--border);
  font-size: 12px; font-family: ui-monospace, monospace; color: var(--ink-2);
}

/* Auth views */
#auth-root,
.auth-section {
  flex: 1;
  width: 100%;
  max-width: 100% !important;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  margin: 0 !important;
  background-color: var(--bg);
  box-sizing: border-box;
}
.auth-card {
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  border: 1.5px solid var(--border-light);
  padding: 38px 34px;
  width: 100%;
  max-width: 440px;
  box-sizing: border-box;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
}
.auth-head {
  text-align: center;
  margin-bottom: 24px;
  position: relative;
}
.auth-head .logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 8px;
}
.auth-head h1 {
  font-size: 24px;
  margin: 0;
  font-family: var(--font-heading, var(--font));
  color: var(--ink);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-form label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-form input {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 14.5px;
  background: var(--surface);
  color: var(--ink);
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font);
}
.auth-form input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-100);
}
.auth-form .btn-primary {
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 999px;
  margin-top: 4px;
}
.auth-alt {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-2);
  margin-top: 14px;
}
.auth-alt a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-err {
  margin-top: 16px;
  background: var(--red-50);
  color: var(--red);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid #fecaca;
  font-weight: 500;
  text-align: center;
}
.auth-hint {
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
}

/* Admin */
.admin-table-wrap {
  background: var(--surface); border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border-light); }
.admin-table th { background: var(--gray-100); font-weight: 600; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.admin-table tr:last-child td { border-bottom: none; }
.role-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--surface); color: var(--ink); }

/* Topbar user chip & badge */
#topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--gray-100);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.user-chip .u-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.badge-admin {
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: .5px;
}

/* Admin & Assignments */
.admin-create-form {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 140px auto;
  gap: 12px;
  align-items: end;
}

.badge-assigned {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 700;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.2px;
}

body.theme-soft .badge-assigned {
  background: var(--blue-50);
  color: var(--blue);
  border: 1px solid var(--blue-100);
}

body.theme-dark .badge-assigned {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.modal-close-btn, .del-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-light) !important;
  background: var(--surface) !important;
  color: var(--ink-2) !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
  font-size: 13px;
  padding: 0;
  outline: none;
  flex-shrink: 0;
}
.modal-close-btn:hover, .del-btn:hover {
  background: var(--surface-hover) !important;
  color: var(--ink) !important;
  border-color: var(--border) !important;
}

.assign-modal-card {
  max-width: 620px;
  width: 94%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-light);
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.assign-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
}

.assign-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.assign-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-hover);
  gap: 12px;
  flex-wrap: wrap;
}

/* Language Switcher */
.lang-toggle-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto !important;
  min-width: 44px;
  position: relative;
}
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  min-width: 155px;
  animation: slideUp 0.15s ease-out;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all .12s ease;
}
.lang-option:hover {
  background: var(--surface-hover);
  color: var(--blue);
}
.lang-option.active {
  background: var(--blue-50);
  color: var(--blue);
}

.assign-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  background: var(--surface);
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.assign-item:hover {
  border-color: var(--blue);
  background: var(--surface-hover);
}

.assign-item.selected {
  border-color: var(--blue);
  background: var(--blue-50);
}

/* Footer */
.app-footer, .footer-text {
  text-align: center; color: var(--gray-400); font-size: 13px;
  padding: 36px 16px; border-top: 1px solid var(--border-light); margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
  .topbar { padding: 0 10px; height: 56px; gap: 6px; }
  .topbar .search { display: none; }
  .topbar .nav-links { display: none; }
  .topbar-actions { gap: 6px; }
  .theme-toggle-btn { width: 32px; height: 32px; font-size: 13px; flex-shrink: 0; }
  #topbar-user { gap: 4px; }
  .user-chip { padding: 4px 8px; font-size: 12px; gap: 4px; }
  .user-chip .u-name { max-width: 65px; }
  .hide-mobile { display: none; }
  .topbar-admin-btn { padding: 6px 10px; }
  .hero h1 { font-size: 28px; }
  .match-grid { grid-template-columns: repeat(2, 1fr); }
  .learn-columns { grid-template-columns: 1fr; }
  .card-row { grid-template-columns: 32px 1fr 1fr 70px; font-size: 13px; }
  .flip-wrap { height: 320px; }
  .flip-face .card-text { font-size: 22px; }
  .ecard-grid { grid-template-columns: 1fr; gap: 14px; }
  .admin-create-form, #admin-create-form {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .admin-create-form .btn-submit-wrap, #admin-create-form .btn-submit-wrap {
    width: 100%;
  }
  .admin-create-form .btn-submit-wrap button, #admin-create-form button[type="submit"] {
    width: 100%;
    justify-content: center;
  }
}

/* Print Stylesheet for Tests */
@media print {
  .topbar, .study-top, .quiz-actions, .btn, .theme-toggle-btn, .footer { display: none !important; }
  body, .study-screen, .quiz-wrap { background: #fff !important; color: #000 !important; }
  .test-print-view { display: block !important; padding: 20px; }
  .card, .quiz-prompt, .quiz-answer { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ==========================================================================
   SOFT DESIGN SYSTEM (Мягкий дизайн / Soft UI Aesthetic Complete Redesign)
   ========================================================================== */

:root[data-theme="soft"],
html.theme-soft,
body.theme-soft {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: 'Plus Jakarta Sans', system-ui, sans-serif;
  --blue: #5B5BE6;
  --blue-dark: #4747CC;
  --blue-50: #F1F1FD;
  --blue-100: #E2E2FB;
  --ink: #26252B;
  --ink-2: #656372;
  --ink-3: #9491A1;
  --bg: #FAF8F5;
  --background: #FAF8F5;
  --surface: #FFFFFF;
  --surface-hover: #F6F3EC;
  --border: #E8E4DC;
  --border-light: #F0ECE4;
  --gray-100: #F4F1EA;
  --gray-200: #EAE6DE;
  --gray-300: #D8D3C8;
  --gray-400: #A29E94;
  --white: #FFFFFF;
  --green: #10B981;
  --green-50: #ECFDF5;
  --red: #F43F5E;
  --red-50: #FFF1F2;
  --orange: #F59E0B;
  --orange-50: #FFFBEB;
  --gold: #F59E0B;
  --shadow-sm: 0 2px 8px -1px rgba(90, 70, 50, 0.04), 0 1px 3px rgba(90, 70, 50, 0.02);
  --shadow-md: 0 8px 24px -4px rgba(90, 70, 50, 0.07), 0 2px 6px -1px rgba(90, 70, 50, 0.03);
  --shadow-lg: 0 20px 40px -8px rgba(90, 70, 50, 0.09), 0 4px 12px -2px rgba(90, 70, 50, 0.04);
  --radius: 20px;
  background-color: var(--bg);
  color: var(--ink);
  letter-spacing: -0.15px;
}

:root[data-theme="soft"].dark,
html.theme-soft.dark,
body.theme-soft.dark {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: 'Plus Jakarta Sans', system-ui, sans-serif;
  --blue: #7C83F5;
  --blue-dark: #636DF0;
  --blue-50: #25263A;
  --blue-100: #333552;
  --ink: #F5F5F7;
  --ink-2: #B3B2C0;
  --ink-3: #7B798A;
  --bg: #15151A;
  --background: #15151A;
  --surface: #1E1E26;
  --surface-hover: #272732;
  --border: #2C2C38;
  --border-light: #24242E;
  --gray-100: #1B1B22;
  --gray-200: #262633;
  --gray-300: #383849;
  --gray-400: #68677A;
  --white: #1E1E26;
  --green-50: #064E3B;
  --red-50: #881337;
  --orange-50: #78350F;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 45px rgba(0, 0, 0, 0.6);
  background-color: var(--bg);
  color: var(--ink);
}

/* Soft Topbar */
body.theme-soft .topbar {
  background: rgba(250, 248, 245, 0.88);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(140, 120, 100, 0.12);
  box-shadow: 0 2px 14px rgba(80, 60, 40, 0.03);
}
body.theme-soft.dark .topbar {
  background: rgba(21, 21, 26, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}
body.theme-soft .topbar .logo {
  color: var(--blue);
  letter-spacing: -0.6px;
}
body.theme-soft .topbar .nav-link {
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13.5px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .topbar .nav-link.active {
  background: var(--blue-50);
  color: var(--blue);
  font-weight: 700;
}
body.theme-soft .topbar .search input {
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: all 0.2s ease;
}
body.theme-soft .topbar .search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-100);
}
body.theme-soft .theme-toggle-btn {
  border-radius: 999px;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .theme-toggle-btn:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow: var(--shadow-sm);
}

/* Soft Buttons */
body.theme-soft .btn {
  border-radius: 999px;
  font-weight: 600;
  padding: 10px 22px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: -0.2px;
}
body.theme-soft .btn-primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  box-shadow: 0 4px 14px rgba(91, 91, 230, 0.28);
  color: #FFFFFF;
}
body.theme-soft .btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 18px rgba(91, 91, 230, 0.36);
  text-decoration: none;
}
body.theme-soft .btn-secondary {
  border-radius: 999px;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
body.theme-soft .btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  background: var(--surface-hover);
  text-decoration: none;
}
body.theme-soft .btn-sm {
  padding: 7px 16px;
  font-size: 13px;
}
body.theme-soft .btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}
body.theme-soft .btn-audio {
  background: var(--blue-50);
  box-shadow: 0 2px 6px rgba(91, 91, 230, 0.12);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .btn-audio:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(91, 91, 230, 0.22);
}

/* Soft Hero & Filters */
body.theme-soft .hero {
  background: linear-gradient(180deg, #F2EFFD 0%, var(--bg) 100%);
  padding: 64px 24px 44px;
}
body.theme-soft.dark .hero {
  background: linear-gradient(180deg, #1C1C28 0%, var(--bg) 100%);
}
body.theme-soft .hero h1 {
  letter-spacing: -0.8px;
  font-weight: 800;
}
body.theme-soft .hero .hero-cta {
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  box-shadow: 0 6px 20px rgba(91, 91, 230, 0.32);
}
body.theme-soft .hero .hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91, 91, 230, 0.4);
}
body.theme-soft .filter-tab {
  border-radius: 999px;
  padding: 8px 18px;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .filter-tab:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}
body.theme-soft .filter-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 4px 14px rgba(91, 91, 230, 0.26);
}

/* Soft Cards & Set Cards */
body.theme-soft .card {
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .set-card {
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}
body.theme-soft .set-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue-100);
}
body.theme-soft .set-card .sample-card {
  border-radius: 14px;
  background: var(--gray-100);
}
body.theme-soft .card-list {
  border-radius: 18px;
  border: 1.5px solid var(--border);
  overflow: hidden;
}

/* Soft Study Mode & Flashcards */
body.theme-soft .study-top {
  border-bottom: 1.5px solid var(--border-light);
}
body.theme-soft .flip-face {
  border-radius: 28px;
  border: 1.5px solid var(--border);
  box-shadow: 0 16px 40px -6px rgba(90, 70, 50, 0.08), 0 4px 12px rgba(90, 70, 50, 0.04);
  transition: box-shadow 0.25s ease;
}
body.theme-soft.dark .flip-face {
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
}
body.theme-soft .flip-face .example {
  border-radius: 12px;
  border-left: 3px solid var(--blue);
}
body.theme-soft .nav-arrow {
  border-radius: 999px;
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .nav-arrow:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.09);
}

/* Soft Quiz (Learn / SRS) */
body.theme-soft .learn-col {
  border-radius: 14px;
  border: 1.5px solid var(--border);
}
body.theme-soft .quiz-prompt {
  border-radius: 24px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-md);
}
body.theme-soft .quiz-answer {
  border-radius: 16px;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .quiz-answer:hover:not(:disabled) {
  border-color: var(--blue);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(91, 91, 230, 0.12);
}
body.theme-soft .quiz-input {
  border-radius: 16px;
  border: 1.5px solid var(--border);
}
body.theme-soft .quiz-feedback {
  border-radius: 14px;
}
body.theme-soft .spell-audio-box {
  border-radius: 24px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-md);
}
body.theme-soft .match-tile {
  border-radius: 18px;
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .match-tile:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
body.theme-soft .test-config-card {
  border-radius: 24px;
  border: 1.5px solid var(--border);
}

/* Soft Card Editor */
body.theme-soft .editor-meta-card {
  border-radius: 22px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
body.theme-soft .editor-cards-wrap .ecard {
  border-radius: 20px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
body.theme-soft .editor-cards-wrap .ecard:hover,
body.theme-soft .editor-cards-wrap .ecard:focus-within {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
  transform: translateY(-1.5px);
}
body.theme-soft .ecard-btn {
  border-radius: 999px;
  border: 1px solid var(--border);
}
body.theme-soft .add-card-quizlet {
  border-radius: 18px;
  border: 2px dashed var(--border);
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-soft .add-card-quizlet:hover {
  border-color: var(--blue);
  background: var(--blue-50);
  transform: translateY(-1px);
}

/* Soft Auth & Admin */
body.theme-soft .auth-card {
  border-radius: 28px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-lg);
}
body.theme-soft .auth-form input {
  border-radius: 12px;
}
body.theme-soft .admin-table-wrap {
  border-radius: 20px;
  border: 1.5px solid var(--border);
}
body.theme-soft .role-select {
  border-radius: 999px;
}
body.theme-soft .badge-admin {
  border-radius: 999px;
  padding: 3px 10px;
}


/* ==========================================================================
   CREATIVE STUDIO DESIGN SYSTEM (Lavender Aesthetic & Gaze Tracking Theme)
   ========================================================================== */

@font-face {
  font-family: "DM Sans";
  src: url("/fonts/DMSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Epilogue";
  src: url("/fonts/Epilogue-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root[data-theme="studio"],
html.theme-studio,
body.theme-studio {
  --font: "DM Sans", Arial, sans-serif;
  --font-heading: "Epilogue", Arial, sans-serif;
  --background: #dfe4f2;
  --foreground: #080909;
  --bg: #dfe4f2;
  --surface: #ffffff;
  --surface-hover: #f7f8fa;
  --ink: #080909;
  --ink-2: #34373d;
  --ink-3: #6c707d;
  --border: #c4cbe0;
  --border-light: #dbe0ef;
  --blue: #080909;
  --blue-dark: #23252a;
  --blue-50: #eceef6;
  --blue-100: #d9def0;
  --white: #ffffff;
  --gray-100: #f7f8fa;
  --gray-200: #e7ecf7;
  --gray-300: #cbcfdc;
  --gray-400: #888d9c;
  --green: #10B981;
  --green-50: #ECFDF5;
  --red: #F43F5E;
  --red-50: #FFF1F2;
  --orange: #F59E0B;
  --orange-50: #FFFBEB;
  --radius: 20px;
  --shadow-sm: 0 2px 8px rgba(8, 9, 9, 0.04);
  --shadow-md: 0 8px 24px rgba(8, 9, 9, 0.08);
  --shadow-lg: 0 20px 40px rgba(8, 9, 9, 0.12);
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: -0.01em;
}

@media (max-width: 700px) {
  :root[data-theme="studio"],
  html.theme-studio,
  body.theme-studio {
    --background: #f0eefa;
    --bg: #f0eefa;
    background-color: #f0eefa;
  }
}

:root[data-theme="studio"].dark,
html.theme-studio.dark,
body.theme-studio.dark {
  --background: #111019;
  --foreground: #f0eefa;
  --bg: #111019;
  --surface: #191825;
  --surface-hover: #222132;
  --ink: #f0eefa;
  --ink-2: #b5b3c7;
  --ink-3: #7b7891;
  --border: #29283b;
  --border-light: #201f2f;
  --blue: #a39ff5;
  --blue-dark: #8c87f2;
  --blue-50: #242337;
  --blue-100: #33324d;
  --white: #191825;
  --gray-100: #1c1a29;
  --gray-200: #252337;
  --gray-300: #34324b;
  --gray-400: #626078;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 20px 45px rgba(0,0,0,0.65);
  background-color: var(--bg);
  color: var(--ink);
}

/* Headings in Studio Theme */
body.theme-studio h1,
body.theme-studio h2,
body.theme-studio h3,
body.theme-studio .section-title,
body.theme-studio .hero h1,
body.theme-studio .set-title,
body.theme-studio .modal-title {
  font-family: "Epilogue", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: -0.02em;
}

/* Topbar in Studio Theme */
body.theme-studio .topbar {
  background: rgba(223, 228, 242, 0.88);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(8, 9, 9, 0.08);
}
body.theme-studio.dark .topbar {
  background: rgba(17, 16, 25, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
body.theme-studio .topbar .nav-link {
  font-weight: 600;
  color: var(--ink-2);
}
body.theme-studio .topbar .nav-link.active {
  color: var(--ink);
  font-weight: 700;
}
body.theme-studio .topbar .search input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
}
body.theme-studio .topbar .search input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(8, 9, 9, 0.1);
}
body.theme-studio .theme-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
}
body.theme-studio .theme-toggle-btn:hover {
  background: var(--surface-hover);
  border-color: var(--ink);
}

/* Buttons in Studio Theme */
body.theme-studio .btn {
  font-family: "DM Sans", Arial, sans-serif;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-studio .btn-primary {
  background: #080909;
  color: #ffffff;
  border: 1px solid #080909;
  box-shadow: 0 3px 12px rgba(8, 9, 9, 0.15);
}
body.theme-studio .btn-primary:hover {
  background: #23252a;
  border-color: #23252a;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 18px rgba(8, 9, 9, 0.22);
}
body.theme-studio.dark .btn-primary {
  background: #f0eefa;
  color: #080909;
  border-color: #f0eefa;
}
body.theme-studio.dark .btn-primary:hover {
  background: #ffffff;
  border-color: #ffffff;
}
body.theme-studio .btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border);
}
body.theme-studio .btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--ink);
  transform: translateY(-1.5px);
}
body.theme-studio .btn-audio {
  border-radius: 999px;
  background: #f7f8fa;
  border: 1px solid var(--border);
  color: var(--ink);
}
body.theme-studio .btn-audio:hover {
  background: #080909;
  color: #ffffff;
  border-color: #080909;
}

/* Filter tabs and badges in Studio Theme */
body.theme-studio .tag,
body.theme-studio .badge-assigned,
body.theme-studio .badge-enrolled,
body.theme-studio .user-chip {
  background: #f7f8fa;
  color: #080909;
  border-radius: 999px;
  border: 1px solid rgba(8, 9, 9, 0.08);
  font-weight: 600;
}
body.theme-studio.dark .tag,
body.theme-studio.dark .badge-assigned,
body.theme-studio.dark .badge-enrolled,
body.theme-studio.dark .user-chip {
  background: #242337;
  color: #f0eefa;
  border-color: rgba(255, 255, 255, 0.08);
}
body.theme-studio .filter-tab {
  background: var(--surface);
  color: var(--ink-2);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
}
body.theme-studio .filter-tab:hover {
  border-color: var(--ink);
  color: var(--ink);
}
body.theme-studio .filter-tab.active {
  background: #080909;
  color: #ffffff;
  border-color: #080909;
  box-shadow: 0 2px 10px rgba(8, 9, 9, 0.15);
}
body.theme-studio.dark .filter-tab.active {
  background: #f0eefa;
  color: #080909;
  border-color: #f0eefa;
}

/* Cards in Studio Theme */
body.theme-studio .card,
body.theme-studio .set-card,
body.theme-studio .modal {
  border-radius: 22px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
body.theme-studio .auth-card {
  border-radius: 28px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: 0 20px 48px rgba(8, 9, 9, 0.08);
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
}
body.theme-studio.dark .auth-card {
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
}
body.theme-studio .auth-form label {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}
body.theme-studio .auth-form input {
  font-family: var(--font);
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 16px;
  font-size: 15px;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
body.theme-studio .auth-form input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(8, 9, 9, 0.1);
  outline: none;
}
body.theme-studio .auth-form .btn-primary {
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: 15px;
  padding: 13px 20px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(8, 9, 9, 0.15);
  transition: transform .15s ease, background .15s ease;
}
body.theme-studio .auth-form .btn-primary:hover {
  background: #23252a;
  transform: translateY(-1px);
}
body.theme-studio.dark .auth-form .btn-primary {
  background: var(--blue);
  color: #080909;
}
body.theme-studio.dark .auth-form .btn-primary:hover {
  background: #8c87f2;
}
body.theme-studio .set-card:hover {
  border-color: #080909;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
body.theme-studio.dark .set-card:hover {
  border-color: #f0eefa;
}

/* Study & Flashcards in Studio Theme */
body.theme-studio .flip-face {
  border-radius: 24px;
  border: 2px solid var(--border);
  background: var(--surface);
}
body.theme-studio .quiz-prompt {
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
}
body.theme-studio .quiz-answer {
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--surface);
}
body.theme-studio .quiz-answer:hover:not(:disabled) {
  border-color: #080909;
  transform: translateY(-1.5px);
}
body.theme-studio .match-tile {
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--surface);
}
body.theme-studio .match-tile:hover {
  border-color: #080909;
  transform: translateY(-2px);
}
body.theme-studio .match-tile.selected {
  border-color: #080909;
  background: #edeef6;
}

/* Standalone Studio Footer & Page Layout (Exact Specification Fidelity) */
.studio-screen {
  position: relative;
  min-height: 100vh;
  width: 100%;
  background: var(--background, #dfe4f2);
  color: #080909;
  font-family: "DM Sans", Arial, sans-serif;
  overflow-x: hidden;
}
.studio-back-link {
  position: fixed;
  top: 18px;
  left: 20px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #080909;
  color: #ffffff;
  border-radius: 999px;
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, background 0.15s ease;
}
.studio-back-link:hover {
  background: #232428;
  transform: translateY(-1px);
  color: #ffffff;
}

/* Studio Footer Component (matches public/studio.html and prompt) */
.footer[aria-label="Footer"] {
  position: relative;
  min-height: 100vh;
  padding-top: 6.54vw;
  isolation: isolate;
  overflow: hidden;
  box-sizing: border-box;
}
.footer[aria-label="Footer"] .jobs {
  margin-left: 8.65vw;
  width: 25vw;
}
.footer[aria-label="Footer"] .tag {
  display: inline-flex;
  align-items: center;
  border-radius: 100px;
  background: #f7f8fa;
  padding: .39vw .61vw;
  font-size: .88vw;
  line-height: 1.2;
  height: 1.9vw;
  white-space: nowrap;
}
.footer[aria-label="Footer"] .headline {
  font-family: "Epilogue", Arial, sans-serif;
  font-weight: 900;
  font-size: 1.66vw;
  line-height: 1.2;
  letter-spacing: 0;
}
.footer[aria-label="Footer"] .job-title {
  display: block;
  margin-top: 1.45vw;
}
.footer[aria-label="Footer"] .footer-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .93vw;
  margin-top: 1.3vw;
  font-size: 1.075vw;
  line-height: 1.35;
}
.footer[aria-label="Footer"] .logo {
  position: absolute;
  left: 40.33vw;
  top: 7.7vw;
  width: 17vw;
}
.footer[aria-label="Footer"] .logo svg {
  display: block;
  width: 100%;
  height: auto;
}
.footer[aria-label="Footer"] .contact {
  position: absolute;
  left: 74.3vw;
  top: 6.54vw;
}
.footer[aria-label="Footer"] .contact-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 1.45vw;
  white-space: nowrap;
}
.footer[aria-label="Footer"] .note {
  margin: 1.05vw 0 0;
  font-size: .733vw;
  line-height: 1.4;
  white-space: nowrap;
}
.footer[aria-label="Footer"] .socials {
  display: flex;
  align-items: center;
  gap: 1.43vw;
  margin-top: 1.61vw;
}
.footer[aria-label="Footer"] .socials span,
.footer[aria-label="Footer"] .socials img {
  display: block;
  width: 1.71vw;
  height: 1.71vw;
}
.footer[aria-label="Footer"] .footer-background {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.footer[aria-label="Footer"] .footer-background video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media(max-width: 700px) {
  .footer[aria-label="Footer"] {
    display: flex;
    flex-direction: column;
    gap: 36px;
    min-height: 100svh;
    padding: 40px 24px 0;
    background: #f0eefa;
  }
  .footer[aria-label="Footer"] .logo {
    position: static;
    order: 0;
    align-self: flex-start;
    width: 210px;
    max-width: 75%;
    margin-bottom: 4px;
  }
  .footer[aria-label="Footer"] .jobs {
    order: 1;
    margin: 0;
    width: 100%;
  }
  .footer[aria-label="Footer"] .tag {
    height: 30px;
    padding: 6px 11px;
    font-size: 14px;
  }
  .footer[aria-label="Footer"] .headline {
    font-size: clamp(22px, 6.3vw, 30px);
    line-height: 1.25;
  }
  .footer[aria-label="Footer"] .job-title,
  .footer[aria-label="Footer"] .contact-links {
    margin-top: 19px;
  }
  .footer[aria-label="Footer"] .footer-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
    margin-top: 20px;
    font-size: 17px;
    line-height: 1.4;
  }
  .footer[aria-label="Footer"] .footer-nav span {
    display: flex;
    align-items: center;
    min-height: 44px;
  }
  .footer[aria-label="Footer"] .contact {
    position: static;
    order: 2;
    width: 100%;
  }
  .footer[aria-label="Footer"] .contact-links {
    gap: 4px;
    white-space: normal;
  }
  .footer[aria-label="Footer"] .note {
    max-width: 34ch;
    margin: 16px 0 0;
    font-size: 14px;
    line-height: 1.5;
    white-space: normal;
  }
  .footer[aria-label="Footer"] .socials {
    gap: 18px;
    margin-top: 20px;
  }
  .footer[aria-label="Footer"] .socials span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
  }
  .footer[aria-label="Footer"] .socials img {
    width: 30px;
    height: 30px;
  }
  .footer[aria-label="Footer"] .socials span:first-child {
    margin-left: -7px;
  }
  .footer[aria-label="Footer"] .footer-background {
    position: relative;
    inset: auto;
    order: 3;
    z-index: auto;
    flex: none;
    align-self: center;
    width: calc(100% + 48px);
    aspect-ratio: 4/3;
    margin-top: -16px;
  }
  .footer[aria-label="Footer"] .footer-background video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }
}

/* ==========================================================================
   ADAPTED CREATIVE STUDIO PLATFORM INTEGRATIONS (Mascot & Studio Layout)
   ========================================================================== */

/* Hero 2-Column Layout with Integrated Mascot Card */
.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  max-width: 1160px;
  margin: 0 auto;
  text-align: left;
}
.hero-content {
  flex: 1 1 540px;
  max-width: 620px;
}
.hero-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.2px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* Mascot Card in Hero (Clean compact display, doesn't take whole screen) */
.hero-mascot-wrapper {
  flex: 0 0 280px;
  display: flex;
  justify-content: center;
}
.mascot-card {
  width: 280px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 14px;
  box-shadow: var(--shadow-md);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.mascot-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--ink);
}
.mascot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mascot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: #f7f8fa;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #080909;
  letter-spacing: -0.2px;
  border: 1px solid rgba(8, 9, 9, 0.08);
}
body.theme-studio.dark .mascot-chip {
  background: #242337;
  color: #f0eefa;
  border-color: rgba(255, 255, 255, 0.08);
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.mascot-tip {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
}
.mascot-video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  background: #dfe4f2;
}
.mascot-video-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.mascot-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-2);
  font-weight: 600;
}
.mascot-studio-btn {
  color: var(--ink-3);
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.mascot-studio-btn:hover {
  color: var(--ink);
  background: var(--gray-100);
}

@media (max-width: 860px) {
  .hero-inner {
    flex-direction: column-reverse;
    text-align: center;
    gap: 28px;
  }
  .hero-content {
    max-width: 100%;
  }
  .hero-badges,
  .hero-actions {
    justify-content: center;
  }
  .mascot-card {
    width: 250px;
  }
}

/* Auth Mascot Avatar (Welcome Buddy) */
.auth-mascot-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 16px;
  border: 2.5px solid var(--border);
  box-shadow: 0 8px 24px rgba(8, 9, 9, 0.08);
  background: #dfe4f2;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.auth-mascot-avatar:hover {
  transform: scale(1.04);
}
.auth-mascot-avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Compact Studio Footer */
.app-studio-footer {
  background: var(--surface);
  border-top: 1.5px solid var(--border-light);
  padding: 48px 24px 36px;
  margin-top: auto;
  font-family: "DM Sans", Arial, sans-serif;
  color: var(--ink);
  width: 100%;
}
.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: start;
  gap: 32px;
}
.footer-col-left .tag,
.footer-col-right .tag {
  display: inline-flex;
  align-items: center;
  border-radius: 100px;
  background: #f7f8fa;
  padding: 4px 12px;
  font-size: 12px;
  line-height: 1.2;
  color: #080909;
  font-weight: 600;
  margin-bottom: 8px;
  border: 1px solid rgba(8, 9, 9, 0.08);
}
body.theme-studio.dark .footer-col-left .tag,
body.theme-studio.dark .footer-col-right .tag {
  background: #242337;
  color: #f0eefa;
  border-color: rgba(255, 255, 255, 0.08);
}
.footer-col-left .headline {
  font-family: "Epilogue", Arial, sans-serif;
  font-weight: 900;
  font-size: 20px;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 14px;
}
.footer-col-left .footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-col-left .footer-nav a {
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
  transition: color 0.15s;
}
.footer-col-left .footer-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.footer-col-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.studio-logo-wrap {
  width: 140px;
  color: var(--ink);
}
.studio-logo-wrap svg {
  width: 100%;
  height: auto;
}
.footer-copy {
  font-size: 13px;
  color: var(--ink-3);
  margin: 0;
  max-width: 320px;
}
.footer-col-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
.footer-col-right .contact-links {
  font-family: "Epilogue", Arial, sans-serif;
  font-weight: 900;
  font-size: 17px;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 6px;
}
.footer-col-right .note {
  font-size: 12px;
  color: var(--ink-3);
  margin: 0 0 12px;
  max-width: 260px;
}
.footer-col-right .socials {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-col-right .socials img {
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
}
.footer-col-right .socials img:hover {
  opacity: 1;
  transform: translateY(-1.5px);
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 32px;
  }
  .footer-col-left, .footer-col-right {
    align-items: center;
    text-align: center;
  }
  .footer-col-left .footer-nav {
    justify-content: center;
  }
}

/* Floating Study Buddy (Corner Companion) */
.studio-floating-buddy {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
body:not(.theme-studio) .studio-floating-buddy {
  display: none;
}
.studio-floating-buddy:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--ink);
}
.buddy-avatar-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: #dfe4f2;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}
.buddy-avatar-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.buddy-text {
  display: flex;
  flex-direction: column;
}
.buddy-title {
  font-family: "Epilogue", Arial, sans-serif;
  font-weight: 900;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.2;
}
.buddy-sub {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.2;
}
@media (max-width: 768px) {
  .studio-floating-buddy {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    padding: 4px;
  }
  .buddy-text {
    display: none;
  }
}

/* ==========================================================================
   Mobile-First Navigation Bar & Enhancements
   ========================================================================== */

.mobile-tab-bar {
  display: none;
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)) 8px;
    background: var(--surface);
    background: rgba(var(--surface-rgb, 255, 255, 255), 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.06);
  }
  .mobile-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--ink-3);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 600;
    gap: 3px;
    transition: color 0.15s ease, transform 0.15s ease;
    border-radius: 8px;
    padding: 2px 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-tab-item .tab-icon-wrap {
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 22px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-tab-item.active {
    color: var(--blue);
  }
  .mobile-tab-item.active .tab-icon-wrap {
    transform: scale(1.15);
  }
  .mobile-tab-item.active .tab-label {
    font-weight: 700;
  }
  .mobile-tab-item:active {
    transform: scale(0.92);
  }

  /* Refined mobile hero card & spacing */
  .hero-inner {
    flex-direction: column-reverse;
    align-items: center;
    gap: 20px;
    padding: 24px 16px 20px 16px;
    text-align: center;
  }
  .hero-content {
    align-items: center;
    text-align: center;
  }
  .hero-content p {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-actions {
    justify-content: center;
  }
  .mascot-card {
    max-width: 280px;
  }
}

/* Mascot Word Count in Hero */
.mascot-card-wordcount {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.06);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.theme-studio .mascot-card-wordcount {
  background: rgba(0, 0, 0, 0.08);
}
.dark .mascot-card-wordcount {
  background: rgba(255, 255, 255, 0.12);
}
.mascot-card-wordcount .wc-label {
  opacity: 0.85;
}
.mascot-card-wordcount b {
  color: var(--blue);
  font-weight: 800;
}
.theme-studio .mascot-card-wordcount b {
  color: #4a38cb;
}
.dark .mascot-card-wordcount b {
  color: #8da4ff;
}

/* ==========================================================================
   Students Section Styles
   ========================================================================== */

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.student-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.student-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
}
.student-card:active {
  transform: scale(0.98);
}

.student-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #8f75ff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(91, 91, 230, 0.25);
}
.student-avatar.lg {
  width: 58px;
  height: 58px;
  font-size: 20px;
}

.student-info {
  flex: 1;
  min-width: 0;
}

.student-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.student-name {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-role {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--gray-200);
  color: var(--ink-2);
}

.student-sets-stat {
  font-size: 13px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 5px;
}

.student-arrow {
  color: var(--ink-3);
  font-size: 13px;
  padding-right: 4px;
  transition: transform 0.2s ease, color 0.2s ease;
}
.student-card:hover .student-arrow {
  transform: translateX(3px);
  color: var(--blue);
}

/* Student Profile View */
.student-profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  flex-wrap: wrap;
}
.student-profile-meta {
  flex: 1;
  min-width: 200px;
}
.student-profile-actions {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   Folders Section Styles
   ========================================================================== */

.folder-card {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.folder-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
}
.folder-card:active {
  transform: scale(0.98);
}

.folder-header-card {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Modal styling for sets assignment */
.assign-modal {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border: 1.5px solid var(--border);
  overflow: hidden;
}

/* Page Search Bar (for Students & Folders views) */
.page-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 480px;
}
.page-search-icon {
  position: absolute;
  left: 14px;
  color: var(--ink-3);
  pointer-events: none;
  font-size: 14px;
}
.page-search-input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 40px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
}
.page-search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 116, 225, 0.15);
}
body.theme-studio .page-search-input {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}
body.theme-studio .page-search-input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(8, 9, 9, 0.1);
}

/* Keep the full vocabulary navigation and account controls within the viewport.
   Layout overrides come after theme rules; no font shrinking or clipped controls. */
.topbar {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  grid-template-areas: "brand search account" "navigation navigation navigation";
  height: auto;
  min-height: 60px;
  padding: 12px 24px 10px;
  gap: 8px 20px;
  width: 100%;
  min-width: 0;
}
.topbar .logo { grid-area: brand; white-space: nowrap; }
.topbar .nav-links {
  grid-area: navigation;
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  margin-left: 0;
  gap: 4px;
}
.topbar .nav-link { white-space: nowrap; min-height: 38px; display: inline-flex; align-items: center; gap: 6px; }
.topbar .search { grid-area: search; display: block; min-width: 0; width: 100%; max-width: 500px; }
.topbar .search input { min-width: 0; }
.topbar .topbar-actions { grid-area: account; min-width: 0; gap: 8px; }
.topbar #topbar-user { min-width: 0; }
.topbar-menu-toggle { display: none; }
.topbar :is(a, button):focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

@media (max-width: 960px) and (min-width: 769px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "brand account" "search search" "navigation navigation"; padding-inline: 18px; }
  .topbar .search { max-width: none; }
  .topbar .topbar-actions { justify-self: end; }
}
@media (max-width: 768px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand toggle" "search search" "navigation navigation" "account account";
    padding: 10px 14px;
    gap: 0 12px;
  }
  .topbar-menu-toggle { grid-area: toggle; display: inline-flex; min-height: 40px; }
  .topbar .nav-links, .topbar .search, .topbar .topbar-actions { display: none; }
  .topbar.nav-open { row-gap: 12px; }
  .topbar.nav-open .search { display: block; max-width: none; }
  .topbar.nav-open .nav-links { display: flex; }
  .topbar.nav-open .topbar-actions { display: flex; flex-wrap: wrap; width: 100%; margin-left: 0; gap: 10px; }
  .topbar .nav-link { min-height: 44px; }
  .topbar .topbar-actions > .theme-toggle-btn, .topbar .lang-toggle-btn { min-width: 40px; min-height: 40px; }
  .topbar #topbar-user { flex-wrap: wrap; margin-left: auto; gap: 6px; }
  .topbar #topbar-user > .btn { min-height: 40px; min-width: 40px; }
  .topbar .user-chip .u-name { max-width: 85px; }
}

/* Native modal supplies focus containment, Escape handling, and inert background. */
.assign-students-dialog {
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; border: 0; color: var(--ink);
}
.assign-students-dialog::backdrop { background: transparent; }
.assign-students-dialog .assign-modal-card { width: 100%; max-height: calc(100dvh - 80px); }
.assign-students-dialog .assign-modal-header { gap: 16px; }
.assign-students-dialog h3 { margin: 0 0 6px; font-size: 17px; }
.assign-students-dialog .assign-modal-header p { margin: 0; color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.assignment-counts { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.assignment-counts[hidden], .assign-students-dialog [hidden] { display: none; }
.assignment-student-details { display: flex; flex-direction: column; min-width: 0; gap: 4px; }
.assignment-student-name { font-weight: 600; overflow-wrap: anywhere; }
.assignment-student-date { color: var(--ink-3); font-size: 12px; }
.assignment-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.assignment-error { color: var(--red); line-height: 1.5; }
.assign-students-dialog .assign-item:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
.assign-students-dialog button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (max-width: 768px) {
  .assign-students-dialog { padding: 16px; }
  .assign-students-dialog .assign-modal-card { max-height: calc(100dvh - 32px); }
}

/* A native link opens each set; separate action buttons remain above its hit area. */
.set-card > .set-top { order: -1; }
.set-card-link { color: var(--ink); }
.set-card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.set-card-link:focus-visible { outline: none; }
.set-card-link:focus-visible::after { outline: 3px solid var(--blue); outline-offset: 3px; }
.set-card button { position: relative; z-index: 1; }
.set-card button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* Avoid fixed card/hero minimums creating a second overflow on narrow phones. */
.set-grid { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.set-card { min-width: 0; }
.set-card .set-title, .set-card .set-desc { overflow-wrap: anywhere; }
.assign-students-dialog, .assign-students-dialog .assign-modal-body { overscroll-behavior: contain; }
@media (max-width: 768px) {
  #home-main { padding: 20px 16px; }
  #home-main > .hero { padding: 24px 0; }
  #home-main .hero-inner { padding: 0; }
  #home-main > .section { padding: 24px 0; }
  #home-main .hero-content { flex: 0 1 auto; min-width: 0; }
  #home-main .hero-mascot-wrapper { flex: 0 1 auto; max-width: 100%; }
  #home-main .mascot-card { max-width: 100%; }
}

/* ==========================================================================
   Unified Classroom Design System Across All Pages
   (Matches Overview / Classroom aesthetic from portal.css)
   ========================================================================== */

:root,
html,
body,
html.theme-soft,
body.theme-soft,
html.theme-classic,
body.theme-classic,
html.theme-studio,
body.theme-studio {
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  --font-heading: Georgia, 'Times New Roman', serif !important;
  --blue: #242e4b !important;
  --blue-dark: #3b4766 !important;
  --blue-50: #eeebf8 !important;
  --blue-100: #dfdaf2 !important;
  --ink: #202a43 !important;
  --ink-2: #555d72 !important;
  --ink-3: #8c8e9b !important;
  --bg: #f8f8f4 !important;
  --background: #f8f8f4 !important;
  --surface: #ffffff !important;
  --surface-hover: #f3f2ed !important;
  --border: #e9e7e2 !important;
  --border-light: #eeece7 !important;
  --gray-100: #f4f3ee !important;
  --gray-200: #eae8e1 !important;
  --gray-300: #dcddd9 !important;
  --gray-400: #9294a0 !important;
  --white: #ffffff !important;
  --green: #5b8266 !important;
  --green-50: #edf4ee !important;
  --red: #a94444 !important;
  --red-50: #f9eeee !important;
  --orange: #b69978 !important;
  --orange-50: #f9efe6 !important;
  --gold: #c29b53 !important;
  --shadow-sm: 0 2px 6px rgba(32, 42, 67, 0.03) !important;
  --shadow-md: 0 10px 24px rgba(32, 42, 67, 0.06) !important;
  --shadow-lg: 0 18px 48px rgba(32, 42, 67, 0.09) !important;
  --radius: 12px !important;
  background-color: #f8f8f4 !important;
  color: #202a43 !important;
}

/* Editorial Georgia Serif Headings across all views */
body h1,
body .hero h1,
body .set-head h1,
body .editor-top-bar h1,
body .auth-head h1,
body .section-head h1,
body .section-head h2 {
  font-family: Georgia, 'Times New Roman', serif !important;
  font-weight: 400 !important;
  letter-spacing: -0.6px !important;
  color: #202a43 !important;
}

/* Classroom Left Sidebar Layout on Desktop for all non-portal pages */
.topbar .logo.cp-brand {
  color: #202a43 !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 23px !important;
  font-weight: 800 !important;
  letter-spacing: -0.8px !important;
  text-decoration: none !important;
  gap: 11px !important;
}
.topbar .cp-brand-title {
  display: block;
  line-height: 1.05;
  color: #202a43 !important;
}
.topbar .cp-brand-sub {
  display: block;
  color: #858896 !important;
  font-size: 9px !important;
  font-weight: 400 !important;
  letter-spacing: 1.2px !important;
  margin-top: 2px !important;
}
.topbar-workspace,
.topbar-nav-label,
.topbar-sidebar-note {
  display: none;
}

@media (min-width: 961px) {
  body:not(.classroom-page) .topbar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: 236px !important;
    height: 100vh !important;
    background: #fdfcf8 !important;
    border-right: 1px solid #e9e7e2 !important;
    border-bottom: none !important;
    padding: 34px 20px 22px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    z-index: 40 !important;
    box-shadow: none !important;
  }
  body:not(.classroom-page) .topbar-workspace {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 30px 0 24px;
  }
  body:not(.classroom-page) .topbar-workspace strong {
    display: block;
    font-size: 11.5px;
    color: #202a43;
    line-height: 1.4;
  }
  body:not(.classroom-page) .topbar-workspace span:not(.cp-workspace-icon) {
    display: block;
    font-size: 10px;
    color: #74798b;
    margin-top: 1px;
  }
  body:not(.classroom-page) .topbar .search {
    order: 2;
    max-width: none !important;
    margin: 0 0 20px 0 !important;
  }
  body:not(.classroom-page) .topbar .search input {
    height: 36px !important;
    border-radius: 8px !important;
    border: 1px solid #e6e5de !important;
    background: #f6f5f0 !important;
    font-size: 12.5px !important;
    padding: 0 12px 0 34px !important;
    color: #202a43 !important;
  }
  body:not(.classroom-page) .topbar .search .icon {
    left: 11px !important;
    font-size: 12px !important;
    color: #8c8e9b !important;
  }
  body:not(.classroom-page) .topbar-nav-label {
    order: 3;
    display: block !important;
    color: #9999a0;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.45px;
    margin: 0 10px 10px;
  }
  body:not(.classroom-page) .topbar .nav-links {
    order: 4;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
    margin: 0 !important;
  }
  body:not(.classroom-page) .topbar .nav-link {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 11px !important;
    min-height: 42px !important;
    padding: 9px 12px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #717688 !important;
    background: transparent !important;
    border: none !important;
  }
  body:not(.classroom-page) .topbar .nav-link i {
    width: 16px;
    text-align: center;
    color: #8c8e9b;
    font-size: 13.5px;
  }
  body:not(.classroom-page) .topbar .nav-link:hover {
    background: #f0efe9 !important;
    color: #202a43 !important;
    text-decoration: none !important;
  }
  body:not(.classroom-page) .topbar .nav-link.active {
    background: #eeebf8 !important;
    color: #433a72 !important;
    font-weight: 600 !important;
  }
  body:not(.classroom-page) .topbar .nav-link.active i {
    color: #5b4c70 !important;
  }
  body:not(.classroom-page) .topbar .topbar-actions {
    order: 5;
    margin-top: auto !important;
    margin-left: 0 !important;
    padding-top: 16px;
    border-top: 1px solid #eeece7;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
  }
  body:not(.classroom-page) .topbar #topbar-user {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 6px;
  }
  body:not(.classroom-page) .topbar-sidebar-note {
    order: 6;
    display: block !important;
    border-radius: 10px;
    background: #eeeee6;
    margin-top: 14px;
    padding: 16px 14px 12px;
    position: relative;
  }
  body:not(.classroom-page) .topbar-sidebar-note p {
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    color: #71766b;
  }
  body:not(.classroom-page) .topbar-sidebar-note strong {
    color: #454f48;
    font-weight: 600;
  }
  body:not(.classroom-page) .topbar-sidebar-note .cp-school-label {
    margin-top: 10px;
    text-align: left;
  }
  body:not(.classroom-page) > main,
  body:not(.classroom-page) > .study-screen:not(.fullscreen),
  body:not(.classroom-page) > #admin-root {
    margin-left: 236px !important;
    width: calc(100% - 236px) !important;
    max-width: 1360px !important;
    padding: 36px 44px 56px !important;
    box-sizing: border-box !important;
  }
}

/* Unified Buttons & Controls (Classroom aesthetic) */
.btn,
body.theme-studio .btn,
body.theme-soft .btn {
  border-radius: 8px !important;
  font-family: var(--font) !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  box-shadow: none !important;
  letter-spacing: 0 !important;
}
.btn-primary,
body.theme-studio .btn-primary,
body.theme-soft .btn-primary {
  background: #242e4b !important;
  color: #ffffff !important;
  border: 1px solid #242e4b !important;
}
.btn-primary:hover:not(:disabled) {
  background: #3b4766 !important;
  border-color: #3b4766 !important;
}
.btn-secondary,
body.theme-studio .btn-secondary,
body.theme-soft .btn-secondary {
  background: #ffffff !important;
  color: #424b63 !important;
  border: 1px solid #dcddd9 !important;
}
.btn-secondary:hover:not(:disabled) {
  background: #f0efe9 !important;
  color: #202a43 !important;
}
.btn-ghost,
body.theme-studio .btn-ghost,
body.theme-soft .btn-ghost {
  background: transparent !important;
  color: #555d72 !important;
  border: 1px solid transparent !important;
}
.btn-ghost:hover:not(:disabled) {
  background: #f0efe9 !important;
  color: #202a43 !important;
}
.btn-danger,
body.theme-studio .btn-danger,
body.theme-soft .btn-danger {
  background: #a94444 !important;
  color: #ffffff !important;
  border: 1px solid #a94444 !important;
}

/* Unified Cards & Panels */
.card,
.set-card,
.folder-card,
.student-card,
.student-profile-card,
.folder-header-card,
.admin-table-wrap,
.editor-meta-card,
.editor-cards-wrap .ecard,
.test-config-card,
.flip-face,
.quiz-prompt,
.auth-card,
body.theme-studio .card,
body.theme-studio .set-card,
body.theme-studio .auth-card,
body.theme-studio .flip-face,
body.theme-studio .quiz-prompt {
  background: #ffffff !important;
  border: 1px solid #e9e7e2 !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 8px rgba(32, 42, 67, 0.03) !important;
  color: #202a43 !important;
}
.set-card:hover,
.folder-card:hover,
.student-card:hover {
  border-color: #c9bfdf !important;
  box-shadow: 0 10px 24px rgba(32, 42, 67, 0.07) !important;
  transform: translateY(-2px) !important;
}

/* Dark Navy Classroom Hero Banner on Vocabulary Library (#/library) */
#home-main > .hero {
  position: relative;
  overflow: hidden;
  background: #27324c !important;
  color: #faf9f6 !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 34px 36px !important;
  margin: 0 0 28px 0 !important;
  max-width: none !important;
  min-height: 240px;
  display: flex;
  align-items: center;
  text-align: left !important;
}
#home-main .hero-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  z-index: 2;
}
#home-main .hero-content {
  max-width: 60%;
}
#home-main .hero h1 {
  color: #faf9f6 !important;
  font-family: Georgia, 'Times New Roman', serif !important;
  font-size: clamp(26px, 2.5vw, 35px) !important;
  font-weight: 400 !important;
  line-height: 1.17 !important;
  letter-spacing: -0.5px !important;
  margin: 18px 0 12px !important;
}
#home-main .hero p {
  color: #bec5d6 !important;
  font-size: 12.5px !important;
  line-height: 1.75 !important;
  margin: 0 0 22px !important;
  max-width: 440px !important;
}
#home-main .hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#home-main .hero .hero-cta {
  background: #f6f3ee !important;
  color: #26304e !important;
  border: 1px solid #f6f3ee !important;
  border-radius: 7px !important;
  padding: 10px 18px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}
#home-main .hero .hero-cta:hover {
  background: #ffffff !important;
  transform: translateY(-1px);
}
#home-main .hero .btn-secondary {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f6f3ee !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 7px !important;
  padding: 10px 16px !important;
  font-size: 12px !important;
}
#home-main .hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16) !important;
}
#home-main > .section {
  padding: 0 !important;
  max-width: none !important;
}

@media (max-width: 760px) {
  #home-main .hero-content { max-width: 100%; }
  #home-main .cp-hero-art { display: none; }
}

/* Classroom Filter Tabs (.cp-tabs style) */
.filter-tabs {
  display: inline-flex !important;
  align-items: center;
  gap: 4px !important;
  padding: 4px !important;
  border: 1px solid #efede8 !important;
  border-radius: 8px !important;
  background: #f9f8f5 !important;
  flex-wrap: wrap;
}
.filter-tab,
body.theme-studio .filter-tab,
body.theme-soft .filter-tab {
  border: none !important;
  background: transparent !important;
  color: #74798b !important;
  border-radius: 6px !important;
  padding: 8px 14px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}
.filter-tab:hover {
  color: #202a43 !important;
  background: rgba(255, 255, 255, 0.6) !important;
}
.filter-tab.active,
body.theme-studio .filter-tab.active,
body.theme-soft .filter-tab.active {
  background: #ffffff !important;
  color: #433a72 !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 4px rgba(53, 48, 74, 0.08) !important;
}

/* Pastel Classroom Badges & Progress */
.badge-level,
.badge-assigned,
.badge-enrolled,
.badge-role,
.badge-admin {
  border-radius: 6px !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.3px !important;
  padding: 3px 8px !important;
  border: none !important;
}
.badge-b1 { background: #f0edf8 !important; color: #6d618f !important; }
.badge-a1, .badge-enrolled { background: #edf4ed !important; color: #5b8266 !important; }
.badge-assigned { background: #f9efe6 !important; color: #9a7b56 !important; }
.badge-role { background: #f3f2f0 !important; color: #74798b !important; }
.badge-admin { background: #eeebf8 !important; color: #433a72 !important; }

.card-progress-box {
  background: #f8f8f4 !important;
  border: 1px solid #eeece7 !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
}
.card-progress-pct {
  color: #5b4c70 !important;
}
.card-progress-fill {
  background: #8c80c4 !important;
}

/* Grouped Sets ("Нові / Непройдені" & "Пройдені") */
.sets-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 8px;
  border-bottom: 1px solid #e9e7e2;
}
.sets-group-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.sets-group-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #202a43;
}
.sets-group-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.sets-group-dot.active {
  background: #8c80c4;
  box-shadow: 0 0 0 4px #f0edf8;
}
.sets-group-dot.completed {
  background: #6b8b72;
  box-shadow: 0 0 0 4px #edf4ed;
}
.sets-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eeece7;
  color: #555d72;
  font-size: 11.5px;
  font-weight: 600;
}
.sets-group-empty {
  padding: 18px 20px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px dashed #dcddd9;
  color: #74798b;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Student Avatar (Warm Classroom Beige matching .cp-avatar) */
.student-avatar,
body.theme-studio .student-avatar,
body.theme-soft .student-avatar {
  background: #e9e4da !important;
  color: #77644e !important;
  border: none !important;
  font-weight: 600 !important;
}

/* Modern Set Page (#/set/:id) in Classroom Style */
.set-page .set-head {
  background: #ffffff;
  border: 1px solid #e9e7e2;
  border-radius: 12px;
  padding: 26px 28px;
  margin-bottom: 16px;
}
.set-page .mode-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 8px 0 24px;
  border-bottom: none;
  margin-bottom: 12px;
}
.set-page .mode-item {
  width: 100%;
  flex-direction: row;
  justify-content: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: #ffffff !important;
  border: 1px solid #e9e7e2 !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 6px rgba(32, 42, 67, 0.03) !important;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.set-page .mode-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(32, 42, 67, 0.07) !important;
  border-color: #c9bfdf !important;
  text-decoration: none;
}
.set-page .mode-circle {
  width: 42px;
  height: 42px;
  border-radius: 10px !important;
  font-size: 16px;
  flex-shrink: 0;
  border: none !important;
  outline: none !important;
}
.set-page .mode-flashcards { background: #f0edf8 !important; color: #6d618f !important; }
.set-page .mode-learn { background: #edf4ed !important; color: #5b8266 !important; }
.set-page .mode-test { background: #f9efe6 !important; color: #9a7b56 !important; }
.set-page .mode-match { background: #f1f5fd !important; color: #5c78a4 !important; }
.set-page .mode-item:hover .mode-circle {
  transform: none;
  box-shadow: none;
}
.set-page .mode-item span {
  font-size: 14px;
  font-weight: 600;
  color: #202a43 !important;
}
.set-page .card-list,
.study-screen .card-list {
  border: none !important;
  background: transparent !important;
  overflow: visible !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.set-page .card-row,
.study-screen .card-row {
  border: 1px solid #e9e7e2 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
}

@media (max-width: 820px) {
  .set-page .mode-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Study Modes (Flashcards, Learn, Test, Match) in Classroom Style */
.study-screen {
  background: #f8f8f4 !important;
}
.study-top {
  background: #fdfcf8 !important;
  border-bottom: 1px solid #e9e7e2 !important;
  border-radius: 12px;
  margin-bottom: 16px;
}
.btn-audio {
  background: #f0edf8 !important;
  color: #6d618f !important;
}
.btn-audio:hover {
  background: #e2dcf3 !important;
}

/* Modern Set Editor (#/new-set, #/set/:id/edit) in Classroom Style */
.editor-public-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f0edf8;
  border: 1px solid #dfdaf2;
  color: #5b4c70;
  font-size: 12px;
  font-weight: 600;
}
.editor-create-btn {
  border-radius: 8px !important;
  padding: 10px 22px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
}
.editor-meta-card {
  border-radius: 12px;
  padding: 24px;
}
.editor-filled-field {
  background: #f6f5f1;
  border: 1px solid #e9e7e2;
  border-radius: 9px;
  padding: 10px 14px 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.editor-filled-field:focus-within {
  border-color: #8c80c4;
  background: #ffffff;
}
.editor-meta-card input.title-input,
.editor-meta-card textarea.desc-input {
  border-bottom: none !important;
  padding: 2px 0 !important;
  font-size: 15px !important;
  background: transparent !important;
  color: #202a43 !important;
}
.editor-toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.editor-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #dcddd9;
  background: #ffffff;
  color: #202a43;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.editor-pill-btn:hover {
  background: #f0efe9;
  border-color: #c9bfdf;
}
.editor-select-pill {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #dcddd9;
  background: #ffffff;
  color: #202a43;
  font-size: 12.5px;
  font-weight: 500;
}
.editor-sugg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #555d72;
  cursor: pointer;
  user-select: none;
}
.editor-cards-wrap .ecard {
  border-radius: 12px;
  padding: 18px 22px 22px;
}
.ecard-field textarea {
  background: #f6f5f1 !important;
  border: 1px solid #e9e7e2 !important;
  border-radius: 9px !important;
  padding: 11px 14px !important;
  min-height: 44px !important;
  font-size: 14.5px !important;
  color: #202a43 !important;
  transition: border-color 0.15s ease, background 0.15s ease !important;
}
.ecard-field textarea:focus {
  border-color: #8c80c4 !important;
  background: #ffffff !important;
}
.ecard-field .field-sublabel {
  margin-top: 6px;
  padding-left: 4px;
}
.ecard-sugg-box {
  background: #faf9f5 !important;
  border: 1px solid #e9e7e2 !important;
}
.ecard-sugg-label {
  color: #5b4c70 !important;
}
.sugg-pill {
  background: #f0edf8 !important;
  border-color: #dfdaf2 !important;
  color: #433a72 !important;
}
.sugg-pill:hover,
.sugg-pill.active {
  background: #242e4b !important;
  border-color: #242e4b !important;
  color: #ffffff !important;
}
