:root {
  --bg: #f4efe4;
  --paper: #fffaf0;
  --ink: #21252d;
  --on-light-surface: #2f2419;
  --on-warm-surface: #5f3d11;
  --muted: #686e79;
  --accent: #c65b2d;
  --accent-dark: #a6481f;
  --line: #ddd4c0;
  --shadow: 0 18px 42px rgba(88, 60, 24, 0.08);
  --gold: #f0bf62;
  --green: #1d8f3b;
  --rose: #fff0eb;
  --surface-strong: rgba(255, 250, 240, 0.88);
  --surface-soft: rgba(255, 251, 243, 0.75);
  --surface-panel: rgba(255, 250, 240, 0.98);
  --surface-input: rgba(255, 255, 255, 0.96);
  --surface-muted: rgba(255, 255, 255, 0.6);
  --modal-backdrop: rgba(35, 29, 21, 0.42);
  --page-grad-start: #f7f0e2;
  --page-grad-mid: #f2ecdf;
  --page-grad-end: #ebe4d6;
  --page-glow-left: rgba(255, 221, 170, 0.32);
  --page-glow-right: rgba(214, 123, 78, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color-scheme: light;
  background:
    radial-gradient(circle at top left, var(--page-glow-left), transparent 30%),
    radial-gradient(circle at bottom right, var(--page-glow-right), transparent 28%),
    linear-gradient(135deg, var(--page-grad-start) 0%, var(--page-grad-mid) 48%, var(--page-grad-end) 100%);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

body.policy-page {
  min-height: 100vh;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #12161d;
  --paper: #171d26;
  --ink: #eef2f8;
  --on-light-surface: #2f2419;
  --on-warm-surface: #5f3d11;
  --muted: #a8b1c0;
  --accent: #db7a45;
  --accent-dark: #f0a16e;
  --line: #2c3643;
  --shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
  --surface-strong: rgba(23, 29, 38, 0.88);
  --surface-soft: rgba(21, 27, 35, 0.78);
  --surface-panel: rgba(23, 29, 38, 0.98);
  --surface-input: rgba(20, 26, 34, 0.96);
  --surface-muted: rgba(28, 35, 46, 0.92);
  --modal-backdrop: rgba(4, 8, 14, 0.66);
  --page-grad-start: #12161d;
  --page-grad-mid: #171d26;
  --page-grad-end: #0f1319;
  --page-glow-left: rgba(219, 122, 69, 0.14);
  --page-glow-right: rgba(79, 122, 193, 0.12);
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(193, 175, 142, 0.5);
  background: var(--surface-soft);
  backdrop-filter: blur(10px);
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand-logo {
  display: block;
  width: min(360px, 30vw);
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.account-shell {
  position: relative;
  z-index: 30;
}

.account-btn {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--paper) 93%, white 7%), color-mix(in srgb, var(--paper) 84%, black 16%));
  color: var(--ink);
}

.account-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid rgba(205, 190, 160, 0.9);
  border-radius: 18px;
  background: var(--surface-panel);
  box-shadow: var(--shadow);
  z-index: 80;
}

.account-menu #authStatus {
  margin-bottom: 12px;
  word-break: break-word;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.auth-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.account-menu-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);
  gap: 10px;
}

.account-menu-actions .small-btn {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 14px 40px;
}

.policy-container {
  padding-bottom: 24px;
}

.card {
  background: var(--surface-strong);
  border: 1px solid rgba(205, 190, 160, 0.9);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

.brand-home-link {
  display: inline-block;
}

.centered,
.centered-block {
  text-align: center;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--accent-dark);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.muted {
  color: var(--muted);
}

.status-message {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.sign-in-card {
  max-width: 560px;
  margin: 60px auto 0;
  text-align: center;
}

.sign-in-logo {
  display: block;
  width: min(360px, 78%);
  margin: 0 auto 18px;
  height: auto;
}

.sign-in-card h2,
.deck-header h2,
.modal-panel h3 {
  margin: 0;
}

.policy-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 34px 34px 30px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper) 97%, white 3%), color-mix(in srgb, var(--paper) 93%, black 7%));
}

.policy-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.06;
}

.policy-meta {
  margin: 0 0 18px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.policy-intro {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.72;
}

.policy-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 6px;
}

.policy-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  background: color-mix(in srgb, var(--surface-muted) 88%, transparent);
  color: var(--ink);
  text-decoration: none;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.92rem;
}

.policy-nav a:hover,
.policy-nav a:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  color: var(--accent-dark);
}

.policy-section {
  margin-top: 28px;
}

.policy-section h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.policy-section h3 {
  margin: 18px 0 8px;
  font-size: 1.04rem;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  letter-spacing: 0.01em;
}

.policy-section p {
  margin: 0;
  line-height: 1.72;
}

.policy-section p + p {
  margin-top: 12px;
}

.policy-list {
  margin: 10px 0 0;
  padding-left: 22px;
}

.policy-list li {
  margin: 0 0 10px;
  line-height: 1.68;
}

.policy-email {
  color: var(--accent-dark);
}

.legal-footer {
  padding: 0 20px 20px;
  text-align: center;
}

.legal-link {
  color: color-mix(in srgb, var(--muted) 84%, var(--ink));
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.82rem;
  text-decoration: none;
}

.legal-link:hover,
.legal-link:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
}

