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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-hover: #1a2744;
  --text: #e0e0e0;
  --text-muted: #8a8a9a;
  --accent: #e94560;
  --accent-hover: #ff6b81;
  --border: #2a2a4a;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --max-width: 700px;
  --ai-border: #3a3a6a;
  --ai-text: #9090d0;
  --ai-text-hover: #c0c0ff;
  --ai-bg: rgba(90, 90, 160, 0.15);
  --ai-pulse-from: #3a3a6a;
  --ai-pulse-to: #8080d0;
}

/* Visually hidden but accessible to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* --- Auth Header / Nav Bar --- */
.auth-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 44px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.header-nav-link {
  font-family: sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.header-nav-link:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.header-nav-link.nav-active {
  color: var(--text);
  background: var(--bg);
}

.header-nav-cta {
  color: var(--accent);
  font-weight: 600;
}

.header-nav-cta:hover {
  color: var(--accent-hover);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.auth-name {
  font-size: 0.85rem;
  font-family: sans-serif;
  color: var(--text-muted);
}

.auth-signin {
  text-decoration: none;
}

/* --- Library Tabs --- */
.library-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

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

.sort-controls {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.sort-controls .btn-small {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* --- Upvote --- */
.upvote-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
}

.upvote-btn:hover {
  color: var(--accent);
}

.upvote-btn.upvoted {
  color: var(--accent);
}

.upvote-btn.upvoted .upvote-icon {
  fill: var(--accent);
}

.upvote-icon {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
}

/* --- Badges --- */
.published-badge {
  font-size: 0.7rem;
  background: var(--success);
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: sans-serif;
  text-transform: uppercase;
  vertical-align: middle;
}

.draft-badge {
  font-size: 0.7rem;
  background: var(--text-muted);
  color: var(--bg);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: sans-serif;
  text-transform: uppercase;
  vertical-align: middle;
}

/* --- Screens --- */
.screen {
  display: none;
}

.screen.active {
  display: flex;
}

/* --- Library Screen --- */
#library-screen {
  flex-direction: column;
  min-height: 100vh;
}

.library-header {
  text-align: center;
  padding: 1rem 1.5rem;
}

.library-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.library-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.library-empty p {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.story-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.2s;
}

.story-card:hover {
  border-color: var(--accent);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.story-card h3 {
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1.3;
}

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

.story-card .card-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card .card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.card-stats {
  display: flex;
  gap: 0.75rem;
  font-family: sans-serif;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.card-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.card-stat-icon {
  display: inline-flex;
  align-items: center;
}

.card-stat svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

/* --- Player Screen --- */
#player-screen {
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

#player-screen .player-wrap {
  width: 100%;
  max-width: var(--max-width);
  padding: 2rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Title sub-screen within player */
.player-title {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}

.player-title.active {
  display: flex;
}

.player-title h2 {
  font-size: 2.4rem;
  font-weight: bold;
  color: var(--text);
  line-height: 1.2;
}

.player-title .author {
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
}

.player-title .description {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 500px;
  margin-top: 0.5rem;
}

.title-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Story reading sub-screen */
.player-story {
  flex: 1;
  display: none;
  flex-direction: column;
}

.player-story.active {
  display: flex;
}

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

.story-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

#node-content {
  flex: 1;
}

#node-image {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: none;
}

#node-text {
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text);
}

#node-text p { margin-bottom: 1rem; }
#node-text em { color: var(--text-muted); }
#node-text strong { color: #fff; }

#choices {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 3rem;
}

.choice-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Georgia', serif;
  font-size: 1.05rem;
  text-align: left;
  line-height: 1.5;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

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

.ending-marker {
  text-align: center;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.ending-marker p {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.5rem;
}

/* --- Editor Screen --- */
#editor-screen {
  flex-direction: column;
  height: calc(100vh - 45px);
  height: calc(100dvh - 45px);
  position: relative;
  overflow: hidden;
}

/* --- Floating Toolbar --- */
.editor-floating-toolbar {
  position: fixed;
  top: 57px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  flex-wrap: nowrap;
  white-space: nowrap;
}

.toolbar-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: sans-serif;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

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

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.15rem;
  flex-shrink: 0;
}

.editor-dirty .toolbar-dirty-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--warning);
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

