/* ============================================================
   LexiRoots - Shared UI Components
   Buttons, Cards, Modals, Toasts, Inputs, Login, Lessons, Profile
   Class names aligned to JS template usage
   ============================================================ */

/* =========================
   BUTTONS
   ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    background var(--duration-fast) ease,
    transform var(--duration-fast) ease,
    box-shadow var(--duration-base) ease,
    border-color var(--duration-fast) ease;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

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

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Primary */
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: var(--shadow-glow-primary);
}

/* Secondary */
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-light);
  border-color: var(--color-surface-lighter);
}

/* Danger */
.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
  background: #c0292a;
  border-color: #c0292a;
  box-shadow: 0 0 20px rgba(214, 48, 49, 0.3);
}

/* Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Back button */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  cursor: pointer;
  padding: var(--space-2) var(--space-1);
  border-radius: var(--radius-md);
  transition:
    color var(--duration-fast) ease,
    background var(--duration-fast) ease;
  margin-bottom: var(--space-4);
}

.btn-back:hover {
  color: var(--color-text);
  background: var(--color-surface-light);
}

.btn-back svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Google sign-in button */
.btn-google {
  background: #ffffff;
  color: #333333;
  border: 1.5px solid #dadce0;
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    transform var(--duration-fast) ease,
    box-shadow var(--duration-base) ease;
}

.btn-google:hover {
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.08);
}

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

.google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}


/* =========================
   FORM INPUTS
   ========================= */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.input-group label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  letter-spacing: 0.3px;
}

.input-field {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-base);
  transition:
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    background var(--duration-fast) ease;
  -webkit-appearance: none;
  appearance: none;
}

.input-field::placeholder {
  color: var(--color-text-dim);
}

.input-field:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
  background: var(--color-surface-light);
  outline: none;
}

.input-field:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.input-field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: calc(var(--space-4) + 20px);
}


/* =========================
   CARDS
   ========================= */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-base) ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-light);
}

.card-body {
  padding: var(--space-2) 0;
}


/* =========================
   LOGIN SCREEN
   ========================= */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-6) var(--space-4);
}

.login-brand {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: var(--space-3);
  filter: drop-shadow(0 4px 12px rgba(108, 92, 231, 0.25));
}

.login-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-black);
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xl);
}

.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-6);
  border-bottom: 2px solid var(--color-border);
}

.login-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition:
    color var(--duration-fast) ease,
    border-color var(--duration-fast) ease;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  position: relative;
}

.login-tab:hover {
  color: var(--color-text);
}

.login-tab.active {
  color: var(--color-primary-light);
  border-bottom-color: var(--color-primary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-form .input-field {
  padding: var(--space-4);
  font-size: var(--text-md);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text-dim);
  font-size: var(--text-sm);
  margin: var(--space-6) 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}


/* =========================
   LESSON MAP
   ========================= */
.lesson-map {
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
}

.lesson-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) 0;
}

.connector-line {
  width: 2px;
  height: 28px;
  background: var(--color-surface-lighter);
  border-radius: var(--radius-full);
}

/* Lesson Card */
.lesson-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1.5px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  cursor: pointer;
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-base) ease;
  position: relative;
  overflow: hidden;
}

.lesson-card:hover:not(.locked) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.lesson-card:active:not(.locked) {
  transform: scale(0.98);
}

/* Completed state */
.lesson-card.completed {
  border-color: rgba(0, 184, 148, 0.35);
}

.lesson-card.completed .lesson-card-icon {
  background: rgba(0, 184, 148, 0.12);
  border-color: var(--color-success);
}

/* Locked state */
.lesson-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.3);
}

.lesson-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  flex-shrink: 0;
  border: 2px solid var(--color-border-light);
  background: var(--color-surface-light);
  transition: all var(--duration-base) ease;
}

.lesson-card-content {
  flex: 1;
  min-width: 0;
}

.lesson-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.lesson-number {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lesson-difficulty {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: 0.3px;
}

.lesson-title {
  font-size: var(--text-md);
  font-weight: var(--font-bold);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-tight);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lesson-score {
  font-size: var(--text-sm);
  color: var(--color-success);
  font-weight: var(--font-semibold);
  margin-top: var(--space-1);
}

.lesson-roots-preview {
  font-size: var(--text-sm);
  color: var(--color-text-dim);
  font-style: italic;
  margin-top: var(--space-1);
}

.lesson-card-arrow {
  font-size: var(--text-2xl);
  color: var(--color-text-dim);
  flex-shrink: 0;
  line-height: 1;
  transition: transform var(--duration-fast) ease;
}

.lesson-card:hover:not(.locked) .lesson-card-arrow {
  transform: translateX(2px);
  color: var(--color-primary-light);
}


/* =========================
   LESSON DETAIL
   ========================= */
.lesson-detail {
  padding: var(--space-4) 0;
}

.lesson-detail-header {
  margin-bottom: var(--space-6);
}

.lesson-detail-header h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

.lesson-detail-header p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

.lesson-detail-section {
  margin-bottom: var(--space-6);
}

.lesson-detail-section h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

/* Root Cards */
.root-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

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

.root-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) ease,
    border-color var(--duration-base) ease;
}

.root-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--color-border-light);
}

.root-card-root {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-primary-light);
  margin-bottom: var(--space-1);
}

.root-card-origin {
  font-size: var(--text-xs);
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
}

