/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1a1612;
  --bg-surface: #231e18;
  --bg-panel: #2c2520;
  --bg-input: #352d26;
  --border: #4a3f35;
  --border-light: #5c4e42;
  --text: #e8ddd2;
  --text-muted: #a89888;
  --text-dim: #7a6c5e;
  --accent: #c9a84c;
  --accent-hover: #d9bc6e;
  --accent-dim: rgba(201,168,76,0.15);
  --danger: #c94c4c;
  --danger-dim: rgba(201,76,76,0.15);
  --success: #4cc97a;
  --success-dim: rgba(76,201,122,0.15);
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --max-width: 1200px;
  --header-height: 56px;
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent-hover); text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

.skip-link {
  position: absolute; top: -100%;
  left: 16px; padding: 8px 16px;
  background: var(--accent); color: var(--bg);
  border-radius: var(--radius-sm);
  z-index: 9999; font-weight: 600;
}
.skip-link:focus { top: 8px; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}
.header-inner {
  display: flex; align-items: center;
  justify-content: space-between;
  height: 100%;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; font-size: 1.1rem;
}
.logo:hover, .logo:focus-visible { color: var(--accent); text-decoration: none; }
.logo-icon { flex-shrink: 0; }

.main-nav ul { display: flex; list-style: none; gap: 24px; }
.main-nav a {
  color: var(--text-muted); font-size: 0.9rem;
  padding: 4px 0; border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a[aria-current="page"] {
  color: var(--text); border-bottom-color: var(--accent); text-decoration: none;
}

/* ===== HERO ===== */
.hero-section {
  padding: 64px 0 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-section h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800; line-height: 1.2;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.1rem; color: var(--text-muted);
  max-width: 560px; margin: 0 auto 28px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-hover); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-light); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; margin-bottom: 8px; }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ===== PANELS ===== */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.panel-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.panel-header h2 { font-size: 1.15rem; font-weight: 700; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.85rem;
  font-weight: 600; color: var(--text-muted);
  margin-bottom: 4px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font);
  font-size: 0.9rem; line-height: 1.5;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-group textarea { resize: vertical; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }

/* ===== PLANNER LAYOUT ===== */
.planner-section { padding: 40px 0; }
.planner-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}
.planner-sidebar { position: sticky; top: calc(var(--header-height) + 20px); }
.planner-sidebar .panel { padding: 16px; }
.planner-sidebar h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; }
.sidebar-note { font-size: 0.8rem; color: var(--text-dim); margin-top: 8px; }

/* ===== SCENE CARDS ===== */
.scenes-list { display: flex; flex-direction: column; gap: 16px; }
.scene-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
}
.scene-card.is-start { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim); }
.scene-card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.scene-card-header h3 {
  font-size: 0.95rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.scene-id {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--text-dim); background: var(--bg-input);
  padding: 2px 8px; border-radius: var(--radius-sm);
}
.scene-badge {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--accent-dim); color: var(--accent);
}
.choices-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.choice-row {
  display: grid;
  grid-template-columns: 1fr 140px 100px 100px auto;
  gap: 8px; align-items: end;
}
.choice-row .form-group { margin-bottom: 0; }
.btn-add-choice {
  margin-top: 8px;
  font-size: 0.82rem;
}

/* ===== COMPARISON TABLE ===== */
.compare-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.compare-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}
.compare-table th {
  text-align: left; padding: 10px 14px;
  background: var(--bg-surface);
  color: var(--text-muted); font-weight: 600;
  font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.compare-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: rgba(201,168,76,0.04); }
.compare-table .empty-state { text-align: center; color: var(--text-dim); padding: 32px; }

.compare-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 12px; padding: 0 4px;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--text-muted);
}
.dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.dot-low { background: var(--success); }
.dot-med { background: var(--accent); }
.dot-high { background: var(--danger); }
.dot-unreachable { background: var(--text-dim); }

.risk-low { color: var(--success); }
.risk-med { color: var(--accent); }
.risk-high { color: var(--danger); }
.unreachable-warning { color: var(--danger); font-weight: 600; }

/* ===== STATS ===== */
.stats-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.stats-list dt { font-size: 0.8rem; color: var(--text-dim); }
.stats-list dd { font-size: 1.1rem; font-weight: 700; color: var(--accent); }

/* ===== GUIDE SECTION ===== */
.guide-section {
  padding: 48px 0 64px;
  border-top: 1px solid var(--border);
}
.guide-section h2 {
  font-size: 1.6rem; font-weight: 800;
  margin-bottom: 32px; text-align: center;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.guide-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.guide-step {
  width: 32px; height: 32px;
  background: var(--accent); color: var(--bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem;
  margin-bottom: 12px;
}
.guide-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.guide-card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; }

.guide-walkthrough,
.guide-mistakes,
.guide-assumptions,
.guide-faq {
  margin-bottom: 32px;
}
.guide-walkthrough h3,
.guide-mistakes h3,
.guide-assumptions h3,
.guide-faq h3 {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 12px;
}
.guide-walkthrough p,
.guide-assumptions p {
  color: var(--text-muted); font-size: 0.92rem;
  line-height: 1.6; margin-bottom: 8px;
}
.guide-mistakes ul {
  list-style: none;
  display: flex; flex-direction: column; gap: 10px;
}
.guide-mistakes li {
  font-size: 0.9rem; color: var(--text-muted);
  padding-left: 20px; position: relative;
}
.guide-mistakes li::before {
  content: '›'; position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}
.guide-mistakes li strong { color: var(--text); }

.guide-faq details {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.guide-faq summary {
  padding: 12px 16px;
  cursor: pointer; font-weight: 600;
  font-size: 0.92rem;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.guide-faq summary::-webkit-details-marker { display: none; }
.guide-faq summary::after {
  content: '+'; font-size: 1.2rem;
  color: var(--accent); transition: transform 0.2s;
}
.guide-faq details[open] summary::after { content: '−'; }
.guide-faq details p {
  padding: 0 16px 14px;
  font-size: 0.88rem; color: var(--text-muted);
  line-height: 1.55;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; color: var(--text-dim);
  font-size: 0.88rem; padding: 24px;
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  background: var(--bg-surface);
}
.footer-inner {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem; color: var(--text-dim);
}
.footer-brand a { color: var(--text-muted); }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a { color: var(--text-dim); }
.footer-nav a:hover { color: var(--text-muted); }
.footer-meta { font-size: 0.78rem; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-panel); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.88rem; font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 9999;
  animation: toast-in 0.3s ease;
}
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .planner-layout { grid-template-columns: 1fr; }
  .planner-sidebar { position: static; }
  .choice-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .container { padding: 0 14px; }
  .hero-section { padding: 40px 0 32px; }
  .hero-actions { flex-direction: column; align-items: center; }
  .panel { padding: 14px; }
  .choice-row { grid-template-columns: 1fr; }
  .compare-table { font-size: 0.78rem; }
  .compare-table th, .compare-table td { padding: 8px 10px; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* ===== PRINT ===== */
@media print {
  .site-header, .site-footer, .hero-actions,
  .panel-actions, .btn, .planner-sidebar,
  .guide-section { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { border: 1px solid #ccc; break-inside: avoid; }
  .compare-table th { background: #f0f0f0; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
