@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);
  --shadow-soft: 0 10px 30px rgba(36, 47, 43, 0.1);
  --shadow-lifted: 0 24px 70px rgba(36, 47, 43, 0.2);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  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);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.24);
  --shadow-lifted: 0 28px 82px rgba(0, 0, 0, 0.52);
  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[aria-busy="true"] {
  opacity: 0.78;
}

.access-form button:disabled {
  cursor: wait;
  filter: saturate(0.7);
  transform: none;
}

.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(46px, 7vh, 82px) clamp(24px, 5vw, 96px) clamp(62px, 10vh, 92px);
}

.flashcard:fullscreen .card-text {
  max-width: 86vw;
  max-height: calc(100vh - 132px);
  padding-bottom: 0;
  transform-origin: center;
  will-change: transform, opacity, filter;
}

.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 .card-feedback {
  right: clamp(22px, 4vw, 54px);
  bottom: clamp(58px, 9vw, 92px);
  left: clamp(22px, 4vw, 54px);
}

.flashcard:fullscreen .fullscreen-controls {
  display: grid !important;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  left: max(8px, env(safe-area-inset-left));
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: clamp(4px, 1vw, 8px);
  overflow: visible;
}

.flashcard:fullscreen .fullscreen-controls::-webkit-scrollbar {
  display: none;
}

.flashcard:fullscreen .fullscreen-controls > button {
  min-width: 0;
  min-height: clamp(30px, 8vh, 38px);
  padding: 0;
  border-radius: 7px;
  font-size: 0;
  line-height: 1;
  white-space: nowrap;
}

.flashcard:fullscreen .fullscreen-controls > button::before {
  display: grid;
  place-items: center;
  font-size: clamp(1rem, 4vw, 1.35rem);
  font-weight: 900;
  line-height: 1;
}

.flashcard:fullscreen #fsPrevBtn::before {
  content: "←";
}

.flashcard:fullscreen #fsAgainBtn::before {
  content: "↻";
}

.flashcard:fullscreen #fsKnowBtn::before {
  content: "✓";
}

.flashcard:fullscreen #fsNextBtn::before {
  content: "→";
}

.flashcard:fullscreen #fsSpeakBtn::before {
  content: attr(data-short);
  font-size: clamp(0.68rem, 2.2vw, 0.9rem);
}

.flashcard:fullscreen #fsExitBtn::before {
  content: "×";
}

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);
  animation: pane-reveal 480ms var(--ease-out) both;
  transition:
    border-color 220ms ease,
    background 220ms ease,
    box-shadow 220ms ease;
}

.deck-pane {
  animation-delay: 70ms;
}

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);
  overflow: visible;
}

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

.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));
  transform-origin: center bottom;
  transition:
    filter 240ms ease,
    transform 320ms var(--ease-out);
}

.brand-lockup:hover .brand-logo {
  filter: drop-shadow(0 18px 26px rgba(36, 47, 43, 0.22));
  transform: translateY(-2px) rotate(-1.5deg);
}

.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: visible;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.04;
  letter-spacing: 0;
  text-overflow: clip;
  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;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.04);
  transition:
    border-color 200ms ease,
    box-shadow 220ms var(--ease-out),
    transform 220ms var(--ease-out);
}

.stats span:hover {
  border-color: color-mix(in srgb, var(--blue) 34%, var(--line));
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
}

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(96px, 1fr));
  gap: clamp(5px, 0.8vw, 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 {
  position: relative;
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  box-shadow: 0 0 18px color-mix(in srgb, var(--green) 28%, transparent);
  transition: width 520ms var(--ease-out);
}

.progress-bar span::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.58) 50%, transparent 80%);
  content: "";
  transform: translateX(-120%);
  animation: progress-glint 2.8s ease-in-out infinite;
}

#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 {
  --card-light-x: 50%;
  --card-light-y: 44%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  max-height: min(64vh, 620px);
  padding: clamp(50px, 5.2vw, 68px) clamp(22px, 5vw, 64px);
  overflow: hidden;
  border: 1px solid #cfd8d2;
  border-radius: 8px;
  background:
    radial-gradient(circle at var(--card-light-x) var(--card-light-y), rgba(255, 255, 255, 0.32), transparent 34%),
    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),
    0 14px 34px rgba(15, 23, 42, 0.1);
  color: var(--card-color, var(--ink));
  cursor: pointer;
  font-family: var(--card-font, Inter), ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  touch-action: pan-y;
  will-change: transform, opacity, filter;
  transition:
    border-color 220ms ease,
    box-shadow 260ms var(--ease-out),
    transform 260ms var(--ease-out),
    background-position 220ms ease;
}

.flashcard.is-card-transitioning {
  pointer-events: none;
}

.flashcard.is-pointer-lit {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.86),
    0 24px 58px rgba(15, 23, 42, 0.16);
}

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

