/* ==========================================================================
   mimiCo — Production Swiss-Minimalist CSS
   Author & Copyright: Ольга Хилтунен (Olga Hiltunen), Olga.Hiltunen@gmail.com
   © 2026 Olga Hiltunen. All rights reserved. Worldwide.
   Zero Framework Bloat — Pure Modern CSS (Variables, Grid, Flex, dvh, safe-areas)
   ========================================================================== */

:root {
  --base-font-size: 17px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Nordic Night Blue Mode */
  --bg-main: #071326;
  --bg-header: rgba(10, 25, 47, 0.96);
  --bg-card: #0f213e;
  --bg-card-hover: #162d54;
  --bg-subtle: #0b1930;
  --bg-input: #081528;
  --border: #1e3a6e;
  --border-focus: #0284c7;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-gradient: linear-gradient(135deg, #0052b4, #0284c7);
  --accent: #38bdf8;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --text: #f8fafc;
  --text-muted: #bae6fd;
  --text-dim: #7dd3fc;
  --modal-bg: #0f213e;
  --box-shadow: 0 10px 30px rgba(0, 20, 60, 0.45);
  --brand-glow: rgba(2, 132, 199, 0.35);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --touch-target: 44px;
}

[data-theme="light"], [data-mode="light"] {
  --bg-main: #f0f7ff;
  --bg-header: rgba(255, 255, 255, 0.98);
  --bg-card: #ffffff;
  --bg-card-hover: #f4f9ff;
  --bg-subtle: #e6f2ff;
  --bg-input: #ffffff;
  --border: #bfdbfe;
  --border-focus: #0052b4;
  --primary: #0052b4;
  --primary-hover: #003580;
  --primary-gradient: linear-gradient(135deg, #003580, #0052b4);
  --accent: #0284c7;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --text: #061c3d;
  --text-muted: #1e3a6e;
  --text-dim: #3b5998;
  --modal-bg: #ffffff;
  --box-shadow: 0 8px 24px rgba(0, 53, 128, 0.08);
  --brand-glow: rgba(0, 82, 180, 0.2);
}

/* Reset & Ergonomics */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--base-font-size);
  background-color: var(--bg-main);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: env(safe-area-inset-bottom);
}

[data-theme="light"] body {
  color: #000000 !important;
}

/* Base Accessibility & Focus Rings */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

/* App Shell Container */
.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  margin: 0 -16px 18px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #ffffff;
  box-shadow: 0 2px 8px var(--brand-glow);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--accent);
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.network-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  white-space: nowrap;
}

.network-status-pill .net-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.network-status-pill.offline {
  border-color: var(--warning);
  background: var(--warning-bg);
  color: var(--text);
}

.network-status-pill.offline .net-dot {
  background: var(--warning);
}

@media (max-width: 480px) {
  .network-status-pill #network-status-label {
    font-size: 0.7rem;
  }
}

.header-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 11px;
  border-radius: 18px;
  border: 1.5px solid rgba(0, 82, 180, 0.45);
  background: linear-gradient(135deg, rgba(0, 82, 180, 0.12), rgba(2, 132, 199, 0.08));
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.header-install-btn:hover {
  background: linear-gradient(135deg, rgba(0, 82, 180, 0.22), rgba(2, 132, 199, 0.18));
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-install-device {
  width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1.5px solid rgba(0, 82, 180, 0.45);
  background: linear-gradient(135deg, rgba(0, 82, 180, 0.10), rgba(2, 132, 199, 0.08));
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-install-device:hover {
  background: linear-gradient(135deg, rgba(0, 82, 180, 0.20), rgba(2, 132, 199, 0.16));
  border-color: var(--primary);
  transform: translateY(-1px);
}

@media (max-width: 400px) {
  .header-install-btn .install-btn-label {
    display: none;
  }
  .header-install-btn {
    padding: 0 9px;
  }
}

/* Font Size Controls Group */
.font-size-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-subtle);
  height: 38px;
  flex-shrink: 0;
}

