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

:root {
  --bg:          #0e0b07;
  --bg2:         #181309;
  --bg3:         #211a0e;
  --card:        #1c1710;
  --card2:       #241e12;
  --border:      #3e3220;
  --border-hi:   #6a5030;
  --accent:      #c8860a;
  --accent2:     #f0b030;
  --accent-dim:  #6b4a08;
  --gold:        #d4aa60;
  --red:         #b83030;
  --green:       #2a9d5c;
  --text:        #eedcb0;
  --text-dim:    #a08860;
  --text-muted:  #5c4830;
  --radius:      6px;
  --radius-sm:   4px;
  --shadow:      2px 4px 20px rgba(0,0,0,0.7);
  --shadow-lg:   4px 8px 40px rgba(0,0,0,0.85);
  --shadow-pin:  3px 5px 18px rgba(0,0,0,0.8), 0 0 0 1px rgba(200,134,10,0.12);
}

body {
  background-color: var(--bg);
  /* subtle wood-grain lines */
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(200,134,10,0.018) 3px, rgba(200,134,10,0.018) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 12px, rgba(0,0,0,0.12) 12px, rgba(0,0,0,0.12) 13px);
  color: var(--text);
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== HEADER ===== */
#site-header {
  background: linear-gradient(180deg, #1a1208 0%, #120d07 100%);
  border-bottom: 3px solid var(--accent-dim);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 4px 24px rgba(0,0,0,0.85);
}

/* Top brand row */
.header-brand {
  border-bottom: 1px solid rgba(200,134,10,0.2);
  padding: 10px 24px;
}
.header-brand-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-style: italic;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-icon { font-size: 32px; filter: sepia(1) saturate(2) brightness(0.9); }
.logo h1 {
  font-size: 26px;
  color: var(--accent2);
  letter-spacing: 5px;
  text-transform: uppercase;
  text-shadow: 0 0 30px rgba(240,176,48,0.6), 0 2px 4px rgba(0,0,0,0.8);
  line-height: 1.1;
}
.logo .subtitle {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Nav row */
.header-nav-row {
  padding: 0 24px;
  background: rgba(0,0,0,0.25);
}
.header-nav-row nav {
  max-width: 1300px;
  margin: 0 auto;
}

nav {
  display: flex;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }

.nav-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  border-top: 3px solid transparent;
  color: var(--text-muted);
  padding: 10px 18px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-btn:hover { color: var(--text-dim); border-bottom-color: var(--accent-dim); }
.nav-btn.active { color: var(--accent2); border-bottom-color: var(--accent); background: rgba(200,134,10,0.07); }


/* ===== HERO STRIP ===== */
.hero-strip {
  background: var(--bg2);
  border-bottom: 2px solid var(--accent-dim);
  padding: 16px 24px;
  /* rope-like top border effect */
  box-shadow: inset 0 2px 0 rgba(200,134,10,0.12);
}

.hero-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 0 20px;
  min-width: 120px;
}

.hero-num {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent2);
  line-height: 1;
  text-shadow: 0 0 20px rgba(230,160,32,0.4);
}

.hero-num-sm {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent2);
  line-height: 1.3;
  text-align: center;
}

.hero-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hero-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

/* ===== MAIN ===== */
main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.tab { display: none; }
.tab.active { display: block; }

.tab-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.tab-header h2 {
  font-size: 22px;
  color: var(--accent2);
  letter-spacing: 5px;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(240,176,48,0.35);
  flex-shrink: 0;
  position: relative;
  padding-left: 20px;
}
.tab-header h2::before {
  content: '★';
  position: absolute;
  left: 0;
  font-size: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
}

/* ===== SEARCH ===== */
.search-input, .compendium-search-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus, .compendium-search-input:focus { border-color: var(--accent); }
.search-input { width: 280px; }
.compendium-search-input {
  width: 100%;
  font-size: 16px;
  padding: 14px 20px;
  margin-bottom: 20px;
  border-radius: var(--radius);
}

/* ===== SESSIONS GRID ===== */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 28px;
}

/* Frontier gazette / pinned notice style */
.session-card {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-top: 3px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-pin);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  position: relative;
}
.session-card:hover {
  border-color: var(--accent);
  border-top-color: var(--accent);
  transform: translateY(-3px) rotate(0.3deg);
  box-shadow: 4px 10px 32px rgba(0,0,0,0.75), 0 0 0 1px rgba(200,134,10,0.3);
}
/* Pin dot at top center */
.session-card::before {
  content: '✦';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--accent2);
  z-index: 2;
  line-height: 1;
  text-shadow: 0 0 8px rgba(240,176,48,0.8);
}

