:root {
  --bg: #060504;
  --bg-soft: #0e0b09;
  --surface: #12100d;
  --surface-2: #19140f;
  --surface-3: #271e17;
  --text: #f7ead4;
  --muted: #d0b994;
  --paper: #ead6aa;
  --paper-ink: #24190f;
  --gold: #efb84f;
  --gold-soft: #8d642a;
  --red: #a83d31;
  --red-dark: #3a1410;
  --green: #243f28;
  --blue: #1e384b;
  --purple: #2d243d;
  --border: #5a452f;
  --shadow: rgba(0, 0, 0, 0.45);
  --line: rgba(198, 184, 159, 0.22);
  --accent: var(--gold);
  --accent-bright: var(--gold);
  --danger: var(--red);
  --card: var(--surface-2);
  --panel: var(--surface);
  --paper-dark: #5a4329;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(239, 184, 79, 0.18), transparent 20rem),
    radial-gradient(circle at 88% 8%, rgba(168, 61, 49, 0.13), transparent 22rem),
    linear-gradient(180deg, var(--bg) 0%, #0b0907 48%, #030302 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
.button,
.site-nav a,
.nav-link {
  min-height: 44px;
}

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

img,
iframe {
  max-width: 100%;
}

h1,
h2,
h3,
.brand strong {
  font-family: Georgia, "Times New Roman", serif;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(90, 69, 47, 0.8);
  background: rgba(8, 7, 6, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(239, 184, 79, 0.72);
  border-radius: 8px;
  background: linear-gradient(145deg, #1f1710, #070604);
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.02rem;
  line-height: 1.05;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-toggle {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.site-nav {
  position: absolute;
  top: calc(100% + 1px);
  right: 1rem;
  left: 1rem;
  display: none;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0c0a08;
  box-shadow: 0 20px 42px var(--shadow);
}

.site-nav.is-open {
  display: grid;
}

.site-nav a {
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.is-active {
  background: rgba(239, 184, 79, 0.12);
  color: var(--gold);
}

.app-shell {
  width: min(1180px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem;
  overflow-x: clip;
}

.app-shell:focus {
  outline: none;
}

.starter-hero,
.page-hero,
.dashboard-hero,
.panel,
.character-card {
  border: 1px solid rgba(90, 69, 47, 0.82);
  border-radius: 14px;
  background: rgba(18, 16, 13, 0.94);
  box-shadow: 0 18px 42px var(--shadow);
}

.starter-hero {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  margin-bottom: 1rem;
  padding: 1rem;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(6, 5, 4, 0.97) 0%, rgba(9, 7, 5, 0.91) 45%, rgba(9, 7, 5, 0.42) 100%),
    radial-gradient(circle at 8% 8%, rgba(239, 184, 79, 0.22), transparent 14rem),
    url("assets/hero-tabletop.png");
  background-position: center;
  background-size: cover;
}

.hero-copy {
  display: grid;
  gap: 0.42rem;
  min-width: 0;
}

.starter-hero h1,
.page-hero h1,
.dashboard-hero h1 {
  margin: 0;
  max-width: 100%;
  color: var(--text);
  overflow-wrap: break-word;
  font-size: clamp(2.3rem, 9vw, 3.35rem);
  line-height: 1;
}

.starter-hero h2 {
  margin: 0;
  max-width: 100%;
  color: var(--gold);
  overflow-wrap: break-word;
  font-size: clamp(1.2rem, 5vw, 2.2rem);
  line-height: 1.08;
}

.starter-hero p,
.page-hero p,
.dashboard-hero p {
  max-width: 66ch;
  margin: 0;
  color: var(--muted);
  overflow-wrap: break-word;
}

.hero-actions,
.quick-link-grid {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
}

.quick-link-card {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(90, 69, 47, 0.86);
  border-radius: 12px;
  background: rgba(25, 20, 15, 0.94);
  color: var(--text);
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 235, 190, 0.08), 0 12px 28px rgba(0, 0, 0, 0.24);
}

.hero-actions .quick-link-card {
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
}

.hero-actions .quick-link-card:nth-child(1) {
  border-color: rgba(210, 77, 58, 0.78);
  background: linear-gradient(135deg, rgba(97, 30, 22, 0.96), rgba(45, 16, 12, 0.96));
}

.hero-actions .quick-link-card:nth-child(2) {
  border-color: rgba(118, 103, 160, 0.68);
  background: linear-gradient(135deg, rgba(45, 36, 61, 0.96), rgba(25, 20, 38, 0.96));
}

.hero-actions .quick-link-card:nth-child(3) {
  border-color: rgba(77, 123, 73, 0.7);
  background: linear-gradient(135deg, rgba(36, 63, 40, 0.96), rgba(19, 36, 22, 0.96));
}

.hero-actions .quick-link-card:nth-child(4) {
  border-color: rgba(70, 113, 145, 0.72);
  background: linear-gradient(135deg, rgba(30, 56, 75, 0.96), rgba(15, 31, 43, 0.96));
}

.hero-actions .quick-link-card:nth-child(5) {
  border-color: rgba(239, 184, 79, 0.78);
  background: linear-gradient(135deg, rgba(96, 63, 15, 0.96), rgba(39, 28, 12, 0.96));
}

.quick-link-card strong,
.quick-link-card span {
  display: block;
}

.quick-link-card strong {
  color: var(--text);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.quick-link-card span {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.quick-card-action {
  color: var(--gold);
  font-weight: 800;
  white-space: nowrap;
}

.quick-link-card:hover {
  border-color: rgba(239, 184, 79, 0.84);
  transform: translateY(-1px);
}

.starter-grid,
.dashboard-grid,
.content-grid,
.card-grid,
.character-grid,
.session-list,
.timeline {
  display: grid;
  gap: 1rem;
}

.panel,
.character-card {
  min-width: 0;
  max-width: 100%;
  padding: 1rem;
  background: linear-gradient(145deg, rgba(18, 16, 13, 0.98), rgba(12, 10, 8, 0.98));
}

.panel h2,
.character-card h2 {
  margin: 0 0 0.55rem;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1.2;
}

.panel p,
.character-card p {
  color: var(--muted);
}

.panel p:last-child,
.character-card p:last-child {
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.intro-card {
  background: linear-gradient(145deg, rgba(22, 20, 17, 0.98), rgba(10, 9, 7, 0.98));
}

.parchment-card {
  border-color: rgba(234, 214, 170, 0.74);
  background:
    radial-gradient(circle at 92% 12%, rgba(159, 121, 56, 0.18), transparent 9rem),
    radial-gradient(circle at 10% 100%, rgba(89, 54, 22, 0.12), transparent 12rem),
    var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(255, 244, 214, 0.38);
}

.parchment-card .eyebrow {
  color: #7b4b1f;
}

.parchment-card h2,
.parchment-card h3,
.parchment-card p,
.parchment-card li,
.parchment-card dt,
.parchment-card dd {
  color: var(--paper-ink);
}

.no-campaign-card {
  background: linear-gradient(145deg, rgba(17, 16, 14, 0.98), rgba(9, 8, 7, 0.98));
}

.coming-later-card {
  background: linear-gradient(145deg, rgba(36, 27, 18, 0.94), rgba(18, 14, 10, 0.96));
}

.source-card {
  background: rgba(21, 17, 14, 0.9);
}

.button-stack,
.quick-actions,
.dice-buttons,
.initiative-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.quick-actions {
  margin-bottom: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.72rem 0.95rem;
  border: 1px solid var(--gold-soft);
  border-radius: 9px;
  background: linear-gradient(180deg, #edc56d, var(--gold));
  color: #201408;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.button:hover {
  filter: brightness(1.06);
}

.button-secondary {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.button-tertiary {
  border-color: rgba(198, 184, 159, 0.22);
  background: rgba(21, 17, 14, 0.72);
  color: var(--muted);
}

.button-danger {
  border-color: var(--red);
  background: rgba(143, 52, 44, 0.24);
  color: var(--text);
}

.button-small {
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  font-size: 0.94rem;
}

.button-disabled {
  cursor: not-allowed;
  flex-direction: column;
  gap: 0.1rem;
  border-color: rgba(198, 184, 159, 0.18);
  background: rgba(21, 17, 14, 0.7);
  color: var(--muted);
}

.button-disabled small {
  font-size: 0.72rem;
  font-weight: 500;
}

.check-list,
.coming-list,
.clean-list,
.step-list,
.tutorial-list {
  margin: 0;
  padding-left: 1.25rem;
}

.check-list li,
.coming-list li,
.clean-list li,
.step-list li,
.tutorial-list li {
  margin: 0.42rem 0;
}

.clean-list,
.step-list,
.tutorial-list {
  color: var(--muted);
}

.future-mini-grid,
.help-tile-grid,
.tool-preview-grid,
.definition-grid,
.glossary-grid,
.admin-file-grid,
.quick-card-list,
.faq-list {
  display: grid;
  gap: 0.75rem;
}

.future-mini-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.future-mini-link,
.help-tile,
.tool-preview-grid article,
.definition-card,
.quick-character,
.tool-link-row,
.admin-file-card {
  border: 1px solid rgba(198, 184, 159, 0.18);
  border-radius: 10px;
  background: rgba(21, 17, 14, 0.58);
}

.future-mini-link,
.help-tile {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.future-mini-link span,
.help-tile span {
  color: var(--muted);
  font-size: 0.88rem;
}

.help-tile:hover,
.future-mini-link:hover {
  border-color: rgba(214, 168, 79, 0.55);
  background: rgba(50, 40, 31, 0.72);
}

.tool-preview-grid article,
.definition-card,
.admin-file-card,
.tool-link-row {
  padding: 0.85rem;
}

.tool-preview-grid h3,
.definition-card h3,
.definition-card dt,
.info-list dt,
.admin-file-card h3 {
  margin: 0 0 0.25rem;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 800;
}

.tool-preview-grid p,
.definition-card p,
.definition-card dd,
.info-list dd {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.parchment-card .definition-card,
.parchment-card .tool-preview-grid article {
  background: rgba(255, 249, 235, 0.28);
}

.page-hero,
.dashboard-hero {
  margin-bottom: 1rem;
  padding: 1.2rem;
}

.page-hero {
  background: linear-gradient(145deg, rgba(38, 31, 25, 0.96), rgba(21, 17, 14, 0.96));
}

.page-hero h1 {
  font-size: clamp(2rem, 9vw, 4rem);
}

.session-chip {
  display: grid;
  gap: 0.2rem;
  align-content: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(21, 17, 14, 0.68);
}

.session-chip strong {
  color: var(--text);
  font-size: 1.1rem;
}

.session-chip span,
.muted,
.help-text {
  color: var(--muted);
}

.panel-heading,
.card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-topline span {
  color: var(--muted);
  font-size: 0.9rem;
}

.map-frame {
  position: relative;
  min-height: 18rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.map-frame iframe {
  display: block;
  width: 100%;
  min-height: 18rem;
  height: 100%;
  border: 0;
  background: transparent;
}

.map-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.25rem;
  padding: 1rem;
  color: var(--text);
  text-align: center;
}

.help-text {
  margin-top: 0.75rem;
  font-size: 0.92rem;
}

.quick-character {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
  padding: 0.75rem;
}

.quick-character strong,
.quick-character span {
  display: block;
}

.quick-character span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.9rem 0;
}

.stat {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(198, 184, 159, 0.18);
  border-radius: 8px;
  background: rgba(14, 11, 9, 0.55);
}

.stat small {
  color: var(--muted);
  font-size: 0.78rem;
}

.stat strong {
  overflow-wrap: anywhere;
  color: var(--text);
}

.info-list {
  display: grid;
  gap: 0.9rem;
  margin: 0 0 1rem;
}

.info-list.compact {
  gap: 0.55rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
}

.step-number {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #201408;
  font-weight: 900;
}

.dice-buttons {
  margin: 0.75rem 0;
}

.dice-results,
.initiative-list {
  display: grid;
  gap: 0.5rem;
}

.dice-results {
  min-height: 2.5rem;
}

.dice-results p,
.initiative-list li {
  margin: 0;
  padding: 0.6rem;
  border: 1px solid rgba(198, 184, 159, 0.18);
  border-radius: 8px;
  background: rgba(14, 11, 9, 0.5);
}

.dice-results p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: baseline;
}

.dice-results small,
.initiative-list small {
  color: var(--muted);
}

.initiative-form {
  display: grid;
  gap: 0.75rem;
}

.initiative-form label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.initiative-form input,
.search-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: rgba(14, 11, 9, 0.82);
  color: var(--text);
}

.initiative-actions {
  margin: 0.75rem 0;
}

.initiative-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.initiative-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.initiative-list strong,
.initiative-list small {
  display: block;
}

.empty-row {
  color: var(--muted);
}

.plain-button {
  border: 0;
  padding: 0.35rem;
  background: transparent;
  color: var(--gold);
}

details {
  border: 1px solid rgba(198, 184, 159, 0.18);
  border-radius: 10px;
  background: rgba(38, 31, 25, 0.78);
}

summary {
  min-height: 44px;
  padding: 0.75rem;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

details p {
  margin: 0;
  padding: 0 0.75rem 0.75rem;
}

.search-label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  color: var(--muted);
}

.glossary-grid {
  margin: 1rem 0 0;
}

.tool-link-row {
  display: grid;
  gap: 0.55rem;
  width: 100%;
}

.tool-link-row p {
  display: grid;
  gap: 0.2rem;
  margin: 0;
}

.tool-link-row span {
  color: var(--muted);
}

.site-footer {
  display: grid;
  gap: 0.25rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(21, 17, 14, 0.86);
  color: var(--muted);
}

.site-footer strong {
  color: var(--text);
}

code {
  border: 1px solid rgba(198, 184, 159, 0.22);
  border-radius: 4px;
  padding: 0.08rem 0.25rem;
  background: rgba(14, 11, 9, 0.7);
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.94em;
}

.noscript {
  margin: 1rem;
  padding: 1rem;
  border: 1px solid var(--red);
  border-radius: 12px;
  background: #2a1814;
  color: var(--text);
}

@media (min-width: 760px) {
  .nav-toggle {
    display: none;
  }

  .site-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.2rem;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .site-nav a {
    min-height: 44px;
    padding: 0.45rem 0.6rem;
    font-size: 0.94rem;
  }

  .app-shell {
    padding: 1.5rem;
  }

  .starter-hero {
    padding: 1.5rem;
  }

  .hero-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .starter-grid,
  .content-grid,
  .quick-link-grid,
  .card-grid,
  .character-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide-panel {
    grid-column: 1 / -1;
  }

  .help-tile-grid,
  .tool-preview-grid,
  .definition-grid,
  .admin-file-grid,
  .glossary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-hero {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .initiative-form {
    grid-template-columns: 1fr 8rem auto;
    align-items: end;
  }

  .quick-character {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

@media (min-width: 1100px) {
  .starter-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
    align-items: end;
    padding: 2rem;
  }

  .hero-actions {
    grid-template-columns: 1fr;
  }

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

  .intro-card,
  .parchment-card {
    min-height: 100%;
  }

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

  .card-grid,
  .quick-link-grid,
  .character-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .help-tile-grid,
  .tool-preview-grid,
  .definition-grid,
  .admin-file-grid,
  .glossary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
    align-items: start;
  }

  .map-panel,
  .party-panel {
    grid-row: span 2;
  }

  .map-frame,
  .map-frame iframe {
    min-height: 30rem;
  }
}
