:root {
  --bg: #0f0e0c;
  --panel: #1c1a16;
  --text: #e7e2d9;
  --muted: #b9b4a8;
  --accent: #c2a878;
  --border: #2b2822;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 10% 5%, #1a1712, var(--bg));
  color: var(--text);
  font-family: "Source Serif 4", serif;
  line-height: 1.65;
}

a {
  color: var(--accent);
}

h1, h2, h3 {
  margin-top: 0;
  font-family: "Cinzel", serif;
  letter-spacing: 0.02em;
}

.top-nav {
  border-bottom: 1px solid var(--border);
  background: rgba(28, 26, 22, 0.92);
  padding: 1rem 1.5rem;
}

.top-nav nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.session-bar {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  color: var(--muted);
}

.session-bar form {
  display: inline;
  margin: 0;
}

.session-bar input[type="submit"] {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}

.page-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.25rem;
}

.lore-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  margin-bottom: 1rem;
}

.lore-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.type-badge {
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.lore-section-dm {
  border-color: #6c5840;
}

.relation-columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.relation-grid {
  display: grid;
  gap: 0.65rem;
}

.relation-card {
  background: #171511;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.relation-type {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.relation-link {
  text-align: right;
}

.simple-list {
  margin: 0;
  padding-left: 1.2rem;
}

.simple-list li {
  margin-bottom: 0.35rem;
}

.filter-row {
  margin: 0.9rem 0 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.active-filter {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.button-link {
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  text-decoration: none;
}

.action-row {
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1rem;
  align-items: center;
}

.danger-inline {
  margin-left: 0.5rem;
}

.danger-inline input[type="submit"] {
  background: transparent;
  border: 1px solid #a96e63;
  color: #d7a39a;
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
}

.stacked-form p {
  margin: 0.6rem 0;
}

.form-section {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 0.9rem;
}

.form-section:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.stacked-form label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
}

.form-helper {
  display: block;
  max-width: 42rem;
  margin: 0.2rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.stacked-form input[type="text"],
.stacked-form input[type="number"],
.stacked-form input[type="date"],
.stacked-form textarea,
.stacked-form select {
  width: 100%;
  max-width: 36rem;
  background: #14120f;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.5rem 0.6rem;
  font-family: inherit;
}

.stacked-form input[type="submit"] {
  background: #2a241b;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.inline-form-compact {
  gap: 0.45rem;
}

.inline-form-secondary {
  margin-top: 0.45rem;
}

.inline-form input[type="text"] {
  min-width: 280px;
}

.inline-form__number {
  width: 4.5rem;
  min-width: 0;
}

.inline-form__number-prominent {
  width: 5.5rem;
  text-align: center;
  font-size: 1.15rem;
}

.flash-banner {
  border: 1px solid var(--border);
  background: #181611;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  margin: 0 0 0.9rem;
}

.flash-banner.alert {
  border-color: #8a6852;
  color: #f0d8bf;
}

.searchable-select {
  margin: 0.6rem 0;
}

.searchable-select__input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-start;
  max-width: 42rem;
}

.searchable-select__input-row input[type="text"] {
  flex: 1 1 18rem;
  margin: 0;
}

.searchable-select__toggle,
.searchable-select__clear {
  background: #211c15;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-family: inherit;
}

.searchable-select__panel {
  max-width: 42rem;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #14120f;
  padding: 0.7rem;
}

.searchable-select__feedback {
  margin: 0 0 0.55rem;
}

.searchable-select__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  max-height: 16rem;
  overflow-y: auto;
}

.searchable-select__option {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  background: #1a1712;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  font-family: inherit;
}

.searchable-select__option:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.searchable-select__meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.searchable-select__dialog {
  width: min(48rem, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  background: #14120f;
  color: var(--text);
}

.searchable-select__dialog::backdrop {
  background: rgba(15, 14, 12, 0.72);
}

.searchable-select__dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

.searchable-select__dialog-header p {
  margin: 0.35rem 0 0;
}

.searchable-select__dialog-body {
  padding: 1rem;
}

.searchable-select__dialog-body input[type="text"] {
  width: 100%;
  margin-bottom: 0.75rem;
}

.searchable-select__close {
  background: #211c15;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font-family: inherit;
}

.reveal-callout {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.8rem;
  background: #171511;
}

.reveal-callout p,
.reveal-guidance p {
  margin: 0.35rem 0 0;
}

.reveal-callout-visible {
  border-color: #6f8d65;
}

.reveal-callout-pending {
  border-color: #8a6852;
}

.reveal-grid {
  display: grid;
  gap: 0.75rem;
}

.reveal-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  background: #171511;
}

.reveal-card-compact {
  padding: 0.65rem 0.8rem;
}

.reveal-card__header {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
}

.reveal-card__header-compact {
  margin-bottom: 0.35rem;
}

.reveal-card__badges {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem 1rem;
}

.reveal-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.reveal-status-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  background: #171511;
}

.reveal-status-card p {
  margin: 0.35rem 0 0;
}

.reveal-table {
  display: grid;
  gap: 0.55rem;
}

.reveal-table__head,
.reveal-table__row {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 0.9fr 0.8fr 1.2fr 1.5fr 1.4fr;
  gap: 0.8rem;
  align-items: start;
}

