/* ==========================================================================
   Lexio • Modern Scandinavian Design System with Light/Dark Themes & i18n
   ========================================================================== */

:root {
  /* Common Palette */
  --brand-blue: #0284c7;
  --brand-blue-hover: #0369a1;
  --brand-yellow: #f59e0b;
  --brand-yellow-light: #fbbf24;
  --brand-yellow-dark: #d97706;

  /* Grammatical Articles */
  --color-en: #0284c7;
  --color-en-bg: rgba(2, 132, 199, 0.14);
  --color-ett: #d97706;
  --color-ett-bg: rgba(217, 119, 6, 0.14);
  --color-att: #10b981;
  --color-att-bg: rgba(16, 185, 129, 0.14);
  --color-de: #8b5cf6;
  --color-de-bg: rgba(139, 92, 246, 0.14);
  --color-none: #64748b;
  --color-none-bg: rgba(100, 116, 139, 0.18);

  /* Status Colors */
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.14);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.14);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.14);

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme (Default) */
[data-theme="dark"] {
  --bg-primary: #0a0f1d;
  --bg-surface: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --bg-card-active: #334155;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  --header-bg: rgba(17, 24, 39, 0.88);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 14px 28px -6px rgba(0, 0, 0, 0.7);
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --bg-card-active: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-faint: #94a3b8;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: #0284c7;
  --header-bg: rgba(255, 255, 255, 0.9);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 14px 28px -6px rgba(0, 0, 0, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: 78px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

@media (min-width: 768px) {
  body {
    padding-bottom: 30px;
  }
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ==========================================================================
   Header & Controls
   ========================================================================== */

.app-header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--transition-fast);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.brand-logo-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-blue) 0%, #0369a1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
  font-size: 1.3rem;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-main) 40%, var(--brand-yellow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--brand-yellow);
  background: rgba(245, 158, 11, 0.15);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 640px) {
  .header-controls {
    gap: 10px;
  }
}

.status-item {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.daily-goal-pill {
  padding: 0 8px;
}

.goal-circle {
  position: relative;
  width: 24px;
  height: 24px;
}

.circular-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.circle-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 4;
}

.circle-fill {
  fill: none;
  stroke: var(--color-success);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

.goal-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.52rem;
  font-weight: 800;
}

.status-label {
  display: none;
}

@media (min-width: 640px) {
  .status-label {
    display: inline;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
  }
}

.streak-pill {
  color: #ff8a65;
}

.fire-icon {
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.streak-value {
  font-weight: 800;
  color: #ffab91;
}

.xp-pill {
  padding: 0 10px;
}

.xp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 75px;
}

@media (min-width: 640px) {
  .xp-info {
    width: 95px;
  }
}

.xp-level-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
}

.level-badge {
  font-weight: 800;
  color: var(--brand-yellow);
}

.xp-text {
  color: var(--text-muted);
  font-size: 0.62rem;
}

.xp-bar-track {
  width: 100%;
  height: 4px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue) 0%, var(--brand-yellow) 100%);
  transition: width 0.4s ease;
}

/* Language Selector Dropdown */
.language-dropdown-wrapper {
  position: relative;
}

.btn-lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
  transition: var(--transition-fast);
}

.btn-lang-switcher:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.lang-arrow {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.lang-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  min-width: 140px;
  z-index: 60;
  overflow: hidden;
  animation: dropdownIn 0.2s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.lang-dropdown-item:hover {
  background: var(--bg-card-hover);
}

.lang-dropdown-item.active {
  background: rgba(2, 132, 199, 0.15);
  color: var(--brand-blue);
}

/* Theme Toggle Button */
.btn-theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: var(--transition-fast);
}

.btn-theme-toggle:hover {
  background: var(--bg-card-hover);
  transform: rotate(15deg);
}

/* User Profile Button */
.user-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  height: 38px;
  padding: 0 12px 0 6px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
  transition: var(--transition-fast);
}

.user-profile-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-yellow);
}

