:root {
  --bg: #1b1410;
  --panel: #2a201a;
  --border: #4a3a2c;
  --text: #f0e6d8;
  --muted: #b8a890;
  --accent: #c8893f;
  --accent-hover: #e0a157;
  font-family: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.site-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}

.site-header h1 { margin: 0; font-size: 2rem; letter-spacing: 1px; }
.accent { color: var(--accent); }
.tagline { color: var(--muted); margin-top: 0.25rem; }

.tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.tab-btn.active, .tab-btn:hover {
  background: var(--accent);
  color: #1b1410;
  border-color: var(--accent);
}

main { max-width: 800px; margin: 0 auto; padding: 0 1rem 3rem; }

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

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.controls label { color: var(--muted); font-size: 0.9rem; }

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
}

.primary-btn, .secondary-btn {
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-size: 1rem;
}

.primary-btn {
  background: var(--accent);
  color: #1b1410;
  font-weight: bold;
}

.primary-btn:hover { background: var(--accent-hover); }

.secondary-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  margin: 0.5rem 0 1rem;
}

.secondary-btn:hover { background: var(--accent); color: #1b1410; }

.output {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 100px;
}

.result-title {
  margin-top: 0;
  color: var(--accent);
  font-size: 1.5rem;
}

.result-title.editable {
  border-bottom: 1px dashed var(--border);
  cursor: text;
}

.result-feature { color: var(--muted); font-style: italic; }

.result-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
.result-list dt { color: var(--muted); }
.result-list dd { margin: 0; }

.stat-grid { grid-template-columns: repeat(2, max-content 1fr); }

.menu h4 {
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin-top: 1.5rem;
}

.menu-list { list-style: none; padding: 0; margin: 0; }
.menu-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.item-name { font-weight: bold; }
.item-price { color: var(--accent); }
.item-desc { color: var(--muted); font-size: 0.9rem; }

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

.loading, .error { color: var(--muted); }
.error { color: #d97b6c; }

/* --- Owner Card --- */
.owner-card {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0 1.5rem;
}
.owner-heading {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.owner-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  font-size: 0.95rem;
}
.owner-label { color: var(--muted); }
.owner-secret { font-style: italic; color: #c17a7a; }

/* --- Menu heading inside output --- */
.menu-heading {
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin-top: 1.5rem;
  font-size: 1rem;
}
.menu-heading .muted { font-size: 0.8rem; font-weight: normal; }

/* --- Loot --- */
.loot-section { margin-bottom: 1rem; }

.coin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.coin {
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  border: 1px solid;
}
.coin-pp { background: #2a1f40; border-color: #9b7fd4; color: #c9a8ff; }
.coin-gp { background: #2a200a; border-color: #c8893f; color: #f0c060; }
.coin-sp { background: #1a2030; border-color: #8899cc; color: #aabbee; }
.coin-cp { background: #201510; border-color: #a06030; color: #cc8855; }

.loot-total { font-size: 0.85rem; font-weight: normal; margin-left: 0.5rem; }
.muted { color: var(--muted); }

/* --- Collapsible --- */
.collapsible {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.collapsible-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.2);
  border: none;
  color: var(--accent);
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 1rem;
  font-family: Georgia, serif;
  text-align: left;
}

.collapsible-toggle:hover { background: rgba(200,137,63,0.1); }
.collapsible-arrow { font-size: 0.75rem; }

.collapsible-body {
  padding: 0.5rem 1rem 1rem;
}

/* --- Price Table --- */
.price-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  table-layout: fixed;
}

/* First column (item/lifestyle name) takes remaining space */
.price-table th:first-child,
.price-table td:first-child {
  width: auto;
}

/* Price columns are fixed width, right-aligned */
.price-table th:not(:first-child),
.price-table td:not(:first-child) {
  width: 90px;
  text-align: right;
}

.price-table th {
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  font-weight: normal;
  font-style: italic;
}

.price-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.price-table tr:last-child td { border-bottom: none; }
.price-table tr:hover td { background: rgba(255,255,255,0.03); }
.price-table .price-cell { color: var(--accent); }

/* --- NPC Card --- */
.npc-header { margin-bottom: 1rem; }
.npc-header .result-title { margin-bottom: 0.1rem; }
.npc-meta { color: var(--muted); margin: 0; font-style: italic; }

/* Stat boxes */
.stat-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.stat-box {
  flex: 1;
  min-width: 52px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.25rem;
  gap: 0.1rem;
}
.stat-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 1.2rem; font-weight: bold; }
.stat-mod   { font-size: 0.8rem; color: var(--accent); }

/* NPC detail rows */
.npc-details { display: flex; flex-direction: column; gap: 0; }

.npc-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.95rem;
  align-items: baseline;
}
.npc-row:last-child { border-bottom: none; }
.npc-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-top: 0.1rem;
}
.npc-value { line-height: 1.4; }
