/* ── A Story For You: Design System & Literary Typography ───────────────────────── */

:root {
  --bg: #fbf8f1;
  --text: #2b2621;
  --text-muted: #6e6459;
  --accent: #8b3a2b;
  --accent-hover: #ad4936;
  --panel-bg: rgba(246, 241, 230, 0.85);
  --border: #dfd5c2;
  --chip-bg: #ede3ce;
  --shadow: 0 4px 20px rgba(43, 38, 33, 0.06);
  --font-serif: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --line-height: 1.75;
}

[data-theme="slate"] {
  --bg: #14171a;
  --text: #dfdcd7;
  --text-muted: #8d959e;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --panel-bg: rgba(26, 31, 36, 0.85);
  --border: #2c333a;
  --chip-bg: #22272e;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="sepia"] {
  --bg: #f3edd9;
  --text: #382e22;
  --text-muted: #786752;
  --accent: #9c5825;
  --accent-hover: #ba6b30;
  --panel-bg: rgba(235, 226, 204, 0.85);
  --border: #cebf9e;
  --chip-bg: #ded0b0;
  --shadow: 0 4px 20px rgba(56, 46, 34, 0.08);
}

[data-theme="terminal"] {
  --bg: #0d1117;
  --text: #56d364;
  --text-muted: #2ea043;
  --accent: #79c0ff;
  --accent-hover: #a5d6ff;
  --panel-bg: rgba(22, 27, 34, 0.9);
  --border: #238636;
  --chip-bg: #161b22;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  --font-serif: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

[data-theme="midnight"] {
  --bg: #0b0e14;
  --text: #d8dee9;
  --text-muted: #67768e;
  --accent: #b48ead;
  --accent-hover: #d08770;
  --panel-bg: rgba(18, 24, 32, 0.85);
  --border: #273142;
  --chip-bg: #1a222e;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: var(--line-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.4s ease, color 0.4s ease;
  padding: 2.5rem 1.25rem 4rem 1.25rem;
  -webkit-font-smoothing: antialiased;
}

/* ── Container Layout ───────────────────────────────────────────────────── */

#app-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2rem;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.story-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  gap: 1rem;
}

.story-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.story-title {
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.story-author {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
}

.story-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.ctrl-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ctrl-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

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

.page-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
}

.lang-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  transition: all 0.15s ease;
  opacity: 0.65;
}

.lang-btn:hover {
  opacity: 1;
  color: var(--text);
}

.lang-btn.active {
  opacity: 1;
  color: var(--accent);
  font-weight: 600;
}

.lang-sep {
  opacity: 0.35;
  font-size: 0.7rem;
  user-select: none;
}

.footer-link-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  opacity: 0.7;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
}

.footer-link-btn:hover {
  opacity: 1;
  color: var(--text);
}

/* ── Inventory Satchel ──────────────────────────────────────────────────── */

.inventory-bar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  box-shadow: var(--shadow);
}

.inventory-bar.visible {
  display: flex;
}

.inv-label {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.inv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.inv-empty {
  color: var(--text-muted);
  font-style: italic;
}

.inv-chip {
  background: var(--chip-bg);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  animation: chipAppear 0.3s ease-out;
}

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

/* ── Passage Container ──────────────────────────────────────────────────── */

.passage-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.passage-content p {
  margin-bottom: 1.25rem;
  text-align: justify;
  hyphens: auto;
}

.first-paragraph::first-letter {
  font-size: 3.2em;
  float: left;
  line-height: 0.8;
  margin-right: 0.12em;
  margin-top: 0.05em;
  color: var(--accent);
  font-weight: 600;
}

/* ── Choices List ───────────────────────────────────────────────────────── */

.choices-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}

.choice-btn {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  text-align: left;
  padding: 0.9rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.choice-arrow {
  color: var(--accent);
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.choice-label {
  flex-grow: 1;
}

.choice-btn.enabled:hover {
  background: var(--bg);
  border-color: var(--accent);
  transform: translateX(4px);
}

.choice-btn.enabled:hover .choice-arrow {
  transform: translateX(3px);
}

.choice-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: transparent;
}

.choice-lock {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--chip-bg);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}

/* ── Ending Card ────────────────────────────────────────────────────────── */

.ending-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  padding: 2.5rem 1.75rem;
  border-radius: 12px;
  gap: 1.25rem;
  box-shadow: var(--shadow);
  margin-top: 1.5rem;
}

.ending-badge {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
}

.ending-win {
  background: #238636;
  color: #ffffff;
}

.ending-loss {
  background: #cf222e;
  color: #ffffff;
}

.ending-neutral {
  background: var(--chip-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.ending-message {
  font-size: 1.35rem;
  font-style: italic;
  max-width: 480px;
}

.ending-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.action-btn {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn.primary {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}

.action-btn.primary:hover {
  background: var(--accent-hover);
}

.action-btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

/* ── Toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--panel-bg);
  border: 1px solid var(--accent);
  padding: 0.65rem 1.4rem;
  border-radius: 9999px;
  box-shadow: var(--shadow);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.hidden {
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
}

/* ── Animation ──────────────────────────────────────────────────────────── */

.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* ── Story Editor Overlay ───────────────────────────────────────────────── */
/* Scoped entirely under .editor-overlay: it only exists in the DOM once
   "✎ Create" is clicked, and none of these rules touch the reading view. */

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 17, 13, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  font-family: var(--font-sans);
}

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

.editor-panel {
  position: relative;
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg);
}

.editor-meta-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
}