.user-avatar-badge {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar {
  font-size: 0.95rem;
  line-height: 1;
}

.avatar-sync-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-success);
  border: 1.5px solid var(--bg-card);
  display: inline-block;
  box-shadow: 0 0 5px rgba(34, 197, 94, 0.7);
}

.avatar-sync-dot.local {
  background-color: var(--brand-blue);
  box-shadow: 0 0 5px rgba(56, 189, 248, 0.7);
}

.avatar-sync-dot.offline {
  background-color: var(--color-warning);
  box-shadow: none;
}

.user-name {
  max-width: 75px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .user-name {
    max-width: 120px;
  }
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */

.nav-bar {
  background-color: var(--header-bg);
  border-top: 1px solid var(--border-subtle);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@media (min-width: 768px) {
  .nav-bar {
    position: static;
    border-top: none;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
  }
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 4px;
}

@media (min-width: 768px) {
  .nav-inner {
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
  }
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  font-family: inherit;
  min-width: 50px;
}

@media (min-width: 768px) {
  .nav-tab {
    flex-direction: row;
    gap: 8px;
    padding: 8px 16px;
  }
}

.nav-tab .tab-icon {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

@media (min-width: 768px) {
  .nav-tab .tab-icon {
    font-size: 1.1rem;
    margin-bottom: 0;
  }
}

.nav-tab .tab-text {
  font-size: 0.7rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .nav-tab .tab-text {
    font-size: 0.88rem;
  }
}

.nav-tab:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: var(--brand-blue);
  background-color: rgba(2, 132, 199, 0.12);
}

/* ==========================================================================
   Content Views
   ========================================================================== */

.app-main {
  flex: 1;
  padding-top: 24px;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .view-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.view-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.view-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Article Badges */
.article-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.article-pill.en, .article-pill[data-art="en"] {
  background-color: var(--color-en-bg);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.article-pill.ett, .article-pill[data-art="ett"] {
  background-color: var(--color-ett-bg);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.article-pill.att, .article-pill[data-art="att"] {
  background-color: var(--color-att-bg);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.article-pill.de, .article-pill[data-art="de"] {
  background-color: var(--color-de-bg);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.35);
}

.article-pill.none, .article-pill[data-art="-"] {
  background-color: var(--color-none-bg);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.theme-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid var(--border-subtle);
}

.leitner-pill {
  font-size: 0.7rem;
  color: #c084fc;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  text-decoration: none;
}

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

.btn-full {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-blue) 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0284c7 100%);
  transform: translateY(-1px);
}

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

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

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger) 0%, #dc2626 100%);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-warning-sm {
  background: var(--brand-yellow);
  color: #000000;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-warning-sm:hover {
  background: #d97706;
}

/* Select & Input Elements */
.select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.select-prefix-icon {
  position: absolute;
  left: 12px;
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.select-dropdown {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  height: 38px;
  padding: 0 34px 0 14px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.select-wrapper .select-dropdown {
  padding-left: 36px;
}

.select-dropdown:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(56, 189, 248, 0.4);
}

.select-dropdown:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.select-dropdown option {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 10px;
}

.quiz-controls, .filter-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.select-theme-wrapper .select-dropdown {
  max-width: 320px;
}

.select-direction-wrapper .select-dropdown {
  min-width: 190px;
}

.input-text {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  box-sizing: border-box;
  transition: var(--transition-fast);
}

.input-text:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.theme-search-box .input-text {
  width: 100%;
  max-width: 300px;
}

.pill-group {
  display: inline-flex;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.pill-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pill-btn.active {
  background-color: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.btn-audio-speak, .btn-audio-speak-sm {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-audio-speak {
  width: 38px;
  height: 38px;
  font-size: 1rem;
}

.btn-audio-speak-sm {
  width: 28px;
  height: 28px;
  font-size: 0.82rem;
}

.btn-audio-speak:hover, .btn-audio-speak-sm:hover {
  background: var(--bg-card-hover);
  transform: scale(1.06);
}

/* ==========================================================================
   VIEW 1: Teman (Themes Grid)
   ========================================================================== */

.themes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .themes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .themes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.theme-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  transition: var(--transition-normal);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.theme-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-card);
}

.theme-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.theme-card-icon {
  font-size: 2.2rem;
  line-height: 1;
  background: var(--bg-card);
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.theme-card-info {
  flex: 1;
}

.theme-chapter-num {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-yellow);
  letter-spacing: 0.05em;
}

.theme-card-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
  line-height: 1.25;
}

.theme-card-title-trans {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.theme-card-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

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

.theme-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--color-success));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.theme-card-actions {
  display: flex;
  gap: 8px;
}

.theme-card-actions .btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.8rem;
}

