/* ═══════════════════════════════════════════════════════════════════════════════
   DRAW STEEL DIRECTOR'S TOOLKIT
   "The Director's Grimoire" — a tactical reference tome
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;0,700;0,800;1,400;1,600&family=Source+Sans+3:ital,wght@0,300;0,400;0,600;0,700;1,400&display=swap');

:root {
  /* ── Surface & Background ── */
  --color-bg:               #f6f4ef;
  --color-bg-surface:       #ffffff;
  --color-bg-muted:         #edeae2;
  --color-bg-recessed:      #e4e0d6;

  /* ── Sidebar ── */
  --color-sidebar-bg:       #f0ece3;
  --color-sidebar-border:   #d5cfc2;
  --color-sidebar-hover:    #e4e0d6;

  /* ── Header ── */
  --color-header-bg:        #12121e;
  --color-header-text:      #d0cec8;

  /* ── Text ── */
  --color-text:             #2a2722;
  --color-text-muted:       #6b6560;
  --color-text-faint:       #9b9590;

  /* ── Accent ── */
  --color-gold:             #c8a432;
  --color-gold-soft:        #e8d48a;
  --color-gold-bg:          rgba(200, 164, 50, 0.08);
  --color-link:             #1e56a0;
  --color-link-hover:       #143d73;

  /* ── Border ── */
  --color-border:           #d5cfc2;
  --color-border-strong:    #b5af9f;

  /* ── Tables ── */
  --color-table-head-bg:    #2d2926;
  --color-table-head-text:  #e8e6e0;
  --color-table-stripe:     #f4f1ea;
  --color-table-border:     #c8c2b5;

  /* ── Blockquotes ── */
  --color-quote-bg:         #f0ece3;
  --color-quote-border:     #2d2926;
  --color-quote-nested-bg:  #e4e0d6;

  /* ── Badges ── */
  --color-badge-homebrew:   #d4a017;
  --color-badge-guide:      #4a8cc7;
  --color-director:         #9b2335;
  --color-director-bg:      rgba(155, 35, 53, 0.07);

  /* ── Layout ── */
  --sidebar-width:          260px;
  --header-height:          3.25rem;
  --content-max-width:      960px;

  /* ── Typography ── */
  --font-heading:           'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-body:              'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* ── Transitions ── */
  --ease-out:               cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-fast:        150ms var(--ease-out);
  --transition-med:         250ms var(--ease-out);
}

/* ─── Dark Theme — "The Dungeon" ──────────────────────────────────────────────── */

[data-theme="dark"] {
  --color-bg:               #0e0e16;
  --color-bg-surface:       #171721;
  --color-bg-muted:         #1e1e2a;
  --color-bg-recessed:      #141420;

  --color-sidebar-bg:       #131320;
  --color-sidebar-border:   #2a2a3a;
  --color-sidebar-hover:    #1e1e2e;

  --color-header-bg:        #08080f;
  --color-header-text:      #b0aca0;

  --color-text:             #d5d0c5;
  --color-text-muted:       #8a8578;
  --color-text-faint:       #5a5548;

  --color-gold:             #d4aa30;
  --color-gold-soft:        #a08520;
  --color-gold-bg:          rgba(212, 170, 48, 0.06);
  --color-link:             #60a5fa;
  --color-link-hover:       #93c5fd;

  --color-border:           #2a2a3a;
  --color-border-strong:    #3a3a4a;

  --color-table-head-bg:    #1a1a2e;
  --color-table-head-text:  #d0ccc0;
  --color-table-stripe:     #1a1a26;
  --color-table-border:     #2a2a3a;

  --color-quote-bg:         #161622;
  --color-quote-border:     var(--color-gold);
  --color-quote-nested-bg:  #1c1c2c;

  --color-badge-homebrew:   #c8a020;
  --color-badge-guide:      #4a90d0;
  --color-director:         #c4364a;
  --color-director-bg:      rgba(196, 54, 74, 0.08);
}