.editor-topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.editor-input {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.editor-title-input {
  font-weight: 600;
  min-width: 220px;
}

.editor-warning-banner {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  background: #fef0e0;
  color: #7a4a00;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.editor-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.editor-node-list {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.editor-node-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  color: var(--text);
}

.editor-node-card:hover {
  background: var(--chip-bg);
}

.editor-node-card.active {
  border-color: var(--accent);
  background: var(--chip-bg);
}

.editor-node-id {
  font-size: 0.8rem;
  font-weight: 600;
}

.editor-node-preview {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.editor-node-flag {
  font-size: 0.65rem;
  color: #b45309;
}

.editor-new-node-btn {
  margin-top: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.editor-node-form {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-empty-state {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.editor-node-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.editor-node-id-readout {
  font-family: var(--font-sans);
  font-weight: 700;
  margin-left: 0.4rem;
}

.editor-checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.editor-delete-btn {
  margin-left: auto;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: #cf222e;
  background: transparent;
  border: 1px solid #cf222e;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

.editor-field-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.editor-textarea {
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.editor-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.editor-choices-title {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.editor-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.editor-choice-row .editor-input {
  flex: 1 1 120px;
  min-width: 90px;
}

.editor-choice-row .editor-choice-label {
  flex: 2 1 160px;
}

.editor-remove-choice-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.editor-add-choice-btn {
  align-self: flex-start;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.editor-preview-row {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.editor-link-popover {
  position: absolute;
  inset: 0;
  background: rgba(20, 17, 13, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.editor-link-popover-inner {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow);
}

.editor-link-text {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
  resize: vertical;
  min-height: 80px;
}

.editor-link-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .editor-body {
    flex-direction: column;
  }
  .editor-node-list {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .editor-choice-row .editor-input {
    flex-basis: 100px;
  }
}

/* ── About Overlay ──────────────────────────────────────────────────────── */
/* Scoped entirely under .about-overlay: it only exists in the DOM once
   "ⓘ About" is clicked, and none of these rules touch the reading view. */

.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 17, 13, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  font-family: var(--font-sans);
}

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

.about-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 1.75rem;
}

.about-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}

.about-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
}

.about-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.about-version {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.about-lang-section {
  margin-top: 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.about-lang-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.about-lang-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lang-chip {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.lang-chip.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 500;
}

.about-whats-new {
  margin-top: 1rem;
}

.about-whats-new-summary,
.about-whats-new-more-summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.about-whats-new-body {
  margin-top: 0.75rem;
}

.about-changelog-version {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.9rem;
}

.about-changelog-date {
  font-weight: 400;
  color: var(--text-muted);
}

.about-changelog-lines {
  margin: 0.35rem 0 0 1.1rem;
  font-size: 0.8rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.about-whats-new-more {
  margin-top: 1rem;
}

.about-whats-new-older {
  margin-top: 0.5rem;
}

.about-copyright {
  margin-top: 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.about-mail {
  color: var(--accent);
}

.about-note {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.about-note code {
  font-family: var(--font-sans);
  font-size: 0.92em;
  background: var(--chip-bg);
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

.about-note a {
  color: var(--accent);
}

.about-guide {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── Quick "Ask Your AI" Overlay ────────────────────────────────────────── */
/* Mobile-first, single column, large tap targets — the default "Create" flow. Scoped under
   .quickai-overlay, so it only exists in the DOM once opened. */

.quickai-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 17, 13, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  font-family: var(--font-sans);
}

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

.quickai-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quickai-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
}

.quickai-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  padding-right: 2rem;
}

.quickai-lead {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.quickai-field-label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quickai-input,
.quickai-textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  /* 16px effective font-size and generous padding: avoids iOS Safari's zoom-on-focus and keeps
     the tap target comfortably large on a phone. */
}

.quickai-textarea {
  min-height: 110px;
  resize: vertical;
}

.quickai-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.quickai-status {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.quickai-error {
  font-size: 0.78rem;
  color: #cf222e;
  flex: 1;
}

.quickai-btn {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  border-radius: 9999px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
  min-height: 44px;
  /* 44px: the standard minimum comfortable touch-target size. */
}

.quickai-btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  width: 100%;
}

.quickai-btn-primary:hover {
  background: var(--accent-hover);
}

.quickai-loaded {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  border-radius: 10px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
}

.quickai-loaded-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.quickai-btn-play {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  width: 100%;
}

.quickai-btn-play:hover {
  background: var(--accent-hover);
}

.quickai-btn-secondary {
  background: transparent;
  width: 100%;
}

.quickai-link-btn {
  align-self: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.5rem;
}