.deck-home {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.deck-home-shell {
  position: relative;
  overflow: hidden;
  padding: 30px 28px 28px;
  border: 1px solid rgba(205, 190, 160, 0.92);
  border-radius: 30px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper) 95%, white 5%), color-mix(in srgb, var(--paper) 91%, black 9%));
  box-shadow:
    0 24px 48px rgba(88, 60, 24, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.deck-home-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, rgba(198, 91, 45, 0.96), rgba(240, 191, 98, 0.92), rgba(33, 37, 45, 0.92));
}

.voice-chat-home-shell {
  margin-top: 2px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.voice-chat-home-shell::before {
  display: none;
}

.voice-chat-entry-row {
  margin-bottom: 12px;
}

.voice-chat-entry-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(205, 190, 160, 0.9);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 252, 246, 0.98), rgba(246, 236, 218, 0.94));
  box-shadow: 0 14px 28px rgba(95, 71, 31, 0.08);
  text-align: left;
}

.voice-chat-entry-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 239, 226, 0.98), rgba(250, 219, 190, 0.95));
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.voice-chat-entry-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.voice-chat-entry-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.voice-chat-entry-title {
  color: var(--ink);
  font-size: 1.24rem;
  font-weight: 700;
  line-height: 1.05;
}

.voice-chat-entry-subtitle {
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.95rem;
  line-height: 1.4;
}

.deck-home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
}

.deck-home-copy {
  max-width: 32rem;
}

.deck-home-header h2 {
  margin: 0;
  font-size: clamp(2rem, 3.6vw, 2.8rem);
  line-height: 1;
}

.deck-home-intro {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
}

.deck-home #addDeckBtn {
  width: auto;
  min-width: 170px;
  padding: 14px 22px;
  border-radius: 999px;
  box-shadow: 0 16px 28px rgba(166, 72, 31, 0.18);
}

.deck-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.deck-card,
.empty-state {
  min-height: 208px;
}

.deck-card {
  position: relative;
}

.deck-card-button,
.empty-state {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(193, 173, 138, 0.8);
  border-radius: 26px;
  padding: 22px 22px 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 32%),
    radial-gradient(circle at top left, var(--deck-card-highlight, rgba(255, 255, 255, 0.98)), var(--deck-card-mid, rgba(255, 247, 233, 0.88)) 44%, var(--deck-card-base, rgba(245, 232, 205, 0.9)) 100%);
  box-shadow:
    0 18px 32px rgba(87, 62, 27, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.72) inset;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.deck-card-button:hover,
.deck-card-button:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow:
    0 24px 40px rgba(87, 62, 27, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.82) inset;
}

.deck-card-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.64);
  border: 1px solid rgba(193, 173, 138, 0.68);
  color: rgba(33, 37, 45, 0.68);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.deck-card-main {
  display: flex;
  flex: 1;
  width: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 10px 0;
}

.deck-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  margin-top: auto;
}

.deck-card-button strong {
  max-width: 86%;
  font-size: clamp(1.7rem, 2.9vw, 2.2rem);
  line-height: 1.02;
  text-wrap: pretty;
  margin: 0 auto;
  transform: translateY(-6px);
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35),
    0 5px 16px rgba(18, 22, 30, 0.3),
    0 10px 28px rgba(18, 22, 30, 0.12);
}

.deck-language-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 8px 12px;
  border: 1px solid rgba(201, 181, 144, 0.8);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.92);
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
}

