/* ============================================================
   Caplyra — Full Design System
   ============================================================ */

/* --- Google Fonts loaded in HTML --- */

:root {
  --bg: #141414;
  --surface: #1d1d1d;
  --surface2: #252525;
  --border: #2e2e2e;
  --text: #f0ede8;
  --muted: #6b6b6b;
  --accent: #e8c547;
  --accent2: #c9a82c;
  --green: #4ade80;
  --green-bg: rgba(74,222,128,0.06);
  --green-border: rgba(74,222,128,0.18);
  --red-bg: rgba(239,68,68,0.06);
  --red-border: rgba(239,68,68,0.18);
  --border-radius: 10px;
  --border-radius-sm: 7px;
}

/* --- Light mode --- */
body.light {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface2: #efecea;
  --border: #ddd8d0;
  --text: #1c1917;
  --muted: #78716c;
  --accent: #e8a500;
  --accent2: #cc8e00;
  --green: #15803d;
  --green-bg: rgba(21,128,61,0.07);
  --green-border: rgba(21,128,61,0.22);
  --red-bg: rgba(185,28,28,0.06);
  --red-border: rgba(185,28,28,0.2);
}

/* Nav */
body.light .top-nav {
  background: rgba(247,245,241,0.95);
}

/* Buttons */
body.light .btn-secondary {
  background: var(--surface2);
}
body.light .btn-ghost {
  color: var(--muted);
}
body.light .btn-ghost:hover:not(:disabled) {
  background: var(--surface2);
  color: var(--text);
}

/* Nav buttons */
body.light .nav-btn {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}
body.light .nav-btn:hover {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}
body.light .nav-btn.active {
  color: var(--accent);
  border-color: rgba(232,165,0,0.3);
  background: rgba(232,165,0,0.08);
}
body.light .theme-toggle-btn {
  color: var(--muted);
  border-color: var(--border);
}
body.light .theme-toggle-btn:hover {
  color: var(--text);
}

/* Toggle switch */
body.light .toggle-track {
  background: var(--border);
}
body.light .toggle-track::after {
  background: var(--muted);
}
body.light .toggle-switch input:checked + .toggle-track::after {
  background: #ffffff;
}

/* Error / warning text on light bg */
body.light .toast.error   { color: #b91c1c; }
body.light .inline-error  { color: #b91c1c; }

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 400;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

img, svg { display: block; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ============================================================
   Layout
   ============================================================ */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Loading screen --- */
#loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 12px;
}

#loading-screen .logo-mark {
  font-family: 'DM Serif Display', serif;
  font-size: 2.2rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}

/* --- Top nav --- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(20,20,20,0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-logo {
  font-family: 'DM Serif Display', serif;
  color: var(--accent);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.nav-logo-name {
  font-size: 1.25rem;
  line-height: 1;
}

.nav-logo-slogan {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: none;
  line-height: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1;
}

.nav-btn:hover {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}

.nav-btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #141414;
  font-weight: 600;
}

.nav-btn.accent:hover {
  background: var(--accent2);
  border-color: var(--accent2);
}

.nav-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 6px;
  flex-shrink: 0;
}

.badge {
  background: var(--accent);
  color: #0f0f0f;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 20px;
  min-width: 16px;
  text-align: center;
}

/* --- Main content area --- */
.main-content {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  width: 100%;
}

/* ============================================================
   Views (fade transitions)
   ============================================================ */

.view {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Voice bar (persistent top bar)
   ============================================================ */

.voice-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  cursor: default;
}

.voice-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.voice-bar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex-shrink: 0;
}

.voice-bar-traits {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-bar-demo-badge {
  font-size: 11px;
  background: rgba(232,197,71,0.12);
  color: var(--accent);
  border: 1px solid rgba(232,197,71,0.25);
  border-radius: 20px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.voice-bar-edit {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  font-family: 'DM Sans', sans-serif;
}

.voice-bar-edit:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* ============================================================
   Onboarding view
   ============================================================ */

.onboarding-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 0;
}

.onboarding-wrap h1 {
  font-size: 2rem;
  margin-bottom: 8px;
  line-height: 1.2;
}

.onboarding-slogan {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.01em;
  margin-bottom: 10px;
  margin-top: -4px;
}

.onboarding-wrap .subtitle {
  color: var(--muted);
  margin-bottom: 36px;
  font-size: 15px;
  line-height: 1.6;
}

.samples-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.sample-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  animation: fadeIn 0.2s ease;
}

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