/* --- Track Canvas --- */
.track-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  background: var(--bg);
}

.track-canvas:active {
  cursor: grabbing;
}

/* --- Track Cards (nodes as pages) --- */
.card-bg {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
}

.track-card:hover .card-bg {
  stroke: var(--accent);
}

.card-bg.selected {
  stroke: var(--accent);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px rgba(233, 69, 96, 0.35));
}

.card-bg.start {
  stroke: var(--success);
  stroke-width: 2;
}

.card-bg.start.selected {
  stroke: var(--success);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px rgba(76, 175, 80, 0.35));
}

.card-bg.ending {
  stroke-dasharray: 6 3;
}

.card-bg.empty {
  fill: var(--bg);
}

.card-title {
  fill: var(--text);
  font-size: 11px;
  font-family: monospace;
  text-anchor: middle;
  pointer-events: none;
  font-weight: bold;
}

.card-preview {
  fill: var(--text-muted);
  font-size: 9px;
  font-family: 'Georgia', serif;
  text-anchor: middle;
  pointer-events: none;
}

.card-info {
  fill: var(--text-muted);
  font-size: 8px;
  font-family: sans-serif;
  text-anchor: middle;
  pointer-events: none;
  opacity: 0.7;
}

.card-info.card-end {
  fill: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.card-start-dot {
  fill: var(--success);
}

/* --- Track Edges --- */
.track-edge {
  stroke: var(--border);
  stroke-width: 1.5;
  fill: none;
}

.edge-label {
  font-size: 9px;
  font-family: sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  opacity: 0.85;
}

/* --- Track Tooltip --- */
.track-tooltip {
  position: absolute;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  max-width: 320px;
  font-size: 0.8rem;
  font-family: 'Georgia', serif;
  line-height: 1.4;
  pointer-events: none;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.track-tooltip-id {
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.track-tooltip-text {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
  white-space: pre-wrap;
}

.track-tooltip-choices {
  font-family: sans-serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid var(--border);
}

.track-tooltip-choice {
  margin: 0.15rem 0;
}

.track-tooltip-choice-num {
  font-weight: bold;
}

/* --- Drag Handle --- */
.drag-dot {
  fill: var(--text-muted);
  opacity: 0.4;
  pointer-events: none;
}

.card-drag-handle:hover .drag-dot {
  opacity: 0.8;
}

/* --- Zoom Controls --- */
.track-zoom-controls {
  position: absolute;
  bottom: 24px;
  right: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  font-family: sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

.zoom-btn.layout-horizontal {
  color: var(--accent);
  border-color: var(--accent);
}

/* --- FAB (Add Node) --- */
.fab {
  position: absolute;
  bottom: 24px;
  left: 16px;
  z-index: 20;
  width: 48px;
  height: 48px;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  font-family: sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
  transition: background 0.2s, transform 0.1s;
}

.fab:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.fab:active {
  transform: scale(0.95);
}

/* --- Modal Sheet --- */
.modal-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-sheet-overlay.modal-open {
  opacity: 1;
}

.modal-sheet-overlay.modal-closing {
  opacity: 0;
}

.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

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

.modal-closing .modal-sheet {
  transform: translateY(100%);
}

.modal-sheet-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 85vh;
}

.modal-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.modal-sheet-header h3 {
  font-size: 1rem;
  color: var(--text);
  font-family: sans-serif;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
}

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

.modal-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.modal-sheet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Desktop: centered dialog instead of bottom sheet */
@media (min-width: 769px) {
  .modal-sheet-overlay {
    align-items: center;
  }

  .modal-sheet {
    border-radius: 12px;
    max-height: 80vh;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.25s, opacity 0.25s;
  }

  .modal-open .modal-sheet {
    transform: translateY(0);
    opacity: 1;
  }

  .modal-closing .modal-sheet {
    transform: translateY(20px);
    opacity: 0;
  }

  .modal-sheet-content {
    max-height: 80vh;
  }
}

/* --- Node Editor Modal --- */
.node-textarea {
  width: 100%;
  min-height: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem;
  border-radius: 6px;
  font-family: 'Georgia', serif;
  font-size: 0.95rem;
  resize: vertical;
  line-height: 1.7;
}

.node-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.choices-header {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem;
  font-family: sans-serif;
}

.adv-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: sans-serif;
  cursor: pointer;
  padding: 0.5rem 0;
  margin-top: 0.75rem;
  opacity: 0.7;
}

.adv-toggle:hover {
  color: var(--text);
  opacity: 1;
}

.adv-section {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}

/* --- Settings sections --- */
.settings-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-family: sans-serif;
}

/* --- Help Menu --- */
.help-menu-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.help-menu-item:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.help-menu-item strong {
  font-size: 0.9rem;
  font-family: sans-serif;
  color: var(--text);
}

.help-menu-item span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: sans-serif;
}

