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

/* Generic hide-toggle used all over app.js (classList.add/remove('hidden')).
   A few elements also carry their own more-specific ".X.hidden" rule below
   (harmless — same effect, kept for readability at each call site); this one
   is the rule that actually covers every other hideable element (tabs,
   argument sidebar, feedback error/thanks, etc.) — without it, "hidden" is
   just an inert class name. */
.hidden { display: none !important; }

:root {
  --yellow:  #FFF3CD;
  --orange:  #F4A946;
  --orange-dark: #D4841A;
  --green:   #D4EDDA;
  --green-dark: #28A745;
  --blue:    #D1ECF1;
  --blue-dark: #0C7890;
  --gray-light: #F8F9FA;
  --gray:    #E9ECEF;
  --gray-mid: #ADB5BD;
  --text:    #212529;
  --text-muted: #6C757D;
  --radius:  12px;
  --shadow:  0 2px 8px rgba(0,0,0,0.10);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  background: #FFFBF0;
}

/* ── Header ── */
header {
  /* Sticky (not fixed) so it stays reserved in normal document flow — no
     compensating padding needed below it — while still guaranteeing it's
     always at viewport y=0 whenever visible. showInfoPage() in app.js
     measures this height to position overlays right below it; that math
     is only correct if the header is genuinely pinned, not just assumed to be. */
  position: sticky;
  top: 0;
  z-index: 310; /* above .info-overlay's z-index: 300 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--orange);
  color: #fff;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo { font-size: 1.6rem; }

.header-title { display: flex; flex-direction: column; gap: 0.1rem; }

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.85;
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.age-label { font-size: 0.95rem; font-weight: 600; }

#age-select {
  font-size: 1rem;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.25);
  color: #fff;
  cursor: pointer;
}

#age-select option { color: var(--text); background: #fff; }

/* ── Tab navigation ── */
.tabs {
  display: flex;
  gap: 0;
  background: #fff;
  border-bottom: 3px solid var(--gray);
  padding: 0 1rem;
  /* Sits directly under the sticky header, at the same screen position where
     .info-overlay begins (its top is set to the header's height in JS). A
     stacking context + z-index above the overlay's (300) lets the tab bar
     stay visible and clickable even while an overlay (Home/How it
     works/About/Feedback) is open, so switching tabs doubles as "back to
     app" without needing a separate button. */
  position: relative;
  z-index: 310; /* above .info-overlay's z-index: 300 */
}

.tab {
  flex: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  margin-bottom: -3px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--orange-dark); }

.tab.active {
  color: var(--orange-dark);
  border-bottom-color: var(--orange);
}

/* ── Panels ── */
.panel { display: flex; flex-direction: column; }
.panel.hidden { display: none; }

/* ── Reference layout ── */
.reference-layout {
  display: flex;
  height: calc(100vh - 130px);
  overflow: hidden;
  /* Match Main Topics / Explore More Topics' content width instead of
     stretching full-bleed on wide screens. */
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.reference-sidebar {
  width: 240px;
  min-width: 200px;
  flex-shrink: 0;
  background: #fff;
  border-right: 2px solid var(--gray);
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-heading {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 1rem 0.5rem;
}

#reference-list {
  list-style: none;
}

#reference-list li {
  border-left: 4px solid transparent;
}

#reference-list li a,
#reference-list li.loading-placeholder {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

#reference-list li a:hover { background: var(--yellow); }

#reference-list li.active {
  border-left-color: var(--orange);
  background: var(--yellow);
}

#reference-list li.active a { font-weight: 700; }

.reference-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  max-width: 800px;
}

.reference-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 2px solid var(--gray);
  border-radius: 20px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 1.25rem;
  transition: border-color 0.15s, color 0.15s;
}
.reference-back-btn:hover { border-color: var(--orange); color: var(--orange-dark); }