.deck-manage-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 251, 243, 0.94);
  box-shadow: 0 10px 18px rgba(87, 62, 27, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.deck-manage-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.empty-state {
  justify-content: center;
  text-align: left;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(255, 252, 246, 0.94), rgba(251, 244, 229, 0.9));
  border-style: dashed;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.empty-state p {
  margin: 0;
  max-width: 22rem;
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wrap {
  flex-wrap: wrap;
}

.deck-header {
  margin-bottom: 14px;
}

.deck-title-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 0 160px;
}

.deck-header h2 {
  margin: 0;
  text-align: center;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.deck-title-row #backToDecksBtn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.deck-view-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.deck-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.bottom-actions {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(205, 190, 160, 0.7);
}

.study-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.study-controls.hidden {
  display: none;
}

.seg-toggle.hidden {
  display: none;
}

.study-view-stack.hidden {
  display: none;
}

.word-list-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.word-list-view.hidden {
  display: none;
}

.word-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.word-list-count {
  margin: 0;
  font-size: 0.98rem;
}

.word-sort-toggle .toggle-btn {
  min-width: 128px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.word-list-shell {
  border: 1px solid rgba(205, 190, 160, 0.72);
  border-radius: 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--paper) 95%, white 5%), color-mix(in srgb, var(--paper) 90%, black 10%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  overflow: hidden;
}

.word-list {
  list-style: none;
  margin: 0;
  padding: 10px;
  max-height: 560px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-list-row,
.word-list-empty {
  border: 1px solid rgba(202, 186, 156, 0.7);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}

.word-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.word-list-empty {
  padding: 28px 22px;
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
}

.word-list-entry {
  min-width: 0;
  display: flex;
  flex: 1;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.word-list-word {
  min-width: 0;
}

.word-list-word-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.word-list-word strong {
  display: block;
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.06;
}

.word-list-media {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.word-list-media-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  color: var(--muted);
}

.word-list-media-btn svg {
  width: 17px;
  height: 17px;
}

.word-list-media-btn.is-playing {
  color: var(--accent);
  border-color: rgba(198, 91, 45, 0.5);
  background: color-mix(in srgb, var(--surface-input) 72%, var(--accent) 28%);
  box-shadow: 0 10px 20px rgba(198, 91, 45, 0.16);
}

.word-list-word p {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.96rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-list-meta {
  flex-shrink: 0;
  margin-right: 10px;
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.84rem;
  white-space: nowrap;
}

.word-list-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.word-list-actions .small-btn {
  min-width: 74px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.quiz-panel {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 26px 24px 24px;
  border: 1px solid rgba(205, 190, 160, 0.78);
  border-radius: 26px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper) 93%, white 7%), rgba(255, 255, 255, 0.08) 36%),
    linear-gradient(145deg, color-mix(in srgb, var(--paper) 98%, white 2%), color-mix(in srgb, var(--paper) 91%, black 9%));
  box-shadow: 0 20px 40px rgba(95, 71, 31, 0.08);
}

.quiz-panel-head {
  text-align: center;
  margin-bottom: 20px;
}

.quiz-panel-head h3 {
  margin: 0 0 8px;
  font-size: clamp(2.1rem, 4vw, 2.8rem);
}

.quiz-panel-head h3.quiz-cloze-text {
  max-width: 18ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.25;
  font-size: clamp(1.6rem, 3.1vw, 2.15rem);
}

.quiz-panel-head p {
  margin: 0 auto;
  max-width: 34rem;
  line-height: 1.5;
}

.quiz-cloze-blank {
  display: inline-block;
  min-width: var(--cloze-blank-width, 4.5ch);
  padding: 0 0.18em 0.1em;
  border-bottom: 3px solid #111827;
  color: transparent;
  user-select: none;
  text-align: center;
}

.quiz-response-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-response-wrap.hidden {
  display: none;
}

.quiz-response-input {
  min-height: 120px;
  resize: vertical;
}

.quiz-action-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.quiz-secondary-btn {
  min-width: 128px;
}

.quiz-submit-btn {
  width: auto;
  min-width: 180px;
}

.quiz-choice-wrap {
  display: block;
}

.quiz-choice-wrap.hidden {
  display: none;
}

.quiz-choice-options {
  display: grid;
  gap: 12px;
}

.quiz-choice-btn {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(205, 190, 160, 0.8);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: 0 12px 22px rgba(95, 71, 31, 0.06);
}

.quiz-choice-btn:disabled {
  opacity: 1;
}

.quiz-choice-letter {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(198, 91, 45, 0.12);
  color: var(--accent-dark);
  font-weight: 700;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.quiz-choice-text {
  min-width: 0;
  line-height: 1.4;
}

.quiz-choice-btn.is-correct {
  border-color: rgba(29, 143, 59, 0.5);
  background: rgba(229, 247, 234, 0.96);
  animation: quizPulseCorrect 0.55s ease;
}

.quiz-choice-btn.is-incorrect {
  border-color: rgba(161, 36, 36, 0.45);
  background: rgba(255, 240, 237, 0.96);
  animation: quizPulseWrong 0.55s ease;
}

.quiz-choice-loading {
  padding: 18px;
  border: 1px dashed rgba(205, 190, 160, 0.8);
  border-radius: 18px;
  text-align: center;
}

#quizStatus {
  margin-top: 14px;
}

.quiz-result-meter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.quiz-result-meter.is-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quiz-result-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(205, 190, 160, 0.78);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.quiz-result-pill.is-selected {
  color: var(--ink);
  box-shadow: 0 12px 24px rgba(88, 60, 24, 0.12);
}

.quiz-result-pill[data-review-pill="noIdea"].is-selected {
  background: #ffe6e1;
  border-color: #edb2a5;
}

.quiz-result-pill[data-review-pill="forgot"].is-selected {
  background: rgba(252, 228, 222, 0.98);
  border-color: rgba(205, 92, 68, 0.55);
  color: #a63827;
}

.quiz-result-pill[data-review-pill="remembered"].is-selected {
  background: rgba(229, 247, 234, 0.98);
  border-color: rgba(86, 166, 103, 0.52);
  color: #1d8f3b;
}

.quiz-result-pill[data-review-pill="mastered"].is-selected {
  background: #e5f7ea;
  border-color: #9bccaa;
}

.quiz-result-pill.is-animated {
  animation: quizJudgmentPulse 0.7s ease;
}

.quiz-feedback-text {
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.5;
}

.quiz-answer-reveal {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(205, 190, 160, 0.8);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
}

.quiz-answer-reveal strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-dark);
}

.quiz-answer-reveal-block + .quiz-answer-reveal-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(205, 190, 160, 0.45);
}

.voice-chat-panel {
  position: relative;
  overflow: visible;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.voice-chat-panel::before {
  display: none;
}

.voice-chat-head {
  position: relative;
  z-index: 1;
  text-align: left;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.voice-chat-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
}

.voice-chat-title-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.voice-chat-head h3 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 0.9;
}

.voice-chat-title-subtitle {
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.voice-chat-head p {
  margin: 0;
  max-width: 44rem;
  line-height: 1.45;
}

.voice-chat-head #voiceChatIntro.hidden {
  display: none;
}