.help-shortcuts {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.help-shortcuts h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-family: sans-serif;
}

.help-shortcuts div {
  font-size: 0.85rem;
  font-family: sans-serif;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.help-shortcuts kbd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--text);
  margin-right: 0.5rem;
}

/* --- Editor Field (shared across modals) --- */
.editor-field {
  margin-bottom: 0.75rem;
}

.editor-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-family: sans-serif;
}

.editor-field input,
.editor-field textarea,
.editor-field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-family: 'Georgia', serif;
  font-size: 0.95rem;
  resize: vertical;
}

.editor-field input:focus,
.editor-field textarea:focus,
.editor-field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.editor-field textarea {
  min-height: 150px;
}

/* Choice editor rows */
.choice-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.choice-row input {
  flex: 2;
}

.choice-row select {
  flex: 1;
}

.choice-row .btn-icon {
  flex-shrink: 0;
}

.choice-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.choice-target-wrap {
  position: relative;
  flex: 1;
}

.choice-target-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: monospace;
}

.choice-target-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.choice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}

.status-has-content { background: var(--success); }
.status-empty { background: var(--warning); }
.status-missing { background: var(--danger); }

.choice-target-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  max-height: 160px;
  overflow-y: auto;
  display: none;
}

.choice-target-dropdown.open {
  display: block;
}

.target-dropdown-item {
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.8rem;
  font-family: sans-serif;
  transition: background 0.1s;
}

.target-dropdown-item:hover {
  background: var(--surface-hover);
}

.target-dropdown-item .dd-id {
  color: var(--text);
  font-family: monospace;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.target-dropdown-item .dd-preview {
  color: var(--text-muted);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Validation list (used in modal) --- */
.validation-list {
  list-style: none;
  padding: 0.5rem 0;
}

.validation-list li {
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  font-family: sans-serif;
  border-radius: 4px;
  transition: background 0.15s;
}

.validation-list li:hover {
  background: var(--surface-hover);
}

.val-error { color: var(--danger); }
.val-error::before { content: 'Error: '; font-weight: bold; }
.val-warning { color: var(--warning); }
.val-warning::before { content: 'Warning: '; font-weight: bold; }
.val-ok { color: var(--success); }


/* --- Shared Buttons --- */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: sans-serif;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s;
}

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

.btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: none;
}

.btn-small {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: sans-serif;
  transition: border-color 0.2s, color 0.2s;
}

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

.btn-small:disabled {
  opacity: 0.3;
  cursor: default;
}

.btn-small:disabled:hover {
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.btn-danger:hover {
  background: #d32f2f;
  border-color: #d32f2f;
  color: #fff;
}

.btn-small.btn-danger {
  background: none;
  color: var(--danger);
}

.btn-small.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}


/* --- Story Bible Characters --- */
.bible-character {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.bible-character-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.bible-character-header input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: sans-serif;
}

.bible-character-header input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.bible-character textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: sans-serif;
  resize: vertical;
  min-height: 50px;
}

.bible-character textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

/* --- AI Toolbar --- */
.ai-toolbar {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.ai-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-color: var(--ai-border);
  color: var(--ai-text);
}

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

.ai-stop-btn {
  border-color: var(--danger);
  color: var(--danger);
}

.ai-custom-input {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.ai-custom-input input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--ai-border);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: sans-serif;
}

.ai-custom-input input:focus {
  outline: 2px solid var(--ai-text);
  outline-offset: -1px;
  border-color: var(--ai-text);
}

/* --- AI Accept/Reject Bar --- */
.ai-accept-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
  border-radius: 6px;
}

.ai-accept-label {
  font-size: 0.75rem;
  color: var(--ai-text);
  font-family: sans-serif;
  margin-right: auto;
}