.sample-card-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sample-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.sample-remove:hover { color: #ef4444; }

.sample-input-wrap {
  position: relative;
  margin-bottom: 12px;
}

.sample-textarea {
  width: 100%;
  min-height: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color 0.15s;
  outline: none;
}

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

.sample-textarea::placeholder { color: var(--muted); }

.char-counter {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}

.sample-counter {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
}

.sample-counter span {
  color: var(--accent);
  font-weight: 600;
}

.onboarding-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

/* Demo voice CTA */
.demo-divider {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
  outline: none;
}

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

.btn-primary {
  background: var(--accent);
  color: #0f0f0f;
  border-color: var(--accent);
}

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

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

.btn-secondary:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--border-radius-sm);
}

/* Spinner */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ============================================================
   Platform selector
   ============================================================ */

.platform-selector {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 4px;
}

.platform-selector::-webkit-scrollbar { display: none; }

.platform-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 2px 0 10px;
  min-width: 100%;
}

.platform-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 14px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  min-width: 76px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  outline: none;
}

.platform-tab svg { flex-shrink: 0; }

.platform-tab:hover {
  border-color: var(--muted);
  color: var(--text);
}

.platform-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  position: relative;
}

.platform-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
  min-height: 18px;
}

/* ============================================================
   Generator form
   ============================================================ */

.generator-section {
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 14px;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--muted); }

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--surface2);
  color: var(--text);
}

/* ============================================================
   Variant cards grid
   ============================================================ */

.variants-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

@media (max-width: 900px) {
  .variants-grid { grid-template-columns: 1fr; }
}

/* Skeleton loading */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-line {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line.h-sm { height: 14px; }
.skeleton-line.h-md { height: 18px; }
.skeleton-line.h-lg { height: 80px; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-40 { width: 40%; }

/* Variant card */
.variant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.25s ease;
  position: relative;
}

.variant-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.variant-label {
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
  line-height: 1.3;
}

.proven-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(232,197,71,0.12);
  border: 1px solid rgba(232,197,71,0.3);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: help;
  flex-shrink: 0;
}

/* Hook strength dots */
.hook-strength {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hook-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hook-label-text {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  flex-shrink: 0;
}

.hook-score-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-left: auto;
}

.hook-dots {
  display: flex;
  gap: 4px;
}

.hook-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
}

.hook-dot.filled { background: var(--accent); }

.hook-explanation {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  font-style: italic;
}