/* ─── Reset & Foundation ──────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.65;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--color-gold-soft);
  color: var(--color-text);
}

[data-theme="dark"] ::selection {
  background: rgba(200, 164, 50, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SITE HEADER — The Binding
   ═══════════════════════════════════════════════════════════════════════════════ */

.site-header {
  background: var(--color-header-bg);
  color: var(--color-header-text);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 2px solid var(--color-gold);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
}

.site-title {
  font-family: var(--font-heading);
  color: var(--color-gold);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color var(--transition-fast);
  text-shadow: 0 0 20px rgba(200, 164, 50, 0.15);
}

.site-title:hover {
  color: var(--color-gold-soft);
}

/* ── Header Search ── */

.header-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}

/* Pagefind overrides for compact header search */
.header-search .pagefind-ui {
  --pagefind-ui-scale: 0.75;
  --pagefind-ui-primary: var(--color-gold);
  --pagefind-ui-text: var(--color-header-text);
  --pagefind-ui-background: rgba(255, 255, 255, 0.07);
  --pagefind-ui-border: rgba(255, 255, 255, 0.12);
  --pagefind-ui-border-width: 1px;
}

.header-search .pagefind-ui__search-input {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #eee !important;
  border-radius: 6px !important;
  font-family: var(--font-body) !important;
  height: 2rem !important;
  font-size: 0.85rem !important;
  transition: border-color var(--transition-fast), background var(--transition-fast) !important;
}

.header-search .pagefind-ui__search-input:focus {
  border-color: var(--color-gold) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(200, 164, 50, 0.2) !important;
}

.header-search .pagefind-ui__search-input::placeholder {
  color: rgba(255, 255, 255, 0.3) !important;
}

.header-search .pagefind-ui__form {
  height: 2rem !important;
}

.header-search .pagefind-ui__form::before {
  top: 50% !important;
  transform: translateY(-50%) !important;
}

.header-search .pagefind-ui__search-clear {
  color: rgba(255, 255, 255, 0.4) !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  height: auto !important;
}

.header-search .pagefind-ui__drawer {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  width: 480px !important;
  max-width: 90vw !important;
  max-height: 65vh !important;
  overflow-y: auto !important;
  background: var(--color-bg-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-top: 2px solid var(--color-gold) !important;
  border-radius: 0 0 8px 8px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
  z-index: 300 !important;
  padding: 0.5rem !important;
}

.header-search .pagefind-ui__result {
  border-bottom: 1px solid var(--color-border) !important;
  padding: 0.6rem 0.5rem !important;
}

.header-search .pagefind-ui__result-link {
  color: var(--color-link) !important;
  font-family: var(--font-heading) !important;
  font-weight: 600 !important;
}

.header-search .pagefind-ui__result-excerpt {
  color: var(--color-text-muted) !important;
  font-size: 0.82rem !important;
}

.header-search .pagefind-ui__message {
  color: var(--color-text-muted) !important;
  font-size: 0.82rem !important;
  padding: 0.5rem !important;
}

/* ── Dark Mode Toggle ── */

.theme-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--color-header-text);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.theme-toggle:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

/* ── Hamburger Menu ── */

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-header-text);
  border-radius: 1px;
  transition: transform var(--transition-med), opacity var(--transition-fast);
}

.sidebar-open .hamburger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.sidebar-open .hamburger span:nth-child(2) {
  opacity: 0;
}
.sidebar-open .hamburger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SIDEBAR — The Index Tabs
   ═══════════════════════════════════════════════════════════════════════════════ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

.site-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
  z-index: 100;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 3px;
}

.sidebar-nav {
  padding: 0.5rem 0 2rem;
}

.sidebar-section {
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-sidebar-border);
}

.sidebar-section-last {
  border-bottom: none;
  margin-bottom: 0;
}

.sidebar-heading {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-faint);
  padding: 0.75rem 1.25rem 0.35rem;
  user-select: none;
}