.ai-accept-btn {
  border-color: var(--success);
  color: var(--success);
}

/* --- AI Generating Animation --- */
.ai-generating {
  border-color: var(--ai-text);
  animation: aiPulse 1.5s ease-in-out infinite;
}

@keyframes aiPulse {
  0%, 100% { border-color: var(--ai-pulse-from); }
  50% { border-color: var(--ai-pulse-to); }
}

/* --- AI Choice Suggestions --- */
.ai-suggestion-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.ai-suggestion-card {
  background: var(--bg);
  border: 1px solid var(--ai-border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.ai-suggestion-card .suggestion-text {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.ai-suggestion-card .suggestion-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.ai-suggestion-card .suggestion-actions {
  display: flex;
  gap: 0.35rem;
}

/* --- AI Spinner --- */
.ai-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ai-border);
  border-top-color: var(--ai-text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* --- Outline Modal --- */
.outline-modal-box {
  width: 95%;
}

.outline-modal-box h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.outline-params {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.outline-params .editor-field {
  flex: 1;
}

.outline-params select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: sans-serif;
}

.outline-preview-content {
  max-height: 65vh;
  overflow-y: auto;
  padding: 0 0 1rem;
  margin: 0.5rem 0 0;
}

.outline-header {
  margin-bottom: 1rem;
}

.outline-title {
  font-size: 1rem;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.outline-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.outline-stats {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: sans-serif;
}

.outline-nodes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.outline-node {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.outline-node.start {
  border-left-color: #4caf50;
}

.outline-node.ending {
  border-left-color: var(--accent);
}

.outline-node-id {
  display: inline-block;
  font-size: 0.7rem;
  font-family: monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
}

.outline-node-summary {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: text;
  min-height: 1.2em;
}

.outline-node-summary:hover {
  border-color: var(--border);
}

.outline-node-summary:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
  background: var(--surface);
}

.outline-node-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.outline-choice {
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  color: var(--text-muted);
  font-family: sans-serif;
}

.outline-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-family: sans-serif;
}

#outline-loading-text {
  transition: opacity 0.4s ease;
}

#outline-loading-text.fade-out {
  opacity: 0;
}


/* --- Splinter Modal --- */
.splinter-modal-sheet {
  max-width: 750px;
}

.splinter-narrative-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
  opacity: 0.7;
}

.splinter-points-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 45vh;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.splinter-point-card {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  transition: opacity 0.2s;
}

.splinter-point-card.disabled {
  opacity: 0.4;
}

.splinter-point-card input[type="checkbox"] {
  margin-top: 0.3rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.splinter-point-question {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: sans-serif;
}

.splinter-point-question:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.splinter-point-location {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: sans-serif;
  margin-top: 0.2rem;
  font-style: italic;
}

.splinter-char-counter {
  text-align: right;
  font-size: 0.75rem;
  font-family: sans-serif;
  color: var(--text-muted);
  margin-top: 0.25rem;
  opacity: 0.7;
}

.splinter-char-counter.over-limit {
  color: var(--danger);
  opacity: 1;
  font-weight: 600;
}

.splinter-loading-text {
  transition: opacity 0.4s ease;
}

.splinter-loading-text.fade-out {
  opacity: 0;
}

/* --- Branch Wizard Modal --- */
.branch-modal-sheet {
  max-width: 750px;
}

.branch-source-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-height: 80px;
  overflow-y: auto;
  white-space: pre-wrap;
  opacity: 0.7;
}

.branch-radio-label {
  display: block;
  font-family: sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  padding: 0.35rem 0;
  cursor: pointer;
}

.branch-radio-label input[type="radio"] {
  accent-color: var(--accent);
  margin-right: 0.4rem;
}

.branch-idea-field {
  margin-top: 0.5rem;
}

.branch-idea-field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: sans-serif;
  resize: vertical;
}

.branch-idea-field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.branch-plans-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.branch-plan-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.branch-plan-card:hover {
  border-color: var(--ai-border);
  box-shadow: 0 0 0 1px var(--ai-border);
}

.branch-plan-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.branch-plan-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(233, 69, 96, 0.3);
}

