/* ==========================================================================
   The Cthulhu Compendium — design system
   Tokens → base → layout chrome → components → utilities.
   Feature-specific sections (creator, dossier, dice, primers) follow below.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #070a08;
  --surface: rgba(13, 19, 16, 0.86);
  --surface-solid: #0d1310;
  --surface-raised: #111814;
  --surface-inset: #121a16;
  --surface-hover: #17211c;

  /* Lines */
  --line: rgba(201, 168, 76, 0.13);
  --line-soft: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(201, 168, 76, 0.32);

  /* Text */
  --ink-strong: #f0e6cc;
  --ink: #ddd2b6;
  --muted: #a8a293;
  --subtle: #82857c;
  --faint: #5c605a;

  /* Accent + semantic */
  --gold: #c9a84c;
  --gold-light: #e0c06a;
  --gold-dark: #a07830;
  --gold-tint: rgba(201, 168, 76, 0.09);
  --danger: #e06a6a;
  --success: #6fcf8f;
  --warning: #e5b450;
  --info: #7fb2e0;

  /* Shape + depth */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 28px 64px -24px rgba(0, 0, 0, 0.85);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 180ms;

  --nav-h: 64px;

  /* Legacy aliases used by feature sections below */
  --color-dark: var(--bg);
  --color-darker: #030504;
  --color-card: var(--surface-solid);
  --color-border: var(--line);
  --color-gold: var(--gold);
  --color-gold-light: var(--gold-light);
  --color-text: var(--ink);
  --color-muted: var(--subtle);
}

/* ── Base ─────────────────────────────────────────────────────────────── */

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  accent-color: var(--gold);
}

/* Atmosphere lives on a fixed layer so it never repaints while scrolling. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 50% -8%, rgba(201, 168, 76, 0.07), transparent 65%),
    radial-gradient(1200px 900px at 50% 30%, #0d1612 0%, var(--bg) 70%);
}

h1, h2, h3, h4, h5, h6, .font-serif {
  font-family: 'Cinzel', Georgia, serif;
  letter-spacing: 0.01em;
}

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

a { transition: color var(--dur) var(--ease); }

::selection {
  background: rgba(201, 168, 76, 0.32);
  color: var(--ink-strong);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

:focus:not(:focus-visible) { outline: none; }

img { color: transparent; }

html { scrollbar-color: #24322a var(--bg); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1f2b24; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #33443a; }

.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* ── Page transitions ─────────────────────────────────────────────────── */

@view-transition { navigation: auto; }

::view-transition-old(root) { animation: vt-out 140ms ease both; }
::view-transition-new(root) { animation: vt-in 220ms var(--ease) both; }

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Browsers without cross-document view transitions get a light entrance. */
@supports not (view-transition-name: none) {
  .site-main { animation: page-in 0.32s var(--ease) both; }
}

/* ── Navigation ───────────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 10, 8, 0.78);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
  transition: background-color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  view-transition-name: site-nav;
}

.site-nav.is-scrolled {
  background: rgba(7, 10, 8, 0.92);
  border-color: var(--line);
  box-shadow: 0 12px 32px -18px rgba(0, 0, 0, 0.9);
}

.site-nav-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--nav-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: var(--gold);
}

.brand-mark {
  width: 1.65rem;
  height: 1.65rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.35));
  transition: transform 0.5s var(--ease);
}

.brand:hover .brand-mark { transform: rotate(45deg); }

.brand-name {
  overflow: hidden;
  color: var(--ink-strong);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-name span { color: var(--gold); }

.nav-links {
  display: none;
  align-items: center;
  gap: 0.125rem;
  margin-left: 0.75rem;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.25rem;
  padding: 0 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.nav-link:hover { color: var(--ink-strong); background: rgba(255, 255, 255, 0.04); }

.nav-link.active { color: var(--gold-light); background: var(--gold-tint); }

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: calc((var(--nav-h) - 2.25rem) / -2);
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--gold);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  color: var(--muted);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.nav-icon-btn:hover { color: var(--ink-strong); background: rgba(255, 255, 255, 0.05); }

.nav-icon-btn .icon-close { display: none; }
.nav-icon-btn[aria-expanded="true"] .icon-open { display: none; }
.nav-icon-btn[aria-expanded="true"] .icon-close { display: inline-block; }

@media (min-width: 1180px) {
  .nav-links { display: flex; }
  .nav-only-mobile { display: none !important; }
}

@media (max-width: 1179px) {
  .nav-only-desktop { display: none !important; }
}

/* Account dropdown (a <details> element so it works without JS) */
.menu { position: relative; }

.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 0.5rem 0 0.3rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.account-trigger:hover,
.menu[open] > .account-trigger { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.03); }

.account-trigger .chevron { color: var(--subtle); transition: transform var(--dur) var(--ease); }
.menu[open] > .account-trigger .chevron { transform: rotate(180deg); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: linear-gradient(160deg, #3a2f16, #1b160b);
  border: 1px solid rgba(201, 168, 76, 0.45);
  color: var(--gold-light);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  min-width: 14rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 19, 16, 0.98);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: menu-in 0.18s var(--ease) both;
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
}

.menu-header {
  padding: 0.6rem 0.75rem 0.7rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--line-soft);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: left;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.menu-item:hover { color: var(--ink-strong); background: rgba(255, 255, 255, 0.05); }
.menu-item.is-danger:hover { color: var(--danger); background: rgba(224, 106, 106, 0.08); }

/* Mobile drawer: animates height via grid rows, no JS measuring. */
.mobile-menu {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  opacity: 0;
  transition: grid-template-rows 0.3s var(--ease), opacity 0.2s ease, visibility 0s linear 0.3s;
}

.mobile-menu.is-open {
  grid-template-rows: 1fr;
  visibility: visible;
  opacity: 1;
  transition: grid-template-rows 0.3s var(--ease), opacity 0.2s ease, visibility 0s;
}

.mobile-menu > div { min-height: 0; overflow: hidden; }