.voice-chat-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.voice-chat-setting-card {
  height: 100%;
  padding: 18px 18px 16px;
  border: 1px solid rgba(220, 187, 147, 0.78);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.97), rgba(255, 252, 247, 0.97)) padding-box,
    linear-gradient(145deg, rgba(246, 200, 141, 0.3), rgba(200, 108, 47, 0.16)) border-box;
  box-shadow: 0 12px 24px rgba(103, 77, 43, 0.06);
}

.voice-chat-setting-card select,
.voice-chat-setting-card input {
  min-height: 56px;
  font-size: 1.06rem;
}

.voice-chat-setting-card .preference-label {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 0.94rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.voice-chat-setting-card .preference-help {
  margin-top: 10px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.voice-chat-topic-card {
  grid-column: 1 / -1;
}

#voiceChatSetupSection,
#voiceChatLiveSection {
  position: relative;
  z-index: 1;
}

.voice-chat-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.voice-chat-actions .primary-btn,
.voice-chat-actions .ghost-btn {
  min-width: 170px;
}

.voice-chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.voice-chat-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.voice-chat-action-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.voice-chat-actions .primary-btn {
  min-height: 58px;
  min-width: 240px;
  padding-inline: 32px;
  box-shadow: 0 18px 34px rgba(198, 91, 45, 0.2);
}

.voice-chat-actions .ghost-btn {
  min-height: 54px;
  min-width: 220px;
  padding-inline: 28px;
  background: rgba(255, 250, 244, 0.96);
  color: var(--on-warm-surface);
}

#voiceChatStatus {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 248, 239, 0.92);
  border: 1px solid rgba(221, 188, 147, 0.72);
  color: var(--on-light-surface);
  text-align: center;
}

.voice-chat-inline-status {
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.92rem;
  line-height: 1.35;
  min-height: 1.35em;
}

.voice-chat-inline-status:not(.hidden) {
  display: block;
}

.voice-chat-inline-status.is-thinking::after {
  content: "";
  display: inline-block;
  width: 1.1em;
  margin-left: 0.12em;
  text-align: left;
  vertical-align: baseline;
  animation: voiceChatDots 1.1s steps(4, end) infinite;
}

.voice-chat-transcript-card,
.voice-chat-evaluation-card {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(205, 190, 160, 0.78);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255, 252, 246, 0.96), rgba(244, 234, 216, 0.92));
  box-shadow: 0 12px 24px rgba(104, 78, 45, 0.06);
}

.voice-chat-insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.voice-chat-insights > *:only-child {
  grid-column: 1 / -1;
}

.voice-chat-insight-card {
  padding: 14px;
  border: 1px solid rgba(205, 190, 160, 0.78);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255, 252, 246, 0.96), rgba(244, 234, 216, 0.92));
  box-shadow: 0 12px 24px rgba(104, 78, 45, 0.06);
}

.voice-chat-insight-list {
  min-height: 90px;
}

.voice-chat-simple-list {
  margin: 0;
  padding-left: 20px;
}

.voice-chat-simple-list li {
  margin: 0 0 8px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.45;
}

.voice-chat-word-list {
  min-height: 90px;
}

.voice-chat-word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.voice-chat-word-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(198, 91, 45, 0.24);
  background: rgba(255, 244, 234, 0.96);
  color: var(--accent-dark);
  font-weight: 600;
}

.voice-chat-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.voice-chat-section-head h4 {
  margin: 0;
  font-size: 1.32rem;
}

.voice-chat-transcript {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 410px;
  max-height: 410px;
  overflow: auto;
  overflow-anchor: none;
  padding: 0;
  border-radius: 18px;
  scrollbar-gutter: stable both-edges;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0)),
    rgba(255, 251, 244, 0.72);
}

.voice-chat-empty {
  margin: 0;
  padding: 18px 12px;
}

.voice-chat-transcript-spacer {
  flex: 0 0 auto;
  pointer-events: none;
}

.voice-chat-line {
  width: min(92%, 820px);
  padding: 14px 16px 13px;
  border-radius: 22px;
  border: 1px solid rgba(205, 190, 160, 0.6);
  background: color-mix(in srgb, var(--surface-input) 92%, transparent);
  box-shadow: 0 8px 18px rgba(110, 84, 48, 0.06);
}

.voice-chat-line-user {
  align-self: flex-end;
  background: rgba(231, 242, 255, 0.92);
  border-color: rgba(170, 201, 235, 0.8);
  border-bottom-right-radius: 10px;
}

.voice-chat-line-assistant {
  align-self: flex-start;
  background: rgba(255, 244, 234, 0.96);
  border-color: rgba(230, 180, 150, 0.72);
  border-bottom-left-radius: 10px;
}

.voice-chat-line.is-live {
  box-shadow: 0 0 0 1px rgba(198, 91, 45, 0.16), 0 10px 20px rgba(198, 91, 45, 0.06);
}

