/* ============================================================
   Campaign Gremlin — Main Stylesheet
   Palette: warm dark, aged brass accent, campaign-journal feel
   Fonts: Cinzel (display headings) + Inter (body)
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Backgrounds — warm near-blacks, not cold blue-grey */
  --bg:        #0f0d0b;   /* page background */
  --panel:     #1a1714;   /* card / panel surface */
  --panel-2:   #221e1a;   /* slightly elevated panel */
  --panel-3:   #2a2520;   /* inset / input background */

  /* Borders */
  --line:      #3a342a;   /* default border */
  --line-dim:  #2a2520;   /* subtle divider */

  /* Typography */
  --text:      #ede8df;   /* primary — warm off-white */
  --muted:     #9c9080;   /* secondary / label text */
  --faint:     #5a5248;   /* placeholders & hints */

  /* Accent — aged brass / amber */
  --accent:    #c9923a;
  --accent-hi: #dba84e;   /* hover */
  --accent-lo: #8f6325;   /* pressed / dimmed */
  --accent-bg: rgba(201, 146, 58, 0.08);

  /* Semantic colours */
  --success:   #5a9e72;
  --danger:    #b85650;
  --info:      #4a7c9e;

  /* Elevation */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow:    0 6px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);

  /* Shape */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  /* Motion */
  --ease: 150ms ease;
}


/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--ease);
}
a:hover { color: var(--accent-hi); }

/* Headings use the display font for atmosphere */
h1, h2, h3, h4, h5, h6 {
  font-family: "Cinzel", "Georgia", serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  margin: 0 0 0.6em;
  color: var(--text);
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

/* Eyebrow — small caps label above a heading */
.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 6px;
  display: block;
}


/* ── App Header ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 clamp(16px, 4vw, 48px);
  background: rgba(15, 13, 11, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-family: "Cinzel", serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--accent-hi); }

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color var(--ease);
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }

.nav-spacer { flex: 1; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .nav-links { display: none; }
}


/* ── Page Shell ─────────────────────────────────────────────── */
.page-shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 36px auto;
}

.page-shell--narrow {
  width: min(760px, calc(100vw - 32px));
  margin: 36px auto;
}

.page-heading {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-dim);
}
.page-heading h1 { margin-bottom: 6px; }


/* ── Panels / Cards ─────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.panel + .panel { margin-top: 16px; }
.panel h2, .panel h3 { margin-top: 0; }

.panel--accented { border-left: 3px solid var(--accent); }
.panel--raised   { background: var(--panel-2); box-shadow: var(--shadow); }
.panel--inset    { background: var(--panel-3); border-color: var(--line-dim); box-shadow: none; }


/* ── Grids ──────────────────────────────────────────────────── */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.sidebar-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .sidebar-layout { grid-template-columns: 1fr; }
}


/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 16px;
  text-decoration: none;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  white-space: nowrap;
}