.session-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-bottom: 2px solid var(--accent-dim);
}

.session-card-image-placeholder {
  width: 100%;
  height: 200px;
  background: repeating-linear-gradient(
    45deg,
    var(--bg2),
    var(--bg2) 10px,
    var(--bg3) 10px,
    var(--bg3) 20px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-bottom: 2px solid var(--accent-dim);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.session-card-body { padding: 16px 18px 12px; }

.session-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* Ink-stamp style session badge */
.session-badge {
  background: transparent;
  color: var(--accent);
  padding: 2px 10px;
  border: 1px solid var(--accent-dim);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: 'Georgia', serif;
}

.session-date {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.session-card-title {
  font-size: 20px;
  color: var(--accent2);
  margin-bottom: 10px;
  line-height: 1.2;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 8px rgba(240,176,48,0.25);
}

.session-card-excerpt {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Opening flourish before the excerpt */
.session-card-excerpt::before {
  content: '"';
  font-size: 28px;
  color: var(--accent-dim);
  line-height: 0.5;
  float: left;
  margin: 8px 6px 0 0;
}

.session-card-footer {
  padding: 10px 18px 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.session-footer-tag {
  font-size: 11px;
  color: var(--text-muted);
}

.session-footer-tag strong {
  color: var(--text-dim);
  margin-right: 4px;
}

.session-tags {
  padding: 0 18px 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ===== SESSION MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 700px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-wide { max-width: 960px; }
.modal-lightbox {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  max-width: 100%;
  width: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }

.modal-session-header { margin-bottom: 20px; }
.modal-session-badge {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-session-title {
  font-size: 26px;
  color: var(--accent2);
  margin-bottom: 4px;
  font-style: italic;
  text-shadow: 0 0 20px rgba(240,176,48,0.2);
  line-height: 1.2;
}
.modal-session-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.modal-session-date { font-size: 12px; color: var(--text-muted); font-style: italic; }

/* Two-part story layout */
.modal-story-part { margin-bottom: 4px; }
.modal-story-part2 {
  border-top: 2px dashed var(--border);
  padding-top: 24px;
  margin-top: 8px;
}
.modal-part-label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  padding: 7px 14px;
  border-left: 3px solid var(--accent-dim);
  background: rgba(200,134,10,0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Storyteller style */
.story-section { padding: 0; }
.story-opener {
  font-size: 13px;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 14px;
  padding: 10px 16px;
  border-left: 3px solid var(--accent-dim);
  background: rgba(200,134,10,0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.story-body {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-dim);
}

.modal-image {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  display: block;
}

.session-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 0 12px;
  margin-bottom: 20px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.session-carousel::-webkit-scrollbar { height: 4px; }
.session-carousel::-webkit-scrollbar-track { background: var(--surface2); border-radius: 2px; }
.session-carousel::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.session-carousel-slide {
  flex: 0 0 auto;
  width: 260px;
  scroll-snap-align: start;
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.session-carousel-slide:hover { border-color: var(--accent); }
.session-carousel-slide img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.modal-section { margin-bottom: 20px; }
.modal-section-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.modal-notes {
  color: var(--text-dim);
  line-height: 1.8;
  white-space: pre-wrap;
}

.modal-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.modal-footer-item { font-size: 13px; color: var(--text-dim); }
.modal-footer-item strong { display: block; font-size: 11px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }


/* ===== PARTY GRID ===== */
.party-grid { display: block; }

.party-section-label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.party-subsection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

.friend-card { border-color: rgba(200,134,10,0.25); }
.friend-chip { background: rgba(200,134,10,0.15) !important; color: var(--accent2) !important; }

.party-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.party-card-header {
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  padding: 24px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
}

.party-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  color: var(--accent2);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-shadow: none;
}

.party-avatar-img {
  width: 80px;
  height: 100px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--accent);
  object-fit: cover;
  object-position: top;
  flex-shrink: 0;
}

.party-header-info { flex: 1; }
.party-name { font-size: 22px; color: var(--accent2); margin-bottom: 4px; }
.party-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.party-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.party-card-stats {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.party-stat-block {
  flex: 1;
  padding: 14px 16px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.party-stat-block:last-child { border-right: none; }

.party-stat-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent2);
}

.party-stat-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Character quote on card */
.char-quote {
  font-size: 12px;
  font-style: italic;
  color: var(--accent2);
  padding: 10px 20px 0;
  line-height: 1.5;
  opacity: 0.88;
}

/* Color description (Stranger voice) on card */
.char-description {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.72;
  margin-bottom: 16px;
}

/* NPC card quote */
.npc-card-quote {
  font-size: 12px;
  font-style: italic;
  color: var(--accent2);
  margin-top: 6px;
  line-height: 1.5;
  opacity: 0.85;
}

/* Modal quote bar */
.modal-char-quote {
  font-size: 15px;
  font-style: italic;
  color: var(--accent2);
  border-left: 3px solid var(--accent);
  padding: 8px 14px;
  margin: 0 0 18px;
  line-height: 1.55;
  background: rgba(200,134,10,0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Color description in modal */
.modal-color-desc {
  font-size: 14px;
  color: var(--text);
  line-height: 1.78;
  font-style: italic;
}

.party-card-body { padding: 20px 24px; }

.party-backstory {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  font-style: italic;
  margin-bottom: 16px;
  padding-left: 12px;
  border-left: 3px solid var(--accent-dim);
}

.party-notes {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg3);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

/* Bastion block on party card */
.party-bastion {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.party-bastion-img {
  width: 100%;
  aspect-ratio: 16/7;
  object-fit: cover;
  display: block;
}
.party-bastion-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  padding: 8px 12px 4px;
}
.party-bastion-desc {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 12px 10px;
  line-height: 1.55;
  font-style: italic;
}

.party-items {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.party-items-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}

.party-items-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.party-item-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
}
.spell-tag {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== COMPENDIUM ===== */
.compendium-browse {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.browse-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s;
}
.browse-btn:hover { border-color: var(--accent-dim); color: var(--text); }
.browse-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent2); }

.compendium-section { margin-bottom: 32px; }
.compendium-section-title {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.compendium-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.compendium-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  transition: border-color 0.15s;
}
.compendium-card:hover { border-color: var(--accent-dim); }

.compendium-card-type {
  font-size: 10px;
  color: var(--accent-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-family: Consolas, monospace;
}

.compendium-card-name {
  font-size: 16px;
  color: var(--accent2);
  margin-bottom: 4px;
}

.compendium-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.compendium-card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* status colors */
.status-active { color: var(--green); }
.status-rumor  { color: var(--accent2); }
.status-done   { color: var(--text-muted); }
.status-dead   { color: var(--red); }

/* ===== QUEST BOARD ===== */
.quest-section { margin-bottom: 44px; }
.quest-section-title {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.quest-count-badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 11px;
}

.quest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Bounty board cards */
.quest-card {
  background: #1e1508;
  border: 1px solid #5a3e18;
  border-radius: 2px;
  padding: 0;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 3px 5px 18px rgba(0,0,0,0.7), inset 0 0 40px rgba(0,0,0,0.3);
  overflow: visible;
}
.quest-card::before {
  content: '';
  display: block;
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 40% 35%, #e8c060, #a06820 60%, #5c3a10);
  border-radius: 50%;
  border: 1px solid #3a2008;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  z-index: 2;
}
.quest-card:hover {
  transform: translateY(-2px) rotate(0.3deg);
  box-shadow: 5px 8px 28px rgba(0,0,0,0.85), inset 0 0 40px rgba(0,0,0,0.3);
}

.quest-card-inner {
  padding: 22px 18px 16px;
  border-top: 3px solid var(--border);
}
.quest-card.q-active  .quest-card-inner { border-top-color: var(--green); }
.quest-card.q-rumor   .quest-card-inner { border-top-color: var(--accent); }
.quest-card.q-completed .quest-card-inner { border-top-color: var(--text-muted); }
.quest-card.q-failed  .quest-card-inner { border-top-color: var(--red); }

.quest-card-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid currentColor;
  font-weight: 700;
  opacity: 0.7;
  transform: rotate(4deg);
  pointer-events: none;
}
.quest-card.q-active    .quest-card-stamp { color: var(--green); }
.quest-card.q-rumor     .quest-card-stamp { color: var(--accent); }
.quest-card.q-completed .quest-card-stamp { color: var(--text-muted); }
.quest-card.q-failed    .quest-card-stamp { color: var(--red); }

.quest-card-title {
  font-size: 15px;
  color: var(--accent2);
  margin-bottom: 8px;
  line-height: 1.35;
  padding-right: 52px;
}
.quest-card-meta  { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; display: flex; gap: 12px; flex-wrap: wrap; }
.quest-card-desc  { font-size: 12px; color: var(--text-dim); line-height: 1.6; margin-bottom: 10px; }
.quest-card-reward {
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.5px;
  border-top: 1px dashed #3a2a10;
  padding-top: 10px;
  margin-top: 4px;
}
.quest-card-notes {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 10px;
  background: rgba(0,0,0,0.25);
  border-radius: 2px;
  margin-top: 8px;
  border-left: 2px solid var(--border);
}
.quest-card.q-completed { opacity: 0.6; }
.quest-card.q-failed    { opacity: 0.5; }

/* ===== HIGHLIGHTS ===== */
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
  padding: 8px 0 24px;
}

.hl-card {
  display: flex;
  flex-direction: row;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s;
}

.hl-card-clickable {
  cursor: pointer;
}

.hl-card-clickable:hover {
  box-shadow: 0 6px 28px rgba(0,0,0,0.45);
  transform: translateY(-2px);
}

.hl-img-wrap {
  width: 160px;
  flex-shrink: 0;
  overflow: hidden;
  background: #1a1410;
}

.hl-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.hl-card-clickable:hover .hl-img {
  transform: scale(1.04);
}

.hl-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.hl-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(194, 140, 60, 0.12);
  border: 1px solid rgba(194, 140, 60, 0.25);
  border-radius: 4px;
  padding: 2px 8px;
  width: fit-content;
}

.hl-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-primary);
  line-height: 1.2;
  margin-top: 2px;
}

.hl-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
  margin: 0;
}

.hl-link {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.4px;
  margin-top: 6px;
  transition: color 0.15s;
}

.hl-card-clickable:hover .hl-link {
  color: var(--accent2);
}

/* ===== GALLERY ===== */
.gallery-grid { display: flex; flex-direction: column; gap: 48px; }

.gallery-group-title {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.gallery-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  background: var(--card);
}
.gallery-item.wide { grid-column: span 2; }
.gallery-item:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 28px rgba(200,134,10,0.25);
  transform: translateY(-3px);
}

.gallery-item-img-wrap {
  overflow: hidden;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}
.gallery-item.wide .gallery-item-img-wrap { aspect-ratio: 2 / 1; }

.gallery-item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.gallery-item:hover .gallery-item-img-wrap img { transform: scale(1.04); }

.gallery-item-caption-strip {
  padding: 8px 12px;
  background: var(--bg2);
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
  border-top: 1px solid var(--border);
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* legacy overlay class — hidden now */
.gallery-item-overlay { display: none; }
.gallery-item-caption { display: none; }

/* ===== LIGHTBOX ===== */
.lightbox-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.lightbox-img {
  max-width: 82vw;
  max-height: 72vh;
  border-radius: 6px;
  display: block;
  object-fit: contain;
}
.lightbox-caption {
  color: #ccc;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}
.lightbox-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.lightbox-nav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.lightbox-nav-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.lightbox-counter { font-size: 12px; color: var(--text-muted); min-width: 56px; text-align: center; }
#image-modal .modal {
  background: rgba(8,6,4,0.97);
  border: 1px solid var(--border);
  padding: 48px 28px 28px;
  max-width: 96vw;
}

/* ===== NPC GRID ===== */
.npc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}
.npc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
}
.npc-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.npc-avatar {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: top;
  display: block;
  border-bottom: 2px solid var(--accent);
}
.npc-avatar-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  color: var(--accent);
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
}
.npc-info, .npc-card-body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.npc-name { font-size: 15px; font-weight: 700; color: var(--text); }
.npc-role { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
.npc-status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--text-muted);
  margin-top: 4px;
  align-self: flex-start;
}
.npc-status-badge.ally { background: rgba(60,180,100,0.15); color: #6ecf8e; }
.npc-status-badge.enemy { background: rgba(220,60,60,0.15); color: #e07070; }
.npc-status-badge.neutral { background: rgba(180,140,60,0.15); color: #c9a84c; }
.npc-status-badge.unknown { background: var(--surface-2); color: var(--text-muted); }
.npc-desc { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; flex: 1; }
.card-click-hint {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 8px;
  text-align: right;
}

/* (gallery-item defined above) */

/* ===== BUTTONS ===== */
.btn-primary-sm {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent2);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary-sm:hover { background: var(--accent2); }

.btn-sm {
  background: var(--bg3);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-sm:hover { border-color: var(--accent-dim); color: var(--text); }

/* ===== SPINNER ===== */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== UTILS ===== */
.hidden { display: none !important; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 16px;
}
.empty-sub { font-size: 13px; margin-top: 8px; }


/* ===== TOAST ===== */
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--card);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 500;
  box-shadow: var(--shadow);
}

/* ===== WIKI ===== */
.wiki-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.wiki-index-section {
  margin-bottom: 32px;
}

.wiki-index-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.wiki-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.wiki-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.wiki-card:hover { border-color: var(--accent); background: var(--card2); }

.wiki-card-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.wiki-card-thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
  flex-shrink: 0;
}

.wiki-card-info { flex: 1; min-width: 0; }

.wiki-card-name {
  font-weight: 700;
  color: var(--accent2);
  font-size: 15px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wiki-card-cat {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.wiki-card-excerpt {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== WIKI ARTICLE VIEW ===== */
.wiki-article {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
}

.wiki-article-aside { position: sticky; top: 80px; }

.wiki-article-back {
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wiki-article-back:hover { color: var(--accent2); }

.wiki-article-title {
  font-size: 30px;
  color: var(--accent2);
  margin-bottom: 4px;
  line-height: 1.2;
}

.wiki-article-category {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.wiki-article-body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
}

.wiki-article-body p { margin-bottom: 14px; }

.wiki-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--accent-dim);
  text-underline-offset: 3px;
  transition: color 0.1s;
}
.wiki-link:hover { color: var(--accent2); }

.wiki-infobox {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.wiki-infobox-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: top;
  display: block;
}

.wiki-infobox-img-wide {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.wiki-infobox-body { padding: 16px; }

.wiki-infobox-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 12px;
}

.wiki-infobox-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  align-items: flex-start;
}

.wiki-infobox-label {
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 72px;
}

.wiki-infobox-val { color: var(--text); }

.wiki-related {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.wiki-related-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.wiki-related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wiki-related-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  transition: border-color 0.15s;
}
.wiki-related-chip:hover { border-color: var(--accent); color: var(--accent2); }

.wiki-sessions-list {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.wiki-session-chip {
  display: inline-block;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  margin: 4px 4px 0 0;
  transition: border-color 0.15s;
}
.wiki-session-chip:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 700px) {
  .wiki-article { grid-template-columns: 1fr; }
  .wiki-article-aside { position: static; order: -1; }
  .wiki-infobox { margin-bottom: 20px; }
  .wiki-card-grid { grid-template-columns: 1fr; }
  .wiki-categories { gap: 6px; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  /* Layout */
  main { padding: 20px 14px 60px; }
  .tab-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .search-input { width: 100%; }

  /* Header */
  .header-brand { padding: 8px 14px; }
  .header-brand-tagline { display: none; }
  .header-nav-row { padding: 0; }
  .logo h1 { font-size: 18px; letter-spacing: 3px; }
  .logo .subtitle { display: none; }
  .logo-icon { font-size: 24px; }
  .header-nav-row nav {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
  }
  .nav-btn {
    flex: 1 1 33.33%;
    min-width: 0;
    padding: 9px 4px;
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 2px solid transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    line-height: 1.3;
  }

  /* Hero strip */
  .hero-strip { padding: 14px; }
  .hero-stat { padding: 0 12px; min-width: 80px; }
  .hero-num { font-size: 26px; }
  .hero-num-sm { font-size: 14px; }
  .hero-label { font-size: 9px; }
  .hero-location { font-size: 12px; }

  /* Sessions */
  .sessions-grid { grid-template-columns: 1fr; gap: 14px; }
  .session-card-image { height: 200px; }

  /* Party */
  .party-subsection { grid-template-columns: 1fr; }

  /* Quests */
  .quest-grid { grid-template-columns: 1fr; }

  /* Gallery */
  .gallery-group-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .gallery-item.wide { grid-column: span 1; }
  .gallery-item.wide .gallery-item-img-wrap { aspect-ratio: 1 / 1; }
  .gallery-item-caption-strip { font-size: 11px; min-height: 28px; padding: 5px 8px; }

  /* Lightbox */
  .lightbox-img { max-width: 95vw; max-height: 60vh; }
  #image-modal .modal { padding: 44px 14px 20px; }

  /* Modals */
  .modal { padding: 24px 16px; }
  .modal-close { top: 12px; right: 12px; }

  /* NPC grid */
  .npc-grid { grid-template-columns: 1fr; }

  /* Compendium */
  .compendium-layout { grid-template-columns: 1fr; }
  .compendium-sidebar { display: none; }

  /* Highlights */
  .highlights-grid { grid-template-columns: 1fr; }
  .hl-card { flex-direction: column; }
  .hl-img-wrap { width: 100%; height: 220px; flex-shrink: 0; }
}