.sidebar-section-director .sidebar-heading {
  color: var(--color-director);
}

.sidebar-section-director .sidebar-heading a {
  color: var(--color-director);
  text-decoration: none;
}

.sidebar-section-director .sidebar-heading a:hover {
  text-decoration: underline;
}

.sidebar-divider {
  height: 1px;
  background: var(--color-sidebar-border);
  margin: 0.3rem 1.25rem;
  list-style: none;
}

.sidebar-list {
  list-style: none;
}

.sidebar-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 1.25rem;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  transition: background var(--transition-fast), color var(--transition-fast);
  border-left: 3px solid transparent;
}

.sidebar-list li a:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-link);
  border-left-color: var(--color-gold);
}

.sidebar-count {
  font-size: 0.72rem;
  color: var(--color-text-faint);
  font-weight: 600;
  background: var(--color-bg-muted);
  padding: 0.05rem 0.4rem;
  border-radius: 8px;
  min-width: 1.6rem;
  text-align: center;
}

/* ── Collapsible Book Chapters ── */

.sidebar-book {
  margin: 0.15rem 0;
}

.sidebar-book summary {
  padding: 0.35rem 1.25rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--transition-fast);
  user-select: none;
  border-left: 3px solid transparent;
}

.sidebar-book summary::-webkit-details-marker {
  display: none;
}

.sidebar-book summary::before {
  content: '›';
  font-size: 1rem;
  color: var(--color-text-faint);
  transition: transform var(--transition-fast);
  display: inline-block;
  width: 0.75rem;
  flex-shrink: 0;
}

.sidebar-book[open] summary::before {
  transform: rotate(90deg);
}

.sidebar-book summary:hover {
  color: var(--color-link);
  border-left-color: var(--color-gold);
}

.sidebar-chapters {
  padding-bottom: 0.25rem;
}

.sidebar-chapters li a {
  padding-left: 2.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.sidebar-chapters li a:hover {
  color: var(--color-link);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════════════════════════════════════════════ */

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  max-width: var(--content-max-width);
  padding: 1.75rem 2.5rem;
  width: 100%;
  flex: 1;
}

/* ─── Breadcrumbs ─────────────────────────────────────────────────────────────── */

.breadcrumb {
  font-size: 0.8rem;
  color: var(--color-text-faint);
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-weight: 400;
}

.breadcrumb a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* ─── Entity Type Label ────────────────────────────────────────────────────────── */

.entity-type-label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-faint);
  padding: 0 0 0.75rem 0;
  border-left: 2px solid var(--color-gold);
  padding-left: 0.5rem;
  margin-bottom: 0;
}

/* ─── Source Badges ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.badge-homebrew {
  background: var(--color-badge-homebrew);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.badge-guide {
  background: var(--color-badge-guide);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.badge-director {
  background: var(--color-director);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ARTICLE TYPOGRAPHY — The Manuscript
   ═══════════════════════════════════════════════════════════════════════════════ */

article h1 {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 3px solid var(--color-gold);
  color: var(--color-text);
}

article h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 2rem 0 0.6rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

article h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 2rem 0 0.5rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

article h4 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.5rem 0 0.4rem;
  color: var(--color-text);
}

article h5 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.25rem 0 0.4rem;
  color: var(--color-text-muted);
}

article h6 {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 1rem 0 0.3rem;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Table of Contents ─────────────────────────────────────────────────────── */

.toc {
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-gold);
  border-radius: 6px;
  padding: 0.85rem 1.1rem 0.9rem;
  margin: 1.25rem 1.75rem 1.75rem 0;
  display: inline-block;
  float: left;
  min-width: 200px;
  max-width: 380px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.toc-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border);
}

.toc-list {
  margin: 0;
  padding-left: 1.1rem;
  list-style: decimal;
}

.toc-sublist {
  margin: 0.1rem 0;
  padding-left: 1.1rem;
  list-style: decimal;
}