/* ==========================================================================
   VIEW 2: Ordkort (Flashcards with 3D Flip)
   ========================================================================== */

.flashcard-viewport {
  perspective: 1200px;
  width: 100%;
  max-width: 580px;
  height: 380px;
  margin: 0 auto 24px;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border-radius: var(--radius-xl);
  outline: none;
}

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

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

.flashcard-front {
  background: linear-gradient(145deg, #182234 0%, #111827 100%);
}

[data-theme="light"] .flashcard-front {
  background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
}

.flashcard-back {
  background: linear-gradient(145deg, #14222b 0%, #0d1b2a 100%);
  transform: rotateY(180deg);
}

[data-theme="light"] .flashcard-back {
  background: linear-gradient(145deg, #f0fdf4 0%, #e2e8f0 100%);
}

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

.card-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.card-swedish-word {
  font-size: 2.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

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

.phonetic-text {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text-muted);
}

.flip-hint {
  font-size: 0.78rem;
  color: var(--text-faint);
  text-align: center;
  display: block;
}

.card-translation-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.card-russian-word {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--brand-yellow);
}

.card-example-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  width: 100%;
  text-align: left;
  margin-top: 6px;
}

[data-theme="light"] .card-example-box {
  background: rgba(255, 255, 255, 0.6);
}

.example-sv {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.example-ru {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.flashcard-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  max-width: 580px;
  margin: 0 auto;
}

.btn-action {
  flex: 1;
  padding: 14px 12px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.btn-action .btn-icon {
  font-size: 1.25rem;
}

.btn-action .btn-text {
  font-size: 0.88rem;
  font-weight: 700;
}

.btn-action .btn-keyhint {
  font-size: 0.65rem;
  color: var(--text-faint);
}

.btn-hard {
  background-color: var(--color-danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-hard:hover {
  background-color: rgba(239, 68, 68, 0.25);
}

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

.btn-flip:hover {
  background-color: var(--bg-card-hover);
}

.btn-easy {
  background-color: var(--color-success-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.btn-easy:hover {
  background-color: rgba(16, 185, 129, 0.25);
}

/* ==========================================================================
   VIEW 3: "En eller Ett?" (Rapid Gender Drill)
   ========================================================================== */

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

.drill-stats-pills {
  display: flex;
  gap: 10px;
}

.drill-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.combo-pill {
  background: rgba(245, 158, 11, 0.15);
  color: var(--brand-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.score-pill {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.drill-arena {
  max-width: 580px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drill-card {
  background: linear-gradient(145deg, #182234 0%, #111827 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 34px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
  min-height: 290px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

[data-theme="light"] .drill-card {
  background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
}

.drill-card.shake {
  animation: shakeCard 0.4s ease;
  border-color: var(--color-danger);
}

@keyframes shakeCard {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.drill-card.pulse-correct {
  animation: pulseCorrect 0.4s ease;
  border-color: var(--color-success);
}

@keyframes pulseCorrect {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

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

.drill-streak-badge {
  font-size: 0.78rem;
  font-weight: 800;
  color: #ff8a65;
}

.drill-card-main {
  margin: 20px 0;
}

.drill-article-placeholder {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--brand-yellow);
  height: 38px;
}

.drill-target-word {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 4px 0 8px;
}

.drill-pronounce-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.drill-russian-hint {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.drill-feedback {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.drill-feedback.correct {
  background: var(--color-success-bg);
  color: #34d399;
}

.drill-feedback.incorrect {
  background: var(--color-danger-bg);
  color: #f87171;
}

.drill-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn-drill-choice {
  padding: 24px 16px;
  border-radius: var(--radius-xl);
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s ease, filter 0.1s ease;
  font-family: inherit;
}

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

.btn-choice-en {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}

.btn-choice-ett {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.4);
}

.choice-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.choice-shortcut {
  font-size: 0.75rem;
  opacity: 0.85;
  font-weight: 700;
}

/* ==========================================================================
   VIEW 4: Quiz
   ========================================================================== */

.quiz-arena {
  max-width: 620px;
  margin: 0 auto;
}

.quiz-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 20px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-yellow));
  transition: width 0.3s ease;
}

.quiz-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
}

.quiz-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.quiz-question-counter {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 700;
}

.quiz-prompt-box {
  text-align: center;
  padding: 16px 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.quiz-prompt-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.quiz-prompt-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0;
}

.quiz-prompt-word {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.quiz-phonetic {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 540px) {
  .quiz-options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.quiz-option-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-fast);
}

.quiz-option-btn:hover:not(:disabled) {
  background-color: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.quiz-option-btn.correct {
  background-color: var(--color-success-bg) !important;
  color: #34d399 !important;
  border-color: var(--color-success) !important;
}

.quiz-option-btn.incorrect {
  background-color: var(--color-danger-bg) !important;
  color: #f87171 !important;
  border-color: var(--color-danger) !important;
}

.quiz-result-box {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  animation: fadeIn 0.3s ease;
}

.quiz-result-message {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.quiz-example-display {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* ==========================================================================
   VIEW 5: Statistik
   ========================================================================== */

.stats-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .stats-overview-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  font-size: 2rem;
  background: var(--bg-card);
  padding: 10px;
  border-radius: var(--radius-md);
}

.metric-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.card-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.section-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 16px;
}

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

.header-with-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.badge-counter {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.section-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.leitner-boxes-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.leitner-box-column {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  text-align: center;
}

.leitner-box-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
}

.leitner-box-count {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 4px 0;
}

.leitner-box-desc {
  font-size: 0.65rem;
  color: var(--text-faint);
}

.stats-comparison-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 840px) {
  .stats-comparison-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.words-table-wrapper {
  overflow-x: auto;
  max-height: 380px;
  overflow-y: auto;
}

.words-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.words-table th {
  text-align: left;
  padding: 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.words-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.empty-table-msg {
  text-align: center;
  color: var(--text-faint);
  padding: 30px !important;
}

/* ==========================================================================
   VIEW 6: Inställningar & Account Modals
   ========================================================================== */

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.card-header-with-icon {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.card-header-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-label-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.setting-control-col {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

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

.setting-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

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

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 6px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--brand-blue) 0%, rgba(56, 189, 248, 0.3) 100%);
  outline: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--brand-blue);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--brand-blue);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.speed-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-blue);
  background: rgba(56, 189, 248, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  min-width: 48px;
  text-align: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: 0.3s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--brand-blue);
  border-color: var(--brand-blue);
}

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

.cloud-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin: 14px 0 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.account-badge-view {
  display: flex;
  align-items: center;
  gap: 12px;
}

.acc-avatar {
  font-size: 1.8rem;
  line-height: 1;
}

.acc-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.acc-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.db-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

.db-status-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-warning);
}

.db-status-pill.online {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #4ade80;
}

.db-status-pill.online .status-dot {
  background-color: var(--color-success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.db-status-pill.local {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.08);
  color: #38bdf8;
}

.db-status-pill.local .status-dot {
  background-color: var(--brand-blue);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
}

.settings-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Account Modal Styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  animation: zoomPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

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

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.auth-tabs {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.auth-tab.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.auth-tab-content {
  display: none;
}

.auth-tab-content.active {
  display: block;
}

.auth-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.profiles-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.profile-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-blue);
}

.profile-item.active {
  border-color: var(--brand-blue);
  background: rgba(2, 132, 199, 0.12);
}

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

.profile-avatar {
  font-size: 1.6rem;
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.profile-stats {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.avatar-opt {
  font-size: 1.5rem;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.avatar-opt:hover {
  background: var(--bg-card-hover);
}

.avatar-opt.active {
  border-color: var(--brand-yellow);
  background: rgba(245, 158, 11, 0.2);
  transform: scale(1.08);
}

/* Auth Modal Form Inputs & Password Toggles */
.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 12px;
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 2;
  line-height: 1;
}

.input-icon-wrapper .input-text {
  width: 100%;
  padding-left: 38px;
  padding-right: 40px;
}

.btn-toggle-pwd {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  color: var(--text-muted);
  transition: var(--transition-fast);
  line-height: 1;
}

.btn-toggle-pwd:hover {
  color: var(--text-main);
  transform: scale(1.15);
}

.auth-error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 14px;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.current-user-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
}

.user-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-banner-avatar {
  font-size: 1.8rem;
  line-height: 1;
}

.user-banner-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.user-banner-stats {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cloud-sync-card {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 16px;
}

.cloud-sync-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.cloud-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.cloud-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
}

.cloud-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.db-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-warning);
}

.db-status-dot.online {
  background-color: var(--color-success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
}

.db-status-dot.local {
  background-color: var(--brand-blue);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
}

.cloud-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.saved-profiles-section {
  margin-top: 12px;
  margin-bottom: 14px;
}

.saved-profiles-header {
  margin-bottom: 8px;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
  font-family: inherit;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
  transition: var(--transition-fast);
}

.btn-ghost:hover {
  color: var(--text-main);
  text-decoration: underline;
}

/* Celebration Overlay */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.celebration-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 30px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  animation: zoomPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomPop {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.celebration-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.celebration-reward {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-yellow);
  margin: 16px 0 20px;
}

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 700;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

.badge {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.badge-success {
  background: var(--color-success-bg);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

/* ==========================================================================
   Minimalist Emoji Design System
   ========================================================================== */
.min-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  filter: saturate(0.85);
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.min-emoji:hover {
  filter: saturate(1.15);
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
}

/* Modernize Theme Icons */
.theme-card-icon {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.5rem;
  filter: saturate(0.85);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.theme-card:hover .theme-card-icon {
  filter: saturate(1.15);
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
}

/* ==========================================================================
   SFI Courses System (A, B, C, D)
   ========================================================================== */
.badge-sfi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: inherit;
  line-height: 1;
}

.badge-sfi-a {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}

.badge-sfi-b {
  background: rgba(56, 189, 248, 0.14) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
}

.badge-sfi-c {
  background: rgba(168, 85, 247, 0.14) !important;
  color: #c084fc !important;
  border: 1px solid rgba(168, 85, 247, 0.35) !important;
}

.badge-sfi-d {
  background: rgba(251, 146, 60, 0.14) !important;
  color: #fb923c !important;
  border: 1px solid rgba(251, 146, 60, 0.35) !important;
}

/* SFI Global Course Bar */
.sfi-course-bar-wrapper {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 0;
  position: sticky;
  top: 68px;
  z-index: 35;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sfi-course-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.sfi-course-bar::-webkit-scrollbar {
  display: none;
}

.sfi-course-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.course-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.course-pill:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.course-pill.active {
  background: rgba(2, 132, 199, 0.18);
  color: var(--brand-blue);
  border-color: rgba(2, 132, 199, 0.45);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.2);
}

.course-pill .pill-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
}

.course-pill .pill-sub {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.7;
}

.sfi-active-user-course {
  display: none;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .sfi-active-user-course {
    display: flex;
  }
}

.course-ind-label {
  font-weight: 600;
}

/* ==========================================================================
   Practice Hub Navigation & Sub-views
   ========================================================================== */
.practice-nav-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.practice-nav-bar::-webkit-scrollbar {
  display: none;
}

.practice-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

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

.practice-tab-btn.active {
  background: rgba(2, 132, 199, 0.16);
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.practice-sub-view {
  display: none;
}

.practice-sub-view.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

/* ==========================================================================
   Reading & Comprehension View (Läsning)
   ========================================================================== */
.reading-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 640px) {
  .reading-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .reading-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.reading-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.reading-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.reading-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reading-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 6px 0 4px 0;
  line-height: 1.3;
}

.reading-card-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.reading-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.74rem;
  color: var(--text-muted);
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Active Reader Modal */
.reader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(14px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.reader-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.reader-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}

.reader-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.reader-audio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  gap: 12px;
}

.reader-text-content {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.reader-text-content p {
  margin-bottom: 14px;
}

.reader-text-content p:last-child {
  margin-bottom: 0;
}

.reader-questions-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-text {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--text-main);
  line-height: 1.4;
}

.question-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 640px) {
  .question-options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.q-opt-btn {
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1.35;
}

.q-opt-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.q-opt-btn.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #34d399 !important;
  color: #34d399 !important;
  font-weight: 700;
}

.q-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #f87171 !important;
  color: #f87171 !important;
}

.q-explanation {
  font-size: 0.82rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(2, 132, 199, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.25);
  color: #7dd3fc;
  line-height: 1.4;
}

/* ==========================================================================
   Grammar Rules View (Grammatik)
   ========================================================================== */
.grammar-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grammar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-fast);
}

.grammar-card-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: var(--bg-card);
  transition: var(--transition-fast);
}

.grammar-card-header:hover {
  background: var(--bg-card-hover);
}

.grammar-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.grammar-card-title {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text-main);
}

.grammar-card-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.35;
}