.btn-primary  { background: var(--accent); color: #0f0d0b; }
.btn-primary:hover { background: var(--accent-hi); color: #0f0d0b; }

.btn-secondary { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 22px; font-size: 0.95rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.action-row { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.action-row--end { justify-content: flex-end; }


/* ── Forms ──────────────────────────────────────────────────── */
.form-field { margin-bottom: 16px; }

.form-field label,
label.field-label {
  display: block;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

::placeholder { color: var(--muted); opacity: 0.7; } /* readable but clearly placeholder */
textarea { resize: vertical; min-height: 80px; }

.field-hint { color: var(--faint); font-size: 0.78rem; margin-top: 4px; }


/* ── Campaign List Rows ─────────────────────────────────────── */
.campaign-list { display: grid; gap: 8px; }

.campaign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--ease), background var(--ease);
}
.campaign-row:hover { border-color: var(--accent); background: var(--panel-2); color: var(--text); }

.campaign-row__name {
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  font-weight: 600;
}

.campaign-row__meta { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }

.campaign-row__badge {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  white-space: nowrap;
}


/* ── Stat / Metric Chips ────────────────────────────────────── */
.metric-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.metric-chip {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.82rem;
  padding: 7px 12px;
  color: var(--muted);
}
.metric-chip strong { color: var(--text); font-weight: 700; }
.metric-chip--accent { border-color: var(--accent-lo); color: var(--accent); }


/* ── Timeline ───────────────────────────────────────────────── */
.timeline { display: grid; gap: 10px; }

.timeline-entry {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-lo);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.timeline-entry__title { font-family: "Cinzel", serif; font-size: 0.92rem; font-weight: 600; }
.timeline-entry__meta  { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.timeline-entry__body  { color: var(--muted); font-size: 0.88rem; line-height: 1.6; margin-top: 8px; }


/* ── AI Content Blocks ──────────────────────────────────────── */
.ai-block {
  background: var(--accent-bg);
  border: 1px solid var(--accent-lo);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.92rem;
  line-height: 1.75;
  padding: 16px 20px;
}

.ai-block__label {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-generating {
  opacity: 0.55;
  animation: ai-pulse 1.5s ease-in-out infinite;
}
@keyframes ai-pulse {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 0.9; }
}


/* ── Empty States ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty-state p { max-width: 360px; margin: 0 auto 20px; }


/* ── Badges & Tags ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 9px;
}
.badge--accent  { background: var(--accent-bg);        border-color: var(--accent-lo); color: var(--accent); }
.badge--success { background: rgba(90,158,114,0.1);     border-color: #3d7a57;          color: var(--success); }
.badge--danger  { background: rgba(184,86,80,0.1);      border-color: #8a3d3a;          color: var(--danger); }


/* ── Flash Messages ─────────────────────────────────────────── */
.flash-messages { display: grid; gap: 8px; margin-bottom: 20px; }

.flash { border-radius: var(--radius-sm); font-size: 0.88rem; padding: 10px 16px; }
.flash--success { background: rgba(90,158,114,0.12); border: 1px solid #3d7a57; color: var(--success); }
.flash--error   { background: rgba(184,86,80,0.12);  border: 1px solid #8a3d3a; color: var(--danger); }
.flash--info    { background: var(--accent-bg);       border: 1px solid var(--accent-lo); color: var(--accent); }


/* ── Utilities ──────────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-accent  { color: var(--accent); }
.text-faint   { color: var(--faint); }
.text-sm      { font-size: 0.84rem; }
.text-xs      { font-size: 0.75rem; }
.font-display { font-family: "Cinzel", serif; }
.mt-0  { margin-top: 0 !important; }
.mb-0  { margin-bottom: 0 !important; }
.flex  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }


/* ── Back link / Breadcrumb ─────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 12px;
  text-decoration: none;
}
.back-link:hover { color: var(--text); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb span:not(a) { color: var(--faint); }


/* ── Campaign Header ────────────────────────────────────────── */
.campaign-header { margin-bottom: 32px; }
.campaign-description { color: var(--muted); margin-top: 6px; max-width: 680px; }
.force-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.force-meta { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }


/* ── Force Cards (grid of clickable cards) ──────────────────── */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.force-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.force-card:hover { border-color: var(--accent-lo); background: var(--accent-bg); }
.force-card__header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.force-card__header strong { font-size: 0.95rem; }
.force-card__player { color: var(--muted); font-size: 0.82rem; }
.force-card__notes  { color: var(--muted); font-size: 0.85rem; margin: 0; }
.force-card__cta    { color: var(--accent); font-size: 0.8rem; margin-top: auto; padding-top: 8px; }


/* ── Entity Cards ───────────────────────────────────────────── */
.entity-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.entity-card--dead     { opacity: 0.6; }
.entity-card--retired  { opacity: 0.7; }
.entity-card--missing  { border-style: dashed; }
.entity-card__header   { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.entity-card__header strong { font-size: 0.92rem; }
.entity-card__type     { color: var(--muted); font-size: 0.8rem; }
.entity-card__notes    { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }
.entity-card__edit     { color: var(--accent); font-size: 0.8rem; margin-top: 8px; text-decoration: none; }
.entity-card__edit:hover { text-decoration: underline; }


/* ── Badge status colours ───────────────────────────────────── */
.badge--active      { background: rgba(90,158,114,0.1); border-color: #3d7a57; color: var(--success); }
.badge--eliminated  { background: rgba(184,86,80,0.1);  border-color: #8a3d3a; color: var(--danger); }
.badge--victorious  { background: var(--accent-bg);     border-color: var(--accent-lo); color: var(--accent); }
.badge--dead        { background: rgba(184,86,80,0.1);  border-color: #8a3d3a; color: var(--danger); }
.badge--retired     { background: var(--panel-3);       border-color: var(--line); color: var(--muted); }
.badge--missing     { background: rgba(180,140,50,0.1); border-color: #7a6020; color: #c8a84a; }
.badge--inactive    { background: var(--panel-3);       border-color: var(--line); color: var(--faint); }
.badge--planned     { background: var(--panel-3);       border-color: var(--line); color: var(--muted); }
.badge--in_progress { background: var(--accent-bg);     border-color: var(--accent-lo); color: var(--accent); }
.badge--completed   { background: rgba(90,158,114,0.1); border-color: #3d7a57; color: var(--success); }


/* ── Scenario List ──────────────────────────────────────────── */
.scenario-list { display: grid; gap: 12px; }

.scenario-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: grid;
  gap: 12px;
}
.scenario-row--completed { border-left: 3px solid var(--success); }
.scenario-row--planned   { border-left: 3px solid var(--line); }

.scenario-row__info { display: flex; flex-direction: column; gap: 4px; }
.scenario-row__info strong { font-size: 0.95rem; }
.scenario-row__info small  { color: var(--muted); font-size: 0.82rem; }
.scenario-row__info p      { color: var(--muted); font-size: 0.87rem; margin: 2px 0 0; }

.scenario-row__result { display: flex; flex-direction: column; gap: 6px; }
.scenario-row__result p { color: var(--muted); font-size: 0.87rem; margin: 0; }

.scenario-row__result-form { display: grid; gap: 10px; }
.scenario-row__result-form label { font-size: 0.85rem; }

.outcome { font-weight: 700; font-size: 0.88rem; letter-spacing: 0.05em; }
.outcome--win  { color: var(--success); }
.outcome--loss { color: var(--danger); }
.outcome--draw { color: var(--muted); }


/* ── Stat List (dl grid) ────────────────────────────────────── */
.stat-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  margin: 0;
}
.stat-list > div { display: flex; flex-direction: column; gap: 2px; }
.stat-list dt { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-list dd { font-size: 1.4rem; font-weight: 700; color: var(--text); margin: 0; }


/* ── Form actions row ───────────────────────────────────────── */
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }


/* ── Field Definition Manager ───────────────────────────────── */
.field-def-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.field-def-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
}

.field-def-label { flex: 1; font-size: 0.88rem; font-weight: 500; }
.field-def-delete { margin-left: auto; }

.btn-icon {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.btn-icon:hover { color: var(--danger); background: rgba(184,86,80,0.1); }

.field-add-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 4px;
}
.field-add-form input  { flex: 1; min-width: 160px; margin: 0; }
.field-add-form select { width: auto; margin: 0; }
.field-add-form button { white-space: nowrap; }


/* ── Entity card field values ───────────────────────────────── */
.entity-card__fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 6px 0 0;
}
.entity-card__fields > div { display: flex; flex-direction: column; gap: 1px; }
.entity-card__fields dt { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.entity-card__fields dd { font-size: 0.92rem; font-weight: 600; color: var(--text); margin: 0; }


/* ── Form sections (fieldset) ───────────────────────────────── */
.form-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.form-section legend {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0 6px;
  text-transform: uppercase;
}

.field-inputs { display: grid; gap: 10px; margin-bottom: 4px; }


/* ── Result submission page ─────────────────────────────────── */
.result-layout { display: grid; gap: 20px; max-width: 860px; }

.result-header h1 { margin-top: 6px; }

.result-submit-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 24px;
}

.btn-lg { padding: 11px 28px; font-size: 1rem; }


/* ── Outcome selector (radio cards) ────────────────────────── */
.outcome-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.outcome-option {
  flex: 1;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 20px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.outcome-option input[type="radio"] { display: none; }

.outcome-option--win:has(input:checked)  { border-color: var(--success); background: rgba(90,158,114,0.1); color: var(--success); }
.outcome-option--draw:has(input:checked) { border-color: var(--accent-lo); background: var(--accent-bg); color: var(--accent); }
.outcome-option--loss:has(input:checked) { border-color: #8a3d3a; background: rgba(184,86,80,0.1); color: var(--danger); }

.outcome-option--win:hover  { border-color: var(--success); }
.outcome-option--draw:hover { border-color: var(--accent-lo); }
.outcome-option--loss:hover { border-color: #8a3d3a; }


/* ── Force outcome group ────────────────────────────────────── */
.force-outcome-group { margin-bottom: 28px; }
.force-outcome-group:last-child { margin-bottom: 0; }

.force-outcome-group__title {
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.force-outcome-group__title small {
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 0.82rem;
}


/* ── Entity outcome cards ───────────────────────────────────── */
.entity-outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.entity-outcome-card {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entity-outcome-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.entity-outcome-card__header strong { font-size: 0.92rem; display: block; }
.entity-outcome-card__header small  { color: var(--muted); font-size: 0.78rem; }

.entity-outcome-card__status label { font-size: 0.82rem; margin: 0; }
.entity-outcome-card__status select { margin-top: 3px; }

.entity-outcome-card__fields {
  display: grid;
  gap: 8px;
}
.entity-outcome-card__fields label { font-size: 0.82rem; margin: 0; }
.entity-outcome-card__fields input,
.entity-outcome-card__fields select,
.entity-outcome-card__fields textarea { margin-top: 3px; font-size: 0.88rem; }

.field-input--integer { width: 90px; }


/* ── Outcome log (on completed scenarios) ───────────────────── */
.outcome-log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.outcome-log__entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--muted);
  background: var(--panel-3);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}
.outcome-log__entry strong { color: var(--text); font-size: 0.85rem; }

.outcome-log__status-change { display: flex; align-items: center; gap: 4px; }
.outcome-log__field-change  { color: var(--faint); }


/* ── Entity detail page ─────────────────────────────────────── */
.entity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.entity-header__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.entity-header__title-row h1 { margin: 4px 0 0; }

.badge--lg { font-size: 0.82rem; padding: 4px 12px; }

.entity-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.entity-fields-dl { margin: 0; display: grid; gap: 10px; }
.entity-fields-dl__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.entity-fields-dl__row:last-child { border-bottom: none; padding-bottom: 0; }
.entity-fields-dl__row dt { color: var(--muted); font-size: 0.84rem; }
.entity-fields-dl__row dd { font-size: 1.05rem; font-weight: 700; margin: 0; }

.field-bool         { font-size: 0.82rem; font-weight: 600; }
.field-bool--yes    { color: var(--success); }
.field-bool--no     { color: var(--faint); }

.entity-notes { color: var(--muted); line-height: 1.7; }

.entity-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
}
.entity-card__history-count { color: var(--faint); font-size: 0.78rem; }


/* ── Career timeline ────────────────────────────────────────── */
.career-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.career-entry {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0 12px;
  padding-bottom: 24px;
  position: relative;
}
.career-entry:last-child { padding-bottom: 0; }

/* Vertical line connecting dots */
.career-entry__connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.career-entry:not(:last-child) .career-entry__connector::after {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: var(--line);
}

.career-entry__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  margin-top: 3px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.career-entry__dot--dead          { background: var(--danger);  border-color: var(--danger); }
.career-entry__dot--retired       { background: var(--muted);   border-color: var(--muted); }
.career-entry__dot--status-change { background: var(--accent);  border-color: var(--accent); }
.career-entry__dot--normal        { background: var(--panel-3); border-color: var(--accent-lo); }

.career-entry__body { padding-top: 0; }

.career-entry__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.career-entry__scenario { font-size: 0.92rem; }
.career-entry__time     { color: var(--faint); font-size: 0.78rem; }

.career-entry__changes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.career-change {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  flex-wrap: wrap;
}
.career-change--status { font-weight: 500; }

.career-change__label  { color: var(--muted); min-width: 80px; }
.career-change__before { color: var(--faint); text-decoration: line-through; font-size: 0.82rem; }
.career-change__arrow  { color: var(--faint); }
.career-change__after  { color: var(--text); font-weight: 600; }

.career-change__delta {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.career-change__delta--pos { background: rgba(90,158,114,0.15); color: var(--success); }
.career-change__delta--neg { background: rgba(184,86,80,0.15);  color: var(--danger); }


/* ── Campaign list — GM/Player badge ───────────────────────── */
.campaign-row__right { display: flex; align-items: center; gap: 8px; }


/* ── Members panel ──────────────────────────────────────────── */
.member-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 4px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.member-row--gm   { border-color: var(--accent-lo); }
.member-row--empty { color: var(--faint); font-size: 0.84rem; padding: 10px 0; background: none; border: none; }

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel-3);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.member-row--gm .member-avatar { background: var(--accent-bg); border-color: var(--accent-lo); color: var(--accent); }

.member-name { flex: 1; font-size: 0.88rem; font-weight: 500; }
.member-remove-form { margin-left: auto; }


/* ── Invite block ───────────────────────────────────────────── */
.invite-block { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.invite-block__label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }

.invite-block__code-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }

.invite-code {
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-lo);
  border-radius: var(--radius-sm);
  padding: 4px 14px;
}

.invite-block__url { word-break: break-all; margin-bottom: 10px; }
.invite-block__url em { font-style: normal; color: var(--text); }


/* ── Join page ──────────────────────────────────────────────── */
.join-panel { max-width: 480px; margin: 0 auto; }
.join-panel h1 { margin-top: 6px; }
.join-panel__description { color: var(--muted); margin: 12px 0; line-height: 1.6; }
.join-panel__meta { display: flex; gap: 24px; margin: 16px 0 20px; }
.join-panel__meta dt { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.join-panel__meta dd { font-size: 1.2rem; font-weight: 700; margin: 0; }


/* ── AI Recap block ─────────────────────────────────────────── */
.ai-recap {
  background: var(--accent-bg);
  border: 1px solid var(--accent-lo);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 12px;
}

.ai-recap__label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.ai-icon { font-size: 0.9rem; }

.ai-recap__narrative p {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.75;
  margin: 0 0 10px;
}
.ai-recap__narrative p:last-child { margin-bottom: 0; }

.ai-recap__consequences {
  border-top: 1px solid var(--accent-lo);
  margin: 14px 0 0;
  padding: 12px 0 0 18px;
  display: grid;
  gap: 5px;
}
.ai-recap__consequences li {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.ai-recap__regen { margin-top: 10px; }

.btn-xs { padding: 3px 10px; font-size: 0.78rem; }


/* ── Next Scenario Suggestions ──────────────────────────────── */
.suggestions-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.suggestions-panel__header h2 { margin: 0; }

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.suggestion-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
}
.suggestion-card:hover { border-color: var(--accent-lo); }

.suggestion-card__header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.suggestion-card__mission-type {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.suggestion-card__title {
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  line-height: 1.3;
}

.suggestion-card__premise {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

.suggestion-card__stakes {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.suggestion-card__stakes-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  display: block;
  margin-bottom: 2px;
}

.suggestion-card__use { margin-top: auto; }


/* ── Entity Legend (AI narrative) ───────────────────────────── */
.legend-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.legend-panel__header h2 { margin: 0; }

.legend-panel__stale-btn { display: flex; align-items: center; gap: 6px; }

.legend-stale-tag {
  background: rgba(180,140,50,0.15);
  border: 1px solid #7a6020;
  border-radius: 10px;
  color: #c8a84a;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 7px;
}

.entity-legend {
  border-left: 3px solid var(--accent-lo);
  background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.8;
  margin: 0;
  padding: 16px 20px;
  font-style: italic;
}

/* ── Dashboard ──────────────────────────────────────────────── */

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.dash-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.dash-left, .dash-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dash-section-title {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 0 12px 0;
}

.dash-panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 14px 0;
  color: var(--text);
}

/* Campaign grid */
.dash-campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.dash-campaign-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dash-campaign-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.dash-campaign-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.dash-campaign-card__system {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dash-campaign-card__name {
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.3;
}

.dash-campaign-card__stage {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.dash-campaign-card__stats {
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin-top: 4px;
}

.dash-campaign-card__last {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.dash-campaign-card__planned {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 2px;
}

.dash-campaign-card--new {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  min-height: 120px;
}

.dash-campaign-card--new:hover {
  color: var(--accent);
}

.dash-new-icon {
  font-size: 1.8rem;
  line-height: 1;
  opacity: 0.5;
}

/* Pending actions */
.dash-pending__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  margin: 0 0 14px 0;
}

.pending-dot {
  width: 8px;
  height: 8px;
  background: var(--danger, #e05252);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.pending-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pending-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pending-item__info strong { font-size: 0.88rem; }
.pending-item__info small { font-size: 0.75rem; color: var(--text-muted); }

/* Activity feed */
.activity-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  background: var(--text-muted);
}

.activity-item__dot--win  { background: #4caf50; }
.activity-item__dot--loss { background: #e05252; }
.activity-item__dot--draw { background: #c8a84a; }

.activity-item__body { flex: 1; min-width: 0; }

.activity-item__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.activity-item__meta {
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-item__meta a {
  color: var(--text-muted);
  text-decoration: none;
}

.activity-item__meta a:hover { color: var(--accent); }

.activity-item__recap-tag {
  font-size: 0.7rem;
  color: var(--accent);
  margin-top: 2px;
  display: block;
}

/* Quick join panel */
.dash-quick-join h3 { font-size: 0.9rem; margin: 0 0 10px 0; }

.quick-join-form {
  display: flex;
  gap: 6px;
}

.quick-join-form input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Empty state */
.dash-empty {
  text-align: center;
  padding: 60px 24px;
  max-width: 480px;
  margin: 0 auto;
}

.dash-empty h2 { margin: 8px 0 12px; }

.dash-empty__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Suggestions preview on dashboard */
.dash-suggestion-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.dash-suggestion-block__campaign {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}

.dash-suggestion-block__link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  margin-top: 12px;
}

@media (max-width: 768px) {
  .dash-layout {
    grid-template-columns: 1fr;
  }
  .dash-right { order: -1; }
}

/* ── Page-specific Components ─────────────────────────────── */

/* ── New UI Components (Design Revision 2) ──────────────────────── */

/* 1. TAB SYSTEM */
.tab-strip {
  display: flex;
  flex-direction: row;
  border-bottom: 2px solid var(--line);
  margin-bottom: 24px;
}

.tab-item {
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  text-decoration: none;
  display: inline-block;
  transition: color var(--ease);
  margin-bottom: -2px;
}

.tab-item:hover {
  color: var(--text);
}

.tab-item--active {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}

/* 2. STAT TILES */
.stat-tile-row {
  display: flex;
  flex-direction: row;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}

.stat-tile {
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-right: 1px solid var(--line);
}

.stat-tile:last-child {
  border-right: none;
}

.stat-tile__value {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.stat-tile__value--accent {
  color: var(--accent);
}

.stat-tile__value--danger {
  color: var(--danger);
}

.stat-tile__label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* 3. STATUS DOTS */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--active {
  background: #4caf50;
}

.status-dot--defeated {
  background: #c45a5a;
}

.status-dot--pending {
  background: var(--muted);
}

/* 4. CAMPAIGN HEADER BLOCK */
.campaign-header-block {
  margin-bottom: 24px;
}

.campaign-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 5. SCENARIO FEATURED CARD */
.scenario-featured {
  background: var(--panel-2);
  border: 1px solid var(--accent-lo);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.scenario-featured__title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 0;
}

.scenario-featured__meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* 6. FORCE CARD COMPACT */
.force-card--compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 6px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--ease);
}

.force-card--compact:hover {
  border-color: var(--accent);
}

.force-card--compact__name {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
}

.force-card--compact__player {
  color: var(--muted);
  font-size: 0.8rem;
}

.force-card--compact__caret {
  color: var(--muted);
  font-size: 0.9rem;
}

/* 7. FORCE GRID / ENTITY CARDS */
.force-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.entity-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.entity-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.entity-card__name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.entity-card__type {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Inter', sans-serif;
}

.entity-card__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}


/* ── Mobile nav ─────────────────────────────────────────────────────────────
   On small screens hide the nav links but ALWAYS show brand + user actions  */
@media (max-width: 640px) {
  .nav-links { display: none; }

  /* Ensure user section stays visible and right-aligned */
  .nav-user  { margin-left: auto; }

  /* Tighten header padding on mobile */
  .app-header { padding: 0 16px; gap: 12px; }

  /* Keep brand readable */
  .brand { font-size: 0.85rem; letter-spacing: 0.06em; }
}


/* ── Campaign List page ──────────────────────────────────────────────────── */

/* Page header: title left, + New Campaign button right (button hidden when no campaigns) */
.clist-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;    /* tighter — less air between heading and content */
  flex-wrap: wrap;
}

/* Filter row */
.clist-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.clist-filter__label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  margin-right: 4px;
  white-space: nowrap;
}

.filter-tab {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 14px;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  white-space: nowrap;
}

.filter-tab:hover {
  border-color: var(--accent-lo);
  color: var(--text);
}

.filter-tab--active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.filter-tab__badge {
  color: var(--muted);
  font-weight: 400;
  margin-left: 2px;
}

/* Tab that would show zero results — still clickable, visually dimmed */
.filter-tab--empty {
  opacity: 0.45;
  cursor: default;
}

/* Inline message when a filter returns nothing */
.clist-filter-empty {
  padding: 20px 0 8px;
}

/* Campaign card grid — 2 columns on desktop, 1 on mobile */
.clist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* Individual campaign card */
.ccard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
  position: relative;
}

.ccard:hover {
  border-color: var(--accent);
  background: var(--panel-2);
  transform: translateY(-1px);
}

/* GM campaign gets a subtle left accent bar */
.ccard--gm {
  border-left: 3px solid var(--accent);
}

.ccard--player {
  border-left: 3px solid var(--line);
}

/* Top row: system label left, role badge right */
.ccard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.ccard__system {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Campaign name */
.ccard__name {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 600;
  margin: 0;
  color: var(--text);
  line-height: 1.2;
}

/* Current stage */
.ccard__stage {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0;
}

/* Short description preview */
.ccard__desc {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  margin: 4px 0 0;
  flex: 1; /* push footer to bottom */
}

/* Footer: W/L/D stats left, player count right */
.ccard__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-dim);
  gap: 8px;
}

.ccard__stats {
  display: flex;
  gap: 12px;
}

.ccard__stat {
  color: var(--muted);
  font-size: 0.8rem;
}

.ccard__stat strong {
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  margin-right: 2px;
}

.ccard__stat--win strong {
  color: var(--accent);
}

.ccard__members {
  color: var(--faint);
  font-size: 0.78rem;
  white-space: nowrap;
}

/* ── Empty state (no campaigns) ──────────────────────────────────────────── */
.clist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 24px 24px 64px;   /* less top padding — tighten gap to heading */
  max-width: 480px;
  margin: 0 auto;
}

.clist-empty__icon {
  font-size: 2.2rem;
  opacity: 0.2;
  line-height: 1;
  margin-bottom: 4px;
}

.clist-empty h2 {
  margin: 0;
  font-size: 1.5rem;
}

.clist-empty p {
  margin: 0;
  max-width: 400px;
  line-height: 1.65;
}

.clist-empty__cta {
  width: 100%;
  max-width: 320px;
  justify-content: center;
  margin-top: 4px;
}

/* "or join an existing one" divider */
.clist-empty__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 380px;
  color: var(--muted);      /* bumped up from --faint */
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.clist-empty__divider::before,
.clist-empty__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-dim);
}

/* Invite code input row */
.clist-join-form {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 380px;
}

/* Invite input — flat, no inset/emboss effect */
.clist-join-input {
  flex: 1;
  background: transparent;          /* no recessed panel look */
  border: 1px solid var(--line);
  letter-spacing: 0.06em;
}

.clist-join-input::placeholder {
  color: var(--muted);
  letter-spacing: 0;
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .clist-grid {
    grid-template-columns: 1fr;
  }

  .clist-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .clist-header .btn {
    width: 100%;
    justify-content: center;
  }
}

.entity-card__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entity-card__field-label {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Inter', sans-serif;
}

.entity-card__field-value {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

/* 8. STAT GRID */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.stat-grid__item {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.stat-grid__label {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  font-family: 'Inter', sans-serif;
}

.stat-grid__value {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
}

/* 9. MODAL (native <dialog>) */
dialog.modal-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  min-width: 480px;
  max-width: 640px;
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

dialog.modal-box::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.modal-box__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-box__title {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 1.2rem;
  padding: 4px 8px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}

.modal-close:hover {
  color: var(--text);
  border-color: var(--line);
}

/* 10. OUTCOME DECLARATION */
.outcome-declaration {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}

.outcome-declaration__label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 16px;
}

.outcome-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.outcome-btn {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: all var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.outcome-btn__icon {
  font-size: 1.5rem;
}

.outcome-btn--win.selected {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.outcome-btn--draw.selected {
  border-color: var(--muted);
  background: rgba(156, 144, 128, 0.1);
  color: var(--text);
}

.outcome-btn--defeat.selected {
  border-color: var(--danger);
  background: rgba(184, 86, 80, 0.1);
  color: var(--danger);
}

/* 11. BATTLE REPORT PANEL */
.battle-report-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

/* 12. RESULT CONTEXT BAR */
.result-context-bar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  position: sticky;
  top: 56px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.result-context-bar__title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.result-context-bar__meta {
  color: var(--muted);
  font-size: 0.85rem;
}

/* 13. STICKY SUBMIT BAR */
.sticky-submit {
  position: sticky;
  bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
}

/* 14. ENTITY OUTCOME GRID + CARDS */
.entity-outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.entity-outcome-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.entity-outcome-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.entity-outcome-card__name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

/* 15. FIELD DEF LIST */
.field-def-list {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.field-def-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.field-def-row__label {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}

.field-def-row__type {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Inter', sans-serif;
}

/* 16. MISC UTILITIES */
.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-16 {
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
}

.overview-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
}


/* ── Home / Landing page ─────────────────────────────────────────────────── */

.home-shell {
  /* No max-width constraint on hero — page-shell handles inner content */
}

/* Hero section */
.home-hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--line-dim);
  margin-bottom: 56px;
}

.home-hero__title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin: 8px 0 16px;
  line-height: 1.05;
}

.home-hero__tagline {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 480px;
  line-height: 1.6;
  margin: 0 0 28px;
}

.home-hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Sections */
.home-section {
  margin-bottom: 64px;
}

/* Feature grid */
.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.home-feature {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
}

.home-feature__icon {
  font-size: 1.6rem;
  margin-bottom: 16px;
  opacity: 0.7;
  line-height: 1;
}

.home-feature__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text);
}

.home-feature__body {
  font-size: 0.88rem;
  line-height: 1.65;
  margin: 0;
}

/* Game system tags */
.home-systems {
  text-align: center;
}

.home-system-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.home-system-tag {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 5px 14px;
}

/* Release notes */
.home-release {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.home-release__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line);
}

.home-release__title {
  font-size: 1.4rem;
  margin: 6px 0 0;
}

.home-release__entries {
  padding: 0;
}

.home-release__entry {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  padding: 28px 32px;
  border-bottom: 1px solid var(--line-dim);
}

.home-release__entry:last-child {
  border-bottom: none;
}

.home-release__entry--coming {
  opacity: 0.55;
}

.home-release__version {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding-top: 4px;
}

.home-release__version--muted {
  color: var(--muted);
}

.home-release__entry-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.home-release__entry-title--muted {
  color: var(--muted);
}

.home-release__date {
  margin: 0 0 14px;
}

.home-release__list {
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.8;
}

.home-release__list--muted {
  opacity: 0.7;
}

@media (max-width: 640px) {
  .home-hero { padding: 40px 0 32px; }
  .home-release__entry { grid-template-columns: 1fr; gap: 6px; }
  .home-release__header,
  .home-release__entry { padding: 20px; }
  .home-feature { padding: 20px; }
}


/* ── Site Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 64px;
  background: var(--panel);          /* one step lighter than page bg */
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 20px;
  flex-wrap: wrap;
}

.site-footer__left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-footer__copy {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0;
}

.site-footer__disclaimer {
  color: var(--faint);
  font-size: 0.72rem;
  margin: 0;
  max-width: 520px;
  line-height: 1.5;
}

/* ── AI Campaign Creator modal ───────────────────────────────────────────── */

/* Chip selector rows */
.seed-options { display: flex; flex-direction: column; gap: 16px; margin: 4px 0 8px; }

.seed-row {}

.chip-group {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  margin-top: 6px;
}

.chip-group--wrap { flex-wrap: wrap; }

.chip {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--accent-lo);
  color: var(--text);
}

.chip--active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Chip selected label — shows below each chip group */
.chip-selected-label {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
  min-height: 1.2em;
  letter-spacing: 0.02em;
}

/* Generating phase */
.seed-generating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  gap: 4px;
}

.ai-spark { color: var(--accent); margin-right: 4px; }

/* Animated thinking orb */
.ai-thinking-orb {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
}

/* Central pulsing star */
.ai-thinking-orb__core {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  color: var(--accent);
  animation: orb-pulse 1.8s ease-in-out infinite;
  line-height: 1;
}

/* Three orbiting dots */
.ai-thinking-orb__dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  top: 50%;
  left: 50%;
  transform-origin: 0 0;
}