.toc li {
  margin: 0.15rem 0;
}

.toc a {
  color: var(--color-link);
  text-decoration: none;
}

.toc a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

article::after {
  content: '';
  display: table;
  clear: both;
}

@media (max-width: 600px) {
  .toc {
    float: none;
    display: block;
    max-width: 100%;
    margin-right: 0;
  }
}

article p {
  margin: 0.6rem 0;
}

article ul, article ol {
  margin: 0.6rem 0 0.6rem 1.5rem;
}

article li {
  margin: 0.2rem 0;
}

article a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--transition-fast);
  border-bottom: 1px solid transparent;
}

article a:hover {
  color: var(--color-link-hover);
  border-bottom-color: var(--color-link-hover);
}

article strong {
  font-weight: 700;
  color: var(--color-text);
}

article em {
  font-style: italic;
}

article hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

article code {
  font-size: 0.88em;
  background: var(--color-bg-muted);
  padding: 0.15em 0.35em;
  border-radius: 3px;
  color: var(--color-text);
}

article pre {
  background: var(--color-bg-recessed);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

article pre code {
  background: none;
  padding: 0;
}

/* ─── Stat Block Tables ───────────────────────────────────────────────────────── */

article table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1rem 0;
  font-size: 0.88rem;
  border: 2px solid var(--color-table-head-bg);
  border-radius: 6px;
  overflow: hidden;
}

article th {
  background: var(--color-table-head-bg);
  color: var(--color-table-head-text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.55rem 0.75rem;
  text-align: left;
}

article td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-table-border);
  color: var(--color-text);
  background: var(--color-bg-surface);
  vertical-align: top;
}

article tr:last-child td {
  border-bottom: none;
}

article tr:nth-child(even) td {
  background: var(--color-table-stripe);
}

article td[align="center"], article th[align="center"] { text-align: center; }
article td[align="right"], article th[align="right"] { text-align: right; }

/* ─── Blockquotes — card style ────────────────────────────────────────────────── */

article blockquote {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-strong);
  border-top: 3px solid var(--color-gold);
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  margin: 1.5rem 0;
}

article blockquote > p {
  padding: 0.4rem 1rem;
  margin: 0;
}

article blockquote > p:first-child {
  padding-top: 0.75rem;
}

article blockquote > p:last-child {
  padding-bottom: 0.75rem;
}

article blockquote > ul,
article blockquote > ol {
  padding: 0.25rem 1rem 0.5rem 2.25rem;
  margin: 0;
}

/* Nested blockquotes — toned down so they don't stack gold borders */
article blockquote blockquote {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-muted);
  box-shadow: none;
  margin: 0.5rem 1rem;
}

/* ─── Ability Cards ────────────────────────────────────────────────────────────── */
/* Abilities get class="ability-card" during HTML post-processing.                */