.welcome-message h2 { color: var(--orange-dark); margin-bottom: 0.5rem; }
.welcome-message p {
  color: var(--text-muted);
  line-height: 1.6;
  text-align: justify;
  hyphens: auto;
}

/* Landing-page card grid — one card per Debate Basics topic, built by
   renderTopicCardGrid() in app.js from the same data as the sidebar. */
.topic-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.topic-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  background: #fff;
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

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

.topic-card-icon { font-size: 1.6rem; }
.topic-card-title { font-weight: 700; color: var(--text); font-size: 1rem; }
.topic-card-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

/* Rendered markdown typography */
.reference-content h1 { font-size: 1.7rem; margin-bottom: 1rem; color: var(--orange-dark); }
.reference-content h2 { font-size: 1.3rem; margin: 1.5rem 0 0.5rem; color: #333; border-bottom: 2px solid var(--gray); padding-bottom: 0.2rem; }
.reference-content h3 { font-size: 1.1rem; margin: 1.2rem 0 0.4rem; color: #444; }
.reference-content p  { margin-bottom: 0.8rem; }
.reference-content ul, .reference-content ol { margin: 0.5rem 0 1rem 1.5rem; }
.reference-content li { margin-bottom: 0.3rem; }
.reference-content strong { color: #333; }
.reference-content blockquote {
  border-left: 4px solid var(--orange);
  background: var(--yellow);
  padding: 0.6rem 1rem;
  margin: 1rem 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.reference-content hr { border: none; border-top: 2px solid var(--gray); margin: 1.5rem 0; }
.reference-content table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.reference-content th, .reference-content td { border: 1px solid var(--gray); padding: 0.5rem 0.75rem; text-align: left; }
.reference-content th { background: var(--yellow); font-weight: 700; }
.reference-content code { background: var(--gray); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.9em; }

/* Glossary card grid */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.glossary-card {
  background: #fff;
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.glossary-card .term {
  font-weight: 700;
  font-size: 1rem;
  color: var(--blue-dark);
  margin-bottom: 0.3rem;
}

.glossary-card .definition {
  font-size: 0.9rem;
  color: var(--text);
}

/* ── Explainer layout ── */
.explainer-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 130px);
  padding: 1rem 1.5rem;
  gap: 0.75rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* Two-column area: sidebar + chat */
.explainer-columns {
  display: flex;
  flex: 1;
  gap: 0.75rem;
  overflow: hidden;
  min-height: 0;
}

/* Argument sidebar */
.argument-sidebar {
  width: 200px;
  flex-shrink: 0;
  overflow-y: auto;
  background: #fff;
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  padding: 0.5rem 0;
}

.arg-section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.5rem 0.85rem 0.25rem;
}

.arg-section-heading.pro { color: var(--green-dark); }
.arg-section-heading.con { color: #C0392B; }

.arg-divider {
  border: none;
  border-top: 1px solid var(--gray);
  margin: 0.4rem 0;
}

.arg-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 4px solid transparent;
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  line-height: 1.35;
}

.arg-item:hover { background: var(--yellow); }

.arg-item.active {
  border-left-color: var(--orange);
  background: var(--yellow);
  font-weight: 700;
}

/* Chat column (right side) */
.chat-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  overflow: hidden;
}

/* Invitation bubble */
.chat-bubble.invitation {
  align-self: flex-start;
  background: var(--yellow);
  border: 2px dashed var(--orange);
  color: var(--text);
  font-style: italic;
  font-size: 0.95rem;
  border-bottom-left-radius: 4px;
}

/* ── Suggested questions card (Step 1) ── */
.suggested-questions {
  align-self: stretch;
  background: var(--yellow);
  border: 2px solid var(--orange);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.suggested-q-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.q-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.q-chip {
  background: #fff;
  border: 2px solid var(--orange);
  border-radius: 20px;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--orange-dark);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.3;
}

.q-chip:hover {
  background: var(--orange);
  color: #fff;
}

/* "Skip / Explore arguments" bar inside the suggested-questions card */
.step-transition {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--orange-dark);
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.btn-skip {
  background: none;
  border: 2px solid var(--orange);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 700;
  color: var(--orange-dark);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-skip:hover {
  background: var(--orange);
  color: #fff;
}

/* "Explore arguments" prompt shown after first AI reply in Step 1 */
.explore-prompt {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--green);
  border: 2px solid var(--green-dark);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: #1a5c2a;
  flex-wrap: wrap;
}

.btn-explore {
  background: var(--green-dark);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-explore:hover { opacity: 0.85; }

/* "All questions answered" variant of the suggested-questions card */
.suggested-questions.all-done {
  background: var(--green);
  border-color: var(--green-dark);
}

.suggested-questions.all-done .suggested-q-hint {
  color: #1a5c2a;
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* ── Argument detail card (shown when sidebar item is clicked) ── */
.arg-detail-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-self: stretch;
}

.arg-detail-card {
  background: #fff;
  border: 2px solid var(--gray);
  border-left: 5px solid var(--orange);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.arg-detail-card.pro { border-left-color: var(--green-dark); }
.arg-detail-card.con { border-left-color: #C0392B; }

.arg-detail-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.arg-detail-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  text-transform: uppercase;
}

.arg-detail-badge.pro { background: var(--green); color: var(--green-dark); }
.arg-detail-badge.con { background: #FDECEA; color: #C0392B; }

.arg-detail-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.arg-detail-summary {
  background: var(--yellow);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text);
}

.arg-detail-part {
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
  flex-wrap: wrap;
}

.arg-detail-label {
  flex-shrink: 0;
  width: 60px;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-top: 0.1em;
}

.arg-detail-text {
  flex: 1;
  color: var(--text);
  min-width: 0;
}

.arg-detail-invite {
  align-self: flex-start;
  background: var(--yellow);
  border: 2px dashed var(--orange);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text);
  max-width: 80%;
}

/* ── Argument quick-question chips ── */
.arg-chips-card {
  align-self: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: var(--gray-light);
  border: 2px solid var(--gray);
  border-radius: var(--radius);
}

.arg-chips-hint {
  width: 100%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.arg-chip {
  background: #fff;
  border: 2px solid var(--blue-dark);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--blue-dark);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.3;
}

.arg-chip:hover {
  background: var(--blue-dark);
  color: #fff;
}

/* Reference-navigation chips (Claim/Warrant/Impact) get a slightly different colour */
.arg-chip.ref-chip {
  border-color: var(--green-dark);
  color: var(--green-dark);
}

.arg-chip.ref-chip:hover {
  background: var(--green-dark);
  color: #fff;
}

.topic-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.topic-label { font-weight: 600; white-space: nowrap; }

#topic-select, #explore-topic-select {
  flex: 1;
  min-width: 200px;
  font-size: 1rem;
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--gray);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

/* ── Chat window ── */
.chat-window {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

.chat-welcome {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 1rem;
}

.chat-welcome p + p { margin-top: 0.5rem; }

.chat-bubble {
  max-width: 92%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 1rem;
  line-height: 1.55;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--orange);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--gray-light);
  border: 2px solid var(--gray);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-bubble.assistant p { margin-bottom: 0.5rem; }
.chat-bubble.assistant p:last-child { margin-bottom: 0; }
.chat-bubble.assistant ul, .chat-bubble.assistant ol { margin: 0.3rem 0 0.5rem 1.4rem; }
.chat-bubble.assistant strong { color: #333; }

.chat-bubble.typing {
  background: var(--gray-light);
  border: 2px solid var(--gray);
  align-self: flex-start;
  color: var(--text-muted);
  font-style: italic;
  border-bottom-left-radius: 4px;
}

.chat-bubble.error {
  background: #FDECEA;
  border: 2px solid #F5C6CB;
  color: #842029;
  align-self: stretch;
  text-align: center;
}

/* ── Chat input ── */
.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  font-size: 1rem;
  font-family: inherit;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--gray);
  border-radius: 10px;
  resize: none;
  line-height: 1.4;
  background: #fff;
  transition: border-color 0.15s;
}

.chat-input:focus {
  outline: none;
  border-color: var(--orange);
}

.chat-input:disabled { background: var(--gray-light); color: var(--text-muted); }

.input-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

/* Neither tab has free-form chat — Main Topics uses only its question chips
   and argument chips, Explore More Topics ends with the "practice-prompt"
   card (see app.js). The input/button stay in the DOM (just hidden) rather
   than being removed, since other code still assumes chatInput/sendBtn exist. */
#panel-explainer .chat-input-bar,
#panel-explainer .input-hint,
#panel-explore .chat-input-bar,
#panel-explore .input-hint {
  display: none;
}

