@import url("https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,800;1,400;1,800&family=Lato:ital,wght@0,400;0,900;1,400;1,900&family=Merriweather:ital,wght@0,400;0,900;1,400;1,900&family=Montserrat:ital,wght@0,400;0,800;1,400;1,800&family=Noto+Sans:ital,wght@0,400;0,800;1,400;1,800&family=Open+Sans:ital,wght@0,400;0,800;1,400;1,800&family=Playfair+Display:ital,wght@0,400;0,800;1,400;1,800&family=Poppins:ital,wght@0,400;0,800;1,400;1,800&family=Raleway:ital,wght@0,400;0,800;1,400;1,800&family=Roboto:ital,wght@0,400;0,900;1,400;1,900&family=Source+Sans+3:ital,wght@0,400;0,800;1,400;1,800&display=swap");

:root {
  color-scheme: light;
  --ink: #17201f;
  --muted: #66706d;
  --line: #d9dedb;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --green: #2f7d5c;
  --green-dark: #245f47;
  --rose: #c04b55;
  --rose-dark: #923740;
  --gold: #e7b74d;
  --blue: #3b6f95;
  --shadow: 0 18px 60px rgba(36, 47, 43, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(231, 183, 77, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(59, 111, 149, 0.13), transparent 38%),
    #eef3ef;
}

body.app-dark {
  --ink: #f8fafc;
  --muted: #a8b3c7;
  --line: #334155;
  --paper: #111827;
  --panel: #0f172a;
  --green: #22c55e;
  --green-dark: #16a34a;
  --rose: #fb7185;
  --rose-dark: #f43f5e;
  --gold: #facc15;
  --blue: #38bdf8;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(56, 189, 248, 0.22), transparent 32%),
    radial-gradient(circle at 88% 14%, rgba(168, 85, 247, 0.22), transparent 30%),
    radial-gradient(circle at 50% 95%, rgba(34, 197, 94, 0.18), transparent 34%),
    #020617;
}

body.has-preview {
  overflow: hidden;
}

body.has-dashboard {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.language-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 40;
  display: grid;
  min-width: 48px;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  cursor: pointer;
}

body.app-dark .language-toggle {
  background: #0f172a;
  color: #f8fbff;
}

.access-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 430px);
  gap: 28px;
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  align-items: stretch;
}