.voice-chat-line-role {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.voice-chat-line-text,
.voice-chat-eval-block p,
.voice-chat-eval-summary p {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.48;
  font-size: 0.94rem;
}

.voice-chat-line-text del {
  color: rgba(123, 109, 92, 0.86);
  text-decoration-thickness: 2px;
}

.voice-chat-line-text ins {
  color: #b42318;
  font-weight: 700;
  text-decoration: none;
  margin-left: 6px;
}

.voice-chat-new-word {
  color: #1d7f47;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}

.voice-chat-transcript-footer {
  display: flex;
  justify-content: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(205, 190, 160, 0.52);
}

.voice-chat-turn-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(205, 190, 160, 0.72);
  background: rgba(255, 250, 244, 0.92);
  color: #5c554c;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.voice-chat-turn-indicator::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(118, 118, 118, 0.72);
}

.voice-chat-turn-indicator.is-user {
  color: #0f3b63;
  border-color: rgba(132, 177, 218, 0.85);
  background: rgba(231, 242, 255, 0.96);
}

.voice-chat-turn-indicator.is-user::before {
  background: #0f6cbd;
}

.voice-chat-turn-indicator.is-partner {
  color: #8a4217;
  border-color: rgba(222, 165, 122, 0.84);
  background: rgba(255, 241, 229, 0.96);
}

.voice-chat-turn-indicator.is-partner::before {
  background: #c65b2d;
}

.voice-chat-eval-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-chat-eval-chip {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(198, 91, 45, 0.34);
  background: rgba(255, 240, 232, 0.96);
  color: var(--accent-dark);
  font-weight: 700;
}

.voice-chat-eval-block + .voice-chat-eval-block {
  margin-top: 14px;
}

.voice-chat-eval-block h5 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.voice-chat-eval-block ul {
  margin: 0;
  padding-left: 18px;
}

.voice-chat-eval-block li {
  margin: 0 0 6px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.45;
}

.mode-trigger {
  width: auto;
  min-width: 200px;
  padding: 12px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--paper) 93%, white 7%), color-mix(in srgb, var(--paper) 91%, black 9%));
  text-align: left;
}

.mode-trigger-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.seg-toggle {
  display: inline-flex;
  gap: 8px;
}