/* Caption text */
.caption-text {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Hashtags block */
.hashtags-block {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.hashtags-toggle {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}

.hashtags-toggle:hover { color: var(--text); }

.hashtags-content {
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent);
  line-height: 1.6;
  word-break: break-word;
}

/* Pros/cons */
.pros-cons {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.pros-section-label, .cons-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
  margin-top: 4px;
}

.pros-section-label:first-child { margin-top: 0; }

.pros-section-label { color: var(--green); }
.cons-section-label { color: #f87171; }

.pro-item, .con-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.pro-item {
  color: rgba(74,222,128,0.85);
}

.con-item {
  color: rgba(248,113,113,0.85);
}

.pro-icon, .con-icon {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
}

/* Character count */
.char-count-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  display: inline-block;
}

.char-count-badge.ok {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.char-count-badge.warn {
  background: rgba(232,197,71,0.08);
  color: var(--accent);
  border: 1px solid rgba(232,197,71,0.2);
}

.char-count-badge.over {
  background: var(--red-bg);
  color: #f87171;
  border: 1px solid var(--red-border);
}

/* Card actions */
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ============================================================
   Upgrade banner
   ============================================================ */

.upgrade-banner {
  background: var(--surface);
  border: 1px solid rgba(232,197,71,0.2);
  border-radius: var(--border-radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.upgrade-banner-text {
  font-size: 13px;
  color: var(--text);
}

.upgrade-banner-text strong { color: var(--accent); }

/* ============================================================
   History panel (slide-out right drawer)
   ============================================================ */

.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.history-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.history-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.history-panel.open { transform: translateX(0); }

.history-panel-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.history-panel-header h3 {
  font-size: 1rem;
}

.panel-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.panel-close:hover { color: var(--text); }

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.history-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.history-item:hover { background: var(--surface2); }

.history-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.history-platform-icon {
  color: var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.history-topic {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.history-dot.logged { background: var(--green); }
.history-dot.unlogged { background: var(--border); }

.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.history-item-expanded {
  padding: 10px 20px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: none;
  gap: 8px;
  flex-direction: column;
}

.history-item-expanded.open { display: flex; }

.history-variant-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-variant-chip {
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 20px;
  color: var(--muted);
}

.history-expanded-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Fixed history toggle button */
.history-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 150;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.history-toggle:hover {
  border-color: var(--muted);
  background: var(--surface2);
}

/* ============================================================
   Voice profile drawer
   ============================================================ */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.voice-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.voice-drawer.open { transform: translateX(0); }

.voice-drawer-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.voice-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Voice profile trait grid */
.trait-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 480px) {
  .trait-grid { grid-template-columns: 1fr; }
}

.trait-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  padding: 12px 14px;
}

.trait-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.trait-card-value {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.trait-card-bar {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  margin-top: 6px;
  overflow: hidden;
}

.trait-card-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.6s ease;
}

.tone-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tone-tag {
  font-size: 12px;
  background: rgba(232,197,71,0.1);
  color: var(--accent);
  border: 1px solid rgba(232,197,71,0.2);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ============================================================
   Performance logging sheet
   ============================================================ */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.perf-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-overlay.open .perf-sheet {
  transform: translateY(0);
}

.perf-sheet h3 {
  font-size: 1.1rem;
  margin-bottom: 0;
}

.perf-sheet-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.15s;
}

.perf-sheet-close:hover { color: var(--text); }

.perf-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Variant caption preview in perf sheet */
.perf-caption-preview {
  margin-top: 8px;
  padding: 11px 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 130px;
  overflow-y: auto;
}

/* Goal pills */
.goal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.goal-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
}

.goal-pill.active {
  background: rgba(232,197,71,0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* Star rating */
.star-rating {
  display: flex;
  gap: 4px;
}

.star-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--border);
  padding: 0;
  transition: color 0.1s, transform 0.1s;
  line-height: 1;
}

.star-btn.active { color: var(--accent); }
.star-btn:hover { transform: scale(1.1); }

/* Metric grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

.metric-input-wrap label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.metric-input-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s;
}

.metric-input-wrap input:focus {
  border-color: var(--accent);
}

/* ============================================================
   Insights panel
   ============================================================ */

.insights-view .section-heading {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.insights-view .section-sub {
  color: var(--muted);
  margin-bottom: 24px;
}

.platform-insight-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.platform-insight-tabs::-webkit-scrollbar { display: none; }

.insight-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.insight-tab-count {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  padding: 1px 6px;
  letter-spacing: 0.02em;
}

.insight-tab.active .insight-tab-count {
  background: rgba(232,197,71,0.12);
  border-color: rgba(232,197,71,0.3);
  color: var(--accent);
}

.insight-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.insights-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 16px;
}

.insights-card h4 {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem;
  margin-bottom: 12px;
}

.insights-pattern-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insights-pattern-list li {
  font-size: 13.5px;
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
  color: var(--text);
}

.insights-pattern-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.insight-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.insight-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px 0;
  overflow: hidden;
}

.insight-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.insight-platform-progress-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.insight-platform-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.insight-platform-progress-label {
  flex: 1;
  color: var(--text);
}

.insight-platform-progress-count {
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}

.insight-platform-progress-count.done {
  color: var(--green);
}

.insight-platform-progress-need {
  font-size: 11px;
  color: var(--muted);
  min-width: 48px;
}

.insight-platform-progress-done {
  font-size: 11px;
  color: var(--green);
  min-width: 48px;
}

.best-post-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.best-post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.best-post-label {
  font-size: 13px;
  font-weight: 500;
}

.best-post-stars {
  color: var(--accent);
  font-size: 13px;
}

/* ============================================================
   Toast notifications
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

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

.toast.success { border-color: var(--green-border); color: var(--green); }
.toast.error { border-color: var(--red-border); color: #f87171; }

/* ============================================================
   Inline error
   ============================================================ */

.inline-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--border-radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

/* ============================================================
   Nav tabs for main views
   ============================================================ */

.main-nav-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.main-nav-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.main-nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.main-nav-tab:hover:not(.active) { color: var(--text); }

/* ============================================================
   Inline generate CTA after demo use
   ============================================================ */

.create-voice-cta {
  background: var(--surface);
  border: 1px solid rgba(232,197,71,0.2);
  border-radius: var(--border-radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.create-voice-cta p {
  font-size: 13px;
  color: var(--text);
  margin: 0;
}

.create-voice-cta strong { color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 600px) {
  .main-content { padding: 20px 16px 80px; }
  .top-nav { padding: 0 16px; }
  .history-panel { width: 100%; }
  .voice-drawer { width: 100%; }
  .onboarding-wrap { padding: 24px 0; }
  .onboarding-wrap h1 { font-size: 1.6rem; }
}

/* ============================================================
   Misc utilities
   ============================================================ */

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 12px; }

.hidden { display: none !important; }

/* ============================================================
   Nav active state
   ============================================================ */

.nav-btn.active {
  background: var(--surface2);
  border-color: rgba(232,197,71,0.3);
  color: var(--accent);
}

.nav-btn.active .nav-icon {
  opacity: 1;
}

.nav-pro-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(232,197,71,0.1);
  border: 1px solid rgba(232,197,71,0.25);
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* Inline plan badge next to user name in nav */
.nav-user-plan-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 5px;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.nav-user-plan-pro {
  background: rgba(232,197,71,0.12);
  color: var(--accent);
  border: 1px solid rgba(232,197,71,0.3);
}
.nav-user-plan-free {
  background: rgba(136,136,136,0.1);
  color: var(--muted);
  border: 1px solid rgba(136,136,136,0.2);
}

/* EU consent modal */
.eu-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.eu-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 420px;
}
.eu-modal-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.eu-modal-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.eu-modal-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}
.eu-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  margin-top: 12px;
  line-height: 1.5;
}
.eu-consent-label input[type=checkbox] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.eu-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Theme toggle button in nav */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--border-radius-sm);
  padding: 5px 9px;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.theme-toggle-btn:hover { border-color: var(--muted); color: var(--text); }