.font-btn {
  border: none !important;
  border-radius: 0 !important;
  padding: 0 10px !important;
  height: 100% !important;
  font-weight: 700;
  font-size: 0.85rem;
  background: transparent !important;
  color: var(--text) !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.font-btn:hover {
  background: var(--bg-card-hover) !important;
}

.font-btn:first-child {
  border-right: 1px solid var(--border) !important;
}

/* Entitlement Meter Badge */
.entitlement-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  height: 38px;
  flex-shrink: 0;
  white-space: nowrap;
}

.entitlement-badge:hover {
  border-color: var(--primary);
  background-color: var(--bg-card);
}

.entitlement-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
  flex-shrink: 0;
}

.entitlement-dot.low {
  background-color: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 18px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

/* Header Responsive Breakpoints to eliminate overlap */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    margin: 0 -12px 14px;
  }

  .brand-wrapper {
    width: 100%;
    justify-content: space-between;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-actions .btn,
  .entitlement-badge,
  .font-size-group {
    flex-shrink: 0;
    height: 36px;
    font-size: 0.82rem;
  }
}

[data-theme="light"] .tab-btn {
  color: #1e293b;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--brand-glow);
}

/* Cards & Sections */
.view-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.view-panel.active {
  display: flex;
}

.ui-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

[data-theme="light"] .ui-card {
  background-color: #ffffff;
  color: #000000;
  border-color: #cbd5e1;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Centered Microphone Zone */
.mic-centered-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  gap: 12px;
  margin: 6px 0;
}

[data-theme="light"] .mic-centered-zone {
  background: #ffffff;
  border-color: #cbd5e1;
}

.btn-mic-large {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 24px var(--brand-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: #ffffff;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-mic-large:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 30px var(--brand-glow);
}

.btn-mic-large:active {
  transform: scale(0.96);
}

.btn-mic-large.recording {
  background: #ef4444 !important;
  border-color: #fca5a5 !important;
  box-shadow: 0 0 0 12px rgba(239, 68, 68, 0.25) !important;
  animation: pulse-recording 1.4s infinite;
}

.mic-icon-large {
  font-size: 2.2rem;
  line-height: 1;
}

.mic-btn-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mic-status-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

[data-theme="light"] .mic-status-text {
  color: #1e293b;
}

/* Input & Textarea */
.speech-textarea {
  width: 100%;
  min-height: 120px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  color: var(--text);
  transition: border-color 0.2s ease;
}

[data-theme="light"] .speech-textarea {
  background-color: #ffffff;
  color: #000000 !important;
  border-color: #cbd5e1;
}

.speech-textarea:focus {
  border-color: var(--border-focus);
}

.word-count-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.word-badge {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.word-badge.warning {
  color: var(--warning);
  border-color: var(--warning);
}

.word-badge.exceeded {
  color: var(--danger);
  border-color: var(--danger);
}

/* Real-Time Live Translation Card */
.live-translation-card {
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.08);
  transition: all 0.25s ease;
}

[data-theme="light"] .live-translation-card {
  background: #f0fdf4;
  border-color: #86efac;
}

.live-translation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.live-translation-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

[data-theme="light"] .live-translation-badge {
  color: #15803d;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.live-speak-btn {
  min-height: 32px !important;
  padding: 2px 10px !important;
  font-size: 0.8rem !important;
}

.live-translation-content {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  min-height: 28px;
  word-break: break-word;
}

[data-theme="light"] .live-translation-content {
  color: #0f172a;
}

.live-translation-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.9rem;
}

/* Audio Playing Toggle State */
.btn-playing {
  background-color: var(--danger-bg) !important;
  color: var(--danger) !important;
  border-color: var(--danger) !important;
  animation: pulse-speaking 1.2s infinite ease-in-out;
}

@keyframes pulse-speaking {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Pre-flight Consent */
.consent-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.consent-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Action Buttons */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-target);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--brand-glow);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .btn-secondary {
  color: #000000;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-card-hover);
  border-color: var(--primary);
}

.btn-record {
  background-color: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-record.recording {
  background-color: var(--danger);
  color: #ffffff;
  animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Flashcard SRS Engine */
.flashcard-stage {
  perspective: 1200px;
  width: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  position: relative;
  touch-action: pan-y;
}

.flashcard-wrapper {
  width: 100%;
  max-width: 540px;
  min-height: 300px;
  position: relative;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
  user-select: none;
}

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

.flashcard-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--box-shadow);
}