.mobile-menu-inner {
  display: grid;
  gap: 0.15rem;
  padding: 0.5rem 0 1.25rem;
  border-top: 1px solid var(--line-soft);
}

.mobile-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.8rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.mobile-link .icon { color: var(--subtle); }
.mobile-link:hover { color: var(--ink-strong); background: rgba(255, 255, 255, 0.04); }
.mobile-link.active { color: var(--gold-light); background: var(--gold-tint); }
.mobile-link.active .icon { color: var(--gold); }

.mobile-section-label {
  padding: 0.9rem 0.8rem 0.35rem;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  background: rgba(5, 7, 6, 0.75);
}

.footer-link {
  color: var(--subtle);
  font-size: 0.85rem;
  transition: color var(--dur) var(--ease);
}

.footer-link:hover { color: var(--gold-light); }

.footer-heading {
  margin-bottom: 0.85rem;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn,
.btn-gold,
.btn-outline,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    filter var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.btn-gold {
  background-color: #c4a24a;
  background-image: linear-gradient(180deg, #d8b85e 0%, #b8933d 100%);
  border-color: rgba(255, 226, 150, 0.25);
  color: #17120a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 14px -6px rgba(201, 168, 76, 0.45);
}

.btn-gold:hover {
  filter: brightness(1.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 22px -8px rgba(201, 168, 76, 0.6);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: rgba(201, 168, 76, 0.04);
  border-color: var(--line-strong);
  color: var(--gold-light);
}

.btn-outline:hover {
  background-color: rgba(201, 168, 76, 0.1);
  border-color: rgba(201, 168, 76, 0.6);
  color: #f0d585;
}

.btn-ghost {
  background-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover { background-color: rgba(255, 255, 255, 0.05); color: var(--ink-strong); }

.btn-danger {
  background-color: rgba(224, 106, 106, 0.06);
  border-color: rgba(224, 106, 106, 0.35);
  color: #ef8f8f;
}

.btn-danger:hover {
  background-color: rgba(224, 106, 106, 0.14);
  border-color: rgba(224, 106, 106, 0.6);
  color: #f7b0b0;
}

.btn-danger-solid {
  background-color: #9b2a2a;
  background-image: linear-gradient(180deg, #ad3434, #8a2222);
  border-color: rgba(255, 140, 140, 0.25);
  color: #fff4f4;
}

.btn-danger-solid:hover { filter: brightness(1.1); }

.btn-gold:active,
.btn-outline:active,
.btn-ghost:active,
.btn-danger:active { transform: translateY(0) scale(0.98); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 0.95rem; }

:is(.btn, .btn-gold, .btn-outline, .btn-ghost, .btn-danger):disabled,
:is(.btn, .btn-gold, .btn-outline, .btn-ghost, .btn-danger)[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* Compact row actions (edit / delete) */
.mini-action,
.mini-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.mini-action:hover { color: var(--gold-light); border-color: var(--line-strong); background: var(--gold-tint); }
.mini-danger:hover { color: var(--danger); border-color: rgba(224, 106, 106, 0.4); background: rgba(224, 106, 106, 0.08); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--gold);
  font-size: 0.875rem;
  font-weight: 500;
}

.text-link .icon { transition: transform var(--dur) var(--ease); }
.text-link:hover { color: var(--gold-light); }
.text-link:hover .icon { transform: translateX(3px); }

/* ── Surfaces ─────────────────────────────────────────────────────────── */

.card-bg {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition:
    border-color 0.22s var(--ease),
    background-color 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    transform 0.22s var(--ease);
}

/* Only things you can click lift on hover. */
a.card-bg:hover,
.card-link:hover {
  border-color: rgba(201, 168, 76, 0.4);
  background-color: rgba(17, 25, 21, 0.95);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transform: translateY(-2px);
}

.surface-inset {
  background-color: var(--surface-inset);
  border: 1px solid rgba(201, 168, 76, 0.08);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

a.surface-inset:hover {
  background-color: var(--surface-hover);
  border-color: rgba(201, 168, 76, 0.3);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-strong);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.section-title .icon { color: var(--gold); }

.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--subtle);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
}

.list-row {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
}

.row-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
}

@media (hover: hover) {
  .list-row .row-actions { opacity: 0.55; transition: opacity var(--dur) var(--ease); }
  .list-row:hover .row-actions,
  .list-row:focus-within .row-actions { opacity: 1; }
}

.divider { height: 1px; background: var(--line-soft); border: 0; }

/* ── Page structure ───────────────────────────────────────────────────── */

.page {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 2.25rem 1rem 4rem;
}

.page-narrow { max-width: 42rem; }
.page-medium { max-width: 64rem; }

@media (min-width: 640px) {
  .page { padding: 2.75rem 1.5rem 5rem; }
}

@media (min-width: 1024px) {
  .page { padding-left: 2rem; padding-right: 2rem; }
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-title {
  color: var(--ink-strong);
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(1.7rem, 1.25rem + 1.6vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
}

.page-subtitle {
  max-width: 62ch;
  margin-top: 0.5rem;
  color: var(--subtle);
  font-size: 0.95rem;
  line-height: 1.6;
}

.page-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
  color: var(--subtle);
  font-size: 0.82rem;
}

.breadcrumbs a:hover { color: var(--gold-light); }
.breadcrumbs .icon { color: var(--faint); }
.breadcrumbs [aria-current] { color: var(--ink); }

/* ── Data display ─────────────────────────────────────────────────────── */

.stat-tile {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-value {
  color: var(--gold-light);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  margin-top: 0.3rem;
  color: var(--subtle);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-tile { min-width: 0; }

@media (max-width: 639px) {
  .stat-tile { padding: 0.85rem; }
  .stat-tile .icon-tile { width: 2.2rem; height: 2.2rem; }
  .stat-value { font-size: 1.4rem; }
  .stat-label { font-size: 0.62rem; letter-spacing: 0.05em; }
}

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.15), rgba(201, 168, 76, 0.04));
  color: var(--gold-light);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}

a:hover > .icon-tile,
a:hover .icon-tile { border-color: rgba(201, 168, 76, 0.5); transform: scale(1.05); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}

.tone-neutral { background-color: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.09); color: var(--muted); }
.tone-gold    { background-color: rgba(201, 168, 76, 0.1);   border-color: rgba(201, 168, 76, 0.3);  color: var(--gold-light); }
.tone-success { background-color: rgba(111, 207, 143, 0.09); border-color: rgba(111, 207, 143, 0.28); color: #86dba2; }
.tone-danger  { background-color: rgba(224, 106, 106, 0.09); border-color: rgba(224, 106, 106, 0.3);  color: #ee9090; }
.tone-warning { background-color: rgba(229, 180, 80, 0.09);  border-color: rgba(229, 180, 80, 0.3);   color: #ecc571; }
.tone-info    { background-color: rgba(127, 178, 224, 0.09); border-color: rgba(127, 178, 224, 0.3);  color: #9cc5ea; }
.tone-arcane  { background-color: rgba(139, 132, 240, 0.09); border-color: rgba(139, 132, 240, 0.3);  color: #a9a4f5; }

.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--faint);
}

.status-dot.is-on { background: var(--success); box-shadow: 0 0 0 3px rgba(111, 207, 143, 0.15); }

.progress-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.06);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.6s var(--ease);
}

.empty-state {
  padding: 3.5rem 1.5rem;
  border: 1px dashed rgba(201, 168, 76, 0.2);
  border-radius: var(--radius-lg);
  background: rgba(13, 19, 16, 0.5);
  text-align: center;
}

.empty-state-sm { padding: 1.75rem 1rem; }

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--gold-tint);
  color: var(--gold);
}

.empty-state h2,
.empty-state h3 { color: var(--ink-strong); font-size: 1.25rem; font-weight: 700; }
.empty-state p { max-width: 42ch; margin: 0.5rem auto 0; color: var(--subtle); font-size: 0.92rem; }
.empty-state .empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 1.5rem; }