/* Toggle switch (Settings) */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

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

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: #0f0f0f;
}

/* ============================================================
   History toggle
   ============================================================ */

.history-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.history-topic-row .history-page-topic {
  padding: 12px 0;
  border-bottom: none;
  flex: 1;
}

.history-captions-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.history-captions-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* ============================================================
   Settings page
   ============================================================ */

.settings-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

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

.settings-card-header h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem;
  font-weight: 400;
}

.settings-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.settings-trait-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.settings-trait-row:last-of-type { border-bottom: none; }

.settings-trait-label {
  color: var(--muted);
  flex-shrink: 0;
  min-width: 130px;
}

.settings-trait-val {
  color: var(--text);
  text-align: right;
  line-height: 1.5;
}

.settings-uid {
  font-size: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--muted);
  word-break: break-all;
}

/* Stats grid */
.settings-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .settings-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.settings-stat {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  padding: 12px 14px;
  text-align: center;
}

.settings-stat-value {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  color: var(--text);
  line-height: 1.2;
}

.settings-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.settings-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Plan */
.settings-plan-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
}

.settings-plan-free {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.settings-plan-pro {
  background: rgba(232,197,71,0.12);
  color: var(--accent);
  border: 1px solid rgba(232,197,71,0.3);
}

.settings-plan-features {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.settings-plan-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.settings-upgrade-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(232,197,71,0.06);
  border: 1px solid rgba(232,197,71,0.18);
  border-radius: var(--border-radius-sm);
  padding: 14px 16px;
  flex-wrap: wrap;
}

/* Danger zone */
.settings-danger-card {
  border-color: var(--red-border);
  background: var(--red-bg);
}

.settings-danger-card .settings-card-header h3 {
  color: #f87171;
}

.settings-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 0;
}