.stress-index-control {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.stepper-btn {
  width: 64px;
  min-width: 64px;
  margin-top: 8px;
  padding: 12px 0;
  border-radius: 14px;
  font-size: 1rem;
}

.stress-index-control input {
  margin-top: 8px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

label {
  display: block;
  margin-bottom: 14px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.word-modal-panel label {
  margin-bottom: 12px;
  font-size: 1.03rem;
}

.field-block {
  margin-bottom: 16px;
}

.word-modal-panel .field-block {
  margin-bottom: 12px;
}

.word-modal-panel label input,
.word-modal-panel label textarea,
.word-modal-panel label select {
  margin-top: 6px;
}

.word-modal-panel .stepper-btn,
.word-modal-panel .stress-index-control input {
  margin-top: 6px;
}

.word-modal-panel .field-label-row {
  margin-bottom: 6px;
}

.word-modal-panel .field-assist-status {
  margin-top: 4px;
  min-height: 1em;
  font-size: 0.98rem;
}

.word-modal-panel textarea {
  min-height: 88px;
}

.word-modal-panel input,
.word-modal-panel select,
.word-modal-panel textarea,
.word-modal-panel button {
  font-size: 1.03rem;
}

.deck-color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.deck-color-swatch {
  width: 42px;
  min-width: 42px;
  height: 42px;
  margin-top: 0;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(201, 181, 144, 0.7);
  box-shadow:
    0 6px 12px rgba(87, 62, 27, 0.08),
    0 2px 0 rgba(255, 255, 255, 0.82) inset;
  background:
    radial-gradient(circle at top left, var(--deck-swatch-highlight, rgba(255, 255, 255, 0.98)), var(--deck-swatch-mid, rgba(255, 247, 233, 0.88)) 42%, var(--deck-swatch-base, rgba(245, 232, 205, 0.9)) 100%);
}

.deck-color-swatch:hover,
.deck-color-swatch:focus-visible {
  transform: translateY(-2px);
}

.deck-color-swatch.is-selected {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px rgba(198, 91, 45, 0.18),
    0 8px 14px rgba(87, 62, 27, 0.12),
    0 2px 0 rgba(255, 255, 255, 0.82) inset;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-ai-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  margin-top: 0;
  padding: 0;
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff4ea;
  color: var(--on-warm-surface);
}

.field-ai-btn--text {
  width: auto;
  min-width: 92px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.95rem;
}

.field-ai-btn.is-loading {
  color: transparent;
  position: relative;
}

.field-ai-btn.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(198, 91, 45, 0.28);
  border-top-color: var(--accent);
  border-radius: 999px;
  position: absolute;
  inset: 0;
  margin: auto;
  animation: spin 0.8s linear infinite;
}

.field-assist-status {
  display: block;
  margin-top: 8px;
  min-height: 1.2em;
  font-size: 0.92rem;
}

input,
select,
textarea,
button {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-input);
  color: var(--ink);
}

textarea {
  min-height: 108px;
  resize: vertical;
}

button {
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary-btn {
  background: linear-gradient(135deg, #cf6334, #b84d21);
  color: #fffaf3;
  border-color: #b84d21;
}

.ghost-btn {
  background: color-mix(in srgb, var(--surface-input) 88%, transparent);
}

.danger-btn {
  background: #fff0ed;
  color: #992f16;
  border-color: #e6ab9a;
}

.soft-btn {
  background: color-mix(in srgb, var(--surface-input) 82%, var(--accent) 18%);
}

.small-btn,
.toggle-btn {
  width: auto;
  margin-top: 0;
}

.toggle-btn.active {
  background: #fff0e8;
  border-color: var(--accent);
  color: var(--on-warm-surface);
}

.flashcard {
  border: 1px solid rgba(206, 191, 165, 0.9);
  border-radius: 24px;
  background: color-mix(in srgb, var(--paper) 96%, white 4%);
  width: min(100%, 520px);
  min-height: 390px;
  margin: 0 auto 12px;
  perspective: 1000px;
  box-shadow: 0 18px 36px rgba(95, 71, 31, 0.08);
}

.flashcard.interactive {
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  min-height: 390px;
  transform-style: preserve-3d;
  transition: transform 240ms ease;
}

.flashcard.no-flip-transition .flashcard-inner {
  transition: none;
}

.flashcard.is-flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashface {
  position: absolute;
  inset: 0;
  padding: 28px;
  border-radius: 22px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.flashface-front {
  background: linear-gradient(145deg, color-mix(in srgb, var(--paper) 97%, white 3%) 0%, color-mix(in srgb, var(--paper) 93%, black 7%) 100%);
}

.flashface-front.has-front-actions {
  padding-bottom: 96px;
}

.flashface-back {
  background: linear-gradient(145deg, color-mix(in srgb, var(--paper) 97%, white 3%) 0%, color-mix(in srgb, var(--paper) 90%, black 10%) 100%);
  transform: rotateY(180deg);
}

.flashface-back > * + * {
  margin-top: 14px;
}

#wordText {
  width: 100%;
  max-width: 100%;
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#definitionText {
  width: 100%;
  max-width: 100%;
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 1.95rem);
  line-height: 1.18;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#exampleText {
  margin-top: 0;
  font-size: 1.08rem;
  color: var(--ink);
  text-align: left;
  line-height: 1.45;
}

.card-details-definition {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.45;
  text-align: left;
}

.card-details-toggle {
  margin-top: 0;
  color: var(--muted);
  background: transparent;
  border-color: rgba(206, 191, 165, 0.9);
}

.card-details-toggle:hover,
.card-details-toggle:focus-visible {
  color: var(--accent);
  background: color-mix(in srgb, var(--surface-input) 88%, transparent);
}

.card-details-modal-panel {
  width: min(640px, 100%);
}

.card-details-modal-panel .centered-block {
  margin-bottom: 18px;
}

.card-details-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.pairings-block {
  width: 100%;
  margin-top: 14px;
}

.pairings-label {
  margin: 0 0 10px;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pairings-list {
  display: block;
  margin: 0;
  padding-left: 22px;
  list-style: disc;
}

.pairings-list li {
  margin: 0 0 8px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.92rem;
  line-height: 1.45;
}

.flashcard-audio {
  width: min(100%, 280px);
  margin-top: 14px;
}

.stressed-char {
  color: var(--green);
  font-weight: 700;
}

.flashcard-lookup-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 16px;
}

.flashcard-lookup-row.hidden {
  display: none;
}

.flashcard-lookup-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.flashcard-lookup-btn img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.flashcard-lookup-btn:hover,
.flashcard-lookup-btn:focus-visible {
  border-color: transparent;
  background: transparent;
  transform: translateY(-1px);
}

.flashcard-lookup-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.rating-row {
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ratingBtn {
  width: auto;
  min-width: 128px;
  margin-top: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.ratingBtn.no-idea {
  background: #ffe6e1;
  border-color: #edb2a5;
  color: var(--on-light-surface);
}

.ratingBtn.forgot {
  background: #fff3dc;
  border-color: #e9cb92;
  color: var(--on-light-surface);
}

.ratingBtn.remembered {
  background: #e7f2ff;
  border-color: #aac9eb;
  color: var(--on-light-surface);
}

.ratingBtn.mastered {
  background: #e5f7ea;
  border-color: #9bccaa;
  color: var(--on-light-surface);
}

.flashcard-undo-row {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.flashcard-undo-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 999px;
}

.flashcard-undo-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.flashcard-front-actions {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 0;
  z-index: 2;
}

.flashcard.is-flipped .flashcard-front-actions {
  visibility: hidden;
  pointer-events: none;
}

.flashcard-video-btn,
.flashcard-audio-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  min-width: 46px;
  height: 46px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  border-color: rgba(206, 191, 165, 0.9);
}

.flashcard-video-btn {
  right: calc(100% + 10px);
}

.flashcard-audio-btn {
  left: calc(100% + 10px);
}

.flashcard-front-actions.actions-only .flashcard-video-btn,
.flashcard-front-actions.actions-only .flashcard-audio-btn {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  transform: none;
}

.flashcard-audio-btn.is-playing {
  color: var(--accent);
  border-color: rgba(198, 91, 45, 0.5);
  background: color-mix(in srgb, var(--surface-input) 72%, var(--accent) 28%);
  box-shadow: 0 10px 20px rgba(198, 91, 45, 0.16);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--modal-backdrop);
  backdrop-filter: blur(8px);
  z-index: 120;
  overflow-y: auto;
}

.modal.hidden {
  display: none;
}

.modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  overflow-x: hidden;
}

.deck-modal-panel {
  width: min(580px, 100%);
}

.picker-panel {
  width: min(720px, 100%);
}

.modal-close-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: auto;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.stacked-actions {
  flex-direction: column;
  align-items: stretch;
}

#definitionLanguageModal .centered-block .eyebrow {
  font-size: 0.84rem;
  margin-bottom: 10px;
}