[data-theme="light"] .flashcard-face,
[data-mode="light"] .flashcard-face {
  background: linear-gradient(145deg, #003580, #0052b4) !important;
  color: #ffffff !important;
  border-color: #93c5fd !important;
  box-shadow: 0 12px 32px rgba(0, 53, 128, 0.26) !important;
}

.flashcard-front {
  transform: rotateY(0deg);
  z-index: 2;
  pointer-events: auto !important;
}

.flashcard-back {
  transform: rotateY(180deg);
  background-color: var(--bg-subtle);
  z-index: 1;
  pointer-events: auto !important;
}

.flashcard-wrapper.flipped .flashcard-front {
  z-index: 1;
  pointer-events: auto !important;
}

.flashcard-wrapper.flipped .flashcard-back {
  z-index: 2;
  pointer-events: auto !important;
}

[data-theme="light"] .flashcard-back,
[data-mode="light"] .flashcard-back {
  background: linear-gradient(145deg, #002868, #003580) !important;
  color: #ffffff !important;
}

[data-theme="light"] .card-translation,
[data-mode="light"] .card-translation {
  color: #ffffff !important;
}

[data-theme="light"] .example-en,
[data-mode="light"] .example-en {
  color: #bae6fd !important;
}

[data-theme="light"] .example-ru,
[data-mode="light"] .example-ru {
  color: #e0f2fe !important;
}

[data-theme="light"] .card-example-box,
[data-mode="light"] .card-example-box {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(186, 230, 253, 0.35) !important;
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-pos-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--accent);
}

.card-main-word {
  text-align: center;
  margin: auto 0;
}

.card-lemma {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.card-ipa {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
}

.card-translation {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

[data-theme="light"] .card-translation {
  color: #000000;
}

.card-context-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.card-example-box {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  text-align: left;
}

[data-theme="light"] .card-example-box {
  background-color: #ffffff;
  color: #000000;
  border-color: #cbd5e1;
}

.example-en {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

[data-theme="light"] .example-en {
  color: #000000;
}

.example-ru {
  color: var(--text-muted);
}

.card-tap-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

/* Cards Scope & Grouping Toolbar */
.cards-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 12px 0;
}

.cards-scope-toggle {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
  align-self: flex-start;
  max-width: 100%;
}

.scope-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.scope-btn:hover {
  color: var(--text);
}

.scope-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--brand-glow);
}

[data-theme="light"] .scope-btn {
  color: #475569;
}

[data-theme="light"] .scope-btn.active {
  color: #ffffff;
}

.cards-group-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.group-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="light"] .group-pill {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.group-pill:hover {
  border-color: var(--primary);
  color: var(--text);
}

.group-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 3px 10px var(--brand-glow);
}

.group-pill.pill-repeat.active {
  background: #f59e0b;
  border-color: #d97706;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
}

.group-pill.pill-know.active {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35);
}

.card-lesson-source {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
}

[data-theme="light"] .card-lesson-source {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.14);
}

/* Flashcard Controls */
.flashcard-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}

/* Grammar Atlas & Habits */
.habit-banner {
  padding: 16px;
  background: var(--bg-subtle);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.habit-title {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}

.habit-formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.habit-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
}

[data-theme="light"] .habit-card {
  background-color: #ffffff;
  color: #000000;
  border-color: #cbd5e1;
}

.habit-card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 4px;
}

.habit-card-val {
  font-weight: 600;
  font-size: 1rem;
}

/* Bilingual Speech Pair Card in Grammar Panel */
.grammar-speech-pair-card {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[data-theme="light"] .grammar-speech-pair-card {
  background: #ffffff;
  border-color: #cbd5e1;
}

.pair-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pair-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pair-tag.ru {
  color: var(--text-dim);
}

.pair-tag.en {
  color: var(--accent);
}

.pair-text {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
}

.pair-text.en-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

[data-theme="light"] .pair-text.en-text {
  color: #0284c7;
}

.pair-divider {
  font-size: 1.1rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1;
}

/* Rule Snippet Box (Translated phrases in grammar rules) */
.rule-snippet-box {
  margin: 8px 0 10px 0;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-theme="light"] .rule-snippet-box {
  background: #f1f5f9;
}

.snippet-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
}