/* ============================================================
   History page (full view)
   ============================================================ */

.history-page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.history-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.history-page-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-platform-icon svg { display: inline-block; vertical-align: middle; }

.history-page-platform {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-page-time {
  font-size: 12px;
  color: var(--muted);
}

.history-logged-badge {
  font-size: 11px;
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  padding: 2px 8px;
  border-radius: 20px;
}

.history-unlogged-badge {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

.history-page-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.history-page-topic {
  padding: 12px 18px;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.history-variants-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

@media (max-width: 900px) {
  .history-variants-grid { grid-template-columns: 1fr; }
}

.history-variant-card {
  padding: 16px 18px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-hook-explanation {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  font-style: italic;
}

.history-pros-cons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 2px;
}

.history-variant-card:last-child { border-right: none; }

@media (max-width: 900px) {
  .history-variant-card {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .history-variant-card:last-child { border-bottom: none; }
}

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

.history-variant-label {
  font-family: 'DM Serif Display', serif;
  font-size: 0.95rem;
  color: var(--text);
}

.history-caption-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}

.history-hashtags {
  font-size: 12px;
  color: var(--accent);
  line-height: 1.6;
  word-break: break-word;
}

.history-variant-footer {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ============================================================
   Monetisation — locked states, upgrade prompts, soft walls
   ============================================================ */

/* Inline regen upgrade prompt (below variant card) */
.regen-upgrade-prompt {
  margin: 6px 0 2px;
  padding: 10px 14px;
  background: rgba(232,197,71,0.06);
  border: 1px solid rgba(232,197,71,0.2);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  color: var(--text);
  animation: fadeIn 0.15s ease;
}

.upgrade-inline-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.upgrade-inline-link:hover { color: var(--accent2); text-decoration: underline; }

/* History soft wall */
.history-soft-wall {
  margin: 8px 0 24px;
  border: 1px dashed var(--border);
  border-radius: var(--border-radius);
  padding: 28px 20px;
  text-align: center;
  background: var(--surface);
}

.history-soft-wall-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.history-soft-wall-inner p {
  font-size: 14px;
  color: var(--muted);
  max-width: 320px;
  line-height: 1.6;
}

/* Locked insights teaser */
.locked-insights-wrap {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.locked-insights-teaser {
  display: flex;
  flex-direction: column;
  gap: 14px;
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.locked-insights-teaser .insights-card {
  opacity: 0.6;
}

.locked-insights-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(15,15,15,0.72);
  backdrop-filter: blur(2px);
  border-radius: var(--border-radius);
  text-align: center;
  padding: 24px;
}

.locked-insights-overlay p {
  font-size: 14px;
  color: var(--muted);
  max-width: 300px;
  line-height: 1.6;
}

/* Plan comparison table in Settings */
.plan-compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 13px;
}

.plan-compare-table th {
  text-align: center;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.plan-compare-table th:first-child { text-align: left; }

.plan-compare-table td {
  padding: 7px 12px;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.plan-compare-table td:first-child {
  color: var(--muted);
  font-size: 12.5px;
}

.plan-compare-table td:not(:first-child) { text-align: center; }

.plan-compare-table tr:last-child td { border-bottom: none; }

.plan-check { color: var(--green); font-size: 15px; }
.plan-cross { color: var(--muted); font-size: 15px; }
.plan-col-active { color: var(--accent) !important; font-weight: 600; }

/* Goal selector hint */
.form-label-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
}

.form-label-hint-pro {
  color: var(--accent);
}

/* Caption polish UI */
.polish-ui {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  animation: fadeIn 0.15s ease;
}

.polish-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  min-width: 0;
}

.polish-input::placeholder { color: var(--muted); }

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

/* ============================================================
   Landing page
   ============================================================ */

.landing {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: rgba(15,15,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

body.light .landing-nav {
  background: rgba(247,245,241,0.94);
}

.landing-nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.35rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hero */
.landing-hero {
  padding: 96px 24px 80px;
  text-align: center;
}

.landing-hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.landing-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(232,165,0,0.1);
  border: 1px solid rgba(232,165,0,0.25);
  border-radius: 20px;
  padding: 5px 14px;
  margin-bottom: 24px;
}

.landing-headline {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  color: var(--text);
}

.landing-headline em {
  font-style: italic;
  color: var(--accent);
}

.landing-sub {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--muted);
  max-width: 580px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.landing-cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.landing-cta-primary {
  font-size: 15px;
  padding: 13px 28px;
}

.landing-cta-note {
  font-size: 13px;
  color: var(--muted);
}

.landing-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.landing-stat-value {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  color: var(--accent);
}

.landing-stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Sections */
.landing-section {
  padding: 80px 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.landing-section-alt {
  background: var(--surface);
  max-width: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.landing-section-alt > * {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.landing-section-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  text-align: center;
  margin-bottom: 10px;
}

.landing-section-sub {
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 48px;
}

/* Steps */
.landing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

@media (max-width: 700px) {
  .landing-steps { grid-template-columns: 1fr; }
}

.landing-step {
  text-align: center;
  padding: 32px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}

.landing-step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(232,165,0,0.12);
  border: 1px solid rgba(232,165,0,0.3);
  color: var(--accent);
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.landing-step-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

.landing-step-desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.65;
}

/* Features */
.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 24px;
  max-width: 1000px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .landing-features-grid { grid-template-columns: 1fr; }
}

.landing-feature-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 24px 20px;
}

.landing-feature-icon {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

.landing-feature-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

.landing-feature-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

/* Pricing */
.landing-pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 720px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .landing-pricing-grid { grid-template-columns: 1fr; }
}

.landing-pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 28px 24px;
  position: relative;
}

.landing-pricing-card.featured {
  border-color: var(--accent);
  background: var(--surface2);
}

.pricing-card-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #0f0f0f;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.pricing-card-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.landing-pricing-card.featured .pricing-card-name { color: var(--accent); }

.pricing-card-price {
  margin-bottom: 4px;
}

.pricing-price-amount {
  font-family: 'DM Serif Display', serif;
  font-size: 2.4rem;
  color: var(--text);
}

.pricing-price-period {
  font-size: 14px;
  color: var(--muted);
}

.pricing-year-note {
  font-size: 12px;
  color: var(--green);
  margin-bottom: 16px;
}

.pricing-feature-list {
  list-style: none;
  margin: 16px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pricing-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.pricing-feature-item.locked { color: var(--muted); }

.pricing-cta {
  width: 100%;
  justify-content: center;
}

/* Final CTA */
.landing-final-cta {
  padding: 80px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.landing-final-cta h2 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: 12px;
}

.landing-final-cta p {
  color: var(--muted);
  margin-bottom: 28px;
}

/* Footer */
.landing-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   Auth modal
   ============================================================ */

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.auth-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 400px;
  position: relative;
}

.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
}
.auth-modal-close:hover { color: var(--text); }

.auth-modal-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  color: var(--accent);
  text-align: center;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.auth-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: #f87171;
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

body.light .auth-error { color: #b91c1c; }

.auth-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s;
  display: block;
  margin-bottom: 10px;
}

.auth-input:focus { border-color: var(--accent); }
.auth-input::placeholder { color: var(--muted); }

.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.auth-switch {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  margin-top: 16px;
}

.auth-switch-link {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
}
.auth-switch-link:hover { text-decoration: underline; }

.captcha-wrap {
  margin: 4px 0 8px;
  min-height: 78px;
}

.check-email-view {
  padding: 8px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.check-email-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: var(--text);
  margin: 0;
}
.check-email-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}
.check-email-resend-status {
  color: #f87171;
  font-size: 13px;
  margin: 0;
}

/* ============================================================
   Navbar upgrade / pro badge
   ============================================================ */

.nav-upgrade-btn {
  background: rgba(232,165,0,0.1) !important;
  border-color: rgba(232,165,0,0.35) !important;
  color: var(--accent) !important;
  font-weight: 600;
}

.nav-upgrade-btn:hover {
  background: rgba(232,165,0,0.18) !important;
}


/* ============================================================
   Upgrade page (in-app)
   ============================================================ */

.upgrade-page {
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 60px;
}

.upgrade-hero {
  text-align: center;
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.upgrade-hero-sub {
  color: var(--muted);
  font-size: 15px;
  max-width: 500px;
  margin: 8px auto 28px;
  line-height: 1.7;
}

.upgrade-pricing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.upgrade-price {
  display: flex;
  align-items: baseline;
}

.upgrade-price-amount {
  font-family: 'DM Serif Display', serif;
  font-size: 3rem;
  color: var(--text);
}

.upgrade-price-period {
  font-size: 15px;
  color: var(--muted);
}

.upgrade-price-alt {
  font-size: 13px;
  color: var(--green);
  margin-bottom: 16px;
}

.upgrade-checkout-btn {
  font-size: 15px;
  padding: 13px 32px;
}

.upgrade-section-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 16px;
}

.upgrade-features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 40px;
}