.muted-note { color: var(--subtle); font-size: 0.875rem; }

/* ── Forms ────────────────────────────────────────────────────────────── */

.form-input {
  display: block;
  width: 100%;
  padding: 0.62rem 0.85rem;
  border: 1px solid rgba(201, 168, 76, 0.16);
  border-radius: var(--radius-sm);
  background-color: rgba(6, 10, 8, 0.65);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.45;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.form-input::placeholder { color: var(--faint); }
.form-input:hover { border-color: rgba(201, 168, 76, 0.3); }

.form-input:focus {
  outline: none;
  border-color: var(--gold);
  background-color: rgba(9, 14, 11, 0.95);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.16);
}

.form-input[aria-invalid="true"] { border-color: rgba(224, 106, 106, 0.7); }
.form-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(224, 106, 106, 0.18); }

textarea.form-input { min-height: 5.5rem; resize: vertical; }

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a293' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  cursor: pointer;
}

select.form-input[multiple] { padding-right: 0.85rem; background-image: none; }
select.form-input option { background-color: var(--surface-solid); color: var(--ink); }

input[type="file"].form-input { padding: 0.4rem; color: var(--subtle); cursor: pointer; }

input[type="file"].form-input::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--gold-tint);
  color: var(--gold-light);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

input[type="file"].form-input::file-selector-button:hover { background: rgba(201, 168, 76, 0.18); }

.form-input::-webkit-calendar-picker-indicator { filter: invert(0.7) sepia(0.6) saturate(2) hue-rotate(5deg); cursor: pointer; }

.form-stack { display: grid; gap: 1.25rem; }

