/* Velvet Empire — 1920s noir, oxblood + brass. */

:root {
  --bg: #12080f;
  --bg-2: #1b0e18;
  --panel: #221324;
  --panel-2: #2b1a2e;
  --line: #3b2440;
  --ink: #f2e8ee;
  --muted: #a08fa4;
  --brass: #c9a227;
  --rose: #e0567a;
  --blood: #8e1b3a;
  --good: #6fd39b;
  --bad: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a1226 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 1080px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- header ---------- */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 18px;
  align-items: end;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--line);
}

.brand h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: .06em;
  font-weight: 500;
  color: var(--ink);
}
.brand h1 span { color: var(--brass); font-style: italic; }
.brand .sub { color: var(--muted); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }

.stats { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: flex-end; }
.stats .stat { display: flex; flex-direction: column; align-items: flex-end; }
.stats .stat span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.stats .stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stats .stat.bell b { color: var(--brass); }
.stats .stat.bell b.soon { color: #e08a3c; }
.stats .stat.bell b.urgent { color: var(--bad); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .55 } }

.bars { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bar-wrap label {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
}
.bar-wrap i { font-style: normal; color: var(--ink); }
.bar { height: 7px; background: #2a1729; border-radius: 99px; overflow: hidden; margin-top: 3px; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; transition: width .35s ease; }
.bar-fill.heat { background: linear-gradient(90deg, #6fb1d6, #c9a227); }
.bar-fill.heat.warn { background: linear-gradient(90deg, #c9a227, #e08a3c); }
.bar-fill.heat.danger { background: linear-gradient(90deg, #e08a3c, #ff4d4d); }
.bar-fill.morale { background: linear-gradient(90deg, #6fd39b, #6fb1d6); }
.bar-fill.morale.warn { background: linear-gradient(90deg, #c9a227, #e08a3c); }
.bar-fill.morale.danger { background: linear-gradient(90deg, #ff6b6b, #8e1b3a); }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 12px 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 99px;
  padding: 7px 16px; cursor: pointer;
  font: inherit; font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
}
.tab:hover { color: var(--ink); }
.tab.active { color: #1a0d18; background: var(--brass); border-color: var(--brass); font-weight: 600; }

/* Unread marker on the Word tab. */
.tab .badge {
  display: inline-block; min-width: 17px; padding: 0 5px;
  margin-left: 4px; border-radius: 99px;
  background: #4a3050; color: var(--ink);
  font-size: 10px; line-height: 16px; letter-spacing: 0;
  vertical-align: 1px; font-weight: 600;
}
.tab .badge.loud { background: var(--blood); color: #fff; }
.tab.active .badge { background: #1a0d18; color: var(--brass); }
.tab.active .badge.loud { background: var(--blood); color: #fff; }

/* ---------- panels ---------- */

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  margin-bottom: 14px;
}
.panel h2 {
  margin: 0 0 8px;
  font-size: 15px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--brass);
  display: flex; align-items: center; gap: 10px;
}
.panel p { margin: 0 0 12px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.right { text-align: right; }

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

/* ---------- buttons ---------- */

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 14px;
  font: inherit; font-size: 14px;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover:not(:disabled) { background: #3a2340; border-color: var(--brass); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn small { color: var(--muted); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }
.btn.primary { background: linear-gradient(180deg, #a12246, var(--blood)); border-color: #b2325a; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #b7284f, #9c1f3f); }
.btn.danger { border-color: #7c2440; color: #ffb3c2; }
.btn.danger:hover:not(:disabled) { background: #4a1229; border-color: var(--blood); }
.btn.tiny { padding: 6px 11px; font-size: 13px; }
.btn.ghost { background: transparent; }

.search-row { margin-bottom: 12px; }
input[type="search"] {
  background: #1a0f1c; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; font: inherit; flex: 1 1 200px; min-width: 160px;
}
input[type="search"]:focus { outline: none; border-color: var(--brass); }
.btn.on { border-color: var(--brass); color: var(--brass); background: #2b1a2e; }
.buy-row { gap: 6px; }
.btn.bulk { padding: 5px 9px; font-size: 12.5px; }
.btn.bulk small { color: var(--good); font-size: 9.5px; }

input[type="number"] {
  background: #1a0f1c; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; font: inherit; width: 150px;
}
input[type="number"]:focus { outline: none; border-color: var(--brass); }

/* ---------- cards ---------- */

.grid, .roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
}

.card {
  background: #1c1020;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex; flex-direction: column; gap: 7px;
}
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .name { font-size: 15.5px; }
.card.rival { border-left: 3px solid var(--blood); }
.liquor-bar { margin: 2px 0 10px; }
.liquor-bar .bar-fill { background: linear-gradient(90deg, #6fd39b, #c9a227, #ff6b6b); }
.tribute {
  font-size: 12px; color: var(--good);
  background: rgba(111,211,155,.10); border-radius: 6px; padding: 3px 8px;
}
.odds { display: flex; align-items: baseline; gap: 7px; }
.odds b { font-size: 17px; font-variant-numeric: tabular-nums; }
.warn-txt { color: #e08a3c; }
.shielded {
  background: rgba(111, 211, 155, .08);
  border-left: 3px solid var(--good);
  padding: 9px 12px; border-radius: 8px; margin: 0 0 12px;
}
.card.ill { border-color: #6d2f38; background: #241119; }
.card.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }

.pill {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--pill, var(--muted));
  border: 1px solid currentColor; border-radius: 99px;
  padding: 2px 8px; white-space: nowrap;
}

.bank-figures { display: flex; gap: 28px; margin-bottom: 12px; }
.bank-figures div { display: flex; flex-direction: column; }
.bank-figures b { font-size: 24px; font-variant-numeric: tabular-nums; }

/* ---------- table ---------- */

.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; color: var(--muted); font-weight: 500;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  padding: 6px 8px; border-bottom: 1px solid var(--line);
}
/* `.table th` outranks a bare `.right`, so alignment needs the same specificity. */
.table th.right { text-align: right; }
.table td { padding: 8px; border-bottom: 1px solid #2a1a2e; }
.table tr.you { background: rgba(201, 162, 39, .10); }
.table tr.you td { color: var(--brass); }

/* ---------- log ---------- */

.log { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow-y: auto; }
.log-line {
  padding: 7px 10px; border-radius: 8px;
  background: #1c1020; border-left: 3px solid var(--line);
  font-size: 14px;
}
.log-line .stamp { color: var(--muted); font-size: 11px; margin-right: 9px; font-variant-numeric: tabular-nums; }
.log-line.good { border-left-color: var(--good); }
.log-line.bad { border-left-color: #e08a3c; }
.log-line.raid { border-left-color: var(--bad); background: #2a1119; }
.log-line.sick { border-left-color: #b0568a; background: #24132a; }
.log-line.event { border-left-color: var(--brass); }

/* ---------- footer & toast ---------- */

.foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-top: 6px; border-top: 1px solid var(--line);
}

.toast {
  position: fixed; left: 50%; bottom: 22px;
  transform: translate(-50%, 20px);
  background: #2b1a2e; border: 1px solid var(--brass);
  color: var(--ink); border-radius: 10px;
  padding: 10px 18px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: min(90vw, 460px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--bad); }

/* ---------- unlocks, styles, choices, season end ---------- */

.log-line.unlock {
  border-left-color: var(--brass);
  background: linear-gradient(90deg, rgba(201,162,39,.16), #1c1020 70%);
}
.log-line.choice { border-left-color: #9b7fd4; background: #1e1630; }

/* Locked things stay visible as goals, dimmed and labelled with what opens them. */
.card.locked, .locked-panel {
  border-style: dashed;
  border-color: #40284a;
  background: #170d1a;
}
.card.locked .name, .locked-panel h2 { color: var(--muted); }
.card.locked .muted { opacity: .75; }

.pill.lock-pill { color: var(--muted); border-color: #4a3050; }

.lock-hint, .lock-hint-inline {
  font-size: 12px; letter-spacing: .04em;
  color: var(--brass); opacity: .85;
}
.lock-hint::before { content: '🔒 '; filter: grayscale(1); }

.tab.locked { color: #6a5670; }
.tab.locked::after { content: ' 🔒'; font-size: 9px; filter: grayscale(1); opacity: .7; }
.tab.locked:hover { color: var(--muted); }

.choose-style { border-color: var(--brass); box-shadow: 0 0 0 1px rgba(201,162,39,.25) inset; }
.style-card { border-color: #4a3050; }
.style-card:hover { border-color: var(--brass); }
.style-effects {
  margin: 2px 0 4px; padding-left: 18px;
  color: var(--muted); font-size: 12.5px;
}
.style-effects li { margin-bottom: 3px; }
.style-effects li::marker { color: var(--brass); }
.style-effects.inline {
  display: flex; flex-wrap: wrap; gap: 4px 20px;
  padding-left: 18px; margin-bottom: 12px;
}
.style-card.current-style { border-color: var(--brass); background: #241a20; }

.intro-card.wide { width: min(660px, 100%); }
.choice-card { text-align: left; }
.choice-title {
  margin: 0 0 10px; font-size: 21px; font-weight: 500;
  color: var(--ink); letter-spacing: 0; text-transform: none;
}
.choice-options { display: grid; gap: 8px; margin-top: 18px; }
.choice-opt {
  align-items: flex-start; text-align: left; padding: 12px 14px; width: 100%;
}
.choice-opt b { font-weight: 600; }
.choice-opt small { text-transform: none; letter-spacing: 0; font-size: 12.5px; }

.end-stats { margin: 18px 0; text-align: left; }
.end-actions { margin-top: 4px; }
.end-actions .btn { flex: 1 1 200px; }

/* ---------- how to play ---------- */

/* Two explanatory cards side by side, filling the row instead of hugging left. */
.grid.duo { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.steps { margin: 0; padding-left: 22px; }
.steps li { margin-bottom: 9px; }
.steps li::marker { color: var(--brass); font-weight: 600; }

/* Prose panels read better with a measure; tables and grids stay full width. */
#view .panel > p { max-width: 68ch; }

/* ---------- start screen ---------- */

.intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(700px 420px at 50% 18%, rgba(142, 27, 58, .40) 0%, transparent 70%),
    rgba(9, 4, 8, .96);
  backdrop-filter: blur(3px);
}
.intro[hidden] { display: none; }

.intro-card {
  width: min(460px, 100%);
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 26px 26px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.intro-card h1 {
  margin: 0; font-size: 40px; font-weight: 500; letter-spacing: .05em;
}
.intro-card h1 span { color: var(--brass); font-style: italic; }
.intro-tag {
  margin: 4px 0 18px;
  color: var(--muted); font-size: 12px;
  letter-spacing: .22em; text-transform: uppercase;
}
.intro-card .muted { text-align: left; margin-bottom: 20px; }
.intro-label {
  display: block; text-align: left;
  color: var(--muted); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px;
}
.intro-card input[type="text"] {
  width: 100%;
  background: #1a0f1c; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; font: inherit; font-size: 17px;
  margin-bottom: 16px;
}
.intro-card input[type="text"]:focus { outline: none; border-color: var(--brass); }
.intro-card .btn { width: 100%; font-size: 16px; padding: 12px; }
.intro-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.intro-mode .btn { font-size: 13px; padding: 9px 8px; }
.btn.mode-btn.on { border-color: var(--brass); color: var(--brass); background: #2b1a2e; }
.stats .stat b.endless { color: var(--muted); font-style: italic; }
.intro-foot { margin: 14px 0 0; }

@media (max-width: 640px) {
  .topbar { grid-template-columns: 1fr; align-items: start; }
  .stats { justify-content: flex-start; gap: 6px 16px; }
  .stats .stat { align-items: flex-start; }
  .brand h1 { font-size: 25px; }
  .bars { grid-template-columns: 1fr; }
  .grid, .roster { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