.access-hero,
.access-panel {
  border: 1px solid rgba(217, 222, 219, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

body.app-dark .access-hero,
body.app-dark .access-panel {
  border-color: rgba(51, 65, 85, 0.9);
  background: rgba(15, 23, 42, 0.82);
}

.access-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: clamp(32px, 6vw, 72px);
}

.access-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.access-copy {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.35;
}

.access-plans {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.access-plans span {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.access-panel {
  align-self: center;
  padding: 24px;
}

.access-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.access-tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.access-tab.is-active {
  background: var(--green);
  color: #fff;
}

.access-form {
  display: grid;
  gap: 14px;
}

.access-form h2 {
  margin-bottom: 2px;
}

.terms-check {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(47, 125, 92, 0.06);
}

.terms-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
}

.terms-check span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.terms-link {
  width: 100%;
  margin-top: 10px;
}

.session-card {
  display: grid;
  gap: 4px;
  min-width: clamp(122px, 16vw, 148px);
  padding: clamp(8px, 1.2vw, 10px) clamp(10px, 1.4vw, 12px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.session-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(0.82rem, 1.4vw, 0.95rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(0.72rem, 1.25vw, 0.82rem);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card .text-button {
  width: 100%;
  min-height: 30px;
  margin-top: 4px;
}

.flashcard:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: clamp(54px, 8vw, 120px);
}

.flashcard:fullscreen .card-text {
  max-width: min(1200px, 88vw);
  padding-bottom: 74px;
}

.flashcard:fullscreen .card-label,
.flashcard:fullscreen .card-title {
  top: clamp(22px, 4vw, 54px);
}

.flashcard:fullscreen .card-label {
  left: clamp(22px, 4vw, 54px);
}

.flashcard:fullscreen .card-hint {
  display: none;
}

.flashcard:fullscreen .fullscreen-controls {
  display: grid;
}

button,
textarea,
select,
input {
  font: inherit;
}

input,
textarea,
select {
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: clamp(14px, 2vw, 24px);
  width: min(1180px, calc(100% - 32px));
  height: calc(100vh - 32px);
  margin: 16px auto;
}

.app-shell.panel-collapsed {
  grid-template-columns: minmax(0, 1fr);
  width: min(1060px, calc(100% - 32px));
}

.app-shell.panel-collapsed .deck-pane {
  display: none;
}

.study-pane,
.deck-pane {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(217, 222, 219, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

body.app-dark .study-pane,
body.app-dark .deck-pane {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(51, 65, 85, 0.9);
}

.study-pane {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.2vw, 26px);
  min-height: 0;
  overflow: auto;
  padding: clamp(18px, 3vw, 32px);
  border-radius: 8px;
}

.deck-pane {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 22px;
  border-radius: 8px;
}

.topbar,
.stats,
.controls,
.section-title {
  display: flex;
  align-items: center;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: clamp(10px, 1.5vw, 18px);
  align-items: center;
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: clamp(10px, 1.4vw, 16px);
}

.brand-lockup > div {
  min-width: 0;
}

.brand-logo {
  width: clamp(64px, 9vw, 92px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  overflow: visible;
  filter: drop-shadow(0 12px 20px rgba(36, 47, 43, 0.16));
}

.logo-body,
.logo-ear-left,
.logo-ear-right {
  fill: #2f7d5c;
}

.logo-wing {
  fill: #245f47;
}

.logo-card {
  fill: #fbfcfa;
  stroke: #17201f;
  stroke-width: 3;
}

.logo-glasses {
  fill: #ffffff;
  stroke: #17201f;
  stroke-width: 4;
}

.logo-bridge,
.logo-belly,
.logo-card-line {
  fill: none;
  stroke: #17201f;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-card-line {
  stroke-width: 3;
}

.logo-eye {
  fill: #17201f;
}

.logo-beak {
  fill: #e7b74d;
}

body.app-dark .brand-logo {
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.34));
}

body.app-dark .logo-body,
body.app-dark .logo-ear-left,
body.app-dark .logo-ear-right {
  fill: #22c55e;
}

body.app-dark .logo-wing {
  fill: #16a34a;
}

body.app-dark .logo-card {
  fill: #0f172a;
  stroke: #e2e8f0;
}

body.app-dark .logo-glasses {
  fill: #f8fafc;
  stroke: #020617;
}

body.app-dark .logo-bridge,
body.app-dark .logo-belly,
body.app-dark .logo-card-line {
  stroke: #020617;
}

body.app-dark .logo-eye {
  fill: #020617;
}

body.app-dark .logo-beak {
  fill: #facc15;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(2rem, 4.4vw, 4.4rem);
  line-height: 0.96;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, 1fr));
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stats span {
  min-width: 0;
  padding: clamp(7px, 0.9vw, 10px) clamp(7px, 1vw, 12px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

body.app-dark .stats span,
body.app-dark .appearance-panel,
body.app-dark .deck-item,
body.app-dark .palette-option {
  background: rgba(15, 23, 42, 0.88);
}

.stats strong {
  display: block;
  color: var(--ink);
  font-size: clamp(0.95rem, 1.65vw, 1.28rem);
}

.stats span.is-pass {
  border-color: rgba(47, 125, 92, 0.55);
  background: rgba(47, 125, 92, 0.1);
}

.stats span.is-pass strong {
  color: var(--green);
}

.stats span.is-fail {
  border-color: rgba(196, 73, 86, 0.5);
  background: rgba(196, 73, 86, 0.1);
}

.stats span.is-fail strong {
  color: var(--rose);
}

.progress-wrap {
  order: 4;
}

.study-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(104px, 15vw, 160px), 1fr));
  gap: 10px;
}

.app-shell:not(.panel-collapsed) .topbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.app-shell:not(.panel-collapsed) .stats {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  order: 2;
  width: 100%;
}

.app-shell:not(.panel-collapsed) .session-card {
  justify-self: end;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe6e1;
}

body.app-dark .progress-bar {
  background: #1e293b;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 180ms ease;
}

#progressText {
  margin: 10px 0 0;
  color: var(--muted);
}

.student-dashboard {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: clamp(8px, 1.2vw, 12px);
  overflow: auto;
  padding: clamp(10px, 1.6vw, 18px);
  background:
    radial-gradient(circle at 10% 8%, rgba(34, 197, 94, 0.12), transparent 28%),
    radial-gradient(circle at 90% 16%, rgba(56, 189, 248, 0.14), transparent 30%),
    #f6f8fb;
  color: #071832;
}

.student-dashboard[hidden] {
  display: none;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.student-profile-card,
.dashboard-panel,
.dashboard-metrics article {
  border: 1px solid #e4eaf2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.student-profile-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.student-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #22c55e, #38bdf8);
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 900;
}

.student-profile-card h2 {
  margin: 0;
  color: #071832;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
}

.student-profile-card p {
  margin: 3px 0 0;
  color: #607088;
  font-weight: 800;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.student-dashboard .ghost {
  border-color: #dbe4ef;
  background: #ffffff;
  color: #071832;
}

.student-dashboard .ghost:hover {
  background: #f7f9fc;
}

.pass-badge {
  display: inline-grid;
  min-width: 104px;
  min-height: 36px;
  place-items: center;
  padding: 0 14px;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  background: #ffffff;
  color: #607088;
  font-weight: 900;
}

.pass-badge.is-pass {
  border-color: rgba(47, 125, 92, 0.55);
  background: rgba(47, 125, 92, 0.12);
  color: #159447;
}

.pass-badge.is-fail {
  border-color: rgba(196, 73, 86, 0.5);
  background: rgba(196, 73, 86, 0.12);
  color: #c04b55;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-metrics article {
  padding: 10px 12px;
}

.dashboard-metrics span {
  display: block;
  color: #607088;
  font-size: 0.82rem;
  font-weight: 800;
}

.dashboard-metrics strong {
  display: block;
  margin-top: 2px;
  color: #071832;
  font-size: clamp(1.1rem, 2.3vw, 1.55rem);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.8fr);
  gap: 10px;
}

.dashboard-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.62fr) minmax(280px, 0.78fr);
  gap: 10px;
}