/* "Now it's your turn" practice prompt — replaces free chat at the end of
   the Explore More Topics question flow. */
.practice-prompt {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  background: var(--green);
  border: 2px solid var(--green-dark);
  border-radius: var(--radius);
  color: #1a5c2a;
}

.practice-prompt-text { font-size: 0.95rem; line-height: 1.55; }

.practice-prompt .btn-explore { align-self: flex-start; }

/* ── Buttons ── */
.btn-primary, .btn-secondary {
  font-size: 1rem;
  font-weight: 700;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

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

.btn-primary:hover:not(:disabled) { background: var(--orange-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-secondary:hover { background: var(--gray-mid); }

/* ── Debate Prep Checklist (static, no AI) ── */
.checklist-layout {
  /* Match Main Topics / Explore More Topics' content width. */
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.checklist-groups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checklist-intro h2 {
  font-size: 1.5rem;
  color: var(--orange-dark);
  margin-bottom: 0.5rem;
}

.checklist-intro p {
  color: var(--text);
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
}

.checklist-warning {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--yellow);
  border: 2px solid var(--orange);
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.checklist-progress {
  margin-top: 0.75rem;
  font-weight: 700;
  color: var(--green-dark);
  font-size: 1rem;
}

.checklist-section {
  background: #fff;
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.checklist-section h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.checklist-heading-link {
  background: none;
  border: 2px solid var(--green-dark);
  border-radius: 20px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--green-dark);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.checklist-heading-link:hover { background: var(--green-dark); color: #fff; }

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.checklist-item-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.checklist-item-label:hover { background: var(--gray-light); }

.checklist-item-label input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  accent-color: var(--green-dark);
  cursor: pointer;
}

.checklist-item-label span { line-height: 1.4; }
.checklist-item-label input:checked ~ span {
  text-decoration: line-through;
  color: var(--text-muted);
}

.checklist-item-link {
  flex-shrink: 0;
  background: none;
  border: 2px solid var(--green-dark);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}
.checklist-item-link:hover { background: var(--green); }

/* ── Responsive ── */
@media (max-width: 640px) {
  header h1 { font-size: 1.1rem; }

  .reference-layout { flex-direction: column; height: auto; min-height: calc(100vh - 130px); }
  .reference-sidebar { width: 100%; border-right: none; border-bottom: 2px solid var(--gray); max-height: 180px; padding: 0.5rem 0; }
  .reference-content { padding: 1rem; }

  .explainer-layout { height: calc(100vh - 130px); padding: 0.75rem; }
  /* The argument list used to be force-hidden here, which made "Explore the
     arguments" unreachable on phones (nothing to click, nowhere to see the
     PRO/CON list). Stack it above the chat instead, capped and scrollable,
     so it stays usable without eating the whole screen. */
  .explainer-columns { flex-direction: column; }
  .argument-sidebar { width: 100%; max-height: 140px; }
  .chat-bubble { max-width: 95%; }

  .checklist-layout { padding: 1rem 1rem 2.5rem; }

  .tab { padding: 0.6rem 0.8rem; font-size: 0.9rem; }
}

/* ── Text-to-speech listen button ── */
.msg-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.6rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.btn-listen {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 1.5px solid var(--gray-mid);
  border-radius: 20px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn-listen:hover {
  border-color: var(--orange);
  color: var(--orange-dark);
}

.btn-listen.speaking {
  border-color: var(--orange);
  color: var(--orange-dark);
  background: var(--yellow);
  animation: tts-pulse 1.4s ease-in-out infinite;
}

@keyframes tts-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* ── Mascot owl ── */
.mascot-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none; /* never blocks clicks on the app */
  gap: 0.4rem;
}

.mascot-bubble {
  background: #fff;
  border: 2px solid var(--orange);
  border-radius: 12px;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  font-family: inherit;
  max-width: 170px;
  text-align: center;
  line-height: 1.35;
  box-shadow: var(--shadow);
  position: relative;
  animation: bubble-in 0.25s ease;
}

/* downward triangle pointing toward the owl */
.mascot-bubble::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--orange);
}
.mascot-bubble::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
  z-index: 1;
}

.mascot-bubble.hidden { display: none; }

.mascot-owl {
  animation: mascot-pulse 3s ease-in-out infinite;
  line-height: 0;
}

@keyframes mascot-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.03); }
}

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

