@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@400;600;700;800&display=swap');

:root {
  --font-sans: 'Manrope', sans-serif;
  --font-display: 'Sora', sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --tracking-tight: -0.025em;
  --tracking-tighter: -0.05em;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-relaxed: 1.625;
  --bg: #f8f9fa;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: #ffffff;
  --surface-muted: #f0f4f8;
  --line: rgba(15, 15, 15, 0.08);
  --text: #1a1a1a;
  --text-soft: #4a5568;
  --text-muted: #718096;
  --primary: #A78BFA;
  --primary-dark: #8E6EEF;
  --primary-light: #C4B5FD;
  --teal: #00bfa6;
  --teal-dark: #008f7c;
  --cyan: #47d9cd;
  --violet: #9b8aca;
  --orange: #e09455;
  --gold: #f4c95d;
  --danger: #df6b67;
  --success: #48BB78;
  --shadow-sm: 0 10px 24px rgba(167, 139, 250, 0.12);
  --shadow-lg: 0 24px 64px rgba(142, 110, 239, 0.16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme='dark'] {
  --bg: #171320;
  --surface-strong: #251f35;
  --surface-muted: #312842;
  --line: rgba(255, 255, 255, 0.08);
  --text: #edf4f2;
  --text-soft: #b2c5c1;
  --text-muted: #8ba39e;
  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(71, 217, 205, 0.12), transparent 30%),
    radial-gradient(circle at bottom right, rgba(155, 138, 202, 0.12), transparent 24%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

body,
#app,
.screen-shell {
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  min-height: 100vh;
}

.auth-visual {
  position: relative;
  overflow: hidden;
  padding: 48px;
  background: linear-gradient(145deg, rgba(29, 101, 95, 0.95), rgba(53, 137, 129, 0.88));
  color: #f4fffd;
}

.auth-visual::before,
.dashboard-hero::before {
  content: '';
  position: absolute;
  left: -70px;
  bottom: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}

.auth-visual::after,
.dashboard-hero::after {
  content: '';
  position: absolute;
  top: 26px;
  right: 70px;
  width: 220px;
  height: 140px;
  background:
    radial-gradient(circle at 12px 12px, rgba(255, 255, 255, 0.15) 2px, transparent 3px),
    radial-gradient(circle at 58px 28px, rgba(255, 255, 255, 0.18) 2px, transparent 3px),
    radial-gradient(circle at 108px 12px, rgba(255, 255, 255, 0.15) 2px, transparent 3px),
    radial-gradient(circle at 170px 34px, rgba(255, 255, 255, 0.16) 2px, transparent 3px),
    radial-gradient(circle at 204px 14px, rgba(255, 255, 255, 0.15) 2px, transparent 3px);
  opacity: 0.7;
  transform: rotate(-7deg);
}

.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}

.brand-mark {
  width: 18px;
  height: 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
}

.brand-mark span {
  display: block;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.85);
}

.brand-mark span:nth-child(2),
.brand-mark span:nth-child(3) {
  background: rgba(71, 217, 205, 0.92);
}

.brand strong {
  font-size: 1.15rem;
}

.brand strong em {
  color: var(--cyan);
  font-style: normal;
}

.auth-copy,
.page-copy {
  position: relative;
  z-index: 1;
}

.auth-copy {
  max-width: 560px;
  margin-top: 84px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
}

body:has(.screen-shell.shell) .topbar .eyebrow {
  background: rgba(167, 139, 250, 0.16);
  color: #6D4DE8;
  border: 1px solid rgba(167, 139, 250, 0.26);
}

.auth-copy h1,
.page-copy h1,
.dashboard-hero h1 {
  margin: 18px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.8vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: var(--tracking-tighter);
}

.auth-copy p,
.page-copy p,
.dashboard-hero p {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.auth-copy p,
.dashboard-hero p {
  color: rgba(255, 255, 255, 0.78);
}

.page-copy p {
  color: var(--text-soft);
}

.auth-feature-grid,
.stats-grid,
.practice-grid,
.mode-grid,
.feature-grid,
.resource-grid,
.metrics-grid,
.plan-grid,
.profile-grid {
  display: grid;
  gap: 16px;
}

.auth-feature-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 36px;
}

.stats-grid,
.profile-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.practice-grid,
.mode-grid,
.feature-grid,
.resource-grid,
.plan-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.glass-card,
.focus-card,
.panel-card,
.plan-card,
.stat-card,
.study-card,
.practice-card,
.mode-card,
.feature-card,
.resource-card,
.metrics-card,
.profile-card,
.activity-card,
.library-panel,
.empty-card {
  border: 1px solid rgba(15, 15, 15, 0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.glass-card,
.focus-card,
.panel-card,
.plan-card,
.metrics-card,
.profile-card,
.activity-card,
.library-panel,
.empty-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.glass-card {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px);
}

.glass-card h3,
.feature-card h3,
.practice-card h3,
.resource-card h3,
.metrics-card h3,
.profile-card h3,
.activity-card h3,
.focus-card h3,
.panel-card h3,
.plan-card h3,
.mode-card h3,
.library-panel h3 {
  margin: 0 0 8px;
  font-size: var(--text-base);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}

.glass-card p,
.feature-card p,
.practice-card p,
.resource-card p,
.metrics-card p,
.profile-card p,
.activity-card p,
.focus-card p,
.panel-card p,
.plan-card p,
.mode-card p,
.library-panel p {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

.auth-card {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid rgba(15, 15, 15, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.auth-card h2 {
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-tight);
}

.auth-card p {
  margin: 0 0 20px;
  color: var(--text-soft);
}

.auth-toggle {
  display: inline-flex;
  padding: 5px;
  border-radius: 999px;
  background: var(--surface-muted);
  gap: 4px;
}

.auth-toggle button {
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 700;
}

.auth-toggle .is-active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(31, 50, 47, 0.08);
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  color: var(--text-soft);
}

.input,
.textarea {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  outline: none;
  accent-color: #A78BFA;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input option,
select option {
  background: #FFFFFF;
  color: var(--text);
}

.input option:hover,
select option:hover,
.input option:focus,
select option:focus {
  background: #A78BFA;
  color: #FFFFFF;
}

.input option:checked,
select option:checked {
  background: #111C1A;
  color: #FFFFFF;
}

.input:focus,
.textarea:focus,
.input:focus-visible,
.textarea:focus-visible {
  border-color: rgba(167, 139, 250, 0.72);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.18);
}

.question-no {
  font-weight: 800;
}

.listening-section-block {
  margin-bottom: 24px;
}

.listening-section-header {
  margin-bottom: 14px;
}

.listening-section-header h4,
.listening-section-header p {
  margin: 0 0 6px;
}

.listening-section-range,
.listening-map-label {
  color: var(--text-soft);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
}

.listening-connected-line {
  margin: 7px 0;
  line-height: 1.65;
}

.listening-connected-options,
.listening-option-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 14px;
}

.listening-option-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.listening-map-block {
  margin: 14px 0 18px;
}

.listening-map-block img {
  display: block;
  width: min(100%, 760px);
  height: auto;
  margin-top: 8px;
}

.listening-table-preview {
  margin-top: 8px;
}

.listening-table-instructions {
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.listening-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.listening-completion-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-strong);
  color: var(--text);
}

.listening-completion-table th {
  padding: 10px;
  border: 1px solid #d8dee9;
  text-align: center;
}

.listening-completion-table td {
  min-width: 130px;
  padding: 10px;
  border: 1px solid #d8dee9;
  vertical-align: top;
}

.listening-table-gap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  vertical-align: middle;
}

.listening-table-gap-number,
.listening-table-gap-marker {
  flex: 0 0 auto;
  padding: 0 4px;
  border-radius: 4px;
  background: #eef2ff;
  color: #172033;
  font-weight: 700;
}

.listening-table-gap .question-inline-input {
  width: 118px;
  min-width: 90px;
  min-height: 34px;
  padding: 6px 8px;
}

.question-inline-input {
  display: inline-block;
  width: min(220px, 100%);
  min-height: 38px;
  padding: 7px 10px;
  vertical-align: middle;
}

.reading-option-list--detailed {
  display: grid;
  gap: 8px;
}

.reading-option-list--detailed .listening-option-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.target-band-custom-select {
  position: relative;
  width: 100%;
}

.target-band-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.target-band-select-button {
  width: 100%;
  min-height: 48px;
  padding: 13px 42px 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.target-band-select-button::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  opacity: 0.62;
}

.target-band-select-button:focus,
.target-band-select-button:focus-visible,
.target-band-custom-select.is-open .target-band-select-button {
  outline: none;
  border-color: rgba(167, 139, 250, 0.72);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.18);
}

.target-band-select-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(45, 27, 78, 0.14);
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 20px 44px rgba(45, 27, 78, 0.16);
}

.target-band-custom-select.is-open .target-band-select-menu {
  display: grid;
  gap: 4px;
}