.dashboard-panel {
  min-width: 0;
  padding: 12px;
}

.dashboard-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.dashboard-panel-head h2 {
  margin: 0;
  color: #071832;
  font-size: clamp(0.92rem, 1.5vw, 1.02rem);
}

.dashboard-panel-head span {
  color: #607088;
  font-size: 0.82rem;
  font-weight: 800;
}

.dashboard-panel-head select {
  min-width: 0;
  max-width: 190px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #ffffff;
  color: #071832;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.exam-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 26px);
  align-items: end;
  min-height: clamp(165px, 23vh, 210px);
  padding: 12px 6px 4px;
  border-bottom: 1px solid #dbe4ef;
}

.exam-bar {
  display: grid;
  min-width: 0;
  grid-template-rows: 20px clamp(104px, 16vh, 140px) auto;
  gap: 6px;
  justify-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.exam-bar:focus-visible {
  outline: 2px solid #22c5dc;
  outline-offset: 4px;
}

.exam-bar span {
  color: #071832;
  font-size: 0.8rem;
  font-weight: 900;
}

.exam-bar i {
  align-self: end;
  width: min(64px, 78%);
  height: var(--height);
  min-height: 8px;
  border-radius: 7px 7px 0 0;
  background: #e8edf5;
}

.exam-bar i.is-active {
  background: linear-gradient(180deg, #5c7cfa, #22c5dc);
}

.exam-bar b {
  overflow: hidden;
  max-width: 100%;
  color: #071832;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-donut-wrap {
  display: grid;
  min-height: clamp(165px, 23vh, 210px);
  place-items: center;
  gap: 10px;
  align-content: center;
  text-align: center;
}

.dashboard-donut {
  position: relative;
  display: grid;
  width: min(132px, 54vw);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffffff 0 54%, transparent 55%),
    conic-gradient(#22c55e var(--score), #e8edf5 0);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.dashboard-donut span {
  color: #071832;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 900;
}

.dashboard-donut-copy {
  display: grid;
  gap: 4px;
}

.dashboard-donut-copy strong {
  color: #071832;
  font-weight: 900;
}

.dashboard-donut-copy span {
  color: #607088;
  font-weight: 800;
}

.status-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border-radius: 8px;
  background: #f7f9fc;
}

.status-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  font-weight: 900;
}