.field-label {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.field-optional { color: var(--faint); font-size: 0.7rem; font-weight: 500; }

.field-help {
  margin-top: 0.4rem;
  color: var(--subtle);
  font-size: 0.75rem;
  line-height: 1.5;
}

.field-help ul { display: grid; gap: 0.15rem; padding-left: 1rem; list-style: disc; }

.field-error {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  color: #ee9090;
  font-size: 0.76rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: fit-content;
  padding: 0.25rem 0;
  color: var(--ink);
  font-size: 0.875rem;
  cursor: pointer;
}

.checkbox-field input,
input[type="checkbox"],
input[type="radio"] { width: 1rem; height: 1rem; accent-color: var(--gold); cursor: pointer; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.form-card { padding: 1.5rem; }

@media (min-width: 640px) {
  .form-card { padding: 2rem; }
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert .icon { margin-top: 0.1rem; }
.alert-error   { background: rgba(224, 106, 106, 0.08); border-color: rgba(224, 106, 106, 0.35); color: #f2b0b0; }
.alert-info    { background: rgba(127, 178, 224, 0.07); border-color: rgba(127, 178, 224, 0.3);  color: #b4d2ee; }
.alert-arcane  { background: rgba(139, 132, 240, 0.07); border-color: rgba(139, 132, 240, 0.3);  color: #bdb9f7; }
.alert-gold    { background: var(--gold-tint);           border-color: var(--line-strong);         color: var(--ink); }

/* Collapsible panel — animates open/closed without measuring height. */
.collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 0.3s var(--ease), opacity 0.2s ease, visibility 0s linear 0.3s;
}

.collapse.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  transition: grid-template-rows 0.3s var(--ease), opacity 0.2s ease 0.05s, visibility 0s;
}

.collapse > * { min-height: 0; overflow: hidden; }

[data-collapse-target] .icon-plus { transition: transform 0.25s var(--ease); }
[data-collapse-target][aria-expanded="true"] .icon-plus { transform: rotate(45deg); }

/* ── Toasts ───────────────────────────────────────────────────────────── */

.toast-region {
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  right: 16px;
  left: 16px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: min(100%, 25rem);
  padding: 0.85rem 0.85rem 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 20, 17, 0.97);
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.35s var(--ease) both;
}

.toast.is-leaving { animation: toast-out 0.22s ease forwards; }
.toast-body { flex: 1; padding-top: 0.05rem; }
.toast .toast-icon { margin-top: 0.1rem; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

.toast-close {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 6px;
  color: var(--subtle);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.toast-close:hover { color: var(--ink-strong); background: rgba(255, 255, 255, 0.06); }

@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ── Bottom sheet / modal ─────────────────────────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.sheet.is-open { opacity: 1; visibility: visible; transition: opacity 0.22s ease, visibility 0s; }

.sheet-panel {
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.25rem;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #0c120f;
  box-shadow: var(--shadow-lg);
  transform: translateY(32px);
  transition: transform 0.32s var(--ease);
}

.sheet.is-open .sheet-panel { transform: none; }

.sheet-grip {
  width: 2.5rem;
  height: 4px;
  margin: -0.35rem auto 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

@media (min-width: 640px) {
  .sheet { align-items: center; padding: 1rem; }
  .sheet-panel { border-bottom: 1px solid var(--line-strong); border-radius: 18px; transform: translateY(12px) scale(0.97); }
  .sheet-grip { display: none; }
}

body.has-overlay { overflow: hidden; }

.fab {
  position: fixed;
  right: 1.1rem;
  bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 1px solid rgba(255, 226, 150, 0.35);
  border-radius: 999px;
  background-image: linear-gradient(160deg, #d8b85e, #9c7428);
  color: #17120a;
  box-shadow: 0 10px 28px -6px rgba(0, 0, 0, 0.85), 0 0 0 4px rgba(7, 10, 8, 0.6);
  transition: transform var(--dur) var(--ease), filter var(--dur) var(--ease);
}

.fab:hover { filter: brightness(1.08); }
.fab:active { transform: scale(0.94); }

.quick-die {
  min-height: 44px;
  border: 1px solid rgba(201, 168, 76, 0.14);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.quick-die:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.quick-die:active { transform: scale(0.96); }

.roll-pop { animation: roll-pop 0.38s cubic-bezier(0.2, 1.4, 0.3, 1) both; }
@keyframes roll-pop { from { opacity: 0.2; transform: scale(0.6); } }

/* ── Page-level components ────────────────────────────────────────────── */

.home-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.home-hero__bg {
  position: absolute;
  inset: 0;
  background-position: 30% 55%;
  background-size: cover;
  filter: saturate(0.85) brightness(1.1);
  transform: scale(1.04);
  animation: hero-drift 24s ease-in-out infinite alternate;
}

.home-hero__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 10, 8, 0.94) 0%, rgba(7, 10, 8, 0.7) 45%, rgba(7, 10, 8, 0.1) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 35%);
}

@keyframes hero-drift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.5%, -1%, 0); }
}

@media (max-width: 639px) {
  .home-hero__veil {
    background: linear-gradient(0deg, var(--bg) 4%, rgba(7, 10, 8, 0.82) 55%, rgba(7, 10, 8, 0.6) 100%);
  }
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.4rem;
}

.feature-card h3 {
  margin-top: 0.5rem;
  color: var(--ink-strong);
  font-size: 1.05rem;
  font-weight: 700;
}

.feature-card p {
  flex: 1;
  color: var(--subtle);
  font-size: 0.875rem;
  line-height: 1.6;
}

.feature-card .text-link { margin-top: 0.4rem; font-size: 0.82rem; }

.nav-tile {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
}

.nav-tile-title { color: var(--ink-strong); font-size: 0.9rem; font-weight: 600; }
.nav-tile-meta { margin-top: 0.1rem; color: var(--subtle); font-size: 0.75rem; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.filter-chip:hover { color: var(--ink-strong); border-color: var(--line-strong); }

.filter-chip.is-active {
  border-color: rgba(201, 168, 76, 0.55);
  background: rgba(201, 168, 76, 0.14);
  color: var(--gold-light);
}

.filter-chip-count {
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--subtle);
  font-size: 0.68rem;
  font-weight: 600;
}

.filter-chip.is-active .filter-chip-count { background: rgba(201, 168, 76, 0.2); color: var(--gold-light); }

.search-field { position: relative; }
.search-field .icon { position: absolute; left: 0.85rem; top: 50%; color: var(--subtle); transform: translateY(-50%); pointer-events: none; }
.search-field .form-input { padding-left: 2.5rem; }

.cover {
  position: relative;
  height: 9.5rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(201, 168, 76, 0.12), transparent 60%),
    linear-gradient(135deg, #15110a, #0b100d);
}

.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
a:hover .cover img { transform: scale(1.04); }
.cover-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: rgba(201, 168, 76, 0.28); }

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-h));
  padding: 3rem 1rem;
}

.auth-card { width: 100%; max-width: 26rem; }

.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.or-divider::before,
.or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.quote-serif {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  letter-spacing: 0;
}

.prose-entry {
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  line-height: 1.85;
  white-space: pre-wrap;
}

.timeline { position: relative; display: grid; gap: 0.75rem; }

.timeline-item { position: relative; padding-left: 1.5rem; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 1.35rem;
  bottom: -0.75rem;
  width: 1px;
  background: var(--line);
}

.timeline-item:last-child::before { display: none; }

.timeline-item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0.95rem;
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid var(--gold);
  border-radius: 999px;
  background: var(--bg);
}

.timeline-item.is-secret::after { border-color: var(--warning); }

/* ── Text utilities (mirrored in the Tailwind config) ─────────────────── */

.text-ink { color: var(--ink); }
.text-ink-strong { color: var(--ink-strong); }
.text-muted { color: var(--muted); }
.text-subtle { color: var(--subtle); }
.text-faint { color: var(--faint); }
.text-gold { color: var(--gold); }
.text-gold-light { color: var(--gold-light); }
.text-gold-dim { color: #9a8a5c; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.border-line { border-color: var(--line); }

/* ── Mobile & touch ───────────────────────────────────────────────────── */

.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

.touch-scroll { -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }

.touch-target { min-height: 44px; min-width: 44px; touch-action: manipulation; }

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .safe-bottom { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
}

.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 { -webkit-line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; }

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

.fade-in { animation: fadeIn 0.3s ease-out forwards; }
.gold-glow { box-shadow: 0 0 12px rgba(201, 168, 76, 0.3); }
.gold-text { color: var(--gold); }

/* ── Reduced motion ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* ==========================================================================
   Feature sections
   ========================================================================== */

/* Guided investigator creator */
.creator-kicker {
  color: var(--color-gold);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.creator-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 0.75rem;
  background: rgba(8, 12, 10, 0.76);
}

.creator-progress-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  color: #9ca3af;
  border-right: 1px solid rgba(201, 168, 76, 0.14);
  transition: color 0.2s ease, background 0.2s ease;
}