.ai-thinking-orb__dot:nth-child(2) {
  animation: orbit 1.6s linear infinite;
  opacity: 0.9;
}
.ai-thinking-orb__dot:nth-child(3) {
  animation: orbit 1.6s linear infinite -0.53s;
  opacity: 0.6;
}
.ai-thinking-orb__dot:nth-child(4) {
  animation: orbit 1.6s linear infinite -1.07s;
  opacity: 0.35;
}

@keyframes orbit {
  from { transform: rotate(0deg) translateX(28px) rotate(0deg) translate(-50%, -50%); }
  to   { transform: rotate(360deg) translateX(28px) rotate(-360deg) translate(-50%, -50%); }
}

@keyframes orb-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
  50%       { transform: translate(-50%, -50%) scale(1.25); opacity: 0.7; }
}

/* Dot-dot-dot text animation for "Writing your campaign" */
.ai-thinking-dots::after {
  content: '';
  animation: thinking-dots 1.4s steps(4, end) infinite;
}

@keyframes thinking-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* Error message */
.seed-error {
  background: rgba(184, 86, 80, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  padding: 10px 14px;
}

/* Regenerate section */
.seed-regen {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-dim);
}

.seed-regen__details {}

.seed-regen__summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.seed-regen__summary::-webkit-details-marker { display: none; }