body.app-dark .flashcard.is-pointer-lit {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 28px 72px rgba(0, 0, 0, 0.36);
}

body.app-dark .flashcard .card-text,
body.app-dark .flashcard .rich-card-content,
body.app-dark .flashcard .answer-list,
body.app-dark .flashcard .mindmap-card {
  color: var(--card-color, #f8fafc);
  text-shadow:
    0 2px 4px rgba(2, 6, 23, 0.32),
    0 14px 34px rgba(2, 6, 23, 0.42);
}

body.app-dark .flashcard .mindmap-svg-text,
body.app-dark .flashcard .mindmap-root-text {
  fill: var(--card-color, #f8fafc);
}

body.app-dark .flashcard .card-label,
body.app-dark .flashcard .card-title,
body.app-dark .flashcard .card-hint,
body.app-dark .flashcard .card-feedback {
  color: #cbd5e1;
}

.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;
  transition:
    color 180ms ease,
    opacity 180ms ease;
}

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

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

.flashcard:hover .card-hint {
  color: var(--ink);
}

.card-feedback {
  position: absolute;
  right: 20px;
  bottom: 48px;
  left: 20px;
  z-index: 2;
  max-width: min(720px, calc(100% - 40px));
  margin: 0 auto;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  font-size: clamp(0.78rem, 1.7vw, 0.96rem);
  font-weight: 900;
  line-height: 1.2;
}

.card-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.card-feedback.is-known {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.16);
  color: #166534;
}

.card-feedback.is-again {
  border-color: rgba(251, 113, 133, 0.42);
  background: rgba(251, 113, 133, 0.16);
  color: #9f1239;
}

body.app-dark .card-feedback.is-known {
  background: rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
}

body.app-dark .card-feedback.is-again {
  background: rgba(251, 113, 133, 0.22);
  color: #ffe4e6;
}

.flashcard.is-marked-known {
  border-color: rgba(34, 197, 94, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0 0 4px rgba(34, 197, 94, 0.16);
}

.flashcard.is-marked-again {
  border-color: rgba(251, 113, 133, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0 0 4px rgba(251, 113, 133, 0.16);
}

.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(6, 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: min(100%, 980px);
  max-height: 100%;
  padding: 0.2em 0.1em 0.26em;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(2rem, 7vw, 5.5rem);
  font-style: var(--card-font-style, normal);
  font-weight: var(--card-font-weight, 800);
  line-height: 1.1;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.26),
    0 12px 28px rgba(15, 23, 42, 0.2);
}

.flashcard.is-card-front .card-text {
  max-width: min(100%, 1120px);
  margin: auto;
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: balance;
  hyphens: none;
  text-align: center;
  line-height: 1.1;
}

.flashcard.is-card-back .card-text {
  line-height: 1.16;
}

.card-text.is-content-entering {
  animation: card-content-reveal 360ms var(--ease-out) both;
}

.flashcard.is-short-front .card-text,
.flashcard.is-medium-front .card-text {
  max-width: min(100%, 1120px);
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: balance;
  line-height: 1.1;
}

.flashcard:fullscreen.is-card-front .card-text {
  max-width: 86vw;
  max-height: calc(100vh - 124px);
  line-height: 1.08;
}

.flashcard:fullscreen.is-card-back .card-text {
  max-width: 85vw;
  max-height: calc(100vh - 148px);
  line-height: 1.1;
}

.answer-list {
  display: grid;
  width: fit-content;
  max-width: 100%;
  gap: 12px;
  margin: 0 auto;
  padding-left: 1.2em;
  text-align: left;
  font-size: 0.9em;
  line-height: 1.14;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 24px rgba(15, 23, 42, 0.18);
}

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

.rich-card-content {
  display: grid;
  place-items: center;
  width: min(100%, 960px);
  max-height: 100%;
  gap: 0.5em;
  overflow: visible;
  color: var(--card-color, var(--ink));
  font-size: 0.86em;
  line-height: 1.14;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2),
    0 10px 24px rgba(15, 23, 42, 0.18);
}

.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(4, minmax(0, 1fr));
  gap: 10px;
}

.controls > button,
.study-actions > button,
.fullscreen-controls > button,
.button-row > button,
.preview-actions > button,
.editor-actions > button {
  min-width: 0;
  width: 100%;
  padding-inline: clamp(6px, 1.2vw, 14px);
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  white-space: normal;
  text-wrap: balance;
  line-height: 1.08;
}

.controls > button,
.study-actions > button {
  padding-inline: clamp(3px, 0.7vw, 10px);
  font-family: inherit;
  font-stretch: normal;
  font-size: clamp(0.56rem, 0.49rem + 0.28vw, 0.76rem);
  font-weight: 800;
  line-height: 1.04;
}