.status-icon.good {
  background: #e8f8ee;
  color: #0c9b4a;
}

.status-icon.warn {
  background: #fff4dc;
  color: #d98a00;
}

.status-icon.info {
  background: #eaf2ff;
  color: #2563eb;
}

.status-row strong {
  display: block;
  color: #071832;
}

.status-row small {
  color: #607088;
  font-weight: 700;
}

.status-row b {
  padding: 5px 10px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.72rem;
}

.status-row b.good {
  background: #0cba52;
}

.status-row b.warn {
  background: #f59e0b;
}

.status-row b.info {
  background: #0ea5e9;
}

.line-chart {
  min-height: clamp(140px, 20vh, 175px);
  overflow: hidden;
}

.line-chart svg {
  display: block;
  width: 100%;
  height: clamp(122px, 18vh, 160px);
}

.line-chart text {
  fill: #071832;
  font-size: 12px;
}

.chart-grid-line {
  stroke: #e6ebf2;
  stroke-width: 1;
}

.line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}

.accuracy-line {
  stroke: #65c7d2;
}

.mastery-line {
  stroke: #8fb4f8;
}

.accuracy-dot {
  fill: #08b9e8;
  stroke: #ffffff;
  stroke-width: 3;
}

.mastery-dot {
  fill: #4f7df3;
  stroke: #ffffff;
  stroke-width: 3;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  color: #607088;
  font-size: 0.78rem;
  font-weight: 800;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.accuracy-key {
  background: #08b9e8;
}

.mastery-key {
  background: #4f7df3;
}

.student-dashboard.dashboard-dark {
  background:
    radial-gradient(circle at 12% 10%, rgba(34, 197, 94, 0.2), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(92, 124, 250, 0.24), transparent 34%),
    #06111f;
  color: #f8fbff;
}

.student-dashboard.dashboard-dark .student-profile-card,
.student-dashboard.dashboard-dark .dashboard-panel,
.student-dashboard.dashboard-dark .dashboard-metrics article {
  border-color: #243349;
  background: rgba(12, 22, 38, 0.96);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

.student-dashboard.dashboard-dark .student-profile-card h2,
.student-dashboard.dashboard-dark .dashboard-metrics strong,
.student-dashboard.dashboard-dark .dashboard-panel-head h2,
.student-dashboard.dashboard-dark .exam-bar span,
.student-dashboard.dashboard-dark .exam-bar b,
.student-dashboard.dashboard-dark .status-row strong,
.student-dashboard.dashboard-dark .dashboard-bar-row strong,
.student-dashboard.dashboard-dark .dashboard-bar-row b,
.student-dashboard.dashboard-dark .dashboard-review-btn span,
.student-dashboard.dashboard-dark .line-chart text,
.student-dashboard.dashboard-dark .dashboard-donut span,
.student-dashboard.dashboard-dark .dashboard-donut-copy strong {
  color: #f8fbff;
  fill: #f8fbff;
}

.student-dashboard.dashboard-dark .student-profile-card p,
.student-dashboard.dashboard-dark .dashboard-metrics span,
.student-dashboard.dashboard-dark .dashboard-panel-head span,
.student-dashboard.dashboard-dark .status-row small,
.student-dashboard.dashboard-dark .dashboard-bar-row span,
.student-dashboard.dashboard-dark .dashboard-empty,
.student-dashboard.dashboard-dark .chart-legend,
.student-dashboard.dashboard-dark .dashboard-donut-copy span {
  color: #aebbd0;
}

.student-dashboard.dashboard-dark .ghost,
.student-dashboard.dashboard-dark .pass-badge,
.student-dashboard.dashboard-dark .dashboard-panel-head select,
.student-dashboard.dashboard-dark .dashboard-review-btn {
  border-color: #2c3b55;
  background: #0b1728;
  color: #f8fbff;
}

.student-dashboard.dashboard-dark .ghost:hover {
  background: #12233b;
}

.student-dashboard.dashboard-dark .status-row {
  background: #0b1728;
}

.student-dashboard.dashboard-dark .chart-grid-line {
  stroke: #25354d;
}

.student-dashboard.dashboard-dark .dashboard-donut {
  background:
    radial-gradient(circle, #0c1626 0 54%, transparent 55%),
    conic-gradient(#22c55e var(--score), #243349 0);
}

.dashboard-bars {
  display: grid;
  max-height: clamp(112px, 17vh, 155px);
  gap: 8px;
  overflow: auto;
}

.dashboard-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  cursor: pointer;
}

.dashboard-bar-row strong,
.dashboard-review-btn span {
  display: block;
  overflow: hidden;
  color: #071832;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-bar-row span {
  display: block;
  margin-top: 2px;
  color: #607088;
  font-size: 0.78rem;
  font-weight: 800;
}

.dashboard-bar-row b {
  color: #071832;
}

.dashboard-bar-row i {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--green) var(--bar), transparent var(--bar)),
    rgba(102, 112, 109, 0.18);
}

.dashboard-list {
  display: grid;
  max-height: clamp(112px, 17vh, 155px);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
}

.dashboard-review-btn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  align-items: center;
  border: 1px solid #e4eaf2;
  background: transparent;
  color: #071832;
  text-align: left;
}

