/* FlowState ADHD — Reader Styles */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:        #0d1117;
  --bg-card:   #161b22;
  --teal:      #00d4c8;
  --teal-dim:  rgba(0, 212, 200, 0.10);
  --teal-mid:  rgba(0, 212, 200, 0.22);
  --text:      #e6edf3;
  --muted:     #7d8590;
  --border:    rgba(255,255,255,0.07);
  --border-hi: rgba(0,212,200,0.28);
  --radius:    12px;
  --nav-h:     58px;
  --sidebar-w: 360px;
}

html { scroll-behavior: smooth; height: 100%; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100%;
}

/* ── Nav ──────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(13,17,23,0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.18s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--teal); }

.nav-cta {
  background: var(--teal) !important;
  color: #0a0e13 !important;
  padding: 0.45rem 1.1rem !important;
  border-radius: 7px !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
}

.nav-cta:hover { opacity: 0.88; }

/* ── Hero (shown when no text loaded — SEO content) ──────────────── */

.hero {
  padding: 5rem 2rem 4rem;
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--teal-dim);
  border: 1px solid var(--teal-mid);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 1.25rem;
}

.hero h1 span { color: var(--teal); }

.hero-lead {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--muted);
  line-height: 1.75;
  max-width: 580px;
  margin: 0 auto 2rem;
}

.hero-demo {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin: 0 auto 2rem;
  max-width: 600px;
  text-align: left;
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero-demo b { font-weight: 800; }

.hero-demo .demo-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  display: block;
}

.hero-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

/* ── App ──────────────────────────────────────────────────────────── */

#app { width: 100%; }

/* ── Input View ──────────────────────────────────────────────────── */

.input-view {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}

.input-card h2 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.85rem;
}

#text-input {
  width: 100%;
  min-height: 200px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  padding: 1rem 1.1rem;
  resize: vertical;
  transition: border-color 0.18s;
}

#text-input:focus { outline: none; border-color: var(--teal-mid); }
#text-input::placeholder { color: var(--muted); }

.import-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.import-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.65rem 1.05rem;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.import-btn:hover {
  border-color: var(--teal-mid);
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.import-btn.active { border-color: var(--teal); color: var(--teal); }

.url-bar {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.url-bar input {
  flex: 1;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--teal-mid);
  border-radius: 9px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
}

.url-bar input:focus { outline: none; border-color: var(--teal); }
.url-bar input::placeholder { color: var(--muted); }

.url-go-btn {
  background: var(--teal);
  border: none;
  border-radius: 9px;
  color: #0a0e13;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.65rem 1.3rem;
  cursor: pointer;
}

.url-go-btn:hover { opacity: 0.88; }

.word-count {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.convert-btn {
  width: 100%;
  background: var(--teal);
  border: none;
  border-radius: 11px;
  color: #0a0e13;
  font-family: 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 1rem;
  cursor: pointer;
  margin-top: 1.1rem;
  transition: opacity 0.18s, transform 0.15s, box-shadow 0.18s;
}

.convert-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,212,200,0.18);
}
.convert-btn:active { transform: translateY(0); }

/* History */
.history-section { margin-top: 0.5rem; }

.history-section h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.history-list { display: flex; flex-direction: column; gap: 0.6rem; }

.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.15s;
}

.history-item:hover { border-color: var(--border-hi); transform: translateX(2px); }

.history-item-text { flex: 1; min-width: 0; }

.history-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }

.history-item-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.18s, color 0.18s;
}

.history-item-del:hover { opacity: 1; color: #ff4d4d; }

/* ── Reader View (full-height app shell) ─────────────────────────── */

.reader-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h));
}

/* Top toolbar */
.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 1.25rem;
  height: 62px;
  background: rgba(13,17,23,0.6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.reader-toolbar::-webkit-scrollbar { display: none; }

.toolbar-back {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.55rem 0.95rem;
  flex-shrink: 0;
  transition: color 0.18s, border-color 0.18s;
}

.toolbar-back:hover { color: var(--teal); border-color: var(--teal-mid); }

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

/* Segmented mode control */
.mode-tabs {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 4px;
}

.mode-tab {
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1.15rem;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
  white-space: nowrap;
}

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

.mode-tab.active {
  color: #0a0e13;
  background: var(--teal);
}

.toolbar-spacer { flex: 1; }

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.toolbar-btn:hover {
  border-color: var(--teal-mid);
  color: var(--teal);
  background: rgba(0,212,200,0.06);
}

.toolbar-btn.active {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-dim);
}

/* TTS speed inline */
.tts-speed {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 0.4rem;
}