.snippet-translation {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.snippet-ru {
  color: var(--text-muted);
}

.snippet-arrow {
  color: var(--accent);
  font-weight: bold;
}

.snippet-en {
  color: var(--accent);
  font-weight: 700;
}

[data-theme="light"] .snippet-en {
  color: #0369a1;
}

.snippet-speak-btn {
  margin-left: auto;
  min-height: 28px !important;
  padding: 2px 8px !important;
  font-size: 0.75rem !important;
}

/* ==========================================================================
   GRAMMAR & CONSTRUCTIONS SECTION STYLES
   ========================================================================== */
.syntax-breakdown-box {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

[data-theme="light"] .syntax-breakdown-box {
  background: #ffffff;
  border-color: #cbd5e1;
}

.syntax-roles-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
  font-size: 0.78rem;
}

.syntax-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-subject { background-color: #38bdf8; box-shadow: 0 0 6px rgba(56, 189, 248, 0.4); }
.dot-predicate { background-color: #c084fc; box-shadow: 0 0 6px rgba(192, 132, 252, 0.4); }
.dot-object { background-color: #34d399; box-shadow: 0 0 6px rgba(52, 211, 153, 0.4); }
.dot-modifier { background-color: #fbbf24; box-shadow: 0 0 6px rgba(251, 191, 36, 0.4); }
.dot-adverbial { background-color: #fb923c; box-shadow: 0 0 6px rgba(251, 146, 60, 0.4); }
.dot-connector { background-color: #2dd4bf; box-shadow: 0 0 6px rgba(45, 212, 191, 0.4); }

.interactive-syntax-tokens-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1.5px dashed var(--border);
  line-height: 1.6;
}

[data-theme="light"] .interactive-syntax-tokens-box {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.syntax-token-chip {
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
}

.syntax-token-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.syntax-token-chip.token-subject {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
}

[data-theme="light"] .syntax-token-chip.token-subject {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
}

.syntax-token-chip.token-predicate {
  background: rgba(192, 132, 252, 0.14);
  border-color: rgba(192, 132, 252, 0.45);
  color: #c084fc;
}

[data-theme="light"] .syntax-token-chip.token-predicate {
  background: #f3e8ff;
  border-color: #9333ea;
  color: #7e22ce;
}

.syntax-token-chip.token-object {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.45);
  color: #34d399;
}

[data-theme="light"] .syntax-token-chip.token-object {
  background: #dcfce7;
  border-color: #16a34a;
  color: #15803d;
}

.syntax-token-chip.token-modifier {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fbbf24;
}

[data-theme="light"] .syntax-token-chip.token-modifier {
  background: #fef3c7;
  border-color: #d97706;
  color: #b45309;
}

.syntax-token-chip.token-adverbial {
  background: rgba(251, 146, 60, 0.14);
  border-color: rgba(251, 146, 60, 0.45);
  color: #fb923c;
}

[data-theme="light"] .syntax-token-chip.token-adverbial {
  background: #ffedd5;
  border-color: #ea580c;
  color: #c2410c;
}

.syntax-token-chip.token-connector {
  background: rgba(45, 212, 191, 0.14);
  border-color: rgba(45, 212, 191, 0.45);
  color: #2dd4bf;
}

[data-theme="light"] .syntax-token-chip.token-connector {
  background: #ccfbf1;
  border-color: #0d9488;
  color: #0f766e;
}

.syntax-role-callout {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-card);
  border-left: 3.5px solid var(--primary);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-color: var(--primary);
  animation: fadeIn 0.2s ease;
}

[data-theme="light"] .syntax-role-callout {
  background: #ffffff;
  border-color: #bfdbfe;
  border-left-color: #0052b4;
}

.callout-role-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.callout-role-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Construction Cards */
.construction-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease;
}

[data-theme="light"] .construction-card {
  background: #ffffff;
  border-color: #bfdbfe;
}

.construction-card:hover {
  border-color: var(--primary);
}

.construction-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.construction-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.construction-formula {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  padding: 8px 12px;
  background: rgba(0, 82, 180, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(0, 82, 180, 0.22);
}

[data-theme="light"] .construction-formula {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #003580;
}

.construction-explanation {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.construction-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.construction-role-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

[data-theme="light"] .construction-role-item {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.construction-role-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.construction-role-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.construction-examples {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.construction-example-item {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

[data-theme="light"] .construction-example-item {
  background: #f1f5f9;
}

/* Pattern Builder */
.pattern-drop-zone {
  min-height: 52px;
  padding: 10px 14px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--bg-subtle);
}

[data-theme="light"] .pattern-drop-zone {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.pattern-drop-zone .placeholder-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
}

.pattern-word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pattern-word-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

[data-theme="light"] .pattern-word-btn {
  background: #ffffff;
  border-color: #cbd5e1;
}

.pattern-word-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.pattern-word-btn.placed {
  opacity: 0.35;
  pointer-events: none;
  background: var(--bg-subtle);
}

.pattern-placed-word {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.pattern-feedback.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid #10b981;
  color: #10b981;
}

.pattern-feedback.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid #ef4444;
  color: #ef4444;
}

/* Exercises */
.exercise-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[data-theme="light"] .exercise-card {
  background-color: #ffffff;
  color: #000000;
  border-color: #cbd5e1;
}

.exercise-prompt {
  font-size: 1.05rem;
  font-weight: 600;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.option-btn {
  min-height: var(--touch-target);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

[data-theme="light"] .option-btn {
  background-color: #ffffff;
  color: #000000;
  border-color: #cbd5e1;
}

.option-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.option-btn.correct, [data-theme="light"] .option-btn.correct {
  background-color: #10b981 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4) !important;
}

.option-btn.wrong, [data-theme="light"] .option-btn.wrong {
  background-color: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4) !important;
}

.exercise-feedback {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.exercise-feedback.correct {
  background-color: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #10b981;
}

[data-theme="light"] .exercise-feedback.correct {
  background-color: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.exercise-feedback.wrong {
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #ef4444;
}

[data-theme="light"] .exercise-feedback.wrong {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.fill-blank-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.fill-input {
  flex: 1 1 200px;
  min-height: var(--touch-target);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.95rem;
}

[data-theme="light"] .fill-input {
  background-color: #ffffff;
  color: #000000;
  border-color: #cbd5e1;
}

.fill-input.input-correct {
  border: 2px solid #10b981 !important;
  background-color: rgba(16, 185, 129, 0.1) !important;
}

.fill-input.input-wrong {
  border: 2px solid #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.1) !important;
}

.fill-check-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 130px;
}

.btn-danger {
  background-color: var(--danger-bg) !important;
  color: var(--danger) !important;
  border-color: var(--danger) !important;
}

.btn-danger:hover {
  background-color: var(--danger) !important;
  color: #ffffff !important;
}

/* Modals (<dialog>) */
dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--modal-bg);
  color: var(--text);
  padding: 24px;
  box-shadow: var(--box-shadow);
  overflow-y: auto;
  z-index: 100;
}

[data-theme="light"] dialog {
  background-color: #ffffff;
  color: #000000;
  border-color: #cbd5e1;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.95rem;
  line-height: 1.6;
}

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

.legal-notice-box {
  padding: 10px 14px;
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  font-size: 0.8rem;
  color: var(--warning);
  border-radius: var(--radius-sm);
}

/* Paywall Plans Grid */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 12px 0;
}

.plan-card {
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="light"] .plan-card {
  background-color: #ffffff;
  border-color: #cbd5e1;
}

.plan-card:hover, .plan-card.selected {
  border-color: var(--primary);
  background: var(--bg-card);
}

.plan-price {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

/* Footer & Collapsible Copyright */
.app-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-copyright-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  overflow: hidden;
  transition: all 0.2s ease;
}

[data-theme="light"] .footer-copyright-details {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.footer-copyright-summary {
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.footer-copyright-summary::-webkit-details-marker {
  display: none;
}

.footer-copyright-summary:hover {
  color: var(--primary);
  background: var(--bg-card-hover);
}

.footer-details-content {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.footer-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

.footer-link-btn:hover {
  color: var(--primary);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--box-shadow);
  animation: toast-in 0.25s ease-out;
  pointer-events: auto;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Screen Reader Only Utility */
.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;
}

/* ==========================================================================
   RESTORED USER SCREENSHOT UI (HEADER, BOTTOM NAV, VOICE INTAKE & CARDS)
   ========================================================================== */

/* Main Container Bottom Padding for Fixed Bottom Navigation */
.app-container {
  padding-bottom: 96px !important;
}

/* Header & Brand */
.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo-circle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  overflow: hidden;
  background: #003580;
  border: 1.5px solid #93c5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 82, 180, 0.3);
  flex-shrink: 0;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.brand-fin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #003580, #0052b4);
  color: #ffffff;
  border: 1.5px solid #93c5fd;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.25;
  box-shadow: 0 2px 6px rgba(0, 53, 128, 0.25);
}

.help-btn-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.help-btn-circle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.help-btn-mini {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Font Size Pill: [ A- ] 18 [ A+ ] */
.font-size-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  padding: 2px 6px;
  height: 36px;
}

.font-size-num {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
  min-width: 26px;
  text-align: center;
}

/* Theme Toggles: ☀️ 🔅 */
.theme-toggles-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.theme-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

/* Page Titles */
.page-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 16px;
}

.page-main-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
}

/* ==========================================================================
   VOICE INTAKE SCREEN (SCREENSHOT 2)
   ========================================================================== */
.voice-intake-container {
  display: flex;
  flex-direction: column;
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
}

.intake-controls-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.custom-select-box {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  padding: 4px 14px;
  height: 38px;
}

.intake-select {
  border: none;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

/* Big Centered Finnish Blue & White Microphone */
.mic-hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 12px 0 20px;
}

.mic-circle-button {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  background: linear-gradient(135deg, #003580, #0052b4, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 82, 180, 0.38), 0 0 0 4px rgba(0, 82, 180, 0.14);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mic-circle-button:active {
  transform: scale(0.95);
}

.mic-circle-button.recording {
  animation: pulse-recording 1.4s infinite;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 0 0 14px rgba(239, 68, 68, 0.25);
}

.mic-circle-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.mic-hero-caption {
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  margin-top: 14px;
  color: var(--text);
}

/* Intake Upload Toolbar (Audio, Text messages, Handwritten notes) */
.upload-toolbar-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.btn-upload-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-upload-choice:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-upload-choice:active {
  transform: scale(0.97);
}

/* Textarea Card */
.speech-textarea-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  margin-bottom: 14px;
}

.speech-textarea-clean {
  width: 100%;
  min-height: 120px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  font-family: inherit;
}

/* Actions Grid below Textarea */
.intake-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.intake-actions-row {
  display: flex;
  gap: 10px;
}

/* User requirement: "вставить", "очистить" и "убрать эхо" строго в один ряд */
.single-row-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.single-row-actions .btn-intake-action {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 8px;
  font-size: 0.86rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  justify-content: center;
  text-align: center;
}

@media (max-width: 380px) {
  .single-row-actions .btn-intake-action {
    padding: 8px 4px;
    font-size: 0.78rem;
    gap: 4px;
  }
}

.btn-intake-action {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-intake-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.btn-intake-action:active {
  transform: scale(0.97);
}

.btn-echo-cleaner {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  font-weight: 700 !important;
}

.btn-echo-cleaner:hover {
  background: rgba(0, 82, 180, 0.08) !important;
}

.word-counter-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 2px;
}

.word-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  padding: 6px 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.btn-create-large {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
}

/* ==========================================================================
   CARDS SCREEN (SCREENSHOT 1)
   ========================================================================== */
.cards-view-container {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.cards-stat-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-box {
  flex: 1;
  min-height: 68px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 8px 6px;
  transition: all 0.15s ease;
}

.stat-box:hover {
  border-color: var(--primary);
}

.stat-box.active {
  border-color: var(--primary);
  border-width: 2px;
  background: var(--bg-card-hover);
  box-shadow: 0 4px 12px var(--brand-glow);
}

.stat-box-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.stat-box-count {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.cards-scope-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.speed-toggle-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
}

/* Finnish Royal Blue & Crisp White Flashcard Face */
.flashcard-face {
  background: linear-gradient(145deg, #003580, #0052b4) !important;
  color: #ffffff !important;
  border: 2px solid #93c5fd !important;
  box-shadow: 0 12px 32px rgba(0, 53, 128, 0.28) !important;
  border-radius: 22px !important;
}

.card-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.card-pos-pill {
  background: #ffffff;
  color: #003580;
  padding: 4px 12px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.card-audio-btn-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  color: #003580;
  border: none;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.card-audio-btn-circle:hover {
  transform: scale(1.05);
}

.card-word-center {
  text-align: center;
  margin: auto 0;
  padding: 10px 0;
}

.card-word-lemma {
  font-size: 2.4rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.card-word-ipa {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: #bae6fd;
}

.card-word-trans {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.card-flip-prompt {
  font-size: 0.9rem;
  color: #e0f2fe;
  text-align: center;
  margin-top: auto;
}

/* Card Navigation Pill */
.card-nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 6px;
}

.card-nav-pill-btn {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: transform 0.1s ease;
}

.card-nav-pill-btn:active {
  transform: scale(0.9);
}

.card-counter-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  padding: 8px 24px;
  font-weight: 700;
  font-size: 1.05rem;
}

.card-swipe-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.card-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

.btn-card-action {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-card-action:active {
  transform: scale(0.98);
}

.btn-card-repeat {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-card-know {
  background: #10b981;
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

/* ==========================================================================
   FIXED BOTTOM NAVIGATION BAR (SCREENSHOTS)
   ========================================================================== */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-tab-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
  font-family: inherit;
}

.nav-tab-item.active {
  color: var(--primary) !important;
  font-weight: 700;
}

.nav-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.nav-label {
  font-size: 0.72rem;
  line-height: 1.1;
}

.nav-icon-wrap {
  position: relative;
  display: inline-flex;
}

.nav-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: #0052b4;
  color: #ffffff;
  border-radius: 999px;
  font-size: 0.65rem;
  padding: 1px 5px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-badge.badge-yellow {
  background: #0284c7;
}

/* Options Panel Row Items */
.options-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   PWA UPDATE BANNER (NON-INTRUSIVE, BEAUTIFUL MOBILE/DESKTOP NOTIFICATION)
   ========================================================================== */
.pwa-update-banner {
  position: fixed;
  bottom: 74px; /* Sits cleanly above the 64px bottom nav bar */
  left: 12px;
  right: 12px;
  max-width: 520px;
  margin: 0 auto;
  z-index: 120;
  background: var(--bg-card);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: 0 12px 32px rgba(0, 53, 128, 0.35), 0 0 16px rgba(0, 82, 180, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideUpUpdateBanner 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpUpdateBanner {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pwa-update-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.pwa-update-icon {
  font-size: 1.45rem;
  line-height: 1;
  flex-shrink: 0;
  animation: pulseUpdateIcon 2s infinite ease-in-out;
}

@keyframes pulseUpdateIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.pwa-update-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pwa-update-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.pwa-update-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.pwa-update-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-pwa-update-confirm {
  background: linear-gradient(135deg, #003580, #0052b4);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 82, 180, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn-pwa-update-confirm:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.btn-pwa-update-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
}

.btn-pwa-update-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   OPTIONS & SETTINGS SCREEN (FULL RESTORATION MATCHING 7 USER SCREENSHOTS)
   ========================================================================== */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.options-main-header {
  text-align: left;
  margin: 4px 0 6px;
}

.options-page-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}

.opt-section-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .opt-section-box,
[data-mode="light"] .opt-section-box {
  background: #ffffff;
  border-color: #e2e8f0;
}

.opt-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.opt-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.opt-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.opt-badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.opt-badge-pill.badge-green {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.opt-badge-pill.badge-blue {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #6366f1;
}

/* API Key Row */
.api-key-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-key-field {
  flex: 1;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  outline: none;
}

.api-key-field:focus {
  border-color: var(--primary);
}

.btn-key-eye {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-save-key {
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #003580, #0052b4);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 82, 180, 0.25);
}

.btn-save-key:hover {
  opacity: 0.92;
}

/* Select full-width */
.custom-select-box.full-width {
  width: 100%;
  display: flex;
  border-radius: 12px;
  padding: 4px 12px;
  height: 44px;
}

.intake-select.full-width {
  width: 100%;
}

/* Font Presets 2x2 Grid */
.font-presets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-font-preset {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-font-preset:hover {
  border-color: var(--primary);
}

.btn-font-preset.active {
  border-color: var(--primary);
  border-width: 2px;
  background: rgba(0, 82, 180, 0.08);
}

.font-preset-num {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.font-preset-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-font-preset.active .font-preset-label {
  color: var(--primary);
}

/* Fine Tuning Card */
.font-fine-tuning-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fine-tuning-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.fine-tuning-buttons {
  display: flex;
  gap: 8px;
}

.btn-fine-tune {
  flex: 1;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-fine-tune:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Theme Modes Row */
.theme-modes-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-theme-mode {
  min-height: 46px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-theme-mode:hover {
  border-color: var(--primary);
}

.btn-theme-mode.active {
  border-color: var(--primary);
  border-width: 2px;
  background: rgba(0, 82, 180, 0.1);
  color: var(--primary);
}

/* Palette Choices (5 choices: Space, Emerald, Sunset, Amethyst, Ocean) */
.palette-subtitle {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.btn-palette-choice {
  min-height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 4px;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-palette-choice:hover {
  border-color: var(--primary);
}

.btn-palette-choice.active {
  border-color: var(--primary);
  border-width: 2px;
  background: rgba(0, 82, 180, 0.1);
  font-weight: 700;
}

.palette-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-space {
  background: #6366f1;
}

.dot-emerald {
  background: #10b981;
}

.dot-sunset {
  background: #f97316;
}

.dot-amethyst {
  background: #a855f7;
}

.dot-ocean {
  background: #0052b4;
}

/* Wake Lock Card & Toggle */
.wakelock-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.wakelock-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wakelock-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.wakelock-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* iOS/Android style toggle switch */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  border-radius: 28px;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-toggle input:checked + .switch-slider {
  background-color: #10b981;
}

.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(22px);
}

/* History Actions */
.opt-history-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-danger-soft {
  min-height: 48px;
  border: 1.5px solid rgba(239, 68, 68, 0.4);
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-danger-soft:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

.btn-restore-soft {
  min-height: 48px;
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-restore-soft:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
}

/* Legal Section */
.legal-scales-icon {
  font-size: 1.3rem;
}

.legal-badge-wrap {
  margin: -4px 0 12px;
}

.author-legal-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.author-legal-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
}

.author-legal-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Legal Document Cards */
.legal-doc-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legal-doc-card-btn {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-align: left;
}

.legal-doc-card-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.doc-btn-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.doc-btn-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.doc-btn-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.doc-btn-arrow {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text-dim);
  line-height: 1;
  margin-left: 8px;
}

/* Protection Cards List */
.protection-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.protection-check-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.protection-check-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}

.protection-check-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Protection Action Buttons */
.protection-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.btn-verify-security {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--primary);
  background: rgba(0, 82, 180, 0.08);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-verify-security:hover {
  background: rgba(0, 82, 180, 0.16);
}

.btn-download-registry {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-download-registry:hover {
  border-color: var(--primary);
}

/* Options Page Footer Links */
.options-page-footer {
  margin-top: 10px;
  padding: 16px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.footer-legal-links-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-text-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-text-link:hover {
  opacity: 0.8;
}

.footer-link-dot {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.footer-copyright-block {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-cr-author {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.footer-cr-distribution {
  font-size: 0.74rem;
  color: var(--text-muted);
}