.target-band-select-option {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.target-band-select-option:hover,
.target-band-select-option:focus-visible {
  outline: none;
  background: #A78BFA;
  color: #FFFFFF;
}

.target-band-select-option.is-selected {
  background: #111C1A;
  color: #FFFFFF;
}

.target-band-select-option.is-selected:hover,
.target-band-select-option.is-selected:focus-visible {
  background: #A78BFA;
  color: #FFFFFF;
}

.button-row,
.hero-meta,
.topbar-tools,
.sound-list,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-row {
  margin-top: 20px;
}

.completion-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 22px;
  align-items: center;
  margin-bottom: 22px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid rgba(0, 191, 166, 0.22);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(167, 139, 250, 0.16), rgba(142, 110, 239, 0.1)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.completion-copy {
  position: relative;
  z-index: 1;
}

.completion-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--teal-dark);
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.completion-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  color: var(--text);
  letter-spacing: 0;
}

.completion-cheer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.completion-cheer span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 191, 166, 0.16);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 800;
}

.completion-card p {
  max-width: 680px;
  color: var(--text-soft);
  line-height: var(--leading-relaxed);
}

.completion-band {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 191, 166, 0.15), rgba(71, 217, 205, 0.15));
  border: 3px solid rgba(0, 191, 166, 0.4);
  box-shadow: 
    inset 0 0 0 12px rgba(0, 191, 166, 0.12),
    0 8px 24px rgba(0, 191, 166, 0.25);
}

.completion-band span {
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.completion-band strong {
  color: var(--teal-dark);
  font-size: 3.2rem;
  line-height: 1;
  font-weight: 900;
  font-family: var(--font-display);
}

.completion-actions {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.completion-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.8;
}

.completion-burst span {
  position: absolute;
  width: 10px;
  height: 34px;
  border-radius: 999px;
  background: var(--teal);
  animation: completion-pop 1800ms ease-in-out infinite;
}

.completion-burst span:nth-child(1) { --tilt: 24deg; top: 18px; right: 18%; }
.completion-burst span:nth-child(2) { --tilt: -18deg; top: 38px; right: 9%; background: var(--orange); animation-delay: 150ms; }
.completion-burst span:nth-child(3) { --tilt: 58deg; bottom: 28px; right: 24%; background: var(--violet); animation-delay: 280ms; }
.completion-burst span:nth-child(4) { --tilt: -42deg; bottom: 22px; left: 28px; background: var(--cyan); animation-delay: 410ms; }

.completion-card--reading {
  border-color: rgba(167, 139, 250, 0.3);
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.16), rgba(142, 110, 239, 0.09)), var(--surface);
}

.completion-card--writing {
  border-color: rgba(224, 148, 85, 0.28);
  background: linear-gradient(135deg, rgba(224, 148, 85, 0.14), rgba(0, 191, 166, 0.08)), var(--surface);
}

.completion-card--speaking {
  border-color: rgba(155, 138, 202, 0.28);
  background: linear-gradient(135deg, rgba(155, 138, 202, 0.14), rgba(0, 191, 166, 0.08)), var(--surface);
}

@keyframes completion-pop {
  0%, 100% { opacity: 0.35; transform: translateY(0) scale(0.9) rotate(var(--tilt, 0deg)); }
  45% { opacity: 1; transform: translateY(-8px) scale(1.05) rotate(var(--tilt, 0deg)); }
}

.btn,
.nav-button,
.sidebar-action,
.sound-button,
.list-link,
.tag-button {
  transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

.btn:hover,
.nav-button:hover,
.sidebar-action:hover,
.sound-button:hover,
.list-link:hover,
.tag-button:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #f4fffd;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  box-shadow: 0 12px 24px rgba(31, 95, 90, 0.24);
}

.btn-secondary {
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
}

.btn-ghost {
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--line);
}

.auth-note,
.muted-label,
.resource-meta,
.card-subtle,
.activity-time,
.list-meta,
.micro-kicker,
.stat-label {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.auth-error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(223, 107, 103, 0.12);
  color: #8e3835;
  font-size: var(--text-sm);
  font-weight: 700;
}

/* Auth modal */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  background: #0b110f;
  padding: 0;
}

.auth-modal-left {
  flex: 1.2;
  position: relative;
  overflow: hidden;
  display: flex;
  background: #0b110f;
  background-image:
    radial-gradient(circle at 30% 70%, rgba(0, 191, 166, 0.15), transparent 40%),
    radial-gradient(circle at 70% 30%, rgba(224, 148, 85, 0.1), transparent 40%);
}

.auth-modal-particles {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(rgba(0,191,166,0.6) 2px, transparent 2px),
    radial-gradient(rgba(224,148,85,0.6) 2px, transparent 2px);
  background-size: 80px 80px;
  background-position: 0 0, 40px 40px;
  opacity: 0.35;
}

.auth-modal__back {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background var(--transition);
}

.auth-modal__back:hover {
  background: rgba(255,255,255,0.15);
}

.auth-modal {
  flex: 0.8;
  position: relative;
  width: 100%;
  max-width: 640px;
  height: 100dvh;
  background: #fdfdfc;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -20px 0 40px rgba(0,0,0,0.15);
}

.auth-modal-content {
  width: 100%;
  max-width: 440px;
  padding: 40px;
}

@media (max-width: 900px) {
  .auth-modal-left { display: none; }
  .auth-modal { flex: 1; max-width: none; }
}

.auth-modal__title {
  margin: 14px 0 8px;
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
}

.auth-modal__desc {
  margin: 0 0 4px;
  font-size: var(--text-sm);
}

.writing-studio-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8600;
  background: rgba(5, 20, 18, 0.58);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

@keyframes ws-modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.writing-studio-modal {
  position: relative;
  width: min(900px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  padding: 36px 32px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 15, 15, 0.07);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 32px 80px rgba(5, 20, 18, 0.22);
  animation: ws-modal-in 0.24s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.writing-studio-header {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-right: 40px;
  margin-bottom: 0;
}

.writing-studio-kicker {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 191, 166, 0.12);
  color: var(--teal-dark);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.writing-studio-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  line-height: var(--leading-tight);
}

.writing-studio-subtitle {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  max-width: 620px;
}

.writing-studio-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.writing-studio-close:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.leave-section-modal {
  width: min(560px, 100%);
  padding: 30px 28px 24px;
}

.leave-section-header {
  margin-right: 0;
  padding-bottom: 16px;
}

.leave-section-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

/* File upload styled button */
.file-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.file-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.file-upload-btn {
  cursor: pointer;
  white-space: nowrap;
}