.creator-progress-step:last-child {
  border-right: 0;
}

.creator-progress-step:hover {
  color: #d1c5a8;
  background: rgba(201, 168, 76, 0.07);
}

.creator-progress-step > span:first-child,
.creator-step-number {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(201, 168, 76, 0.48);
  border-radius: 999px;
  color: var(--color-gold);
  background: rgba(201, 168, 76, 0.08);
  font-size: 0.8rem;
  font-weight: 700;
}

.creator-progress-step strong,
.creator-progress-step small {
  display: block;
}

.creator-progress-step strong {
  color: #d1c5a8;
  font-size: 0.8rem;
}

.creator-progress-step small {
  margin-top: 0.1rem;
  font-size: 0.68rem;
}

.creator-section.card-bg:hover {
  transform: none;
}

.creator-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.creator-section-heading p {
  margin-top: 0.35rem;
  color: #9ca3af;
  font-size: 0.82rem;
  line-height: 1.5;
}

.creator-section-heading-actions {
  align-items: center;
  flex-wrap: wrap;
}

.creator-label {
  display: block;
  margin-bottom: 0.4rem;
  color: #b6ad98;
  font-size: 0.78rem;
  font-weight: 600;
}

.creator-label > span:not(.creator-optional) {
  color: #e0c06a;
}

.creator-optional {
  margin-left: 0.35rem;
  color: #6b7280;
  font-size: 0.68rem;
  font-weight: 400;
}

.creator-help {
  margin-top: 0.4rem;
  color: #737b77;
  font-size: 0.71rem;
  line-height: 1.45;
}

.creator-tip {
  padding: 0.85rem 1rem;
  border-left: 3px solid rgba(201, 168, 76, 0.7);
  border-radius: 0 0.5rem 0.5rem 0;
  color: #9ca3af;
  background: rgba(201, 168, 76, 0.065);
  font-size: 0.76rem;
  line-height: 1.55;
}

.creator-tip strong {
  color: #d1c5a8;
}

.creator-stat {
  padding: 0.9rem;
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 0.6rem;
  background: rgba(5, 9, 7, 0.4);
}

.creator-derived {
  padding: 1rem;
  border: 1px dashed rgba(201, 168, 76, 0.22);
  border-radius: 0.65rem;
  background: rgba(4, 8, 6, 0.46);
}

.form-input.creator-calculated {
  color: #8d958f;
  cursor: not-allowed;
  background: rgba(11, 18, 15, 0.52);
}

.creator-input-error {
  border-color: #b45353 !important;
}

.creator-field-error {
  margin-top: 0.35rem;
  color: #f09595;
  font-size: 0.72rem;
}

.creator-error {
  padding: 1rem 1.1rem;
  border: 1px solid rgba(185, 72, 72, 0.7);
  border-radius: 0.65rem;
  color: #fecaca;
  background: rgba(87, 21, 21, 0.5);
  outline: none;
}

.creator-more {
  border-top: 1px solid rgba(201, 168, 76, 0.14);
  padding-top: 1rem;
}

.creator-more summary {
  width: fit-content;
  color: var(--color-gold);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.creator-more summary:hover {
  color: var(--color-gold-light);
}

.creator-checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(201, 168, 76, 0.13);
  border-radius: 0.45rem;
  color: #9ca3af;
  background: rgba(6, 10, 8, 0.38);
  cursor: pointer;
  font-size: 0.78rem;
}

.creator-checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-gold);
}

.creator-finish {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.2rem;
  border: 1px solid rgba(201, 168, 76, 0.24);
  border-radius: 0.75rem;
  background: linear-gradient(120deg, rgba(201, 168, 76, 0.08), rgba(8, 13, 10, 0.78));
}

#create-investigator:disabled {
  cursor: wait;
  opacity: 0.72;
}

@media (max-width: 640px) {
  .creator-progress {
    display: flex;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    background: rgba(8, 12, 10, 0.9);
    border-radius: 0.6rem;
  }

  .creator-progress::-webkit-scrollbar {
    display: none;
  }

  .creator-progress-step {
    flex: 1 0 auto;
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
    border-right: 1px solid rgba(201, 168, 76, 0.14);
    border-bottom: 0;
  }

  .creator-progress-step small {
    display: none;
  }

  .creator-progress-step strong {
    font-size: 0.75rem;
  }

  .creator-progress-step > span:first-child,
  .creator-step-number {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.75rem;
  }

  .creator-finish {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Investigator gallery cards */
.investigator-card {
  display: grid;
  grid-template-columns: minmax(190px, 38%) minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
}

.investigator-card-portrait {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-right: 1px solid rgba(201, 168, 76, 0.16);
  background:
    radial-gradient(circle at 50% 32%, rgba(201, 168, 76, 0.12), transparent 58%),
    #090a09;
}

.investigator-card-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.34);
}

.investigator-card-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.45s ease, filter 0.45s ease;
}

.investigator-card:hover .investigator-card-portrait img {
  transform: scale(1.015);
  filter: saturate(1.04) contrast(1.02);
}

.investigator-card-body {
  align-self: center;
  min-width: 0;
  padding: 1.5rem;
}

.investigator-card--no-portrait {
  grid-template-columns: 1fr;
}