button {
  min-width: 0;
  max-width: 100%;
  min-height: clamp(38px, 5.2vw, 46px);
  height: auto;
  padding: clamp(8px, 1.1vw, 11px) clamp(8px, 1.6vw, 18px);
  border: 0;
  border-radius: 8px;
  font-size: clamp(0.74rem, 0.64rem + 0.48vw, 1rem);
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  white-space: normal;
  text-wrap: balance;
  text-align: center;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 220ms var(--ease-out),
    transform 180ms var(--ease-out);
}

button:hover {
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0) scale(0.985);
}

.primary,
.success {
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--green) 28%, transparent);
}

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

.danger {
  background: var(--rose);
  color: #fff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--rose) 24%, transparent);
}

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

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

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;
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.09);
}

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;
  width: min(100%, 760px);
  justify-self: center;
  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;
}

.speech-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(180px, 0.75fr);
  gap: 10px;
}

.speech-rate-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.speech-rate-control input {
  width: 100%;
  accent-color: var(--green);
}

.speech-rate-control strong {
  min-width: 3.6em;
  color: var(--ink);
  font-size: 0.78rem;
  text-align: right;
}

.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: flex;
  gap: 8px;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-gutter: auto;
}

.palette-option {
  display: grid;
  grid-template-rows: auto auto;
  flex: 0 0 116px;
  gap: 6px;
  align-items: center;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
  scroll-snap-align: start;
}

.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));
  width: 100%;
  height: 22px;
  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);
  transition:
    border-color 200ms ease,
    box-shadow 220ms var(--ease-out),
    transform 220ms var(--ease-out);
}

.deck-item:hover {
  border-color: color-mix(in srgb, var(--green) 36%, var(--line));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
  transform: translateY(-2px);
}

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

.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);
  animation: dialog-reveal 300ms var(--ease-out) both;
}

.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;
}

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

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

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

.editor-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);
}

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

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

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

.editor-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(360px, 1.18fr);
  gap: 14px;
  min-height: 0;
  padding: 14px;
}

.editor-field {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  margin: 0;
}

.editor-field span,
.editor-preview-head {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

#mindMapEditorInput {
  min-height: 0;
  resize: none;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.94rem;
  line-height: 1.45;
}

.editor-preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.editor-preview-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.95);
}

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

#mindMapEditorStatus {
  margin: 0;
  padding: 0 18px 16px;
}

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

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

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

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

body.app-dark .editor-preview-head {
  background: #0f172a;
}

.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);
  animation: dialog-reveal 300ms var(--ease-out) both;
}

.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));
  }

  .speech-tools {
    grid-template-columns: 1fr;
  }

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

  .flashcard {
    aspect-ratio: 4 / 3;
    max-height: none;
  }

  .study-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .flashcard:fullscreen .fullscreen-controls {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }

  .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 {
    aspect-ratio: 4 / 3;
    min-height: clamp(260px, 52vh, 420px);
    max-height: none;
    padding: clamp(46px, 10vw, 58px) clamp(18px, 5vw, 24px);
  }

  .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(2, minmax(0, 1fr));
    gap: 8px;
  }

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

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

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

  .speech-tools {
    grid-template-columns: 1fr;
  }

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

  .palette-option {
    flex-basis: 104px;
  }

  .preview-modal {
    padding: 8px;
  }

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

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

  .editor-modal {
    padding: 8px;
  }

  .editor-header {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

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

  .editor-actions button {
    min-width: 0;
    padding-inline: 8px;
  }

  .editor-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
    padding: 10px;
  }
}

@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,
  .preview-actions {
    grid-template-columns: 1fr;
  }

  .flashcard:fullscreen .fullscreen-controls {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }

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

  button {
    min-height: 38px;
    padding: 7px 4px;
    font-size: clamp(0.66rem, 3.2vw, 0.82rem);
    line-height: 1.05;
  }

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

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

@media (orientation: landscape) and (max-height: 560px) {
  .flashcard:fullscreen {
    padding: clamp(30px, 6vh, 42px) clamp(18px, 4vw, 60px) clamp(48px, 11vh, 62px);
  }

  .flashcard:fullscreen .card-text {
    max-width: 88vw;
    max-height: calc(100vh - 96px);
  }

  .flashcard:fullscreen .card-label,
  .flashcard:fullscreen .card-title {
    top: clamp(10px, 3vh, 18px);
  }

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

@media (hover: hover) and (pointer: fine) {
  .flashcard:not(:fullscreen):not(.is-card-transitioning):hover {
    border-color: color-mix(in srgb, var(--green) 34%, var(--line));
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.86),
      var(--shadow-lifted);
    transform: translateY(-3px);
  }
}

@keyframes pane-reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-reveal {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes card-content-reveal {
  from {
    opacity: 0;
    filter: blur(3px);
    transform: translateY(9px) scale(0.985);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes progress-glint {
  0%,
  58% {
    transform: translateX(-120%);
  }

  82%,
  100% {
    transform: translateX(120%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  button:hover,
  button:active {
    transform: none;
  }
}