.file-upload-name {
  font-size: var(--text-sm);
  color: var(--text-soft);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Password show/hide */
.password-field-wrap {
  position: relative;
}

.password-input {
  padding-right: 82px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.password-toggle:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.shell {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 20px 14px 16px;
  border-right: 1px solid rgba(15, 15, 15, 0.06);
  background: #ffffff;
}

/* Hide scrollbar for sidebar to keep it clean */
.sidebar::-webkit-scrollbar {
  display: none;
}
.sidebar {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.sidebar-top {
  display: grid;
  gap: 20px;
}

.sidebar .brand {
  gap: 6px;
  color: var(--text);
}

.sidebar .brand-mark--image {
  width: 48px;
  height: 48px;
}

.sidebar .brand-mark span {
  background: rgba(15, 15, 15, 0.15);
}

.sidebar .brand-mark span:nth-child(2),
.sidebar .brand-mark span:nth-child(3) {
  background: rgba(0, 191, 166, 0.92);
}

.nav-list,
.sidebar-actions,
.sound-list,
.mini-list,
.metric-list,
.feedback-list,
.activity-list,
.library-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.sidebar-track-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 16px 24px;
  padding: 4px;
  border: 1px solid rgba(45, 27, 78, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
}

.sidebar-track-option {
  flex: 1;
  min-height: 34px;
  padding: 8px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 800;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.nav-button,
.sidebar-action,
.sound-button,
.list-link,
.tag-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}

.nav-button,
.sidebar-action {
  font-size: var(--text-sm);
}

.nav-button.is-active {
  background: rgba(0, 191, 166, 0.13);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(0, 191, 166, 0.14);
}

.nav-icon,
.action-icon,
.skill-icon,
.mode-icon,
.metric-icon,
.resource-icon,
.stat-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.sidebar-bottom {
  display: grid;
  gap: 14px;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
}

.sidebar-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.sidebar-icon-action {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-soft);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(15, 15, 15, 0.06);
}

.brand-mark--image {
  width: 40px;
  height: 40px;
  display: block;
  padding: 0;
  overflow: visible;
  background: transparent;
}

.brand-mark--image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-icon-action:hover,
.sidebar-icon-action:focus-visible {
  background: rgba(0, 191, 166, 0.13);
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(0, 191, 166, 0.16);
}

.focus-fab {
  position: relative;
}

.focus-fab-trigger {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid rgba(0, 191, 166, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--teal-dark);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.focus-fab-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 12px);
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(15, 15, 15, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 10;
}

.focus-fab:hover .focus-fab-panel,
.focus-fab:focus-within .focus-fab-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.focus-fab-panel h3 {
  margin: 0;
}

.focus-fab-panel p {
  margin: 0;
}

.focus-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.focus-control-button {
  padding: 10px 12px;
  font-size: var(--text-xs);
}

.focus-status {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.sound-button,
.tag-button {
  width: auto;
  padding: 8px 11px;
  border: 1px solid transparent;
  background: var(--surface-muted);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
}

.tag-button--listening {
  min-height: 42px;
  padding: 13px 18px;
  background: rgba(71, 217, 205, 0.12);
  border-color: rgba(0, 191, 166, 0.18);
  color: var(--teal-dark);
}

.sound-button.is-active,
.tag-button.is-active {
  color: #f4fffd;
  background: var(--teal);
}

.workspace {
  padding: 20px 22px 26px;
}

.workspace-inner {
  max-width: 1160px;
  margin: 0 auto;
}

.topbar,
.stat-top,
.card-head,
.resource-head,
.mode-head,
.study-head,
.activity-head,
.card-footer,
.resource-footer,
.panel-footer,
.metric-row,
.settings-row,
.preview-header,
.study-meta,
.activity-item,
.resource-item,
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 18px;
}

.page-copy h1 {
  margin: 8px 0;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
}

.chip,
.pill,
.hero-pill,
.status-pill,
.preview-pdf-warning {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 800;
}

.chip {
  color: var(--teal-dark);
  background: rgba(0, 191, 166, 0.12);
}

button.chip {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 800;
  transition: background 0.15s;
}

button.chip:hover {
  background: rgba(0, 191, 166, 0.22);
}

.pill {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 15, 15, 0.08);
}

.pill--audio {
  min-height: 32px;
  background: rgba(71, 217, 205, 0.1);
  border-color: rgba(0, 191, 166, 0.14);
  color: var(--teal-dark);
}

.hero-pill {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  padding: 24px 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1fa2ff 0%, #12d8fa 50%, #a6ffcb 100%);
  color: #f4fffd;
  box-shadow: var(--shadow-lg);
}

.section-heading {
  margin-top: 24px;
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card,
.study-card,
.practice-card,
.mode-card,
.feature-card,
.resource-card {
  padding: 18px;
  background: rgba(255, 255, 255, 0.86);
}

.stat-card {
  display: grid;
  gap: 16px;
  min-height: 132px;
}

.stat-icon-wrap,
.metric-badge,
.mode-badge,
.resource-badge,
.skill-badge {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.accent-teal { background: rgba(71, 217, 205, 0.14); color: var(--teal-dark); }
.accent-violet { background: rgba(157, 141, 255, 0.14); color: #6759d5; }
.accent-orange { background: rgba(224, 148, 85, 0.16); color: #d17325; }
.accent-gold { background: rgba(244, 201, 93, 0.2); color: #b18514; }

.stat-value,
.band-value,
.metrics-value,
.study-ring strong,
.plan-price {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: var(--tracking-tighter);
}

.study-card {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.study-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
}

.study-ring {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle closest-side, #fff 77%, transparent 78%), conic-gradient(var(--teal) var(--progress, 0%), rgba(0, 191, 166, 0.12) 0);
}

.study-ring span {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--cyan));
}

.practice-card,
.mode-card,
.resource-card {
  position: relative;
  overflow: hidden;
}

.practice-card::before,
.mode-card::before,
.resource-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent, var(--teal));
}

.practice-card[data-accent='writing'] { --accent: #ba9ef6; }
.practice-card[data-accent='reading'] { --accent: #44c6c0; }
.practice-card[data-accent='listening'] { --accent: #8f8afc; }
.practice-card[data-accent='speaking'] { --accent: #ffb16b; }

.status-pill {
  background: var(--surface-muted);
  color: var(--text-soft);
}

.status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.two-column {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-top: 18px;
}

.activity-list,
.mini-list,
.metric-list,
.feedback-list {
  display: grid;
  gap: 10px;
}

.activity-item,
.resource-item,
.list-item {
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(244, 241, 234, 0.78);
}

.activity-item {
  align-items: flex-start;
  gap: 16px;
  border: 1px solid rgba(15, 15, 15, 0.06);
}

.activity-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.activity-copy strong {
  color: var(--text);
  line-height: 1.4;
}

.activity-detail {
  color: var(--text-soft);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.activity-meta {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
}

.activity-time {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.mini-list li,
.metric-list li,
.feedback-list li {
  position: relative;
  padding-left: 18px;
  color: var(--text-soft);
  line-height: 1.5;
}

.mini-list li::before,
.metric-list li::before,
.feedback-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 191, 166, 0.45);
}

.library-layout {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.library-panel {
  min-height: 720px;
}

.library-panel:first-child {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 249, 247, 0.9));
}

.library-search {
  margin: 14px 0 12px;
}

.library-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(233, 245, 242, 0.62);
  border: 1px solid rgba(0, 191, 166, 0.08);
}

.library-list::-webkit-scrollbar,
.preview-content::-webkit-scrollbar,
.library-preview-body::-webkit-scrollbar {
  width: 8px;
}

.library-list::-webkit-scrollbar-thumb,
.preview-content::-webkit-scrollbar-thumb,
.library-preview-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(15, 15, 15, 0.12);
}

.list-link {
  border: 1px solid rgba(167, 139, 250, 0.14);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
}

.library-list .list-link:nth-child(even) {
  background: rgba(250, 247, 255, 0.96);
}

.list-link:hover {
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.26);
}

.list-link.is-active {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.32);
  color: #6D4DE8;
}

.list-link-copy {
  min-width: 0;
}

.list-link-top {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.library-item-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.list-link strong {
  display: block;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.list-link .list-meta {
  color: var(--text-soft);
}

.library-preview-body {
  min-height: 590px;
  max-height: 760px;
  overflow: auto;
}

.preview-frame {
  padding: 18px;
  border-radius: 20px;
  background: rgba(245, 242, 235, 0.72);
  border: 1px solid rgba(15, 15, 15, 0.06);
}

.preview-wrap {
  display: grid;
  gap: 16px;
}

.preview-header {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(15, 15, 15, 0.08);
}

.preview-title {
  font-weight: 800;
}

.preview-pdf-warning {
  background: rgba(223, 107, 103, 0.12);
  color: #983f3b;
}

.preview-pdf-iframe,
.preview-html {
  width: 100%;
  min-height: 620px;
  border: 1px solid rgba(15, 15, 15, 0.1);
  border-radius: 18px;
  background: #fff;
}

.preview-container,
.preview-content {
  min-height: 520px;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pdf-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
}

.pdf-page-input {
  width: 60px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}

.pdf-canvas-wrap {
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
}

.pdf-canvas-wrap canvas {
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(15, 15, 15, 0.12);
}

.preview-image {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 12px 22px rgba(15, 15, 15, 0.1);
}

.preview-audio {
  width: min(520px, 100%);
}

.listening-audio-card {
  width: 100%;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(196, 181, 253, 0.1)), var(--surface-strong);
  border-color: rgba(167, 139, 250, 0.28);
}

.listening-audio-card .preview-audio {
  display: block;
  width: 100%;
  max-width: none;
  accent-color: var(--primary);
  color-scheme: light;
}

.preview-loading,
.preview-error,
.activity-empty,
.library-empty,
.preview-placeholder-panel {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}

.preview-loading-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 12px;
  border: 3px solid rgba(15, 15, 15, 0.12);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.preview-fallback {
  display: inline-flex;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(0, 191, 166, 0.12);
  text-decoration: none;
  font-weight: 800;
}

.markdown-body {
  color: var(--text-soft);
  line-height: 1.8;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: var(--text);
  font-family: var(--font-display);
}

.markdown-body img {
  max-width: 100%;
  border-radius: 18px;
}

.markdown-body code,
.markdown-body pre {
  border-radius: 12px;
  background: rgba(15, 15, 15, 0.06);
}

.markdown-body code {
  padding: 2px 6px;
}

.markdown-body pre {
  padding: 16px;
  overflow: auto;
}

.plan-card.is-highlighted {
  background: linear-gradient(145deg, rgba(44, 120, 114, 0.96), rgba(31, 95, 90, 0.96));
  color: #f4fffd;
}

.plan-card.is-highlighted p,
.plan-card.is-highlighted .muted-label,
.plan-card.is-highlighted .mini-list li {
  color: rgba(244, 255, 253, 0.78);
}

.plan-price span {
  font-size: var(--text-sm);
  font-family: var(--font-sans);
}

.profile-card--span-2 {
  grid-column: span 2;
}

.plans-board {
  margin-top: 18px;
}

.plan-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.plan-option {
  width: 100%;
  border: 1px solid rgba(15, 15, 15, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.plan-option:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 14px 28px rgba(17, 28, 26, 0.14);
}

.plan-option.is-selected {
  border-color: rgba(0, 191, 166, 0.44);
  box-shadow: 0 0 0 2px rgba(0, 191, 166, 0.14), 0 12px 24px rgba(17, 28, 26, 0.14);
}

.plan-option__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-option__price {
  margin-top: 8px;
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: var(--text-sm);
}

.payment-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.metric-row,
.settings-row {
  padding: 12px 0;
}

.metric-row + .metric-row,
.settings-row + .settings-row {
  border-top: 1px solid rgba(15, 15, 15, 0.06);
}

.toggle {
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: rgba(0, 191, 166, 0.18);
  position: relative;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal);
}

.toggle.is-off {
  background: rgba(141, 160, 157, 0.25);
}

.toggle.is-off::after {
  right: auto;
  left: 4px;
  background: rgba(141, 160, 157, 0.85);
}

.auth-success {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 191, 166, 0.14);
  color: var(--teal-dark);
  font-size: var(--text-sm);
  font-weight: 700;
}

.form-grid--single {
  grid-template-columns: 1fr;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: var(--text-sm);
}

.activity-item--form {
  display: grid;
  gap: 14px;
  align-items: stretch;
}

.admin-form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.form-grid--admin {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-upload-form {
  display: grid;
  gap: 16px;
}

.btn:disabled,
.nav-button:disabled,
.sidebar-action:disabled,
.sound-button:disabled,
.tag-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.ai-test-shell {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.ai-builder-card,
.ai-session-card,
.ai-score-card,
.ai-questions-card {
  background: rgba(255, 255, 255, 0.9);
}

.ai-form-grid,
.ai-listening-grid,
.ai-meta-grid {
  display: grid;
  gap: 14px;
}

.ai-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.ai-form-span {
  grid-column: 1 / -1;
}

.ai-listening-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.audio-card,
.ai-question-card,
.ai-mini-card,
.ai-review-item,
.ai-option {
  border: 1px solid rgba(15, 15, 15, 0.08);
  border-radius: 16px;
  background: rgba(244, 241, 234, 0.72);
}

.audio-card,
.ai-mini-card,
.ai-review-item {
  padding: 14px;
}

.audio-card {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.ai-meta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.ai-meta-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-mini-card {
  display: grid;
  gap: 6px;
}

.ai-mini-card strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.ai-question-list,
.ai-review-list,
.ai-option-list {
  display: grid;
  gap: 12px;
}

.ai-builder-card input[type='file'] {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.98);
}

.speaking-recorder-card {
  margin-bottom: 16px;
}

.ai-question-list,
.ai-review-list {
  margin-top: 18px;
}

.ai-question-card {
  padding: 16px;
}

.ai-question-card p {
  margin: 10px 0 14px;
  color: var(--text-soft);
}

.ai-question-header,
.ai-review-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}

.ai-option input {
  margin: 0;
}

.ai-review-item.is-correct {
  border-color: rgba(0, 143, 124, 0.18);
  background: rgba(0, 191, 166, 0.08);
}

.ai-review-item.is-wrong {
  border-color: rgba(223, 107, 103, 0.18);
  background: rgba(223, 107, 103, 0.06);
}

.flow-panel {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.flow-stack {
  display: grid;
  gap: 16px;
}

.panel-card--nested {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 15, 15, 0.06);
  box-shadow: none;
}

.reading-passage,
.writing-sample {
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--text-soft);
  font-size: var(--text-sm);
}

.reading-question,
.result-row {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(15, 15, 15, 0.06);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(15, 15, 15, 0.06);
  color: var(--text-soft);
}

.choice-option input {
  margin-top: 3px;
}

.metrics-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pill-success {
  background: rgba(0, 191, 166, 0.14);
  color: var(--teal-dark);
}

.pill-warning {
  background: rgba(214, 150, 56, 0.16);
  color: #9d6200;
}

.pill-danger {
  background: rgba(223, 107, 103, 0.12);
  color: #8e3835;
}

.pill-neutral {
  background: rgba(103, 122, 120, 0.12);
  color: var(--text-soft);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

html[data-theme='dark'] {
  color-scheme: dark;
}

html[data-theme='dark'] body {
  background:
    radial-gradient(circle at top left, rgba(71, 217, 205, 0.1), transparent 28%),
    radial-gradient(circle at bottom right, rgba(155, 138, 202, 0.08), transparent 22%),
    var(--bg);
}

html[data-theme='dark'] .sidebar {
  background: rgba(17, 24, 22, 0.76);
  border-right-color: rgba(255, 255, 255, 0.06);
}

html[data-theme='dark'] .glass-card,
html[data-theme='dark'] .focus-card,
html[data-theme='dark'] .panel-card,
html[data-theme='dark'] .plan-card,
html[data-theme='dark'] .stat-card,
html[data-theme='dark'] .study-card,
html[data-theme='dark'] .practice-card,
html[data-theme='dark'] .mode-card,
html[data-theme='dark'] .feature-card,
html[data-theme='dark'] .resource-card,
html[data-theme='dark'] .metrics-card,
html[data-theme='dark'] .profile-card,
html[data-theme='dark'] .activity-card,
html[data-theme='dark'] .library-panel,
html[data-theme='dark'] .empty-card,
html[data-theme='dark'] .auth-card,
html[data-theme='dark'] .focus-fab-trigger,
html[data-theme='dark'] .focus-fab-panel,
html[data-theme='dark'] .sidebar-icon-action,
html[data-theme='dark'] .panel-card--nested,
html[data-theme='dark'] .reading-question,
html[data-theme='dark'] .result-row,
html[data-theme='dark'] .choice-option,
html[data-theme='dark'] .preview-pdf-iframe,
html[data-theme='dark'] .preview-html,
html[data-theme='dark'] .pdf-canvas-wrap,
html[data-theme='dark'] .preview-placeholder-panel,
html[data-theme='dark'] .audio-card,
html[data-theme='dark'] .ai-mini-card,
html[data-theme='dark'] .ai-review-item,
html[data-theme='dark'] .ai-option,
html[data-theme='dark'] .ai-question-card,
html[data-theme='dark'] .ai-builder-card,
html[data-theme='dark'] .ai-session-card,
html[data-theme='dark'] .ai-score-card,
html[data-theme='dark'] .ai-questions-card {
  background: rgba(37, 31, 53, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

html[data-theme='dark'] .input,
html[data-theme='dark'] .textarea,
html[data-theme='dark'] .ai-builder-card input[type='file'],
html[data-theme='dark'] .pdf-page-input {
  background: rgba(14, 20, 19, 0.96);
  border-color: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

html[data-theme='dark'] .input::placeholder,
html[data-theme='dark'] .textarea::placeholder {
  color: var(--text-muted);
}

html[data-theme='dark'] .input option,
html[data-theme='dark'] select option {
  background: #251F35;
  color: var(--text);
}

html[data-theme='dark'] .input option:hover,
html[data-theme='dark'] select option:hover,
html[data-theme='dark'] .input option:focus,
html[data-theme='dark'] select option:focus {
  background: #A78BFA;
  color: #FFFFFF;
}

html[data-theme='dark'] .input option:checked,
html[data-theme='dark'] select option:checked {
  background: #111C1A;
  color: #FFFFFF;
}

html[data-theme='dark'] .btn-secondary {
  background: rgba(37, 31, 53, 0.96);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

html[data-theme='dark'] .btn-secondary:hover,
html[data-theme='dark'] .btn-secondary:focus-visible {
  background: rgba(48, 39, 68, 0.98);
  border-color: rgba(167, 139, 250, 0.22);
  color: #edf4f2;
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.16);
}

html[data-theme='dark'] .btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
}

html[data-theme='dark'] .btn-ghost:hover,
html[data-theme='dark'] .btn-ghost:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

html[data-theme='dark'] .plan-option {
  background: rgba(37, 31, 53, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .plan-option:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34);
}

@media (max-width: 980px) {
  .plan-options {
    grid-template-columns: 1fr;
  }
}

html[data-theme='dark'] .btn-secondary:disabled,
html[data-theme='dark'] .btn-ghost:disabled {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  box-shadow: none;
}

html[data-theme='dark'] .pill,
html[data-theme='dark'] .preview-pdf-warning {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
}

html[data-theme='dark'] .pill--audio {
  background: rgba(0, 191, 166, 0.16);
  border-color: rgba(0, 191, 166, 0.18);
  color: #dff8f3;
}

html[data-theme='dark'] .pill-success {
  background: rgba(0, 191, 166, 0.18);
  border-color: rgba(0, 191, 166, 0.2);
  color: #dff8f3;
}

html[data-theme='dark'] .pill-warning {
  background: rgba(224, 148, 85, 0.18);
  border-color: rgba(224, 148, 85, 0.22);
  color: #ffd9b8;
}

html[data-theme='dark'] .pill-danger {
  background: rgba(223, 107, 103, 0.18);
  border-color: rgba(223, 107, 103, 0.22);
  color: #ffc1bd;
}

html[data-theme='dark'] .pill-neutral {
  background: rgba(178, 197, 193, 0.12);
  border-color: rgba(178, 197, 193, 0.14);
  color: #d5e3e0;
}

html[data-theme='dark'] .btn-ghost,
html[data-theme='dark'] .nav-button,
html[data-theme='dark'] .sidebar-action,
html[data-theme='dark'] .sound-button,
html[data-theme='dark'] .list-link,
html[data-theme='dark'] .tag-button {
  color: var(--text-soft);
}

html[data-theme='dark'] .library-list {
  background: rgba(31, 25, 45, 0.86);
  border-color: rgba(167, 139, 250, 0.14);
}

html[data-theme='dark'] .list-link {
  background: rgba(37, 31, 53, 0.94);
  border-color: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

html[data-theme='dark'] .library-list .list-link:nth-child(even) {
  background: rgba(43, 35, 61, 0.96);
}

html[data-theme='dark'] .list-link strong {
  color: var(--text);
}

html[data-theme='dark'] .list-link .list-meta {
  color: var(--text-soft);
}

html[data-theme='dark'] .tag-button--listening {
  background: rgba(0, 191, 166, 0.16);
  border-color: rgba(0, 191, 166, 0.2);
  color: #dff8f3;
}

html[data-theme='dark'] .library-panel:first-child {
  background: linear-gradient(180deg, rgba(43, 35, 61, 0.98), rgba(31, 25, 45, 0.94));
}

html[data-theme='dark'] .list-link:hover {
  background: rgba(167, 139, 250, 0.16);
  border-color: rgba(196, 181, 253, 0.28);
}

html[data-theme='dark'] .list-link.is-active {
  background: rgba(167, 139, 250, 0.22);
  border-color: rgba(167, 139, 250, 0.32);
  color: #F4F0FF;
}

html[data-theme='dark'] .auth-toggle .is-active,
html[data-theme='dark'] .nav-button.is-active,
html[data-theme='dark'] .sound-button.is-active,
html[data-theme='dark'] .tag-button.is-active,
html[data-theme='dark'] .list-link.is-active,
html[data-theme='dark'] .sidebar-icon-action:hover,
html[data-theme='dark'] .sidebar-icon-action:focus-visible,
html[data-theme='dark'] .focus-fab-trigger:hover,
html[data-theme='dark'] .focus-fab-trigger:focus-visible {
  background: rgba(167, 139, 250, 0.2);
  color: #F4F0FF;
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.28);
}

html[data-theme='dark'] .study-ring {
  background: radial-gradient(circle closest-side, #251f35 77%, transparent 78%), conic-gradient(var(--primary) var(--progress, 0%), rgba(167, 139, 250, 0.16) 0);
}

html[data-theme='dark'] .pdf-canvas-wrap canvas,
html[data-theme='dark'] .preview-image {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

html[data-theme='dark'] .preview-audio {
  color-scheme: dark;
}

html[data-theme='dark'] .listening-audio-card {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(142, 110, 239, 0.08)), var(--surface-strong);
  border-color: rgba(196, 181, 253, 0.22);
}

html[data-theme='dark'] .listening-audio-card .preview-audio {
  color-scheme: dark;
  background-color: var(--surface-strong);
  border-radius: 999px;
}

html[data-theme='dark'] .listening-audio-card .preview-audio::-webkit-media-controls-enclosure {
  background-color: var(--surface-strong);
}

html[data-theme='dark'] .metric-row + .metric-row,
html[data-theme='dark'] .settings-row + .settings-row,
html[data-theme='dark'] .preview-header,
html[data-theme='dark'] .choice-option,
html[data-theme='dark'] .reading-question,
html[data-theme='dark'] .result-row {
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .activity-item {
  background: rgba(43, 35, 61, 0.76);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .activity-detail {
  color: var(--text-soft);
}

html[data-theme='dark'] .activity-time {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .completion-card {
  background:
    linear-gradient(135deg, rgba(0, 191, 166, 0.14), rgba(94, 179, 255, 0.08)),
    var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme='dark'] .completion-band {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 191, 166, 0.22);
}

html[data-theme='dark'] .completion-cheer span {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

html[data-theme='dark'] .markdown-body code,
html[data-theme='dark'] .markdown-body pre {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .auth-error {
  background: rgba(223, 107, 103, 0.14);
  color: #ffb5b1;
}

html[data-theme='dark'] .auth-modal {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

html[data-theme='dark'] .auth-modal-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

html[data-theme='dark'] .writing-studio-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

html[data-theme='dark'] .writing-studio-modal {
  background: var(--surface-strong);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
}

html[data-theme='dark'] .writing-studio-kicker {
  background: rgba(0, 191, 166, 0.15);
  color: var(--cyan);
}

html[data-theme='dark'] .muted-label,
html[data-theme='dark'] .resource-meta,
html[data-theme='dark'] .card-subtle,
html[data-theme='dark'] .activity-time,
html[data-theme='dark'] .list-meta,
html[data-theme='dark'] .micro-kicker,
html[data-theme='dark'] .stat-label,
html[data-theme='dark'] .reading-passage,
html[data-theme='dark'] .writing-sample,
html[data-theme='dark'] .ai-question-card p,
html[data-theme='dark'] .focus-status,
html[data-theme='dark'] .focus-fab-panel p {
  color: var(--text-soft);
}

/* Dark mode: Modal text visibility fixes */
html[data-theme='dark'] .writing-studio-title {
  color: var(--text);
}

html[data-theme='dark'] .writing-studio-subtitle {
  color: var(--text-soft);
}

html[data-theme='dark'] .writing-studio-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .writing-studio-close {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
}

html[data-theme='dark'] .writing-studio-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

/* Dark mode: Reading and Writing content visibility */
html[data-theme='dark'] .reading-passage,
html[data-theme='dark'] .writing-sample {
  color: var(--text-soft);
}

/* Dark mode: Choice options visibility */
html[data-theme='dark'] .choice-option {
  background: rgba(43, 35, 61, 0.76);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
}

/* Dark mode: Reading questions visibility */
html[data-theme='dark'] .reading-question {
  background: rgba(43, 35, 61, 0.76);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

html[data-theme='dark'] .reading-question p,
html[data-theme='dark'] .reading-question label {
  color: var(--text-soft);
}

/* Dark mode: Panel cards in modals */
html[data-theme='dark'] .panel-card--nested h3 {
  color: var(--text);
}

html[data-theme='dark'] .panel-card--nested p {
  color: var(--text-soft);
}

/* Dark mode: List items in modals and sections */
html[data-theme='dark'] .mini-list li,
html[data-theme='dark'] .metric-list li,
html[data-theme='dark'] .feedback-list li {
  color: var(--text-soft);
}

html[data-theme='dark'] .mini-list li::before,
html[data-theme='dark'] .metric-list li::before,
html[data-theme='dark'] .feedback-list li::before {
  background: rgba(0, 191, 166, 0.55);
}

/* Dark mode: Panel card headings and text */
html[data-theme='dark'] .panel-card h3,
html[data-theme='dark'] .focus-card h3 {
  color: var(--text);
}

html[data-theme='dark'] .panel-card p,
html[data-theme='dark'] .focus-card p {
  color: var(--text-soft);
}

/* Dark mode: Two column layout text visibility */
html[data-theme='dark'] .two-column h3 {
  color: var(--text);
}

html[data-theme='dark'] .two-column p {
  color: var(--text-soft);
}

/* Dark mode: Result row text */
html[data-theme='dark'] .result-row strong {
  color: var(--text);
}

html[data-theme='dark'] .result-row .muted-label {
  color: var(--text-muted);
}

/* Dark mode: Field labels visibility */
html[data-theme='dark'] .field-label {
  color: var(--text-soft);
}

/* Dark mode: Form elements in sections */
html[data-theme='dark'] .form-grid label {
  color: var(--text-soft);
}

/* Dark mode: AI form elements */
html[data-theme='dark'] .ai-form-grid label,
html[data-theme='dark'] .ai-form-grid .field-label {
  color: var(--text-soft);
}

/* Dark mode: AI cards text visibility */
html[data-theme='dark'] .ai-question-card h3,
html[data-theme='dark'] .ai-question-card h4,
html[data-theme='dark'] .ai-mini-card strong,
html[data-theme='dark'] .audio-card h3,
html[data-theme='dark'] .audio-card h4 {
  color: var(--text);
}

html[data-theme='dark'] .ai-question-card p,
html[data-theme='dark'] .ai-mini-card p,
html[data-theme='dark'] .audio-card p {
  color: var(--text-soft);
}

/* Dark mode: AI review items text */
html[data-theme='dark'] .ai-review-item strong,
html[data-theme='dark'] .ai-review-item label {
  color: var(--text);
}

html[data-theme='dark'] .ai-review-item p {
  color: var(--text-soft);
}

/* Dark mode: AI options text */
html[data-theme='dark'] .ai-option label {
  color: var(--text-soft);
}

/* Dark mode: Correct/Wrong review items */
html[data-theme='dark'] .ai-review-item.is-correct {
  border-color: rgba(0, 191, 166, 0.24);
  background: rgba(0, 191, 166, 0.12);
}

html[data-theme='dark'] .ai-review-item.is-wrong {
  border-color: rgba(223, 107, 103, 0.24);
  background: rgba(223, 107, 103, 0.12);
}

/* Dark mode: Inline styled content backgrounds */
html[data-theme='dark'] div[style*="background: #fff"],
html[data-theme='dark'] div[style*="background: white"],
html[data-theme='dark'] div[style*="background:#fff"],
html[data-theme='dark'] div[style*="background:white"] {
  background: var(--surface-strong) !important;
}

html[data-theme='dark'] div[style*="background: #fdfaf6"] {
  background: rgba(43, 35, 61, 0.76) !important;
}

html[data-theme='dark'] div[style*="background: #f8f9fa"] {
  background: var(--surface-muted) !important;
}

html[data-theme='dark'] div[style*="border: 1px solid #eaeaea"],
html[data-theme='dark'] div[style*="border:1px solid #eaeaea"] {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme='dark'] div[style*="border: 2px solid #e2e8f0"],
html[data-theme='dark'] div[style*="border:2px solid #e2e8f0"] {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme='dark'] div[style*="border-bottom: 1px solid #e2e8f0"],
html[data-theme='dark'] tr[style*="border-bottom: 1px solid #e2e8f0"] {
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

/* Dark mode: Table backgrounds */
html[data-theme='dark'] table[style*="background: #fff"] {
  background: var(--surface-strong) !important;
}

html[data-theme='dark'] tr[style*="background: white"],
html[data-theme='dark'] tr[style*="background:white"] {
  background: var(--surface-strong) !important;
}

html[data-theme='dark'] tr:hover[style*="background"] {
  background: #C4B5FD !important;
}

/* Dark mode: Content boxes with light backgrounds */
html[data-theme='dark'] div[style*="box-shadow"][style*="background: #fff"],
html[data-theme='dark'] div[style*="border-radius"][style*="background: #fff"] {
  background: var(--surface-strong) !important;
}

/* Dark mode: Specific content containers */
html[data-theme='dark'] div[style*="border-radius: 12px"][style*="overflow: hidden"],
html[data-theme='dark'] div[style*="border-radius: 16px"][style*="padding: 32px"],
html[data-theme='dark'] div[style*="border-radius: 8px"][style*="padding: 16px"] {
  background: var(--surface-strong) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Dark mode: YouTube video containers */
html[data-theme='dark'] div[style*="grid-template-columns"] > div[style*="background: #fff"] {
  background: var(--surface-strong) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Dark mode: Writing topic cards */
html[data-theme='dark'] div[style*="cursor: pointer"][style*="background: #fff"] {
  background: var(--surface-strong) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Dark mode: Tables with white backgrounds */
html[data-theme='dark'] table {
  background: var(--surface-strong) !important;
}

html[data-theme='dark'] thead tr {
  background: linear-gradient(135deg, #A78BFA 0%, #8E6EEF 100%) !important;
}

html[data-theme='dark'] tbody tr {
  background: var(--surface-strong) !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme='dark'] tbody tr:hover {
  background: #C4B5FD !important;
}

html[data-theme='dark'] td {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Dark mode: Override all inline white backgrounds in content areas */
html[data-theme='dark'] .workspace div[style*="background: #fff"],
html[data-theme='dark'] .workspace div[style*="background:#fff"],
html[data-theme='dark'] .workspace div[style*="background: white"] {
  background: var(--surface-strong) !important;
}

html[data-theme='dark'] .workspace div[style*="border: 1px solid #eaeaea"],
html[data-theme='dark'] .workspace div[style*="border: 2px solid #e2e8f0"] {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Table row hover effects */
tbody tr {
  transition: background 0.2s;
}

tbody tr:hover {
  background: #C4B5FD !important;
}

html[data-theme='dark'] tbody tr:hover {
  background: #C4B5FD !important;
}

/* Video card and topic card styles */
.video-card,
.topic-card {
  background: #fff;
  transition: all 0.3s;
}

html[data-theme='dark'] .video-card,
html[data-theme='dark'] .topic-card {
  background: var(--surface-strong) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme='dark'] .video-card:hover,
html[data-theme='dark'] .topic-card:hover {
  background: var(--surface-strong) !important;
  border-color: #A78BFA !important;
}

@media (max-width: 1200px) {
  .stats-grid,
  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column,
  .library-layout,
  .auth-shell,
  .ai-listening-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body:has(.screen-shell.shell),
  html[data-theme='dark'] body:has(.screen-shell.shell) {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  body:has(.screen-shell.shell) .screen-shell.shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid rgba(15, 15, 15, 0.06);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    height: auto;
    overflow: visible;
    padding: 18px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .practice-grid,
  .mode-grid,
  .feature-grid,
  .resource-grid,
  .plan-grid,
  .ai-form-grid,
  .ai-meta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .auth-visual,
  .auth-panel,
  .workspace {
    padding: 20px;
  }

  .auth-card {
    padding: 24px;
  }

  .stats-grid,
  .profile-grid,
  .metrics-grid,
  .metrics-grid--compact,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .completion-card {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .completion-band {
    width: 78px;
    height: 78px;
    justify-self: start;
  }

  .completion-actions .btn {
    width: 100%;
    justify-content: center;
  }

}


@media (prefers-reduced-motion: reduce) {
  .landing-reveal,
  .landing-reveal-item,
  .landing-media {
    transition: none !important;
  }

  .landing-reveal,
  .landing-reveal-item {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }

  .landing-media {
    transform: none !important;
  }

  .completion-burst span {
    animation: none !important;
  }
}

.track-card:hover {
  background: rgba(255,255,255,0.08) !important;
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.2) !important;
}

/* V2 static landing page loaded from index.html before the V3 app mounts. */
body:has(.page-shell.landing-shell) {
  background: radial-gradient(circle at top left, rgba(142, 110, 239, 0.12), transparent 28%),
              radial-gradient(circle at bottom right, rgba(99, 102, 241, 0.08), transparent 32%),
              linear-gradient(180deg, #FCFAFF 0%, #F3EFFB 100%);
}

.page-shell.landing-shell {
  max-width: 1260px;
  min-height: auto;
  margin: 0 auto;
  padding: 0 24px 48px;
  position: relative;
  isolation: auto;
  overflow: visible;
  background: transparent;
  background-size: auto;
  animation: none;
}

.page-shell.landing-shell::before,
.page-shell.landing-shell::after {
  content: none;
  display: none;
}

html[data-theme='dark'] .page-shell.landing-shell {
  background: transparent;
}

@media (max-width: 720px) {
  .page-shell.landing-shell {
    padding: 0 18px 30px;
  }
}

/* V2 dashboard theme alignment */
:root {
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Inter', sans-serif;
  --bg: #FCFAFF;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: #FFFFFF;
  --surface-muted: rgba(142, 110, 239, 0.08);
  --line: rgba(63, 38, 142, 0.12);
  --text: #1E1B2B;
  --text-soft: #1E1B2B;
  --text-muted: #6B6A77;
  --primary: #8E6EEF;
  --primary-dark: #6D4DE8;
  --primary-light: #A78BFA;
  --teal: #8E6EEF;
  --teal-dark: #6D4DE8;
  --cyan: #A78BFA;
  --violet: #8E6EEF;
  --orange: #D79D6A;
  --gold: #C7A34B;
  --success: #6C4DE0;
  --shadow-sm: 0 10px 24px rgba(99, 72, 169, 0.08);
  --shadow-lg: 0 28px 80px rgba(99, 72, 169, 0.12);
}

html:has(.screen-shell.shell),
html[data-theme='dark']:has(.screen-shell.shell) {
  color-scheme: light;
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Inter', sans-serif;
  --bg: #FCFAFF;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: #FFFFFF;
  --surface-muted: rgba(142, 110, 239, 0.08);
  --line: rgba(63, 38, 142, 0.12);
  --text: #1E1B2B;
  --text-soft: #1E1B2B;
  --text-muted: #6B6A77;
  --primary: #8E6EEF;
  --primary-dark: #6D4DE8;
  --primary-light: #A78BFA;
  --teal: #8E6EEF;
  --teal-dark: #6D4DE8;
  --cyan: #A78BFA;
  --violet: #8E6EEF;
  --orange: #D79D6A;
  --gold: #C7A34B;
  --success: #6C4DE0;
  --shadow-sm: 0 10px 24px rgba(99, 72, 169, 0.08);
  --shadow-lg: 0 28px 80px rgba(99, 72, 169, 0.12);
}

body:has(.screen-shell.shell),
html[data-theme='dark'] body:has(.screen-shell.shell) {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  color: #1E1B2B;
  background:
    radial-gradient(circle at top left, rgba(142, 110, 239, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(99, 102, 241, 0.08), transparent 32%),
    linear-gradient(180deg, #FCFAFF 0%, #F3EFFB 100%);
}

body:has(.screen-shell.shell) .screen-shell.shell {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: transparent;
}

body:has(.screen-shell.shell) .sidebar,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar {
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid rgba(142, 110, 239, 0.12);
  box-shadow: 12px 0 40px rgba(99, 72, 169, 0.06);
  backdrop-filter: blur(18px);
}

body:has(.screen-shell.shell) .brand {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  letter-spacing: -0.04em;
  color: #2D1B4E;
}

body:has(.screen-shell.shell) .brand strong {
  font-size: 1.45rem;
  font-weight: 300;
}

body:has(.screen-shell.shell) .brand strong em {
  color: #8E6EEF;
  font-style: italic;
}

body:has(.screen-shell.shell) .brand-mark span,
body:has(.screen-shell.shell) .sidebar .brand-mark span {
  background: rgba(45, 27, 78, 0.16);
}

body:has(.screen-shell.shell) .brand-mark span:nth-child(2),
body:has(.screen-shell.shell) .brand-mark span:nth-child(3),
body:has(.screen-shell.shell) .sidebar .brand-mark span:nth-child(2),
body:has(.screen-shell.shell) .sidebar .brand-mark span:nth-child(3) {
  background: #8E6EEF;
}

body:has(.screen-shell.shell) .workspace {
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: transparent;
}

body:has(.screen-shell.shell) .topbar {
  color: #1E1B2B;
}

body:has(.screen-shell.shell) .page-copy h1,
body:has(.screen-shell.shell) .dashboard-hero h1,
body:has(.screen-shell.shell) .metrics-value,
body:has(.screen-shell.shell) .stat-value,
body:has(.screen-shell.shell) .band-value,
body:has(.screen-shell.shell) .study-ring strong,
body:has(.screen-shell.shell) .plan-price {
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.035em;
  color: #2D1B4E;
}

body:has(.screen-shell.shell) .page-copy p,
body:has(.screen-shell.shell) .section-heading,
body:has(.screen-shell.shell) .muted-label,
body:has(.screen-shell.shell) .resource-meta,
body:has(.screen-shell.shell) .card-subtle,
body:has(.screen-shell.shell) .activity-time,
body:has(.screen-shell.shell) .list-meta,
body:has(.screen-shell.shell) .micro-kicker,
body:has(.screen-shell.shell) .stat-label {
  color: #6B6A77;
}

body:has(.screen-shell.shell) .dashboard-hero,
html[data-theme='dark'] body:has(.screen-shell.shell) .dashboard-hero {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.22), transparent 24%),
    linear-gradient(135deg, #8E6EEF 0%, #6D4DE8 100%);
  color: #FFFFFF;
  box-shadow: 0 28px 80px rgba(99, 72, 169, 0.18);
}

body:has(.screen-shell.shell) .dashboard-hero h1 {
  color: #FFFFFF;
}

body:has(.screen-shell.shell) .dashboard-hero p,
body:has(.screen-shell.shell) .hero-pill {
  color: rgba(255, 255, 255, 0.86);
}

body:has(.screen-shell.shell) .hero-pill {
  background: rgba(255, 255, 255, 0.16);
}

body:has(.screen-shell.shell) .glass-card,
body:has(.screen-shell.shell) .focus-card,
body:has(.screen-shell.shell) .panel-card,
body:has(.screen-shell.shell) .plan-card,
body:has(.screen-shell.shell) .stat-card,
body:has(.screen-shell.shell) .study-card,
body:has(.screen-shell.shell) .practice-card,
body:has(.screen-shell.shell) .mode-card,
body:has(.screen-shell.shell) .feature-card,
body:has(.screen-shell.shell) .resource-card,
body:has(.screen-shell.shell) .metrics-card,
body:has(.screen-shell.shell) .profile-card,
body:has(.screen-shell.shell) .activity-card,
body:has(.screen-shell.shell) .library-panel,
body:has(.screen-shell.shell) .empty-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .glass-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .focus-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .panel-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .plan-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .stat-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .study-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .practice-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .mode-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .feature-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .metrics-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .profile-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .activity-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .library-panel,
html[data-theme='dark'] body:has(.screen-shell.shell) .empty-card {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(142, 110, 239, 0.12);
  box-shadow: 0 24px 60px rgba(99, 72, 169, 0.08);
}

body:has(.screen-shell.shell) .panel-card h3,
body:has(.screen-shell.shell) .plan-card h3,
body:has(.screen-shell.shell) .stat-card h3,
body:has(.screen-shell.shell) .practice-card h3,
body:has(.screen-shell.shell) .mode-card h3,
body:has(.screen-shell.shell) .resource-card h3,
body:has(.screen-shell.shell) .metrics-card h3,
body:has(.screen-shell.shell) .profile-card h3,
body:has(.screen-shell.shell) .library-panel h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .panel-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .plan-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .stat-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .practice-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .mode-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .metrics-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .profile-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .library-panel h3 {
  color: #2D1B4E;
}

body:has(.screen-shell.shell) .panel-card p,
body:has(.screen-shell.shell) .plan-card p,
body:has(.screen-shell.shell) .practice-card p,
body:has(.screen-shell.shell) .mode-card p,
body:has(.screen-shell.shell) .resource-card p,
body:has(.screen-shell.shell) .metrics-card p,
body:has(.screen-shell.shell) .profile-card p,
body:has(.screen-shell.shell) .library-panel p,
body:has(.screen-shell.shell) .metric-list li,
body:has(.screen-shell.shell) .mini-list li,
body:has(.screen-shell.shell) .feedback-list li,
html[data-theme='dark'] body:has(.screen-shell.shell) .panel-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .plan-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .practice-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .mode-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .metrics-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .profile-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .library-panel p,
html[data-theme='dark'] body:has(.screen-shell.shell) .metric-list li,
html[data-theme='dark'] body:has(.screen-shell.shell) .mini-list li,
html[data-theme='dark'] body:has(.screen-shell.shell) .feedback-list li {
  color: #6B6A77;
}

body:has(.screen-shell.shell) .nav-button.is-active,
body:has(.screen-shell.shell) .sidebar-action:hover,
body:has(.screen-shell.shell) .sidebar-icon-action:hover,
body:has(.screen-shell.shell) .sidebar-icon-action:focus-visible,
body:has(.screen-shell.shell) .sidebar-track-option:hover,
body:has(.screen-shell.shell) .sidebar-track-option:focus-visible,
body:has(.screen-shell.shell) .sidebar-track-option.is-active,
body:has(.screen-shell.shell) .chip,
body:has(.screen-shell.shell) .focus-fab-trigger {
  color: #6D4DE8;
  background: rgba(142, 110, 239, 0.12);
  box-shadow: inset 0 0 0 1px rgba(142, 110, 239, 0.16);
}

body:has(.screen-shell.shell) .btn-primary,
body:has(.screen-shell.shell) .sound-button.is-active,
body:has(.screen-shell.shell) .tag-button.is-active,
html[data-theme='dark'] body:has(.screen-shell.shell) .btn-primary {
  color: #FFFFFF;
  background: linear-gradient(135deg, #8E6EEF 0%, #6D4DE8 100%);
  box-shadow: 0 22px 48px rgba(142, 110, 239, 0.18);
}

body:has(.screen-shell.shell) .btn-secondary,
body:has(.screen-shell.shell) .btn-ghost,
body:has(.screen-shell.shell) .sidebar-icon-action,
body:has(.screen-shell.shell) .sidebar-track-switch,
body:has(.screen-shell.shell) .pill,
body:has(.screen-shell.shell) .sound-button,
body:has(.screen-shell.shell) .tag-button,
html[data-theme='dark'] body:has(.screen-shell.shell) .btn-secondary,
html[data-theme='dark'] body:has(.screen-shell.shell) .btn-ghost,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-icon-action,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-track-switch,
html[data-theme='dark'] body:has(.screen-shell.shell) .pill,
html[data-theme='dark'] body:has(.screen-shell.shell) .sound-button,
html[data-theme='dark'] body:has(.screen-shell.shell) .tag-button {
  color: #2D1B4E;
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(45, 27, 78, 0.16);
}

body:has(.screen-shell.shell) .accent-teal,
body:has(.screen-shell.shell) .accent-violet,
body:has(.screen-shell.shell) .accent-orange,
body:has(.screen-shell.shell) .accent-gold,
body:has(.screen-shell.shell) .metric-badge,
body:has(.screen-shell.shell) .mode-badge,
body:has(.screen-shell.shell) .resource-badge,
body:has(.screen-shell.shell) .skill-badge,
body:has(.screen-shell.shell) .stat-icon-wrap {
  color: #6D4DE8;
  background: rgba(142, 110, 239, 0.12);
}

body:has(.screen-shell.shell) .practice-card::before,
body:has(.screen-shell.shell) .mode-card::before,
body:has(.screen-shell.shell) .resource-card::before,
body:has(.screen-shell.shell) .progress-fill,
body:has(.screen-shell.shell) .metric-list li::before,
body:has(.screen-shell.shell) .mini-list li::before,
body:has(.screen-shell.shell) .feedback-list li::before {
  background: #8E6EEF;
}

body:has(.screen-shell.shell) .study-ring {
  background:
    radial-gradient(circle closest-side, #fff 77%, transparent 78%),
    conic-gradient(#8E6EEF var(--progress, 0%), rgba(142, 110, 239, 0.12) 0);
}

body:has(.screen-shell.shell) .activity-item,
body:has(.screen-shell.shell) .resource-item,
body:has(.screen-shell.shell) .list-item {
  background: rgba(142, 110, 239, 0.06);
  border-color: rgba(142, 110, 239, 0.12);
}

/* Dark dashboard theme */
html[data-theme='dark']:has(.screen-shell.shell) {
  color-scheme: dark;
  --bg: #100B1A;
  --surface: rgba(27, 20, 43, 0.96);
  --surface-strong: #1B142B;
  --surface-muted: #261D3A;
  --line: rgba(196, 181, 253, 0.16);
  --text: #F7F3FF;
  --text-soft: #D8CCF8;
  --text-muted: #AFA2CF;
  --primary: #A78BFA;
  --primary-dark: #8E6EEF;
  --primary-light: #C4B5FD;
  --teal: #A78BFA;
  --teal-dark: #C4B5FD;
  --cyan: #E9D5FF;
  --violet: #A78BFA;
  --orange: #D79D6A;
  --gold: #D8B56D;
  --success: #B8A1FF;
  --shadow-sm: 0 16px 36px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.38);
}

html[data-theme='dark'] body:has(.screen-shell.shell) {
  color: #F7F3FF;
  background:
    radial-gradient(circle at top left, rgba(167, 139, 250, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(109, 77, 232, 0.12), transparent 34%),
    linear-gradient(180deg, #100B1A 0%, #171021 100%);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar {
  background: rgba(20, 14, 32, 0.94);
  border-right-color: rgba(196, 181, 253, 0.14);
  box-shadow: 12px 0 42px rgba(0, 0, 0, 0.28);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .topbar,
html[data-theme='dark'] body:has(.screen-shell.shell) .brand,
html[data-theme='dark'] body:has(.screen-shell.shell) .page-copy h1,
html[data-theme='dark'] body:has(.screen-shell.shell) .metrics-value,
html[data-theme='dark'] body:has(.screen-shell.shell) .stat-value,
html[data-theme='dark'] body:has(.screen-shell.shell) .band-value,
html[data-theme='dark'] body:has(.screen-shell.shell) .study-ring strong,
html[data-theme='dark'] body:has(.screen-shell.shell) .plan-price {
  color: #F7F3FF;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .brand strong em {
  color: #C4B5FD;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .page-copy p,
html[data-theme='dark'] body:has(.screen-shell.shell) .section-heading,
html[data-theme='dark'] body:has(.screen-shell.shell) .muted-label,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-meta,
html[data-theme='dark'] body:has(.screen-shell.shell) .card-subtle,
html[data-theme='dark'] body:has(.screen-shell.shell) .activity-time,
html[data-theme='dark'] body:has(.screen-shell.shell) .list-meta,
html[data-theme='dark'] body:has(.screen-shell.shell) .micro-kicker,
html[data-theme='dark'] body:has(.screen-shell.shell) .stat-label {
  color: #AFA2CF;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .glass-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .focus-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .panel-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .plan-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .stat-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .study-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .practice-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .mode-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .feature-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .metrics-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .profile-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .activity-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .library-panel,
html[data-theme='dark'] body:has(.screen-shell.shell) .empty-card {
  background: rgba(27, 20, 43, 0.96);
  border-color: rgba(196, 181, 253, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .panel-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .plan-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .stat-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .practice-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .mode-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .metrics-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .profile-card h3,
html[data-theme='dark'] body:has(.screen-shell.shell) .library-panel h3 {
  color: #F7F3FF;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .panel-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .plan-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .practice-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .mode-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .metrics-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .profile-card p,
html[data-theme='dark'] body:has(.screen-shell.shell) .library-panel p,
html[data-theme='dark'] body:has(.screen-shell.shell) .metric-list li,
html[data-theme='dark'] body:has(.screen-shell.shell) .mini-list li,
html[data-theme='dark'] body:has(.screen-shell.shell) .feedback-list li {
  color: #D8CCF8;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .dashboard-hero {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.14), transparent 24%),
    linear-gradient(135deg, #8E6EEF 0%, #4B2FBF 100%);
  color: #FFFFFF;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .dashboard-hero h1,
html[data-theme='dark'] body:has(.screen-shell.shell) .dashboard-hero p,
html[data-theme='dark'] body:has(.screen-shell.shell) .hero-pill {
  color: #FFFFFF;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .topbar .eyebrow {
  background: rgba(167, 139, 250, 0.22);
  color: #EDE9FE;
  border-color: rgba(196, 181, 253, 0.34);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .hero-pill {
  background: rgba(255, 255, 255, 0.14);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .nav-button,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-action,
html[data-theme='dark'] body:has(.screen-shell.shell) .sound-button,
html[data-theme='dark'] body:has(.screen-shell.shell) .tag-button {
  color: #D8CCF8;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .nav-button.is-active,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-action:hover,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-action:focus-visible,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-icon-action:hover,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-icon-action:focus-visible,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-track-option:hover,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-track-option:focus-visible,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-track-option.is-active,
html[data-theme='dark'] body:has(.screen-shell.shell) .chip,
html[data-theme='dark'] body:has(.screen-shell.shell) .focus-fab-trigger {
  color: #E9D5FF;
  background: rgba(167, 139, 250, 0.16);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.22);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .btn-primary,
html[data-theme='dark'] body:has(.screen-shell.shell) .sound-button.is-active,
html[data-theme='dark'] body:has(.screen-shell.shell) .tag-button.is-active {
  color: #FFFFFF;
  background: linear-gradient(135deg, #A78BFA 0%, #6D4DE8 100%);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.28);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .btn-secondary,
html[data-theme='dark'] body:has(.screen-shell.shell) .btn-ghost,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-icon-action,
html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-track-switch,
html[data-theme='dark'] body:has(.screen-shell.shell) .pill,
html[data-theme='dark'] body:has(.screen-shell.shell) .sound-button,
html[data-theme='dark'] body:has(.screen-shell.shell) .tag-button {
  color: #F7F3FF;
  background: rgba(27, 20, 43, 0.96);
  border-color: rgba(196, 181, 253, 0.16);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-voice-title {
  color: #F7F3FF;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .voice-choice-option {
  color: #F7F3FF;
  background: rgba(38, 29, 58, 0.88);
  border-color: rgba(196, 181, 253, 0.18);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.08);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .voice-choice-option:hover,
html[data-theme='dark'] body:has(.screen-shell.shell) .voice-choice-option:focus-within {
  color: #FFFFFF;
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(196, 181, 253, 0.36);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .voice-choice-option.is-selected,
html[data-theme='dark'] body:has(.screen-shell.shell) .voice-choice-option:has(input:checked) {
  color: #FFFFFF;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.28), rgba(109, 77, 232, 0.26));
  border-color: rgba(196, 181, 253, 0.52);
  box-shadow:
    inset 0 0 0 1px rgba(196, 181, 253, 0.18),
    0 18px 40px rgba(0, 0, 0, 0.26);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .voice-choice-option input {
  accent-color: #A78BFA;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-conversation-hero h2,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-conversation-topbar h2,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-control-card h3 {
  color: #F7F3FF;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-conversation-hero p,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-conversation-topbar p,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-control-card .card-subtle {
  color: #D8CCF8;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-conversation-card,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-live-transcript,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-transcript-note,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-audio-panel,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-cue-placeholder {
  color: #F7F3FF;
  background: rgba(27, 20, 43, 0.96);
  border-color: rgba(196, 181, 253, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-call-orb {
  color: #F7F3FF;
  background: rgba(38, 29, 58, 0.88);
  border-color: rgba(196, 181, 253, 0.18);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-call-orb span {
  background: #A78BFA;
  box-shadow: 0 0 0 7px rgba(167, 139, 250, 0.18);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-call-orb.is-listening span {
  background: #C4B5FD;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-call-orb.is-speaking span {
  background: #A78BFA;
  box-shadow: 0 0 0 7px rgba(167, 139, 250, 0.18);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-message {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-message--examiner,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-message--candidate {
  color: #F7F3FF;
  background: rgba(38, 29, 58, 0.92);
  border-color: rgba(196, 181, 253, 0.18);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-message--examiner span,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-message--candidate span,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-live-transcript strong {
  color: #C4B5FD;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-message p,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-live-transcript p,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-transcript-note p,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-audio-panel p,
html[data-theme='dark'] body:has(.screen-shell.shell) .speaking-cue-placeholder p {
  color: #D8CCF8;
}

html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar-icon-action {
  color: #E9D5FF;
  background: rgba(167, 139, 250, 0.14);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.22);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .input,
html[data-theme='dark'] body:has(.screen-shell.shell) .textarea,
html[data-theme='dark'] body:has(.screen-shell.shell) .target-band-select-button {
  color: #F7F3FF;
  background: rgba(16, 11, 26, 0.92);
  border-color: rgba(196, 181, 253, 0.16);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .accent-teal,
html[data-theme='dark'] body:has(.screen-shell.shell) .accent-violet,
html[data-theme='dark'] body:has(.screen-shell.shell) .accent-orange,
html[data-theme='dark'] body:has(.screen-shell.shell) .accent-gold,
html[data-theme='dark'] body:has(.screen-shell.shell) .metric-badge,
html[data-theme='dark'] body:has(.screen-shell.shell) .mode-badge,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-badge,
html[data-theme='dark'] body:has(.screen-shell.shell) .skill-badge,
html[data-theme='dark'] body:has(.screen-shell.shell) .stat-icon-wrap {
  color: #E9D5FF;
  background: rgba(167, 139, 250, 0.16);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .activity-item,
html[data-theme='dark'] body:has(.screen-shell.shell) .resource-item,
html[data-theme='dark'] body:has(.screen-shell.shell) .list-item {
  background: rgba(38, 29, 58, 0.82);
  border-color: rgba(196, 181, 253, 0.14);
}

html[data-theme='dark'] body:has(.screen-shell.shell) .study-ring {
  background:
    radial-gradient(circle closest-side, #1B142B 77%, transparent 78%),
    conic-gradient(#A78BFA var(--progress, 0%), rgba(196, 181, 253, 0.14) 0);
}

@media (max-width: 900px) {
  body:has(.screen-shell.shell),
  html[data-theme='dark'] body:has(.screen-shell.shell) {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  body:has(.screen-shell.shell) .screen-shell.shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  body:has(.screen-shell.shell) .sidebar,
  html[data-theme='dark'] body:has(.screen-shell.shell) .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  body:has(.screen-shell.shell) .workspace {
    height: auto;
    overflow: visible;
  }
}