@media (max-width: 639px) {
  .investigator-card {
    grid-template-columns: 115px minmax(0, 1fr) !important;
    align-items: stretch !important;
  }

  .investigator-card-portrait {
    aspect-ratio: auto !important;
    height: 100% !important;
    min-height: 150px !important;
    border-right: 1px solid rgba(201, 168, 76, 0.16) !important;
    border-bottom: 0 !important;
  }

  .investigator-card-portrait img {
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center !important;
  }

  .investigator-card-body {
    padding: 0.75rem 0.85rem !important;
  }
}

/* Investigator dossier */
.investigator-sheet {
  position: relative;
}

.sheet-hero {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(201, 168, 76, 0.32);
  border-radius: 18px;
  background:
    radial-gradient(circle at 78% 12%, rgba(201, 168, 76, 0.14), transparent 32%),
    linear-gradient(135deg, #15130e 0%, #0c1011 58%, #101715 100%);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.sheet-portrait {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  background: #080a0a;
}

.sheet-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 68%, rgba(12, 16, 17, 0.82) 100%),
    linear-gradient(0deg, rgba(8, 8, 8, 0.62), transparent 34%);
}

.sheet-portrait img {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
  object-position: center top;
  filter: saturate(0.9) contrast(1.04);
  transition: transform 0.6s ease, filter 0.6s ease;
}

.sheet-hero:hover .sheet-portrait img {
  transform: scale(1.018);
  filter: saturate(1) contrast(1.05);
}

.sheet-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4.5rem);
}

.dossier-kicker {
  color: var(--color-gold);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.dossier-rule {
  width: 72px;
  height: 2px;
  margin: 1.25rem 0;
  background: linear-gradient(90deg, var(--color-gold), transparent);
}

.dossier-fact {
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(201, 168, 76, 0.16);
  border-radius: 10px;
  background: rgba(5, 7, 7, 0.44);
}

.dossier-fact-label {
  color: #6b7280;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dossier-fact-value {
  margin-top: 0.2rem;
  color: #d1c5a8;
  font-size: 0.86rem;
  line-height: 1.25;
}

.sheet-section {
  border: 1px solid rgba(201, 168, 76, 0.13);
  background: linear-gradient(145deg, rgba(20, 20, 18, 0.98), rgba(13, 16, 16, 0.98));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.2);
}

.sheet-section-heading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sheet-section-heading::before {
  content: "";
  width: 3px;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--color-gold);
  box-shadow: 0 0 14px rgba(201, 168, 76, 0.32);
}

.stat-roll-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #292820;
  background: linear-gradient(155deg, #1a1a18, #111413);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.stat-roll-card::after {
  content: "ROLL";
  position: absolute;
  right: 0.35rem;
  top: 0.25rem;
  color: rgba(201, 168, 76, 0);
  font-size: 0.48rem;
  letter-spacing: 0.14em;
  transition: color 0.2s ease;
}

.stat-roll-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 168, 76, 0.7) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3), 0 0 18px rgba(201, 168, 76, 0.08);
}

.stat-roll-card:hover::after {
  color: rgba(201, 168, 76, 0.68);
}

.derived-stat-card {
  border: 1px solid rgba(201, 168, 76, 0.12);
  background: linear-gradient(145deg, #151513, #0e1111);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}

.skill-roll-row {
  border: 1px solid #24241f;
  border-radius: 9px;
  background: rgba(12, 14, 14, 0.62);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.skill-roll-row:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 168, 76, 0.42);
  background: rgba(32, 28, 18, 0.78);
}

.compendium-icon {
  border-radius: 50%;
  object-fit: cover;
  background: #0d1111;
  border: 1px solid rgba(201, 168, 76, 0.28);
  box-shadow: inset 0 0 0 1px rgba(209, 197, 168, 0.03), 0 4px 14px rgba(0, 0, 0, 0.34);
}

.compendium-icon-sm {
  box-shadow: inset 0 0 0 1px rgba(209, 197, 168, 0.03), 0 2px 8px rgba(0, 0, 0, 0.28);
}

@media (min-width: 640px) and (max-width: 1024px) {
  .sheet-hero {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    min-height: 420px;
  }

  .sheet-portrait,
  .sheet-portrait img {
    min-height: 420px;
    max-height: 520px;
  }

  .sheet-hero-copy {
    padding: 1.75rem;
  }
}

@media (max-width: 639px) {
  .sheet-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sheet-portrait,
  .sheet-portrait img {
    min-height: 0;
    max-height: 280px;
    height: 280px;
    object-fit: cover;
    object-position: top center;
  }

  .sheet-portrait::after {
    background: linear-gradient(0deg, rgba(16, 23, 21, 0.96) 0%, rgba(16, 23, 21, 0.4) 45%, transparent 100%);
  }

  .sheet-hero-copy {
    padding: 1.25rem;
  }
}

/* Dice roller */
#dice-roller-modal {
  display: flex;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

#dice-roller-modal.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.dice-modal-panel {
  max-height: min(92vh, 54rem);
  overflow-y: auto;
  transform: translateY(18px) scale(0.96);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}

#dice-roller-modal.is-open .dice-modal-panel {
  transform: none;
  opacity: 1;
}

.dice-tray {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 11.5rem;
  padding: 1.15rem 0.75rem 0.9rem;
  overflow: hidden;
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 1rem;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(38, 72, 52, 0.42), rgba(6, 10, 8, 0.96) 68%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.08) 2px,
      rgba(0, 0, 0, 0.08) 3px
    );
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.55);
}

.dice-tray::before {
  content: "";
  position: absolute;
  inset: 0.45rem;
  border: 1px solid rgba(201, 168, 76, 0.08);
  border-radius: 0.75rem;
  pointer-events: none;
}

.dice-tray.is-critical {
  animation: diceCriticalGlow 0.9s ease-out;
}

.dice-tray.is-fumble {
  animation: diceFumbleShake 0.55s ease-in-out;
}

.dice-faces {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.85rem 1.15rem;
  perspective: 700px;
  z-index: 1;
}

.coc-die-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.5));
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.coc-die-wrap:has(.is-kept) {
  filter:
    drop-shadow(0 0 12px rgba(201, 168, 76, 0.48))
    drop-shadow(0 12px 14px rgba(0, 0, 0, 0.5));
}