.reveal-table__head {
  color: var(--muted);
  font-size: 0.92rem;
}

.reveal-table__row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: #171511;
}

.table-panel {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.guide-shell {
  display: grid;
  gap: 1rem;
}

.guide-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

.guide-tab-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.guide-tab-button {
  display: grid;
  gap: 0.2rem;
  flex: 1 1 0;
  min-width: 0;
  text-align: left;
  padding: 0.8rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(194, 168, 120, 0.08), rgba(194, 168, 120, 0)),
    #171511;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.guide-tab-button:hover {
  border-color: var(--accent);
}

.guide-tab-input:focus-visible + .guide-tab-button {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.guide-tab-input:checked + .guide-tab-button {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(194, 168, 120, 0.18), rgba(194, 168, 120, 0.04)),
    #1d1913;
  box-shadow: inset 0 0 0 1px rgba(194, 168, 120, 0.2);
}

.guide-tab-button__eyebrow,
.guide-panel__eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.guide-tab-button__label {
  font-family: "Cinzel", serif;
  font-size: 0.9rem;
  line-height: 1.2;
}

.guide-panel {
  display: none;
  width: 100%;
  order: 99;
  margin-bottom: 0;
}

.guide-tab-input:checked + .guide-tab-button + .guide-panel {
  display: block;
}

.guide-panel__header {
  margin-bottom: 1rem;
}

.guide-panel__header h2 {
  margin-bottom: 0;
}

.guide-card-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-card-grid-two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .guide-card-grid,
  .guide-card-grid-two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.guide-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    #171511;
}

.guide-card-highlight {
  border-color: rgba(194, 168, 120, 0.45);
  background:
    linear-gradient(180deg, rgba(194, 168, 120, 0.18), rgba(194, 168, 120, 0.04)),
    #1b1712;
}

.guide-accordion {
  padding-top: 1rem;
}

.guide-accordion__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}

.guide-accordion__summary::-webkit-details-marker {
  display: none;
}

.guide-accordion__chevron {
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform 0.15s ease;
}

.guide-accordion[open] .guide-accordion__chevron {
  transform: rotate(180deg);
}

.guide-accordion__content {
  margin-top: 1rem;
}

.guide-nav-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.guide-card h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.guide-rows {
  display: grid;
  gap: 0.5rem;
}

.guide-row {
  display: grid;
  gap: 0.15rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(194, 168, 120, 0.12);
}

.guide-row:first-child {
  border-top: none;
  padding-top: 0;
}

.guide-row__label {
  color: var(--accent);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.guide-row__value {
  line-height: 1.45;
}

.guide-row-plain .guide-row__value {
  color: var(--text);
}

@media (max-width: 640px) {
  .guide-tab-button {
    flex-basis: calc(50% - 0.375rem);
  }

  .guide-card-grid,
  .guide-card-grid-two-up {
    grid-template-columns: 1fr;
  }
}

.table-panel__header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 0.75rem;
}

.table-panel__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.table-stat-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  background: #171511;
  min-height: 0;
}

.table-stat-card strong {
  display: block;
  color: var(--muted);
  text-align: center;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
}

.table-stat-card p {
  margin: 0.25rem 0 0;
  font-size: 1.2rem;
}

.table-stat-card__value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.table-stat-card__value-centered {
  text-align: center;
  min-height: 2rem;
}

.table-stat-card__support {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.inline-form__label {
  color: var(--muted);
  font-size: 0.9rem;
}

.table-stat-card__support-divider {
  padding: 0 0.2rem;
}

.table-stat-card-primary {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(194, 168, 120, 0.12), rgba(23, 21, 17, 0.95));
}

.button-link-subtle {
  background: #211c15;
  border: 1px solid var(--border);
  color: var(--text);
}

.equipment-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.equipment-sections {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.equipment-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  background: #14120f;
}

.equipment-section-weapons {
  border-color: #6e7f58;
}

.equipment-section-armor {
  border-color: #6c5840;
}

.equipment-section__header {
  margin-bottom: 0.8rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.equipment-section__header h3 {
  margin-bottom: 0.2rem;
}

.equipment-section__header p {
  margin: 0;
}

.equipment-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #171511;
  padding: 0.8rem;
}

.equipment-card__header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: start;
}

.equipment-card__notes {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.equipment-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.equipment-form__toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.table-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.table-panel__action-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #171511;
}

.table-panel__action-form-button {
  padding: 0;
  border: none;
  background: transparent;
}

.table-panel__action-form-button .button-link {
  margin: 0;
}

.spell-slot-grid {
  display: grid;
  gap: 0.75rem;
}

.spell-slot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.spell-slot-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #211c15;
  color: var(--text);
  font-size: 1rem;
  text-decoration: none;
  font-family: inherit;
}

.spell-slot-button input[type="submit"] {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  font-size: 1rem;
}

.spell-slot-button-available {
  border-color: #8ea57f;
  color: #d7ecd0;
}

.spell-slot-button-expended {
  border-color: #a96e63;
  color: #e1b7ae;
}

@media (max-width: 920px) {
  .reveal-table__head {
    display: none;
  }

  .reveal-table__row {
    grid-template-columns: 1fr;
  }
}