.grammar-chevron {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.grammar-card.open .grammar-chevron {
  transform: rotate(180deg);
}

.grammar-card-content {
  display: none;
  padding: 22px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.18);
  flex-direction: column;
  gap: 20px;
}

.grammar-card.open .grammar-card-content {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.grammar-explanation {
  font-size: 0.94rem;
  line-height: 1.75;
  color: var(--text-main);
}

.grammar-examples-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 10px 0;
}

.grammar-examples-table th {
  background: var(--bg-surface);
  padding: 10px 14px;
  text-align: left;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.grammar-examples-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.4;
}

.syntax-v2 {
  color: #34d399;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.syntax-biff {
  color: #fb923c;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.syntax-sub {
  color: #c084fc;
  font-weight: 700;
}

.grammar-quiz-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================================================
   Sentence Word Order Builder (Meningsbyggnad)
   ========================================================================== */
.sentence-builder-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 720px;
  margin: 0 auto;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.sentence-target-hint {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.sentence-translation-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
}

.sentence-slots-box {
  min-height: 72px;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.25);
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease;
}

.sentence-slots-box.correct {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.08);
}

.sentence-slots-box.wrong {
  border-color: #f87171;
  background: rgba(239, 68, 68, 0.08);
}

.word-chip {
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.word-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-blue);
  transform: translateY(-2px);
}