.coc-die-wrap:has(.is-discarded) {
  opacity: 0.38;
  filter: grayscale(0.4) brightness(0.82) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35));
}

.coc-die {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.35rem;
  height: 5.15rem;
  color: #f4e6b8;
  background: linear-gradient(160deg, #4a3b1d 0%, #1c160c 52%, #0d0a06 100%);
  border: 1px solid rgba(201, 168, 76, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform-style: preserve-3d;
}

.coc-die-value {
  font-family: Cinzel, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
  z-index: 1;
}

.coc-die-caption {
  color: #6b7280;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.coc-die--d4 {
  width: 4.4rem;
  height: 4.1rem;
  clip-path: polygon(50% 4%, 96% 94%, 4% 94%);
}

.coc-die--d6 {
  width: 4.1rem;
  height: 4.1rem;
  border-radius: 0.7rem;
}

.coc-die--d8 {
  width: 4.2rem;
  height: 5rem;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.coc-die--d10,
.coc-die--d100 {
  clip-path: polygon(50% 0%, 93% 28%, 93% 72%, 50% 100%, 7% 72%, 7% 28%);
}

.coc-die--d12 {
  width: 4.5rem;
  height: 4.7rem;
  clip-path: polygon(50% 0%, 95% 35%, 78% 100%, 22% 100%, 5% 35%);
}

.coc-die--d20 {
  width: 4.5rem;
  height: 5rem;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.coc-die--ones {
  background: linear-gradient(160deg, #2f4632 0%, #141c16 55%, #0a0e0b 100%);
  border-color: rgba(134, 239, 172, 0.38);
}

.coc-die--bonus {
  border-color: rgba(103, 232, 249, 0.62);
}

.coc-die--penalty {
  border-color: rgba(248, 113, 113, 0.62);
}

.coc-die.is-tumbling {
  animation: dieTumble 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.coc-die.is-kept {
  animation: dieKeep 0.45s ease-out;
}

.dice-tray-hint {
  margin-top: 0.7rem;
  color: #5b6470;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  z-index: 1;
}

.dice-result {
  padding: 1.1rem 1rem 1rem;
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 0.75rem;
  background: var(--surface-inset);
  text-align: center;
}

.dice-result-value {
  font-family: Cinzel, Georgia, serif;
  font-size: 3.4rem;
  font-weight: 900;
  line-height: 1;
  color: #c9a84c;
}

.dice-result-value.is-revealed {
  animation: resultSlam 0.48s cubic-bezier(0.2, 1.35, 0.3, 1) both;
}

.dice-result-outcome {
  margin-top: 0.45rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.dice-result-outcome.is-revealed {
  animation: fadeIn 0.35s ease-out both;
}

.dice-threshold {
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 0.4rem;
  background: var(--surface-inset);
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.dice-threshold.is-hit {
  background: rgba(201, 168, 76, 0.08);
  border-color: rgba(201, 168, 76, 0.55);
  box-shadow: 0 0 16px rgba(201, 168, 76, 0.12);
}

.dice-threshold[data-level="hard"].is-hit {
  border-color: rgba(74, 222, 128, 0.55);
  background: rgba(74, 222, 128, 0.08);
}

.dice-threshold[data-level="extreme"].is-hit {
  border-color: rgba(103, 232, 249, 0.55);
  background: rgba(103, 232, 249, 0.08);
}

.dice-modifier {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.dice-modifier-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: 0.4rem;
  color: #c9a84c;
  background: rgba(201, 168, 76, 0.08);
  font-size: 1.15rem;
  line-height: 1;
}

.dice-modifier-btn:hover {
  background: rgba(201, 168, 76, 0.16);
}

.dice-modifier-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dice-history-entry {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0;
  animation: fadeIn 0.25s ease-out both;
}

.dice-poly-btn {
  min-width: 3.1rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 0.4rem;
  color: #c9a84c;
  background: var(--surface-inset);
  font-size: 0.875rem;
  font-weight: 600;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.dice-poly-btn:hover {
  border-color: rgba(201, 168, 76, 0.55);
  background: #221c12;
  transform: translateY(-1px);
}

#dice-roller-modal :is(.btn-gold, .btn-outline, .dice-poly-btn, .dice-modifier-btn):disabled {
  opacity: 0.5;
  cursor: wait;
  pointer-events: none;
  transform: none;
}

@keyframes dieTumble {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateY(0) scale(1); }
  18% { transform: rotateX(210deg) rotateY(120deg) rotateZ(40deg) translateY(-10px) scale(0.92); }
  38% { transform: rotateX(420deg) rotateY(240deg) rotateZ(-28deg) translateY(6px) scale(1.06); }
  58% { transform: rotateX(610deg) rotateY(330deg) rotateZ(22deg) translateY(-4px) scale(0.96); }
  78% { transform: rotateX(690deg) rotateY(355deg) rotateZ(-8deg) translateY(2px) scale(1.03); }
  100% { transform: rotateX(720deg) rotateY(360deg) rotateZ(0deg) translateY(0) scale(1); }
}

@keyframes dieKeep {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes resultSlam {
  0% { transform: scale(0.42); opacity: 0; filter: blur(8px); }
  68% { transform: scale(1.1); opacity: 1; filter: blur(0); }
  100% { transform: scale(1); }
}

@keyframes diceCriticalGlow {
  0% { box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.55), 0 0 0 rgba(201, 168, 76, 0); }
  40% { box-shadow: inset 0 0 42px rgba(201, 168, 76, 0.18), 0 0 34px rgba(201, 168, 76, 0.42); }
  100% { box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.55), 0 0 0 rgba(201, 168, 76, 0); }
}

@keyframes diceFumbleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-0.6deg); }
  40% { transform: translateX(7px) rotate(0.6deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  #dice-roller-modal,
  .dice-modal-panel,
  .dice-history-entry,
  .dice-result-value,
  .dice-result-outcome,
  .coc-die {
    animation: none !important;
    transition: none !important;
  }

  #dice-roller-modal.is-open .dice-modal-panel,
  .dice-result-value.is-revealed,
  .dice-result-outcome.is-revealed {
    transform: none;
    opacity: 1;
    filter: none;
  }
}

/* ── Primers ─────────────────────────────────────────────────────────────── */
.primer-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

.primer-kicker {
  color: #c9a84c;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.primer-hero {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(201, 168, 76, 0.18);
  min-height: 18rem;
  display: flex;
  align-items: flex-end;
  margin-bottom: 2rem;
}

.primer-hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: saturate(0.85);
}

.primer-hero__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(3, 5, 4, 0.96) 8%, rgba(3, 5, 4, 0.45) 55%, rgba(3, 5, 4, 0.2));
}

.primer-hero__content {
  position: relative;
  z-index: 1;
  padding: 1.75rem 1.5rem 2rem;
  max-width: 46rem;
}

.primer-hero h1 {
  color: #d1c5a8;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  margin-top: 0.5rem;
}

.primer-lede {
  color: #9ca3af;
  font-size: 1.05rem;
  line-height: 1.65;
  margin-top: 0.85rem;
}

.primer-section {
  margin-top: 2.75rem;
}

.primer-section h2 {
  color: #c9a84c;
  font-size: 1.55rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.primer-section > p,
.primer-copy {
  color: #9ca3af;
  line-height: 1.7;
  max-width: 48rem;
}

.primer-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.primer-grid--2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.primer-grid--3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.primer-grid--4 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .primer-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .primer-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .primer-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
  .primer-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .primer-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.primer-card {
  background: rgba(11, 17, 14, 0.72);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 0.75rem;
  padding: 1.15rem 1.2rem;
}

.primer-card h3 {
  color: #d1c5a8;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.primer-card p,
.primer-card li {
  color: #9ca3af;
  font-size: 0.92rem;
  line-height: 1.6;
}

.primer-card ul {
  list-style: disc;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.primer-card--art {
  overflow: hidden;
  padding: 0;
}

.primer-card--art .primer-card__body {
  padding: 1.1rem 1.2rem 1.25rem;
}

.primer-card__art {
  display: block;
  width: 100%;
  height: 10rem;
  object-fit: cover;
  border-bottom: 1px solid rgba(201, 168, 76, 0.12);
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
}

.primer-nav-cards a { overflow: hidden; }
.primer-nav-cards a:hover .primer-card__art { transform: scale(1.04); filter: saturate(1.1); }

.primer-note {
  margin-top: 1.25rem;
  padding: 1rem 1.15rem;
  border-left: 3px solid rgba(201, 168, 76, 0.55);
  background: rgba(201, 168, 76, 0.06);
  border-radius: 0 0.5rem 0.5rem 0;
  color: #b7ae95;
  font-size: 0.92rem;
  line-height: 1.65;
}

.primer-note strong {
  color: #e0c06a;
}

.primer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.primer-tag {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9a84c;
  border: 1px solid rgba(201, 168, 76, 0.28);
  background: rgba(201, 168, 76, 0.08);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

.primer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.primer-table th,
.primer-table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.12);
}

.primer-table th {
  color: #c9a84c;
  font-weight: 600;
}

.primer-table td {
  color: #9ca3af;
}

.primer-formula {
  color: #e0c06a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.primer-nav-cards a {
  display: block;
  text-decoration: none;
}



.primer-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.primer-tiny {
  color: #6b7280;
  font-size: 0.8rem;
  margin-top: 1rem;
  line-height: 1.5;
}

/* Quick vitals adjust on the character sheet */
.vital-adjust {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.vital-adjust-btn {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--gold-light);
  background: var(--surface-inset);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.vital-adjust-btn:hover {
  border-color: var(--gold);
  background: var(--gold-tint);
}

.vital-adjust-btn:disabled {
  cursor: wait;
  opacity: 0.6;
}

.vital-adjust-amount {
  width: 100%;
  min-width: 0;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface-solid);
  text-align: center;
  font-size: 0.9rem;
}

/* Skill point allocation in the investigator creator */
.creator-pools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.creator-pool {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.6rem;
  background: rgba(5, 9, 7, 0.4);
}

.creator-pool-value {
  color: var(--gold-light);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}

.creator-pool.is-over {
  border-color: rgba(224, 106, 106, 0.7);
}

.creator-pool.is-over .creator-pool-value {
  color: var(--danger);
}

.skill-alloc {
  max-height: 32rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.skill-alloc-head,
.skill-alloc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3rem 5.75rem 5.75rem 3.25rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
}

.skill-alloc-head {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--subtle);
  background: var(--surface-solid);
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.skill-alloc-row {
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.85rem;
}

.skill-alloc-row:last-child {
  border-bottom: 0;
}

.skill-alloc-row.is-suggested {
  background: var(--gold-tint);
}

.skill-alloc-row.is-suggested .skill-alloc-name::after {
  content: 'profession';
  display: inline-block;
  white-space: nowrap;
  margin-left: 0.4rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.6rem;
  vertical-align: middle;
}

.skill-alloc-row.is-over .skill-alloc-total {
  color: var(--danger);
}

.skill-alloc-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-alloc-base,
.skill-alloc-total {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.skill-alloc-base {
  color: var(--subtle);
}

.skill-alloc-total {
  color: var(--gold-light);
  font-weight: 700;
}

.skill-alloc-row .form-input {
  padding: 0.3rem 0.4rem;
  text-align: center;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .creator-pools {
    grid-template-columns: minmax(0, 1fr);
  }

  .skill-alloc-head,
  .skill-alloc-row {
    grid-template-columns: minmax(0, 1fr) 2rem 3.25rem 3.25rem 2.25rem;
    gap: 0.3rem;
    padding: 0.45rem 0.5rem;
  }

  .skill-alloc-name {
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.3;
  }
}

.skill-alloc-row[hidden],
.creator-derived[hidden] {
  display: none;
}