.root-card-meaning {
  font-size: var(--text-base);
  color: var(--color-accent);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.root-card-examples {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

/* Affix Chips */
.affix-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.affix-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border: 1px solid var(--color-border);
  background: var(--color-surface-light);
  color: var(--color-text);
  transition:
    transform var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

.affix-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.affix-chip small {
  font-weight: var(--font-normal);
  color: var(--color-text-muted);
}

.prefix-chip {
  background: rgba(108, 92, 231, 0.12);
  border-color: rgba(108, 92, 231, 0.3);
  color: var(--color-primary-light);
}

.suffix-chip {
  background: rgba(0, 206, 201, 0.12);
  border-color: rgba(0, 206, 201, 0.3);
  color: var(--color-accent);
}

.lesson-detail-actions {
  margin-top: var(--space-8);
  padding-bottom: var(--space-4);
}


/* =========================
   BADGES
   ========================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-success {
  background: rgba(0, 184, 148, 0.15);
  color: var(--color-success-light);
  border: 1px solid rgba(0, 184, 148, 0.3);
}

.badge-warning {
  background: rgba(253, 203, 110, 0.15);
  color: var(--color-warning);
  border: 1px solid rgba(253, 203, 110, 0.3);
}

.badge-info {
  background: rgba(108, 92, 231, 0.15);
  color: var(--color-primary-light);
  border: 1px solid rgba(108, 92, 231, 0.3);
}


/* =========================
   PROFILE
   ========================= */
.profile-screen {
  padding: var(--space-2) 0 var(--space-6);
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-6) 0;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  border: 3px solid var(--color-primary);
  overflow: hidden;
  margin-bottom: var(--space-3);
  box-shadow: 0 0 24px rgba(108, 92, 231, 0.2);
  position: relative;
  background: var(--color-surface-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-4xl);
  color: var(--color-primary-light);
}

.avatar-img,
.avatar-img-lg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
}

.avatar-placeholder,
.avatar-placeholder-lg {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-primary-light);
  line-height: 1;
}

.avatar-placeholder-lg {
  font-size: var(--text-4xl);
}

.profile-name {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-1);
}

.profile-email {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-3);
  text-align: center;
  border: 1px solid var(--color-border);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  display: block;
  font-size: var(--text-2xl);
  font-weight: var(--font-black);
  color: var(--color-primary-light);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.stat-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-section {
  margin-bottom: var(--space-6);
}

.profile-section h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.achievements-grid .achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition:
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) ease;
}

.achievements-grid .achievement-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.achievements-grid .achievement-card.locked {
  opacity: 0.35;
  filter: grayscale(1);
}

.achievements-grid .achievement-card.earned {
  border-color: rgba(108, 92, 231, 0.4);
  box-shadow: 0 0 12px rgba(108, 92, 231, 0.1);
}

.achievements-grid .achievement-icon {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.achievements-grid .achievement-name {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  line-height: var(--leading-tight);
  margin-bottom: 2px;
}

.achievements-grid .achievement-desc {
  font-size: 10px;
  color: var(--color-text-dim);
}

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

.profile-actions {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}


/* =========================
   MODALS
   ========================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-4);
  transition:
    opacity var(--duration-base) ease,
    visibility var(--duration-base) ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modalSlideUp var(--duration-slow) var(--ease-out) forwards;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-xl);
  cursor: pointer;
  transition: background var(--duration-fast) ease;
  z-index: 2;
}

.modal-close-btn:hover {
  background: var(--color-surface-light);
  color: var(--color-text);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

.modal-body {
  padding: var(--space-5);
}

.modal-body p {
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }
}


/* =========================
   TOASTS
   ========================= */
.toast-container {
  position: fixed;
  top: calc(var(--top-bar-height) + var(--safe-area-top) + var(--space-3));
  right: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
  opacity: 0;
  transform: translateX(40px);
  transition:
    opacity var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  border-left: 3px solid var(--color-success);
}

.toast-error {
  border-left: 3px solid var(--color-danger);
}

.toast-info {
  border-left: 3px solid var(--color-primary);
}

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

.toast-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: background var(--duration-fast) ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: var(--color-surface-lighter);
  color: var(--color-text);
}


/* =========================
   SPINNER
   ========================= */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-surface-lighter);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

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

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  min-height: 200px;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.loading-text {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}


/* =========================
   DIVIDERS
   ========================= */
.divider {
  width: 100%;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-4) 0;
}


/* =========================
   SPEAK BUTTON
   ========================= */
.btn-speak {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: rgba(108, 92, 231, 0.12);
  border: 1px solid rgba(108, 92, 231, 0.25);
  color: var(--color-primary-light);
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: var(--space-2);
  transition:
    background var(--duration-fast) ease,
    transform var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

.btn-speak:hover {
  background: rgba(108, 92, 231, 0.2);
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(108, 92, 231, 0.3);
}

.btn-speak:active {
  transform: scale(0.95);
}

.btn-speak svg {
  width: 14px;
  height: 14px;
  display: block;
}

.btn-speak-inline {
  width: 24px;
  height: 24px;
}

.btn-speak-inline svg {
  width: 12px;
  height: 12px;
}

/* Tappable example words */
.example-word {
  cursor: pointer;
  border-bottom: 1px dashed var(--color-text-dim);
  transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

.example-word:hover {
  color: var(--color-primary-light);
  border-color: var(--color-primary-light);
}

/* Tappable affix chips */
.affix-chip[data-speak-root] {
  cursor: pointer;
}

.affix-chip[data-speak-root]:hover {
  border-color: var(--color-primary);
}


/* =========================
   SETTINGS TOGGLE
   ========================= */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-label {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.setting-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

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

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-surface-lighter);
  border-radius: var(--radius-full);
  transition: background var(--duration-fast) ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--color-text);
  border-radius: var(--radius-full);
  transition: transform var(--duration-fast) var(--ease-out);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-primary);
}

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

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.3);
}