.dashboard-review-btn strong {
  color: #159447;
}

.dashboard-empty {
  margin: 0;
  color: #607088;
  font-weight: 800;
}

.flashcard {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(280px, 40vh, 420px);
  max-height: min(54vh, 520px);
  padding: clamp(46px, 5vw, 56px) clamp(20px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid #cfd8d2;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(47, 125, 92, 0.08), transparent 50%),
    var(--card-bg, var(--paper));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  color: var(--card-color, var(--ink));
  cursor: pointer;
  font-family: var(--card-font, Inter), ui-sans-serif, system-ui, sans-serif;
  text-align: center;
}

body.app-dark .flashcard {
  border-color: rgba(148, 163, 184, 0.34);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 18px 56px rgba(0, 0, 0, 0.18);
}

.flashcard:focus-visible,
button:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(59, 111, 149, 0.35);
  outline-offset: 3px;
}

.card-label,
.card-hint,
.card-title {
  position: absolute;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.card-label {
  top: 18px;
  left: 20px;
  text-transform: uppercase;
}

.card-hint {
  right: 20px;
  bottom: 18px;
}

.fullscreen-controls {
  position: absolute;
  right: clamp(18px, 4vw, 54px);
  bottom: clamp(18px, 4vw, 54px);
  left: clamp(18px, 4vw, 54px);
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.card-title {
  top: 18px;
  left: 50%;
  max-width: min(70%, 560px);
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
}

.card-text {
  width: 100%;
  max-width: 760px;
  max-height: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(1.15rem, 3.2vw, 3.45rem);
  font-style: var(--card-font-style, normal);
  font-weight: var(--card-font-weight, 800);
  line-height: 1.1;
}

.answer-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 1.2em;
  text-align: left;
  font-size: 0.82em;
  line-height: 1.16;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.answer-list li {
  padding-left: 0.1em;
}

.rich-card-content {
  display: grid;
  place-items: center;
  width: min(100%, 860px);
  max-height: 100%;
  gap: 0.5em;
  overflow: hidden;
  color: var(--card-color, var(--ink));
  font-size: 0.78em;
  line-height: 1.16;
  text-align: center;
}

.rich-answer-list {
  display: grid;
  gap: 0.38em;
  max-width: 100%;
  margin: 0;
  padding-left: 1.2em;
  text-align: left;
}

.rich-card-content li {
  padding-left: 0.1em;
}

.rich-card-content table {
  max-width: 100%;
  border-collapse: collapse;
  border: 0.08em solid currentColor;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 0.9em;
  line-height: 1.18;
}

.rich-card-content th,
.rich-card-content td {
  padding: 0.24em 0.46em;
  border: 0.06em solid currentColor;
  text-align: left;
  white-space: nowrap;
}

.rich-card-content th {
  font-weight: 900;
}

.rich-card-content img {
  display: block;
  width: auto;
  max-width: min(72%, 340px);
  max-height: min(46vh, 260px);
  object-fit: contain;
}

.rich-card-content pre {
  max-width: 100%;
  margin: 0;
  padding: 0.45em 0.65em;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
  text-align: left;
}

.rich-card-content code {
  padding: 0.1em 0.25em;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.14);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.76em;
}

.rich-card-content pre code {
  padding: 0;
  background: transparent;
  white-space: pre-wrap;
}

.rich-card-content a {
  color: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.rich-card-content mark {
  padding: 0 0.12em;
  background: rgba(255, 236, 141, 0.9);
  color: #17201f;
}

.rich-card-content .md-checkbox {
  display: inline-grid;
  width: 1em;
  height: 1em;
  place-items: center;
  font-size: 0.9em;
  line-height: 1;
}

.rich-card-content .math {
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}

.rich-card-content .katex {
  font-size: 0.9em;
  white-space: nowrap;
}

.mindmap-card {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  color: var(--card-color, var(--ink));
}

.mindmap-card svg {
  width: 100%;
  height: 100%;
  min-height: 280px;
}

.mindmap-svg-text,
.mindmap-root-text {
  fill: var(--card-color, var(--ink));
  font-family: var(--card-font, Inter), ui-sans-serif, system-ui, sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.mindmap-root-text {
  font-size: 23px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(92px, 18vw, 160px), 1fr));
  gap: 10px;
}

button {
  min-height: clamp(38px, 5.2vw, 46px);
  padding: 0 clamp(10px, 1.8vw, 18px);
  border: 0;
  border-radius: 8px;
  font-size: clamp(0.88rem, 1.7vw, 1rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: center;
  cursor: pointer;
}

.primary,
.success {
  background: var(--green);
  color: #fff;
}

.primary:hover,
.success:hover {
  background: var(--green-dark);
}

.danger {
  background: var(--rose);
  color: #fff;
}

.danger:hover {
  background: var(--rose-dark);
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

body.app-dark .ghost,
body.app-dark .text-button,
body.app-dark .delete-btn {
  background: #111827;
  color: var(--ink);
}

.deck-item .ghost {
  width: 100%;
  text-align: left;
}

.ghost:hover,
.text-button:hover {
  background: #f0f4f1;
}

body.app-dark .ghost:hover,
body.app-dark .text-button:hover {
  background: #1e293b;
}

.composer {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.markdown-composer {
  display: grid;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  color: var(--ink);
  line-height: 1.4;
}

body.app-dark input,
body.app-dark textarea,
body.app-dark select {
  border-color: var(--line);
  background: #0b1220;
  color: var(--ink);
}

body.app-dark textarea::placeholder,
body.app-dark input::placeholder {
  color: #94a3b8;
}

textarea {
  resize: vertical;
}

select {
  min-height: 44px;
}

.appearance-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

body.app-dark .appearance-panel {
  background: rgba(15, 23, 42, 0.7);
}

.appearance-panel.is-hidden {
  display: none;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.appearance-panel label {
  margin-bottom: 0;
}

.palette-panel {
  display: grid;
  gap: 8px;
}

.palette-panel p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.palette-grid {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.palette-option {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
}

.palette-option.is-active {
  border-color: rgba(47, 125, 92, 0.7);
  box-shadow: 0 0 0 3px rgba(47, 125, 92, 0.14);
}

.palette-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: 28px;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 31, 0.12);
  border-radius: 6px;
}

.palette-swatches i {
  display: block;
  min-width: 0;
}

input[type="color"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--panel);
  cursor: pointer;
}

body.app-dark input[type="color"] {
  background: #111827;
}

.button-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.form-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.section-title {
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding-bottom: 8px;
  background: rgba(255, 255, 255, 0.92);
}

body.app-dark .section-title {
  background: rgba(15, 23, 42, 0.92);
}

.section-title h2 {
  margin-bottom: 0;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue);
  font-size: 0.86rem;
}

.deck-list-wrap {
  display: flex;
  flex: 0 0 auto;
  min-height: 260px;
  flex-direction: column;
  overflow: hidden;
}

.deck-list {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  max-height: 360px;
  margin: 14px 0 0;
  padding: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  list-style: none;
}

.deck-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.deck-item.active {
  border-color: rgba(47, 125, 92, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 125, 92, 0.12);
}

.deck-item p {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-item small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-btn {
  width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--rose);
}

body.app-dark .preview-modal {
  background: rgba(2, 6, 23, 0.7);
}

body.app-dark .preview-dialog {
  border-color: var(--line);
  background: var(--panel);
}

body.app-dark .preview-header {
  border-color: var(--line);
  background: rgba(15, 23, 42, 0.94);
}

body.app-dark #previewFrame {
  background: #ffffff;
}

.preview-modal[hidden] {
  display: none;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  padding: 18px;
  background: rgba(23, 32, 31, 0.45);
  backdrop-filter: blur(8px);
}

.preview-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(217, 222, 219, 0.95);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.preview-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.preview-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.preview-actions {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
}

.preview-actions button {
  min-height: 40px;
  padding: 0 12px;
}

.preview-actions .is-active {
  border-color: rgba(47, 125, 92, 0.55);
  background: rgba(47, 125, 92, 0.12);
  color: var(--green-dark);
}

#previewFrame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

.terms-modal[hidden] {
  display: none;
}

.terms-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 32, 31, 0.5);
  backdrop-filter: blur(8px);
}