.word-chip.placed {
  opacity: 0.25;
  pointer-events: none;
}

.word-chip.in-slot {
  background: rgba(2, 132, 199, 0.22);
  border-color: var(--brand-blue);
  color: #7dd3fc;
}

.sentence-bank-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 56px;
  padding: 8px 0;
}

.sentence-actions-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}


/* ==========================================================================
   Guest Registration Notice Box
   ========================================================================== */
.migration-notice-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-md);
  color: #e2e8f0;
}
.migration-notice-box .notice-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}
.migration-notice-box .notice-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: #e0e7ff;
}

/* ==========================================================================
   Integrated SFI Course Hub (Replaces old sticky course bar)
   ========================================================================== */
.sfi-course-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.hub-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}
.hub-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}
.hub-card.active {
  background: linear-gradient(145deg, rgba(2, 132, 199, 0.12), rgba(14, 165, 233, 0.05));
  border-color: var(--brand-blue);
  box-shadow: 0 0 20px rgba(2, 132, 199, 0.25), 0 8px 24px rgba(0, 0, 0, 0.3);
}
.hub-card.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}
.hub-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hub-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.hub-all { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }
.hub-a { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.hub-b { background: rgba(2, 132, 199, 0.2); color: #38bdf8; }
.hub-c { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.hub-d { background: rgba(225, 29, 72, 0.2); color: #fb7185; }

.hub-count {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}
.hub-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}
.hub-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* Theme card quick actions */
.theme-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.theme-action-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
  font-family: inherit;
}
.theme-action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}
.theme-action-btn.btn-action-read {
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}
.theme-action-btn.btn-action-read:hover {
  background: rgba(56, 189, 248, 0.15);
}

/* Filter pills */
.reading-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.reading-course-filters, .grammar-course-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.btn-filter-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}
.btn-filter-pill:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}
.btn-filter-pill.active {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  border-color: rgba(2, 132, 199, 0.5);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.2);
}

