:root {
  --bg: #14110f;
  --bg-2: #1d1916;
  --bg-3: #272220;
  --line: #3a322c;
  --text: #e8ded2;
  --muted: #9c8f80;
  --accent: #d9a441;
  --accent-2: #4b3f72;
  --danger: #b3473f;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.2rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 0.5rem; }
.brand-mark { color: var(--accent); font-size: 1.3rem; }
.brand-name { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.03em; }
.brand-tag { color: var(--muted); font-style: italic; font-size: 0.85rem; }
.topnav { display: flex; align-items: center; gap: 0.6rem; }

/* layout */
.layout { display: flex; min-height: calc(100vh - 53px); }
.sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 0.8rem 0.6rem 2rem;
  overflow-y: auto;
}
.side-group { margin-bottom: 0.4rem; }
.side-group h4 {
  margin: 0.7rem 0.5rem 0.25rem;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted);
}
.side-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 0.42rem 0.55rem; border-radius: 6px;
}
.side-item:hover { background: var(--bg-3); }
.side-item.active { background: var(--accent-2); }
.side-item .lock { color: var(--accent); font-size: 0.8rem; }

.main { flex: 1; padding: 1.6rem 2rem 4rem; max-width: 900px; }

/* welcome */
.welcome h1 { margin-top: 0.4rem; }
.quick-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1rem; }
.quick {
  flex: 1; min-width: 200px;
  display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-start;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.quick:hover { border-color: var(--accent); }
.quick.panic { border-color: var(--danger); }
.quick.panic:hover { background: #2a1c1a; }
.quick span { color: var(--muted); font-size: 0.85rem; }

/* generator panel */
.gen-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.gen-header h2 { margin: 0 0 0.2rem; }
.gen-header p { margin: 0; color: var(--muted); }
.params { display: flex; gap: 0.8rem; flex-wrap: wrap; margin: 1rem 0 0.4rem; }
.params label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--muted); }
.params select, .params input[type="text"] {
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 0.45rem 0.6rem; font: inherit; min-width: 140px;
}
.params input[type="text"] { min-width: 280px; }

/* buttons */
.primary {
  background: var(--accent); color: #1c1407; border: none;
  border-radius: 8px; padding: 0.55rem 1.3rem; font-weight: 700;
}
.primary:hover { filter: brightness(1.1); }
.ghost {
  background: none; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem 0.9rem;
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.tiny { font-size: 0.78rem; padding: 0.25rem 0.6rem; }

/* results */
#results { margin-top: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.2rem;
}
.card h3 {
  margin: 0 0 0.6rem; color: var(--accent);
  font-size: 1.05rem; letter-spacing: 0.02em;
  display: flex; justify-content: space-between; align-items: center;
}
.card .field { margin: 0.45rem 0; line-height: 1.45; }
.card .field b { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; display: block; }
.card .subcard { border-top: 1px dashed var(--line); margin-top: 0.8rem; padding-top: 0.8rem; }
.card-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; }

/* modals */
dialog {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  max-width: 420px; width: 92vw; padding: 0;
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
.modal-body { padding: 1.2rem 1.4rem; display: flex; flex-direction: column; gap: 0.7rem; }
.modal-body.wide { max-width: none; }
dialog:has(.wide) { max-width: 640px; }
.modal-body h3 { margin: 0; }
.modal-body label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.modal-body input {
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 0.5rem 0.6rem; font: inherit;
}
.modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-top: 0.4rem; }
.error { color: var(--danger); margin: 0; font-size: 0.85rem; }

/* store */
.pack {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.8rem 1rem; margin: 0.4rem 0;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.pack .name { font-weight: 700; }
.pack .desc { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.pack .owned { color: var(--accent); font-weight: 700; white-space: nowrap; }

/* saves */
.save-row {
  border-bottom: 1px solid var(--line); padding: 0.6rem 0.2rem;
  display: flex; justify-content: space-between; gap: 0.8rem; align-items: baseline;
}
.save-row .when { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--line); }
  .side-group { margin-right: 1rem; }
  .main { padding: 1rem; }
  .brand-tag { display: none; }
}