/* Dark header bar — ability name */
article blockquote.ability-card .ability-name {
  background: var(--color-table-head-bg);
  color: var(--color-table-head-text);
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

/* Stat table (keywords | action-type) / (distance | target) */
article blockquote.ability-card table {
  margin: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.82rem;
}

/* Keywords row (th) */
article blockquote.ability-card th {
  background: #1e1b18;
  color: rgba(224, 218, 208, 0.75);
  padding: 0.25rem 1rem;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Action type label — right th column */
article blockquote.ability-card th:last-child {
  color: var(--color-gold);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

/* Prevent article strong from darkening th text */
article blockquote.ability-card th strong,
article blockquote.ability-card th em {
  color: inherit;
}

/* Distance/Target row (td) */
article blockquote.ability-card td {
  background: var(--color-bg-recessed);
  padding: 0.4rem 1rem;
  border-bottom: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
}

article blockquote.ability-card tr:nth-child(even) td {
  background: var(--color-bg-recessed);
}

/* Flavor text — first paragraph (italic) */
article blockquote.ability-card > p:first-of-type {
  padding: 0.6rem 1rem 0.2rem;
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* Body paragraphs */
article blockquote.ability-card > p {
  padding: 0.25rem 1rem;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

article blockquote.ability-card > p:last-child {
  padding-bottom: 0.85rem;
}

/* "Trigger:", "Effect:", "Spend X Ferocity:" labels */
article blockquote.ability-card > p > strong:first-child {
  font-weight: 700;
}

/* Bullet lists (power roll tiers) */
article blockquote.ability-card > ul,
article blockquote.ability-card > ol {
  padding: 0.25rem 1rem 0.5rem 2.25rem;
  margin: 0;
  line-height: 1.55;
}

article blockquote.ability-card > ul li,
article blockquote.ability-card > ol li {
  margin: 0.15rem 0;
  font-size: 0.92rem;
}

/* Dark mode */
[data-theme="dark"] article blockquote {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] article blockquote.ability-card .ability-name {
  background: #0c0c14;
}

[data-theme="dark"] article blockquote.ability-card th {
  background: #0c0c14;
}

[data-theme="dark"] article blockquote.ability-card td,
[data-theme="dark"] article blockquote.ability-card tr:nth-child(even) td {
  background: var(--color-bg-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PREV / NEXT NAVIGATION — Page Edges
   ═══════════════════════════════════════════════════════════════════════════════ */

.prev-next {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--color-border);
  gap: 0.75rem;
}

.prev-next-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-link);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  transition: background var(--transition-fast), color var(--transition-fast);
  max-width: 40%;
}

.prev-next-link:hover {
  background: var(--color-bg-muted);
  color: var(--color-link-hover);
}

.next-link {
  text-align: right;
}

.prev-next-arrow {
  font-size: 1.15rem;
  flex-shrink: 0;
  opacity: 0.6;
}

.prev-next-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prev-next-index {
  color: var(--color-text-faint);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.prev-next-index:hover {
  color: var(--color-gold);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BROWSE PAGES — The Catalog
   ═══════════════════════════════════════════════════════════════════════════════ */

.browse-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0.75rem 0;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
}

.browse-table th,
.browse-table td {
  padding: 0.5rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.browse-table th {
  background: var(--color-bg-muted);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.browse-table td {
  background: var(--color-bg-surface);
  font-size: 0.88rem;
}

.browse-table tr:last-child td {
  border-bottom: none;
}

.browse-table tr:nth-child(even) td {
  background: var(--color-table-stripe);
}

.browse-table a {
  color: var(--color-link);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.browse-table a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

.browse-description {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.empty-note {
  color: var(--color-text-faint);
  font-style: italic;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

/* ─── Type Tags ───────────────────────────────────────────────────────────────── */

.type-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  background: var(--color-bg-muted);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.type-director-guide {
  background: var(--color-director-bg);
  color: var(--color-director);
}

.type-tool {
  background: rgba(70, 120, 180, 0.12);
  color: #2a5fa0;
}

[data-theme="dark"] .type-tool {
  color: #60a5fa;
}

/* ─── Director Index Cards ──────────────────────────────────────────────────── */

.director-section-heading {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

.director-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.director-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-director);
  border-radius: 5px;
  padding: 1rem 1.15rem 1.1rem;
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.director-card:hover {
  border-color: var(--color-director);
  box-shadow: 0 3px 12px rgba(155, 35, 53, 0.12);
  transform: translateY(-1px);
  color: var(--color-text);
}

[data-theme="dark"] .director-card:hover {
  box-shadow: 0 3px 12px rgba(196, 54, 74, 0.15);
}

.director-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

.director-card-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.director-card-type {
  margin-top: auto;
  padding-top: 0.5rem;
}

.director-card.tool-card-variant {
  border-top-color: #4a78b4;
}

.director-card.tool-card-variant:hover {
  border-color: #4a78b4;
  box-shadow: 0 3px 12px rgba(74, 120, 180, 0.12);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   HOME PAGE — The Cover
   ═══════════════════════════════════════════════════════════════════════════════ */

.home-title {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 0.2rem;
  line-height: 1.15;
}

.home-subtitle {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}

.home-card {
  display: block;
  padding: 1.5rem 1.5rem 1.5rem 1.25rem;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-gold);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--transition-med), border-color var(--transition-fast), transform var(--transition-fast);
}

.home-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border-color: var(--color-border-strong);
  border-left-color: var(--color-gold);
  transform: translateY(-2px);
}

.home-card h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--color-gold);
  border: none;
  padding: 0;
}

.home-card p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ── Stat Pills ── */

.stat-pills-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.stat-pills-heading {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-faint);
  margin-bottom: 0.75rem;
}

.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.82rem;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.stat-pill:hover {
  background: var(--color-gold-bg);
  border-color: var(--color-gold);
  color: var(--color-text);
}

.stat-pill-count {
  font-weight: 700;
  color: var(--color-gold);
  font-size: 0.88rem;
}

.stat-pill-label {
  color: var(--color-text-muted);
  text-transform: capitalize;
}

/* ── Search Hints ── */

.search-hints {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.search-hint-label {
  font-size: 0.8rem;
  color: var(--color-text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.search-hint-chip {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  background: var(--color-bg-muted);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--color-link);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  user-select: none;
}

.search-hint-chip:hover {
  background: var(--color-gold-bg);
  border-color: var(--color-gold);
  color: var(--color-text);
}

/* ─── Content headings (non-article, e.g. browse pages) ───────────────────────── */

.content h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

/* Section subheadings on browse/listing pages */
.content > section h2,
.content section h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.75rem 0 0.5rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--color-border);
}

.content h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.75rem 0 0.6rem;
  color: var(--color-text);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FOOTER — The Colophon
   ═══════════════════════════════════════════════════════════════════════════════ */

.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--color-text-faint);
  font-size: 0.82rem;
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
}

.site-footer a {
  color: var(--color-link);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Pocket Edition
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    z-index: 175;
    transform: translateX(-100%);
    transition: transform var(--transition-med);
    box-shadow: none;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
  }

  .sidebar-open .sidebar-overlay {
    display: block;
  }

  .content {
    padding: 1.25rem 1rem;
  }

  .prev-next {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .prev-next-link {
    max-width: 100%;
    justify-content: flex-start;
  }

  .next-link {
    justify-content: flex-end;
  }

  .prev-next-index {
    text-align: center;
    order: -1;
  }

  .header-search {
    max-width: 200px;
  }

  article table {
    font-size: 0.82rem;
  }

  article th, article td {
    padding: 0.35rem 0.5rem;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .stat-pills {
    gap: 0.4rem;
  }
}

@media (max-width: 480px) {
  .header-search {
    display: none;
  }

  .site-title {
    font-size: 1rem;
  }

  article h1 {
    font-size: 1.7rem;
  }

  article h2 {
    font-size: 1.35rem;
  }

  /* Ensure tables scroll horizontally on narrow screens */
  article table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PRINT — The Player Handout
   ═══════════════════════════════════════════════════════════════════════════════ */

@media print {
  .site-header,
  .sidebar,
  .sidebar-overlay,
  .site-footer,
  .breadcrumb,
  .prev-next,
  .badge,
  .toc,
  .hamburger,
  .theme-toggle,
  .header-search {
    display: none !important;
  }

  .site-layout {
    display: block;
  }

  .main-area,
  .content {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  body {
    background: white;
    color: black;
    font-size: 11pt;
    line-height: 1.5;
  }

  article h1 {
    font-size: 18pt;
    border-bottom: 2pt solid #333;
  }

  article h2 {
    font-size: 15pt;
    border-bottom: 0.5pt solid #999;
  }

  article h3 {
    font-size: 13pt;
  }

  article table {
    border: 1pt solid #444;
    page-break-inside: avoid;
  }

  article th {
    background: #ddd !important;
    color: black !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  article td {
    background: white !important;
  }

  article tr:nth-child(even) td {
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  article blockquote {
    border-left: 3pt solid #444;
    background: #f5f5f5 !important;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  article h1, article h2, article h3 {
    page-break-after: avoid;
  }

  a {
    color: black !important;
    text-decoration: none !important;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
    word-break: break-all;
  }
}

/* ─── Director Tools ────────────────────────────────────────────────────────── */

.tool-intro {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.tool-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 800px) {
  .tool-layout { grid-template-columns: 1fr; }
}

.tool-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.tool-card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-family: var(--font-heading);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.tool-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.tool-row label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.tool-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.tool-stepper button {
  background: var(--color-bg-muted);
  border: none;
  padding: 0.3rem 0.7rem;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--color-text);
  transition: background var(--transition-fast);
}

.tool-stepper button:hover { background: var(--color-bg-recessed); }

.tool-stepper span {
  padding: 0.3rem 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  min-width: 2rem;
  text-align: center;
  background: var(--color-bg-surface);
}

.budget-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.budget-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.budget-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--color-text);
  line-height: 1;
}

.budget-value.budget-over { color: #c0392b; }

.budget-bar-track {
  margin-top: 0.75rem;
  height: 8px;
  background: var(--color-bg-recessed);
  border-radius: 4px;
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  background: var(--color-gold);
  border-radius: 4px;
  transition: width 0.3s var(--ease-out), background 0.3s;
}

.budget-bar-fill.budget-bar-tight { background: #e67e22; }
.budget-bar-fill.budget-bar-over  { background: #c0392b; width: 100% !important; }

.tool-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tool-input {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  flex: 1;
  min-width: 140px;
}

.tool-input:focus { outline: 2px solid var(--color-gold); outline-offset: 1px; }

.tool-input-sm { flex: 0 0 60px; min-width: 60px; }

.tool-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.tool-textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: vertical;
  box-sizing: border-box;
}

.tool-btn-primary {
  padding: 0.4rem 1rem;
  background: var(--color-gold);
  color: #12121e;
  border: none;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.tool-btn-primary:hover { background: var(--color-gold-soft); }

.tool-btn-ghost {
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.tool-btn-ghost:hover { background: var(--color-bg-muted); color: var(--color-text); }

.tool-btn-remove {
  background: transparent;
  border: none;
  color: var(--color-text-faint);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.tool-btn-remove:hover { color: #c0392b; background: rgba(192, 57, 43, 0.08); }

.tool-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0.4rem 0 0;
}

.tool-formula {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--color-gold);
  background: var(--color-gold-bg);
  border: 1px solid var(--color-gold-soft);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  margin: 0;
}

.tool-empty { color: var(--color-text-faint); font-style: italic; margin: 0; }

.tool-ref-table {
  width: 100%;
  font-size: 0.85rem;
  border-collapse: collapse;
}

.tool-ref-table th {
  text-align: left;
  background: var(--color-table-head-bg);
  color: var(--color-table-head-text);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tool-ref-table td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.tool-ref-table tr:last-child td { border-bottom: none; }
.tool-ref-table tr:nth-child(even) td { background: var(--color-table-stripe); }

/* Encounter list */

.encounter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.encounter-header h2 { margin: 0; border: none; padding: 0; }

.encounter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.encounter-table th {
  text-align: left;
  background: var(--color-table-head-bg);
  color: var(--color-table-head-text);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.encounter-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.encounter-table tr:last-child td { border-bottom: none; }
.enc-name { font-weight: 600; }
.enc-cost { font-weight: 700; color: var(--color-gold); text-align: right; }

.encounter-total {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  padding-top: 0.5rem;
  border-top: 2px solid var(--color-border-strong);
}

/* Negotiation Tracker */

.neg-layout { display: flex; flex-direction: column; gap: 0; }

.neg-tab-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.neg-tabs { display: flex; flex-wrap: wrap; gap: 0; }

.neg-tab {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  bottom: -2px;
}

.neg-tab:hover { background: var(--color-bg-muted); color: var(--color-text); }

.neg-tab-active {
  background: var(--color-bg-surface);
  border-color: var(--color-border);
  border-bottom-color: var(--color-bg-surface);
  color: var(--color-text);
  font-weight: 600;
}

.neg-tab-empty { font-size: 0.85rem; color: var(--color-text-faint); font-style: italic; padding: 0.5rem 0; }

.neg-panel { border-radius: 0 6px 6px 6px; }

.neg-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.neg-panel-header h2 { margin: 0; border: none; padding: 0; font-size: 1.3rem; }
.neg-panel-actions { display: flex; gap: 0.5rem; }
.neg-btn-danger { color: #c0392b !important; border-color: rgba(192,57,43,0.3) !important; }
.neg-btn-danger:hover { background: rgba(192,57,43,0.08) !important; }

.neg-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.neg-stat { display: flex; flex-direction: column; gap: 0.4rem; }

.neg-stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.neg-stat-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.neg-adj {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-bg-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text);
  transition: background var(--transition-fast);
}

.neg-adj:hover { background: var(--color-bg-recessed); }

.neg-stat-value {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-heading);
  min-width: 2.5rem;
  text-align: center;
  color: var(--color-text);
  line-height: 1;
}

.neg-stat-max  { color: #27ae60; }
.neg-stat-zero { color: #c0392b; }
.neg-stat-warn { color: #e67e22; }

.neg-pips { display: flex; gap: 4px; }

.pip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--color-border-strong);
  background: transparent;
  transition: background var(--transition-fast);
}

.pip.pip-filled.pip-interest { background: var(--color-gold); border-color: var(--color-gold); }
.pip.pip-filled.pip-patience { background: var(--color-link); border-color: var(--color-link); }

.neg-banner {
  padding: 0.6rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.neg-banner-success { background: rgba(39, 174, 96, 0.12); border: 1px solid rgba(39,174,96,0.3); color: #1e8449; }
.neg-banner-fail    { background: rgba(192, 57, 43, 0.1);  border: 1px solid rgba(192,57,43,0.3); color: #c0392b; }
.neg-banner-warn    { background: rgba(230,126,34,0.1);    border: 1px solid rgba(230,126,34,0.3); color: #ca6f1e; }

[data-theme="dark"] .neg-banner-success { color: #58d68d; }
[data-theme="dark"] .neg-banner-fail    { color: #e74c3c; }
[data-theme="dark"] .neg-banner-warn    { color: #f0a500; }

.neg-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) { .neg-columns { grid-template-columns: 1fr; } }

.neg-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }

.neg-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  background: var(--color-bg-muted);
  font-size: 0.9rem;
  transition: background var(--transition-fast);
}

.neg-item-used {
  background: var(--color-bg-recessed);
  color: var(--color-text-faint);
  text-decoration: line-through;
}

.neg-check {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: var(--color-gold);
  flex-shrink: 0;
}

.neg-pitfall { padding: 0.35rem 0.5rem; border-radius: 4px; font-size: 0.9rem; background: rgba(192,57,43,0.08); border-left: 3px solid #c0392b; color: var(--color-text); }
.neg-pitfall-list { gap: 0.4rem; }

.neg-footer { margin-top: 1rem; display: flex; justify-content: flex-end; }

.tool-empty-panel { text-align: center; padding: 2rem; }

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-box {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  padding: 1.75rem;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.modal-box h2 { margin: 0 0 0.5rem; font-size: 1.2rem; font-family: var(--font-heading); }
.modal-box label { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); margin-top: 0.25rem; }
.modal-box .tool-input, .modal-box .tool-select, .modal-box .tool-textarea { width: 100%; box-sizing: border-box; }

.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