/* ==========================================================================
   In-Page Reading Room Suite (No Popups!)
   ========================================================================== */
.reading-article-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.25s ease;
}
.reading-article-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 8px;
}
.article-meta-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}
.article-meta-theme {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.reader-audio-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  flex-wrap: wrap;
}
.player-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-player-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-player-action.btn-play {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.btn-player-action.btn-play:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}
.btn-player-action.btn-pause {
  background: #f59e0b;
  color: #1e293b;
}
.btn-player-action.btn-stop {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.player-center-info {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.player-status-line {
  font-size: 0.78rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.player-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.player-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.speed-label {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.speed-toggle-group {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-full);
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-speed-opt {
  padding: 4px 9px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-speed-opt.active {
  background: var(--brand-blue);
  color: #fff;
}

.reading-article-container {
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
}

.article-title-block {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 20px;
}
.article-sv-title {
  font-family: 'Newsreader', serif;
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  margin: 0 0 8px 0;
}
.article-trans-title {
  font-size: 1.05rem;
  color: #94a3b8;
  margin: 0 0 8px 0;
  line-height: 1.4;
}
.article-summary-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  font-style: italic;
}

.article-text-body {
  font-family: 'Newsreader', serif;
  font-size: 1.22rem;
  line-height: 1.9;
  color: var(--text-main);
  letter-spacing: 0.01em;
}
.article-text-body p {
  margin-bottom: 1.3em;
  text-indent: 0;
}
.article-text-body p:last-child {
  margin-bottom: 0;
}

.reader-word {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 2px;
  transition: all 0.12s ease;
  display: inline;
}
.reader-word:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}
.reader-word.glos-word {
  text-decoration: underline dotted #f59e0b 2px;
  text-underline-offset: 4px;
}
.reader-word.speaking {
  background: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

/* Glosor Box */
.article-glosor-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.glosor-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
  padding-bottom: 10px;
}
.glosor-box-header .header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.glosor-icon { font-size: 1.25rem; }
.glosor-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fbbf24;
  margin: 0;
}
.glosor-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}
.glosor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}
.glos-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.glos-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.glos-item-word-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.glos-art {
  font-size: 0.72rem;
  font-weight: 800;
  color: #38bdf8;
}
.glos-sv {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
}
.glos-pron {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.glos-trans {
  font-size: 0.82rem;
  color: #94a3b8;
}
.btn-glos-speak {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.btn-glos-speak:hover {
  background: var(--brand-blue);
  color: #fff;
}

/* Comprehension Questions */
.article-questions-box {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.questions-box-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.questions-icon { font-size: 1.35rem; }
.questions-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 2px 0;
}
.questions-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.article-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.aq-prompt-sv {
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--text-main);
  line-height: 1.4;
}
.aq-prompt-trans {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.aq-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 580px) {
  .aq-options-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.aq-opt-btn {
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1.35;
}
.aq-opt-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}
.aq-opt-btn.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #34d399 !important;
  color: #34d399 !important;
  font-weight: 700;
}
.aq-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #f87171 !important;
  color: #f87171 !important;
}
.aq-explanation {
  font-size: 0.82rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(2, 132, 199, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.25);
  color: #7dd3fc;
  line-height: 1.45;
}