@media (max-width: 580px) {
  .upgrade-features-grid { grid-template-columns: 1fr; }
}

.upgrade-feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 18px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.upgrade-feature-icon { font-size: 1.3rem; flex-shrink: 0; }
.upgrade-feature-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.upgrade-feature-desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.upgrade-compare-table { margin: 0; }

.upgrade-final-cta {
  text-align: center;
  padding: 32px 0 0;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Top-up packs (upgrade banner)
   ============================================================ */

.topup-packs {
  margin-bottom: 12px;
}

.topup-packs-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.topup-packs-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.topup-btn {
  font-size: 12px;
  padding: 6px 12px;
  white-space: nowrap;
}

.topup-or-divider {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0;
  text-align: center;
}

/* ============================================================
   Auth consent checkboxes
   ============================================================ */

.auth-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
  cursor: pointer;
  line-height: 1.5;
}

.auth-consent-check {
  flex-shrink: 0;
  margin-top: 2px;
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
}

.auth-consent-label a {
  color: var(--accent);
  text-decoration: underline;
}

/* ============================================================
   App footer (in-app)
   ============================================================ */

.app-footer {
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: auto;
}

.app-footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.app-footer-link {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}

.app-footer-link:hover {
  color: var(--text);
}

.app-footer-copy {
  font-size: 11px;
  color: var(--muted);
}