#definitionLanguageModal .centered-block h3 {
  font-size: clamp(1.6rem, 2vw, 1.95rem);
  line-height: 1.15;
}

#definitionLanguageModal .centered-block .muted {
  font-size: 1.02rem;
  line-height: 1.55;
}

#definitionLanguageModal .modal-actions {
  gap: 12px;
}

#definitionLanguageModal .primary-btn,
#definitionLanguageModal .ghost-btn {
  font-size: 1.04rem;
  padding: 14px 18px;
}

.definition-picker-options {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.definition-picker-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid rgba(205, 190, 160, 0.75);
  border-radius: 16px;
  background: rgba(255, 251, 245, 0.92);
  color: var(--on-light-surface);
}

.definition-picker-option input {
  justify-self: end;
  margin-top: 3px;
  margin-left: 16px;
  transform: scale(1.2);
  transform-origin: top right;
}

.definition-picker-option span {
  display: block;
  min-width: 0;
  line-height: 1.45;
  text-align: left;
}

.delete-word-row {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(205, 190, 160, 0.6);
}

.picker-header {
  margin-bottom: 16px;
}

.picker-options {
  display: grid;
  gap: 12px;
}

.picker-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.picker-option p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.picker-option.active {
  border-color: var(--accent);
  background: #fff4ea;
  color: var(--on-warm-surface);
}

.picker-option-check {
  color: var(--accent-dark);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.word-input-wrap {
  position: relative;
}

#newWord {
  position: relative;
  z-index: 2;
  background: transparent;
  color: transparent;
  caret-color: var(--ink);
}

#newWord::placeholder {
  color: var(--muted);
}

.word-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--ink);
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  will-change: transform;
}

.deck-language-card {
  margin-bottom: 18px;
}

.deck-language-card select {
  min-height: 54px;
  font-size: 1rem;
}

.voice-note-box {
  padding: 18px;
  border: 1px dashed rgba(198, 91, 45, 0.35);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
}

.voice-note-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.voice-note-head h4 {
  margin: 0;
}

.voice-note-head p {
  margin: 4px 0 0;
}

.voice-note-timer {
  padding: 8px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-input) 90%, transparent);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.9rem;
}

.voice-note-timer-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.recording-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d63a2f;
  box-shadow: 0 0 0 0 rgba(214, 58, 47, 0.45);
  animation: recordingPulse 1s ease-in-out infinite;
}

.voice-note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 10px;
}

.voice-note-status {
  margin: 0;
}

#voiceNotePreview {
  width: 100%;
  margin-top: 12px;
}

.profile-plan-note {
  margin: 2px 0 0;
}

.auth-usage {
  margin-top: 10px;
}

.auth-usage-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-usage-summary--percent {
  margin-top: 4px;
  font-size: 0.78rem;
}

.auth-usage-summary span:last-child {
  color: var(--ink);
  font-weight: 700;
}

.auth-usage-summary--percent span:last-child {
  color: var(--muted);
  font-weight: 400;
}

.auth-usage-bar {
  margin-top: 6px;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-input) 80%, transparent);
  overflow: hidden;
}

.auth-usage-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b84f26, #e18a48);
  transition: width 180ms ease;
}

.auth-usage-fill--voice {
  background: linear-gradient(90deg, #c96134, #efad67);
}

.preferences-header {
  margin-bottom: 18px;
}

.preferences-header h3 {
  margin: 0 0 8px;
}

.preference-card {
  padding: 16px;
  border: 1px solid rgba(205, 190, 160, 0.72);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  margin-bottom: 14px;
}

.preference-label {
  display: block;
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--ink);
}

.preference-help {
  margin: 0 0 10px;
}

.preference-card select {
  min-height: 54px;
  font-size: 1rem;
}

.preference-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  cursor: pointer;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-switch-track {
  position: relative;
  width: 58px;
  height: 32px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 75%, transparent);
  transition: background 160ms ease;
}

.theme-switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease;
}