/* ==========================================================================
   Svenska Satschemat & Modern Grammar View
   ========================================================================== */
.satschema-hero-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  margin-bottom: 28px;
}
.satschema-hero-header .hero-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.satschema-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  width: fit-content;
}
.satschema-hero-card .hero-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
}
.satschema-hero-card .hero-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.45;
}

.satschema-formula-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.satschema-formula-tabs::-webkit-scrollbar {
  display: none;
}
.satschema-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.satschema-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.satschema-tab-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}
.tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.satschema-table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
}
.satschema-matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  text-align: center;
}
.satschema-matrix-table th {
  padding: 12px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  vertical-align: top;
}
.satschema-matrix-table th:last-child {
  border-right: none;
}
.satschema-matrix-table th .pos-num {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.68rem;
  margin-right: 5px;
}
.satschema-matrix-table th small {
  display: block;
  font-size: 0.66rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 2px;
}
.col-finit-verb {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #34d399 !important;
  border-bottom: 2px solid #10b981 !important;
}
.col-finit-verb .pos-num {
  background: #10b981 !important;
  color: #022c22 !important;
  font-weight: 900;
}
.satschema-matrix-table td {
  padding: 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
  height: 64px;
}
.satschema-matrix-table td:last-child {
  border-right: none;
}