.branch-plan-premise {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.branch-plan-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.branch-type-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-family: sans-serif;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.branch-type-badge.ending {
  background: rgba(233, 69, 96, 0.2);
  color: var(--accent);
  border: 1px solid rgba(233, 69, 96, 0.4);
}

.branch-type-badge.convergence {
  background: rgba(78, 205, 196, 0.15);
  color: #4ecdc4;
  border: 1px solid rgba(78, 205, 196, 0.4);
}

.branch-plan-size {
  font-size: 0.75rem;
  font-family: sans-serif;
  color: var(--text-muted);
}

.branch-plan-edits {
  font-size: 0.75rem;
  font-family: sans-serif;
  color: var(--warning);
  margin-top: 0.35rem;
}

.branch-plan-explain {
  font-size: 0.8rem;
  font-family: sans-serif;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.3rem;
  line-height: 1.3;
}

.branch-new-choice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #c792ea;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-family: sans-serif;
  color: var(--text);
}

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

.branch-edits-header {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: sans-serif;
  color: var(--warning);
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 152, 0, 0.3);
}

.branch-edit-card {
  background: var(--bg);
  border: 1px solid rgba(255, 152, 0, 0.3);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
}

.branch-edit-old {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: line-through;
  opacity: 0.6;
  margin: 0.3rem 0;
  line-height: 1.4;
}

.branch-edit-new {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: text;
  min-height: 1.2em;
}

.branch-edit-new:hover {
  border-color: var(--border);
}

.branch-edit-new:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
  background: var(--surface);
}

.branch-loading-text {
  transition: opacity 0.4s ease;
}

.branch-loading-text.fade-out {
  opacity: 0;
}

/* --- Track Preview Overlay --- */
.card-bg.preview {
  stroke: #c792ea;
  stroke-width: 2;
  stroke-dasharray: 6 3;
  fill: rgba(199, 146, 234, 0.08);
  filter: drop-shadow(0 0 6px rgba(199, 146, 234, 0.3));
}

.track-edge-preview {
  stroke-dasharray: 8 4;
  filter: drop-shadow(0 0 4px rgba(199, 146, 234, 0.4));
  opacity: 0.8;
}

.preview-dimmer {
  fill: rgba(26, 26, 46, 0.6);
  pointer-events: none;
}

.card-bg.will-edit {
  fill: none;
  stroke: var(--warning);
  stroke-width: 2;
  stroke-dasharray: 6 3;
  pointer-events: none;
}

/* --- Fade animation --- */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

/* --- Toast notifications --- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: sans-serif;
  font-size: 0.9rem;
  z-index: 1000;
  animation: fadeIn 0.3s ease-in;
}

/* --- Confirm dialog --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
}

.modal-box.outline-modal-box {
  max-width: 750px;
  width: 95%;
}

.modal-box p {
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.modal-box .modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* --- Landing Page --- */
#home-screen {
  flex-direction: column;
  min-height: 100vh;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem 5rem;
}

.landing-headline {
  font-size: 3rem;
  font-weight: bold;
  color: var(--text);
  line-height: 1.15;
  max-width: 600px;
}

.landing-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
  max-width: 480px;
  line-height: 1.6;
}

.landing-ctas {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
}

.landing-ctas .btn {
  text-decoration: none;
  display: inline-block;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 2rem;
  border-top: 1px solid var(--border);
}

.landing-feature h2 {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.landing-feature p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* --- Landing Demo --- */
.landing-demo {
  text-align: center;
  padding: 4rem 2rem;
  border-top: 1px solid var(--border);
}

.landing-demo h2 {
  font-size: 1.8rem;
  color: var(--text);
  margin-bottom: 2rem;
}

.demo-container {
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  text-align: left;
}

.demo-text {
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text);
}

.demo-text p { margin-bottom: 1rem; }
.demo-text em { color: var(--text-muted); }
.demo-text strong { color: #fff; }

#demo-choices {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.demo-ending {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.demo-ending .btn {
  text-decoration: none;
  display: inline-block;
}

.landing-how {
  text-align: center;
  padding: 4rem 2rem;
  border-top: 1px solid var(--border);
}

.landing-how h2 {
  font-size: 1.8rem;
  color: var(--text);
  margin-bottom: 3rem;
}

.landing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.landing-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-family: sans-serif;
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.landing-step h3 {
  font-size: 1.05rem;
  color: var(--text);
}