.tts-speed input[type=range] { width: 64px; accent-color: var(--teal); }

/* Body = reading area + persistent sidebar */
.reader-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── Reading Area ─────────────────────────────────────────────────── */

.reading-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--reader-bg, #1a1a2e);
  color: var(--reader-text, #e8e8f0);
  font-size: var(--reader-font-size, 18px);
  font-family: var(--reader-font, system-ui, sans-serif);
  line-height: var(--reader-line-height, 1.6);
  word-spacing: var(--reader-word-spacing, 2px);
  transition: background 0.3s, color 0.3s;
}

.scroll-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 2.5rem 7rem;
}

.bionic-para { margin-bottom: var(--reader-para-gap, 16px); }
.bionic-para b { font-weight: 800; }

.line-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 2.5rem 2.5rem 7rem;
}

.line-item {
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: background 0.15s;
}

.focus-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 2rem;
  text-align: center;
}

.focus-text {
  max-width: 760px;
  font-size: calc(var(--reader-font-size, 18px) + 5px);
  line-height: var(--reader-line-height, 1.6);
  margin-bottom: 3rem;
}

.focus-nav { display: flex; align-items: center; gap: 2rem; }

.focus-arrow {
  background: none;
  border: 2px solid var(--teal-mid);
  border-radius: 50%;
  color: var(--teal);
  font-size: 2rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.18s, opacity 0.18s, transform 0.15s;
}

.focus-arrow:hover:not(:disabled) { border-color: var(--teal); transform: scale(1.05); }
.focus-arrow:disabled { opacity: 0.2; cursor: default; }

.focus-progress {
  font-size: 0.9rem;
  color: var(--muted);
  min-width: 84px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── Style Sidebar (persistent on desktop) ───────────────────────── */

.style-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #0f141b;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.style-panel-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.style-panel-close {
  display: none;            /* only shown on mobile bottom-sheet */
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.18s;
}

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

.style-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.4rem 2.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.style-panel-body::-webkit-scrollbar { width: 8px; }
.style-panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Sliders */
.slider-row { margin-bottom: 1.25rem; }

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.slider-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.slider-value {
  font-size: 0.8rem;
  color: var(--teal);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

input[type=range] {
  width: 100%;
  height: 6px;
  accent-color: var(--teal);
  cursor: pointer;
}

/* Section labels */
.panel-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 1.6rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* Chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }

.chip {
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover { border-color: var(--teal-mid); color: var(--text); }

.chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #0a0e13;
  font-weight: 700;
}

/* Scheme chips */
.scheme-chip {
  padding: 0.5rem 0.85rem;
  border-radius: 9px;
  border: 2px solid transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.scheme-chip:hover { transform: translateY(-1px); }
.scheme-chip.active { border-color: var(--teal) !important; box-shadow: 0 0 0 3px var(--teal-dim); }

/* Bold colour dots */
.color-dot-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 0.5rem; }

.color-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem;
  border: 2px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.color-dot-wrap:hover { border-color: var(--border-hi); }
.color-dot-wrap.active { border-color: var(--teal); }

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
}

.color-dot-label { font-size: 0.68rem; color: var(--muted); }

/* Presets */
.presets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}

.save-preset-btn {
  background: none;
  border: 1px solid var(--teal-mid);
  border-radius: 20px;
  color: var(--teal);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.save-preset-btn:hover { border-color: var(--teal); background: var(--teal-dim); }

.preset-name-row { display: flex; gap: 0.5rem; margin-bottom: 0.7rem; }

.preset-name-input {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--teal-mid);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
}

.preset-name-input:focus { outline: none; border-color: var(--teal); }

.preset-confirm-btn {
  background: var(--teal);
  border: none;
  border-radius: 8px;
  color: #0a0e13;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

.preset-cancel-btn {
  background: rgba(255,255,255,0.07);
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
}

.preset-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.5rem; }

.preset-chip {
  display: flex;
  align-items: center;
  border: 1px solid var(--teal-mid);
  border-radius: 20px;
  overflow: hidden;
}