/* ============================================================
   Landing page footer update
   ============================================================ */

.landing-footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.landing-footer-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
}

.landing-footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.landing-footer-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.landing-footer-link:hover {
  color: var(--text);
}

.landing-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ============================================================
   Legal pages overlay
   ============================================================ */

.legal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow-y: auto;
}

.legal-page-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.legal-page-header {
  margin-bottom: 32px;
}

.legal-back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.15s, border-color 0.15s;
}

.legal-back-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

.legal-content h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  margin-bottom: 6px;
  line-height: 1.2;
}

.legal-content h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--text);
}

.legal-content p {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.8;
}

.legal-content ul {
  margin: 8px 0 12px 20px;
}

.legal-content li {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.7;
}

.legal-content a {
  color: var(--accent);
  word-break: break-all;
}

.legal-content em {
  color: var(--muted);
  font-style: italic;
}

.legal-content strong {
  color: var(--text);
}

.legal-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 28px;
}

.legal-placeholder-notice {
  background: rgba(232, 197, 71, 0.1);
  border: 1px solid rgba(232, 197, 71, 0.3);
  border-radius: var(--border-radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--accent);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ============================================================
   RESPONSIVE — MOBILE FIXES
   Last updated: 2026-04-01 — 15 mobile fixes applied per audit 2026-04-01
   All rules below are additive. Nothing above is removed.
   ============================================================ */

/* FIX 1 — TOP NAV: Hamburger approach (text nodes can't be CSS-hidden)
   .hamburger-btn is injected by initMobileNav() in app.js */
@media (max-width: 640px) {
  .hamburger-btn {
    display: flex !important;
  }

  .nav-actions {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    left: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 8px 16px 16px;
    gap: 4px;
    z-index: 101;
  }

  .top-nav.nav-open .nav-actions {
    display: flex;
  }

  .nav-actions .nav-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    min-height: 44px;
  }

  .top-nav {
    position: relative;
    padding: 0 12px;
  }

  .nav-logo-slogan {
    display: none;
  }

  .nav-logo {
    font-size: 15px;
  }
}