.satschema-token {
  display: inline-block;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  animation: popIn 0.25s ease;
}
.token-fundament { background: rgba(139, 92, 246, 0.25); border: 1px solid #a855f7; color: #d8b4fe; }
.token-verb { background: rgba(16, 185, 129, 0.3); border: 2px solid #34d399; color: #a7f3d0; font-size: 1.02rem; }
.token-subjekt { background: rgba(59, 130, 246, 0.25); border: 1px solid #3b82f6; color: #93c5fd; }
.token-satsadv { background: rgba(245, 158, 11, 0.25); border: 1px solid #f59e0b; color: #fde68a; }
.token-inf-verb { background: rgba(20, 184, 166, 0.25); border: 1px solid #14b8a6; color: #99f6e4; }
.token-objekt { background: rgba(168, 85, 247, 0.2); border: 1px solid #c084fc; color: #e9d5ff; }
.token-adverbial { background: rgba(100, 116, 139, 0.25); border: 1px solid #64748b; color: #cbd5e1; }
.token-empty { color: rgba(255, 255, 255, 0.15); font-size: 1.2rem; }

.satschema-explanation-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.satschema-exp-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.satschema-full-sentence {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
}
.satschema-sentence-trans {
  font-size: 0.88rem;
  color: #94a3b8;
}
.satschema-rule-hint {
  font-size: 0.82rem;
  color: #38bdf8;
  margin-top: 4px;
}
.btn-satschema-speak {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-satschema-speak:hover {
  background: var(--brand-blue);
}

/* Grammar Rule Cards */
.grammar-rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-fast);
}
.grammar-rule-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}
.grammar-rule-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: var(--bg-card);
  transition: var(--transition-fast);
}
.grammar-rule-header:hover {
  background: var(--bg-card-hover);
}
.grammar-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.grammar-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.grammar-title-sv {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}
.grammar-title-trans {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.grammar-toggle-icon {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.grammar-summary-bar {
  padding: 10px 22px;
  font-size: 0.82rem;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.grammar-rule-content {
  padding: 22px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.grammar-theory-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  line-height: 1.6;
}
.grammar-exp-sv {
  font-size: 0.94rem;
  color: var(--text-main);
  margin: 0 0 8px 0;
  white-space: pre-line;
}
.grammar-exp-trans {
  font-size: 0.86rem;
  color: #94a3b8;
  white-space: pre-line;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

/* Contrastive Comparison Cards (Rätt vs Fel) */
.grammar-comp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .grammar-comp-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.comp-card {
  padding: 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.comp-card.fel {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.comp-card.ratt {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.comp-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.comp-card.fel .comp-card-badge { color: #f87171; }
.comp-card.ratt .comp-card-badge { color: #34d399; }
.comp-card-phrase {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}
.comp-card-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