.theme-switch input:checked + .theme-switch-track {
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.theme-switch input:checked + .theme-switch-track .theme-switch-thumb {
  transform: translateX(26px);
}

.theme-switch-label {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.94rem;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes voiceChatDots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

@keyframes quizJudgmentPulse {
  0% {
    transform: scale(0.95);
  }
  55% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes quizPulseCorrect {
  0% {
    transform: scale(0.98);
  }
  55% {
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes quizPulseWrong {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  75% {
    transform: translateX(-2px);
  }
  100% {
    transform: translateX(0);
  }
}

@media (max-width: 760px) {
  #flashcardSection.hidden {
    display: none;
  }

  #flashcardSection:not(.hidden) {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 118px);
    padding-bottom: 0;
  }

  .voice-note-head,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal {
    align-items: flex-start;
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100dvh - 20px);
    margin: 0 auto;
  }

  .word-modal-panel {
    width: min(100%, 620px);
  }

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

  .preference-toggle-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .theme-switch {
    width: 100%;
    justify-content: space-between;
  }

  .field-label-row {
    align-items: center;
  }

  .word-modal-panel .field-block .field-label-row {
    margin-bottom: 2px;
  }

  .word-modal-panel .field-block textarea {
    margin-top: 0;
  }

  .container {
    padding: 6px 2px 16px;
  }

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

  .card {
    padding: 8px;
    border-radius: 16px;
  }

  .topbar {
    padding: 8px 10px;
    align-items: center;
  }

  .brand-block p {
    font-size: 0.9rem;
    max-width: 18rem;
  }

  .brand-logo {
    width: min(300px, 68vw);
  }

  .deck-home-shell {
    padding: 14px 8px 12px;
    border-radius: 20px;
  }

  .voice-chat-home-shell {
    margin-top: 0;
  }

  .voice-chat-entry-btn {
    padding: 14px 14px;
    gap: 12px;
    border-radius: 18px;
  }

  .voice-chat-entry-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .voice-chat-entry-title {
    font-size: 1.12rem;
  }

  .voice-chat-entry-subtitle {
    font-size: 0.9rem;
  }

  .deck-home-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .deck-home-header h2 {
    font-size: 2rem;
  }

  .deck-home-intro {
    font-size: 0.94rem;
  }

  .deck-home #addDeckBtn {
    width: 100%;
  }

  .voice-chat-panel {
    padding: 0;
    border-radius: 0;
  }

  .voice-chat-head {
    padding: 0;
    border-radius: 0;
  }

  .voice-chat-title-row {
    gap: 8px;
  }

  .voice-chat-head h3 {
    font-size: clamp(1.75rem, 7vw, 2.15rem);
  }

  .voice-chat-title-subtitle {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
  }

  .voice-chat-settings {
    grid-template-columns: 1fr;
  }

  .voice-chat-insights {
    grid-template-columns: 1fr;
  }

  .voice-chat-actions .primary-btn,
  .voice-chat-actions .ghost-btn {
    width: 100%;
  }

  .voice-chat-section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .voice-chat-line {
    width: min(96%, 100%);
  }

  .voice-chat-transcript {
    height: 350px;
    max-height: 350px;
  }

  .voice-chat-line-text,
  .voice-chat-eval-block p,
  .voice-chat-eval-summary p {
    font-size: 0.89rem;
    line-height: 1.42;
  }

  .account-btn {
    width: 40px;
    height: 40px;
  }

  .deck-header {
    margin-bottom: 8px;
  }

  .deck-title-row #backToDecksBtn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 9px 14px;
  }

  .deck-view-toggle {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .deck-title-row {
    min-height: 44px;
    padding: 0 68px;
  }

  .deck-title-row h2 {
    font-size: 1.8rem;
    line-height: 1;
    text-align: center;
  }

  .deck-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .deck-manage-btn {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .bottom-actions {
    margin-top: auto;
    padding-top: 14px;
    padding-bottom: 10px;
  }

  .study-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .word-list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .word-sort-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .word-list {
    max-height: none;
    padding: 8px;
  }

  .word-list-row,
  .word-list-entry {
    flex-direction: column;
    align-items: stretch;
  }

  .word-list-word-title {
    gap: 10px;
  }

  .word-list-row {
    padding: 16px;
    gap: 14px;
  }

  .word-list-meta {
    white-space: normal;
  }

  .word-list-actions {
    justify-content: stretch;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
  }

  .word-list-actions .small-btn {
    width: 100%;
    min-width: 0;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 0.98rem;
  }

  .word-list-media-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  .word-sort-toggle .toggle-btn {
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 0.98rem;
  }

  .quiz-panel {
    padding: 20px 16px 18px;
    border-radius: 22px;
  }

  .quiz-submit-btn {
    width: 100%;
    align-self: stretch;
  }

  .quiz-result-meter {
    grid-template-columns: 1fr 1fr;
  }

  .quiz-choice-btn {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
  }

  .mode-trigger {
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    border-radius: 16px;
  }

  .seg-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .seg-toggle .toggle-btn,
  .deck-actions .small-btn,
  .voice-note-actions .small-btn {
    width: 100%;
  }

  .voice-note-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
  }

  .flashcard,
  .flashcard-inner {
    min-height: 250px;
  }

  .flashface {
    padding: 16px;
  }

  .flashface-front.has-front-actions {
    padding-bottom: 82px;
  }

  .flashcard-front-actions {
    bottom: 16px;
  }

  #wordText {
    font-size: clamp(1.8rem, 9vw, 2.3rem);
  }

  #definitionText {
    font-size: clamp(1.18rem, 5.5vw, 1.5rem);
  }

  #exampleText,
  .flashcard-audio {
    font-size: 0.96rem;
  }

  .flashcard-lookup-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 4px;
  }

  .flashcard-lookup-btn img {
    width: 28px;
    height: 28px;
  }

  .rating-row {
    gap: 8px;
  }

  .ratingBtn {
    min-width: 0;
    flex: 1 1 calc(50% - 8px);
    padding: 9px 10px;
  }

  .ratingBtn.no-idea {
    order: 1;
  }

  .ratingBtn.remembered {
    order: 2;
  }

  .ratingBtn.forgot {
    order: 3;
  }

  .ratingBtn.mastered {
    order: 4;
  }
}

@keyframes recordingPulse {
  0% {
    opacity: 0.9;
    box-shadow: 0 0 0 0 rgba(214, 58, 47, 0.45);
  }
  70% {
    opacity: 1;
    box-shadow: 0 0 0 8px rgba(214, 58, 47, 0);
  }
  100% {
    opacity: 0.9;
    box-shadow: 0 0 0 0 rgba(214, 58, 47, 0);
  }
}