/* FIX 2 — LANDING NAV PADDING */
@media (max-width: 600px) {
  .landing-nav {
    padding: 0 16px;
  }
}

/* FIX 3 — LANDING STATS GAP */
@media (max-width: 480px) {
  .landing-stats {
    gap: 24px;
    justify-content: center;
  }
}

/* FIX 4 — HISTORY PAGE ACTIONS NOT WRAPPING */
.history-page-actions {
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .history-page-actions {
    width: 100%;
  }

  .history-page-actions .btn {
    flex: 1;
    min-width: 0;
    text-align: center;
    justify-content: center;
  }
}

/* FIX 5 — VARIANT CARD ACTIONS OVERFLOW (Generator + History) */
.card-actions {
  flex-wrap: wrap;
}

.history-variant-footer {
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .card-actions {
    gap: 6px;
  }

  .history-variant-footer {
    gap: 6px;
  }
}

/* FIX 6 — PLAN COMPARISON TABLE (Settings + Upgrade)
   Tables are <table> elements; wrapping is done in JS (renderSettingsPage /
   showUpgradeView). These rules support the scroll wrapper. */
@media (max-width: 600px) {
  .settings-card .plan-compare-table,
  .upgrade-page .plan-compare-table {
    font-size: 12px;
  }
}

/* FIX 7 — SETTINGS TRAIT ROWS */
@media (max-width: 480px) {
  .settings-trait-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .settings-trait-label {
    min-width: unset;
    width: 100%;
    font-weight: 500;
  }

  .settings-trait-val {
    width: 100%;
    text-align: left;
  }
}

/* FIX 8 — STAR RATING TOUCH TARGETS (Performance sheet) */
.star-btn {
  min-width: 36px;
  min-height: 44px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* FIX 9 — VOICE DRAWER GAP AT 481-599PX */
@media (max-width: 560px) {
  .voice-drawer {
    width: 100%;
  }
}

/* FIX 10 — FLOATING HISTORY TOGGLE — iOS safe area */
.history-toggle {
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
}

/* FIX 11 — PLATFORM TABS SCROLL INDICATOR
   Requires .platform-selector-wrap wrapper in DOM (not added — skip) */
.platform-selector-wrap {
  position: relative;
}

.platform-selector-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 100%;
  background: linear-gradient(to right, transparent, var(--bg));
  pointer-events: none;
}

/* FIX 12 — ONBOARDING BUTTONS AT 320PX */
@media (max-width: 400px) {
  .onboarding-actions {
    flex-direction: column;
  }

  .onboarding-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* FIX 13 — AUTH CONSENT CHECKBOXES */
.auth-consent-check {
  width: 18px;
  height: 18px;
  min-width: 18px;
  cursor: pointer;
}

/* FIX 14 — UPGRADE TOPUP PACKS AT 320PX */
@media (max-width: 480px) {
  .topup-packs-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .topup-pack-btn {
    width: 100%;
  }
}

/* FIX 15 — PERFORMANCE SHEET METRIC INPUTS TOUCH SIZE */
@media (max-width: 600px) {
  .metric-input-wrap input {
    min-height: 44px;
    padding: 10px;
    font-size: 16px;
  }
}

/* ADDITIONAL — all form inputs min font-size 16px on mobile
   (prevents iOS Safari auto-zoom on focus) */
@media (max-width: 600px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  textarea,
  select {
    font-size: 16px;
  }
}

/* ADDITIONAL — main content bottom padding for floating button clearance */
@media (max-width: 640px) {
  .main-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

/* ADDITIONAL — perf sheet bottom safe area */
@media (max-width: 640px) {
  .perf-sheet {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