/* hide on tiny screens so it doesn't cover content */
@media (max-width: 480px) {
  .mascot-container { display: none; }
}

/* ── Header info links (How it works · About) ── */
.header-info-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.5rem;
}

.header-info-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.82);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.2rem 0.25rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.header-info-link:hover { color: #fff; }

.header-info-sep { color: rgba(255,255,255,0.5); font-size: 0.78rem; }

/* ── Info page overlays ── */
.info-overlay.hidden { display: none; }

.info-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #FFFBF0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.info-inner {
  /* Capped (not full-width) on purpose — keeps prose lines a comfortable
     reading length even on wide monitors. 840px still reads fine at this
     font size; going much wider starts to hurt readability. */
  max-width: 840px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.info-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 2px solid var(--gray);
  border-radius: 20px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 1.5rem;
  transition: border-color 0.15s, color 0.15s;
}

.info-back-btn:hover { border-color: var(--orange); color: var(--orange-dark); }
.info-back-btn.hidden { display: none; }

/* Hero section */
.info-hero {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--gray);
}

.info-hero h1 {
  font-size: 2rem;
  color: var(--orange-dark);
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.info-tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Inline mascot card */
.info-mascot {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: var(--yellow);
  border: 2px solid var(--orange);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-top: 0.25rem;
}

.info-mascot-text {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.4;
}

/* Body content */
.info-body { display: flex; flex-direction: column; gap: 1.5rem; }

.info-section { line-height: 1.7; }

.info-section h2 {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.info-section p {
  color: var(--text);
  /* Justify so the right edge lines up instead of ragged-wrapping; hyphens
     keeps word-spacing even at this column width instead of stretching gaps.
     (The last line of a paragraph stays left-aligned automatically — only
     full lines above it get stretched.) */
  text-align: justify;
  hyphens: auto;
}

.info-body a {
  color: var(--blue-dark);
  font-weight: 600;
  text-decoration-color: var(--blue);
}
.info-body a:hover { color: var(--orange-dark); }

/* Text-style link button inside a light overlay body — unlike .header-info-link,
   which is styled for the dark header bar. */
.info-text-link {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue-dark);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.info-text-link:hover { color: var(--orange-dark); }

/* Welcome overlay CTA */
.welcome-start-btn { display: block; margin: 0.5rem 0 1.5rem; font-size: 1.1rem; }

.welcome-feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.welcome-feature-list li {
  padding-left: 1.4rem;
  position: relative;
  line-height: 1.6;
  /* Home and How It Works are mostly bullet lists rather than paragraphs —
     justify here too so wrapped bullet text gets the same straight right
     edge as the prose pages (About, the callout sections). */
  text-align: justify;
  hyphens: auto;
}
.welcome-feature-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--green-dark);
  font-weight: 700;
}
.welcome-feature-list strong { color: var(--text); }