.terms-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(217, 222, 219, 0.95);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.terms-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.terms-header h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

.terms-content {
  display: grid;
  gap: 16px;
  overflow: auto;
  padding: 18px;
}

.terms-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.55;
}

.terms-content article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(47, 125, 92, 0.05);
}

.terms-content h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

body.app-dark .terms-modal {
  background: rgba(2, 6, 23, 0.72);
}

body.app-dark .terms-dialog {
  border-color: var(--line);
  background: var(--panel);
}

body.app-dark .terms-content article {
  background: rgba(34, 197, 94, 0.08);
}

@media (max-width: 1280px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    order: 2;
    width: 100%;
  }

  .session-card {
    justify-self: end;
  }
}

@media (max-width: 860px) {
  .access-screen {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .access-hero {
    min-height: 360px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 32px);
  }

  .app-shell.panel-collapsed {
    width: min(100% - 24px, 1180px);
  }

  .study-pane {
    min-height: 72vh;
    overflow: visible;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .brand-lockup {
    min-width: 0;
  }

  .stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    order: 2;
    width: 100%;
  }

  .session-card {
    justify-self: end;
  }

  .deck-pane {
    max-height: none;
    overflow-y: visible;
  }

  .app-shell.panel-collapsed .deck-pane {
    display: none;
  }

  .deck-list {
    flex: none;
    max-height: none;
    overflow: visible;
  }

  .style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .palette-grid {
    max-height: 240px;
  }

  .fullscreen-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-visual-grid {
    grid-template-columns: 1fr;
  }

  .preview-header {
    grid-template-columns: 1fr;
  }

  .preview-actions {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .access-screen {
    width: min(100% - 16px, 1180px);
    margin: 8px auto;
    gap: 12px;
  }

  .access-hero,
  .access-panel {
    padding: 18px;
  }

  .access-hero {
    min-height: auto;
    gap: 18px;
  }

  .access-copy {
    font-size: 1rem;
  }

  .access-plans span {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .access-brand {
    align-items: flex-start;
  }

  .access-brand .brand-logo {
    width: 64px;
  }

  .app-shell {
    width: min(100% - 16px, 1180px);
    margin: 8px auto;
    min-height: calc(100vh - 16px);
  }

  .app-shell.panel-collapsed {
    width: min(100% - 16px, 1180px);
  }

  .study-pane,
  .deck-pane {
    padding: 14px;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .brand-lockup {
    align-items: center;
  }

  .brand-logo {
    width: clamp(50px, 16vw, 64px);
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3.2rem);
  }

  .stats {
    grid-column: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  .stats span {
    padding: 8px 6px;
    font-size: clamp(0.68rem, 2.6vw, 0.78rem);
  }

  .stats strong {
    font-size: clamp(0.95rem, 5vw, 1.2rem);
  }

  .session-card {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .session-card .text-button {
    min-width: 104px;
    margin-top: 0;
  }

  .flashcard {
    min-height: clamp(260px, 52vh, 420px);
    max-height: none;
    padding: 48px 16px;
  }

  .student-profile-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .dashboard-hero-actions {
    justify-content: flex-start;
  }

  .dashboard-hero-actions .ghost,
  .dashboard-hero-actions .pass-badge {
    flex: 1 1 150px;
  }

  .exam-chart {
    min-height: 180px;
    gap: 8px;
  }

  .exam-bar {
    grid-template-rows: 20px 120px auto;
  }

  .controls {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 8px;
  }

  .study-actions {
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 8px;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .style-grid {
    grid-template-columns: 1fr;
  }

  .palette-grid {
    max-height: 260px;
  }

  .preview-modal {
    padding: 8px;
  }

  .preview-header {
    gap: 10px;
    padding: 12px;
  }

  .preview-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .brand-lockup {
    gap: 10px;
  }

  .brand-logo {
    width: 48px;
  }

  h1 {
    font-size: clamp(1.8rem, 12vw, 2.4rem);
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .dashboard-metrics {
    grid-template-columns: 1fr;
  }

  .student-dashboard {
    padding: 10px;
  }

  .student-profile-card {
    grid-template-columns: 1fr;
  }

  .student-avatar {
    width: 54px;
    height: 54px;
  }

  .exam-chart {
    overflow-x: auto;
    grid-template-columns: repeat(6, 72px);
    justify-content: start;
  }

  .line-chart {
    min-height: 150px;
  }

  .line-chart svg {
    height: 136px;
  }

  .status-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .status-row b {
    grid-column: 2;
    justify-self: start;
  }

  .stats span {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: baseline;
    text-align: left;
  }

  .stats strong {
    display: inline;
  }

  .session-card {
    grid-template-columns: 1fr;
  }

  .session-card .text-button {
    width: 100%;
    min-width: 0;
  }

  .study-actions,
  .controls,
  .fullscreen-controls,
  .preview-actions {
    grid-template-columns: 1fr;
  }

  button {
    min-height: 38px;
    font-size: 0.86rem;
  }

  .flashcard {
    min-height: 250px;
    padding: 44px 12px;
  }

  .card-label,
  .card-title,
  .card-hint {
    font-size: 0.72rem;
  }
}