.preset-chip-name {
  background: none;
  border: none;
  color: var(--teal);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem 0.35rem 0.85rem;
  cursor: pointer;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-chip-del {
  background: none;
  border: none;
  border-left: 1px solid rgba(0,212,200,0.2);
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s;
}

.preset-chip-del:hover { color: #ff4d4d; }

.presets-empty { font-size: 0.8rem; color: var(--muted); font-style: italic; line-height: 1.5; }

/* ── Kindle Modal ─────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  background: #111827;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 460px;
  width: 100%;
}

.modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text); }
.modal p { font-size: 0.9rem; color: var(--muted); line-height: 1.7; margin-bottom: 0.75rem; }

.modal-steps { list-style: none; margin: 0.5rem 0 1.25rem; }

.modal-steps li {
  display: flex;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.modal-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal);
  color: #0a0e13;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.modal-close {
  width: 100%;
  background: var(--teal);
  border: none;
  border-radius: 9px;
  color: #0a0e13;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem;
  cursor: pointer;
}

.modal-close:hover { opacity: 0.88; }

/* Loading */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,17,23,0.75);
  z-index: 250;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.loading-overlay.open { opacity: 1; pointer-events: auto; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.loading-label { font-size: 0.88rem; color: var(--teal); font-weight: 600; }

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #1f2937;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.65rem 1.25rem;
  font-size: 0.88rem;
  color: var(--text);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* Mobile-only overlay behind the bottom-sheet sidebar */
.style-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  display: none;
}

/* ── Footer ───────────────────────────────────────────────────────── */

.footer-wrap { border-top: 1px solid var(--border); }

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy { font-size: 0.8rem; color: var(--muted); }

.footer-nav { display: flex; gap: 1.5rem; list-style: none; }

.footer-nav a {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s;
}

.footer-nav a:hover { color: var(--teal); }

.hidden { display: none !important; }

/* Reader is a focused full-screen mode: lock body scroll + hide marketing chrome */
body.reading { overflow: hidden; }
body.reading .footer-wrap { display: none; }
body.reading .site-outro { display: none; }

/* ── Support outro (above footer, input view only) ──────────────────── */

.site-outro {
  border-top: 1px solid var(--border);
  padding: 4rem 1.5rem 1.5rem;
  text-align: center;
}

/* Buy Me a Coffee button in its signature yellow */
.coffee-btn {
  display: inline-block;
  background: #ffdd00;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  padding: 0.8rem 1.8rem;
  border-radius: 10px;
  transition: transform 0.15s, box-shadow 0.18s, background 0.18s;
}

.coffee-btn:hover {
  background: #ffd400;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(255, 221, 0, 0.25);
}

.outro-reassurance {
  margin-top: 1.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Print ────────────────────────────────────────────────────────── */

@media print {
  .nav, .reader-toolbar, .style-sidebar, .style-overlay,
  .modal-overlay, .loading-overlay, .toast, .footer-wrap,
  .hero, .input-view, .focus-nav { display: none !important; }

  body { background: white !important; color: black !important; }

  .reader-body { display: block !important; }

  .reading-area {
    background: white !important;
    color: black !important;
    height: auto !important;
    overflow: visible !important;
  }

  .scroll-content { max-width: 100% !important; padding: 0 !important; }
  .line-content, .focus-content { display: none !important; }
}

/* ── Responsive ───────────────────────────────────────────────────── */

/* Desktop: persistent sidebar, no Style toggle needed */
@media (min-width: 1025px) {
  #btn-style { display: none; }
}

/* Tablet / mobile: sidebar becomes a slide-up bottom sheet */
@media (max-width: 1024px) {
  .style-overlay { display: block; }
  .style-overlay.open { opacity: 1; pointer-events: auto; }

  .style-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: 80vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    z-index: 160;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  }

  .style-sidebar.open { transform: translateY(0); }

  .style-panel-close { display: block; }
}

@media (max-width: 768px) {
  .nav-inner { padding: 0 1.25rem; }
  .nav-links li:not(:last-child) { display: none; }

  .hero { padding: 3rem 1.5rem 2.5rem; }
  .input-view { padding: 0 1rem 3rem; }

  .scroll-content { padding: 1.75rem 1.25rem 6rem; }
  .line-content { padding: 1.25rem 1.25rem 6rem; }

  /* Toolbar wraps onto multiple rows so EVERY control stays on screen
     (it used to scroll sideways off the edge and look like it had vanished). */
  .reader-toolbar {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    overflow: visible;
    justify-content: center;
    padding: 0.5rem 0.6rem;
    gap: 0.4rem 0.4rem;
  }
  .toolbar-spacer,
  .toolbar-divider { display: none; }
  .tts-speed { display: none; }

  /* Row 1: Back + mode tabs.  Row 2: the action buttons on their own full
     width, centred and wrapping, so Style / PDF / Kindle are always visible. */
  .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
  }

  .toolbar-back,
  .toolbar-btn { font-size: 0.88rem; padding: 0.5rem 0.8rem; }
  .mode-tab { font-size: 0.88rem; padding: 0.5rem 0.95rem; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 2rem; }
  .toolbar-btn { padding: 0.5rem 0.7rem; }
}