.info-section-intro { margin-bottom: 0.75rem; color: var(--text-muted); font-size: 0.95rem; }

/* Callout / highlight box */
.info-callout {
  background: var(--yellow);
  border-left: 4px solid var(--orange);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
}

.info-callout h2 { color: var(--orange-dark); }

.info-callout--blue {
  background: var(--blue);
  border-left-color: var(--blue-dark);
}

.info-callout--blue h2 { color: var(--blue-dark); }

/* Privacy cards */
.privacy-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.privacy-card {
  background: #fff;
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: var(--shadow);
}

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

.privacy-card strong { font-size: 0.95rem; color: var(--text); }

.privacy-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* Scope cards — welcome page's "Deliberately focused, by design" section.
   Horizontal (icon left, text right), stacked as full-width rows — the
   paragraph-length text here doesn't fit the compact vertical privacy-card
   layout above. */
.scope-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.scope-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.9rem;
  background: #fff;
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.scope-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; margin-top: 0.1rem; }

.scope-card-body { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.scope-card-body strong { font-size: 0.98rem; color: var(--text); }
.scope-card .welcome-feature-list { gap: 0.5rem; }
.scope-card .welcome-feature-list li { font-size: 0.92rem; }

/* Contact line */
.info-contact {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
}

/* About page prose */
.info-body--prose { gap: 1rem; }

.info-body--prose p {
  line-height: 1.75;
  color: var(--text);
  text-align: justify;
  hyphens: auto;
}

.info-signature {
  margin-top: 1rem;
  font-style: italic;
  font-weight: 600;
  color: var(--orange-dark);
}

/* ── Feedback page ── */
#feedback-form { display: flex; flex-direction: column; gap: 1.5rem; }

.star-rating {
  display: inline-flex;
  flex-direction: row-reverse; /* so :checked ~ label and label:hover ~ label both light up "up to here" */
  justify-content: flex-end;
  gap: 0.15rem;
  margin-top: 0.5rem;
}

.star-rating input { position: absolute; opacity: 0; width: 0; height: 0; }

.star-rating label {
  font-size: 2.5rem;
  line-height: 1;
  color: var(--gray-mid);
  cursor: pointer;
  transition: color 0.1s;
}

.star-rating input:focus-visible + label { outline: 2px solid var(--blue-dark); outline-offset: 2px; }
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: var(--orange); }

.feedback-textarea {
  width: 100%;
  min-height: 110px;
  margin-top: 0.5rem;
  padding: 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  resize: vertical;
}

.feedback-textarea:focus { outline: none; border-color: var(--orange); }

.feedback-error { color: #C0392B; font-size: 0.9rem; margin-top: -0.75rem; }

/* Mobile */
@media (max-width: 640px) {
  .info-hero h1 { font-size: 1.5rem; }
  .info-inner { padding: 1rem 1rem 3rem; }
  /* The mascot speech bubble stays single-line on normal screens (see
     .info-mascot-text) but wraps again here so it doesn't overflow narrow
     phones. */
  .info-mascot-text { white-space: normal; max-width: 200px; }
  /* Nav links (Home / How it works / About / Feedback) stay visible and wrap
     with the rest of the header — they're the only way to navigate the app
     on a phone, so hiding them entirely (as before) left no way back from
     an open overlay. */
  .header-info-nav { flex-basis: 100%; justify-content: center; margin: 0.3rem 0 0; }
  .privacy-cards { grid-template-columns: 1fr; }
  .scope-card { flex-direction: column; gap: 0.4rem; } /* icon above text on narrow phones */
}