.seed-regen__body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Widen modal for the creator on wider screens */
@media (min-width: 600px) {
  dialog.modal-box { min-width: 520px; }
}

@media (max-width: 599px) {
  dialog.modal-box { min-width: unset; width: calc(100vw - 32px); padding: 20px; }
  .chip { font-size: 0.76rem; padding: 5px 10px; }
}

/* Version pill — matches ReactorOps style */
.site-footer__version {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  white-space: nowrap;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── Credit indicator ─────────────────────────────────────── */
.modal-divider {
  border: none;
  border-top: 1px solid var(--line-dim);
  margin: 0 0 20px;
}
.credit-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-lo);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--muted);
}
.credit-indicator__spark { color: var(--accent); font-size: 0.85rem; }
.credit-indicator__text  { line-height: 1.4; }
.credit-indicator__count { color: var(--accent); font-weight: 700; }

/* ── Discord share toast ───────────────────────────────────── */
.share-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--accent-lo); border-radius: var(--radius);
  color: var(--text); font-size: 0.85rem; padding: 10px 20px; z-index: 999;
  opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.share-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Theater / Zone map ───────────────────────────────────── */
.theater-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.zone-tile { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent-lo); border-radius: var(--radius); padding: 14px 16px; }
.zone-tile__name { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.zone-tile__owner { margin-bottom: 10px; }
.zone-tile__actions { border-top: 1px solid var(--line-dim); padding-top: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.zone-tile__select { width: auto; flex: 1; font-size: 0.8rem; padding: 5px 8px; }