.landing-step p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 260px;
}

.landing-pricing {
  text-align: center;
  padding: 4rem 2rem;
  border-top: 1px solid var(--border);
}

.landing-pricing h2 {
  font-size: 1.6rem;
  color: var(--text);
  margin-bottom: 1rem;
}

.landing-pricing-sub {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.landing-pricing .btn {
  text-decoration: none;
  display: inline-block;
}

.pricing-cards {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  width: 280px;
  text-align: center;
  position: relative;
  font-family: sans-serif;
}

.pricing-card-pro {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(233, 69, 96, 0.15);
}

.pricing-card-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 12px;
  white-space: nowrap;
}

.pricing-card-header {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.pricing-card-price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.pricing-period {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-card-alt {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.pricing-card-features {
  list-style: none;
  text-align: left;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 2;
}

.pricing-card-features li::before {
  content: '\2713';
  color: var(--success);
  margin-right: 0.5rem;
  font-weight: bold;
}

.pricing-card-cta {
  display: block;
  text-decoration: none;
  margin-top: auto;
}

.landing-footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  font-family: sans-serif;
  color: var(--text-muted);
}

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--text);
}

/* --- Legal Pages (Privacy, Accessibility) --- */
.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
  font-family: sans-serif;
  line-height: 1.7;
}

.legal-page h1 {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.legal-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.legal-page h2 {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1.15rem;
  color: var(--text);
  margin: 2rem 0 0.5rem;
}

.legal-page p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.legal-page ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.legal-page li {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.legal-page a {
  color: var(--accent);
  text-decoration: none;
}

.legal-page a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

.legal-back {
  margin-top: 3rem;
  text-align: center;
}

.legal-back .btn {
  text-decoration: none;
  display: inline-block;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .landing-features,
  .landing-steps {
    grid-template-columns: 1fr;
    max-width: 400px;
  }

  .landing-headline {
    font-size: 2.2rem;
  }

  .landing-hero {
    padding: 4rem 1.5rem 3rem;
  }

  .editor-floating-toolbar {
    padding: 0.3rem 0.5rem;
    gap: 0.15rem;
    max-width: calc(100vw - 20px);
    overflow-x: auto;
  }

  .toolbar-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.45rem;
  }

  .fab {
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
  }
}

@media (max-width: 600px) {
  .header-nav-link { font-size: 0.78rem; padding: 0.3rem 0.5rem; }
  .player-wrap { padding: 1.5rem 1rem !important; }
  .player-title h2 { font-size: 1.8rem; }
  #node-text { font-size: 1.05rem; }

  .library-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Shepherd.js Tour Overrides --- */
.shepherd-element {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5) !important;
  max-width: 340px !important;
  font-family: sans-serif !important;
}

.shepherd-text {
  color: var(--text) !important;
  font-size: 0.9rem !important;
  line-height: 1.6 !important;
  padding: 1rem !important;
}

.shepherd-header {
  background: var(--surface) !important;
  padding: 0.75rem 1rem 0 !important;
}

.shepherd-title {
  color: var(--text) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
}

.shepherd-cancel-icon {
  color: var(--text-muted) !important;
}

.shepherd-cancel-icon:hover {
  color: var(--text) !important;
}

.shepherd-footer {
  padding: 0 1rem 0.75rem !important;
  border-top: none !important;
}

.shepherd-button {
  background: var(--accent) !important;
  border: none !important;
  color: #fff !important;
  border-radius: 6px !important;
  font-size: 0.85rem !important;
  padding: 0.35rem 0.8rem !important;
  cursor: pointer !important;
}

.shepherd-button:not(:disabled):hover {
  background: var(--accent-hover) !important;
}

.shepherd-button.shepherd-button-secondary {
  background: none !important;
  border: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}

.shepherd-button.shepherd-button-secondary:hover {
  border-color: var(--text-muted) !important;
  color: var(--text) !important;
}

.shepherd-arrow::before {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
}

.shepherd-target-click-disabled.shepherd-enabled.shepherd-target,
.shepherd-target-click-disabled.shepherd-enabled.shepherd-target * {
  pointer-events: none !important;
}

.shepherd-modal-overlay-container {
  fill: rgba(0, 0, 0, 0.5) !important;
}
