/* WE TRUST — styles
   Dark, period-appropriate (ink, old paper, sepia). Mobile-first. */

:root {
  --bg-0: #141009;
  --bg-1: #1d1610;
  --bg-2: #241b12;
  --paper: #e6d8bd;
  --paper-2: #d9c8a8;
  --paper-hi: #f0e6d0;
  --ink: #221813;
  --ink-soft: #4a3a2c;
  --gold: #c9a25a;
  --gold-dim: #8a6d3c;
  --red: #93231f;
  --red-ink: #7a1d1a;
  --good: #3d6b35;
  --bad: #93231f;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  --line: 1px solid rgba(34, 24, 19, 0.35);
  --serif: Georgia, "Times New Roman", "Nimbus Roman", serif;
  --sans: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(120% 90% at 50% -10%, #2a2015 0%, var(--bg-1) 45%, var(--bg-0) 100%);
  color: var(--paper);
  font-family: var(--serif);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.grain,
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.grain {
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.02) 0 1px, transparent 1px 4px);
}
.vignette {
  background: radial-gradient(120% 120% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.app {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

[hidden] { display: none !important; }

.screen { animation: screen-in 0.5s ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
  padding: 13px 22px;
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-transform: uppercase;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn--primary {
  background: linear-gradient(180deg, #3a1412, var(--red-ink));
  color: #f3e7cd;
  border-color: #5a1a15;
  padding: 15px 30px;
  font-size: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn--primary:hover { background: linear-gradient(180deg, #461715, var(--red)); }

.btn--ghost {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold-dim);
}
.btn--ghost:hover { background: rgba(201, 162, 90, 0.1); }

.btn--reset {
  background: transparent;
  color: rgba(230, 216, 189, 0.6);
  border-color: rgba(201, 162, 90, 0.3);
  padding: 7px 12px;
  font-size: 0.72rem;
}
.btn--reset:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ---------- title screen ---------- */
.screen--title {
  text-align: center;
  margin: auto 0;
  padding: 32px 6px;
}
.title-header .seal {
  font-size: 2.6rem;
  line-height: 1;
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold-dim);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2c2113, #191207);
  box-shadow: 0 0 0 5px rgba(201, 162, 90, 0.12), inset 0 0 22px rgba(0, 0, 0, 0.8);
}
.title-kicker {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 10px;
}
.title-main {
  font-size: clamp(1.9rem, 12vw, 4.4rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  margin: 0;
  color: var(--paper-hi);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  text-indent: 0.16em;
  white-space: nowrap;
  max-width: 100%;
}
.title-sub {
  font-size: clamp(1.15rem, 5.4vw, 1.6rem);
  font-style: italic;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin: 10px 0 26px;
}
.title-flavor {
  max-width: 34rem;
  margin: 0 auto 26px;
  color: #d9c9a9;
  font-size: 1.05rem;
}
.title-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.title-save-hint {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--gold);
  margin: 0 0 10px;
}
.title-note {
  font-size: 0.78rem;
  color: rgba(230, 216, 189, 0.45);
  max-width: 30rem;
  margin: 18px auto 0;
}

/* ---------- top bar / date ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 12px;
  border-bottom: var(--line);
  margin-bottom: 14px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  color: var(--paper-hi);
}
.topbar-logo { font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.game-date {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  white-space: nowrap;
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(36, 27, 18, 0.85), rgba(20, 16, 9, 0.7));
  border: 1px solid rgba(201, 162, 90, 0.22);
  border-radius: 5px;
}
.stat {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}
.stat .s-icon { text-align: center; font-size: 0.95rem; }
.stat .s-label { color: #cdbc9d; font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .s-value { font-family: var(--sans); font-weight: 700; font-size: 0.82rem; color: var(--paper-hi); min-width: 2.4em; text-align: right; }
.stat .s-bar { grid-column: 2 / -1; height: 5px; background: rgba(230, 216, 189, 0.12); border-radius: 3px; overflow: hidden; }
.stat .s-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.stat .s-bar i.is-good { background: linear-gradient(90deg, #4c7a41, #7fb26b); }
.stat .s-bar i.is-bad { background: linear-gradient(90deg, #8a2a24, #c0453c); }
.stat.is-flash { animation: flash 0.6s ease; }
@keyframes flash { 0% { background: rgba(201, 162, 90, 0.35); } 100% { background: transparent; } }

/* ---------- event card ---------- */
.stage { flex: 1; display: flex; flex-direction: column; }
.event {
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.02) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, var(--paper-hi) 0%, var(--paper) 55%, var(--paper-2) 100%);
  color: var(--ink);
  border: 1px solid #2b1f13;
  border-radius: 4px;
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(34, 24, 19, 0.07);
  padding: 22px 20px;
  position: relative;
}
.event::before,
.event::after {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  border-color: var(--gold-dim);
  border-style: solid;
  pointer-events: none;
}
.event::before { top: 10px; left: 10px; border-width: 1px 0 0 1px; }
.event::after { bottom: 10px; right: 10px; border-width: 0 1px 1px 0; }

.event-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.event-icon {
  flex: 0 0 auto;
  width: 58px; height: 58px;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  border: 2px solid var(--red-ink);
  border-radius: 50%;
  background: #f0e6d0;
  box-shadow: 0 0 0 3px #d9c8a8;
}
.event-date {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red-ink);
  margin: 2px 0 4px;
}
.event-title {
  font-size: 1.35rem;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}
.event-text {
  margin: 0 0 18px;
  font-size: 1.02rem;
  color: #33271c;
  white-space: pre-line;
}

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  width: 100%;
  text-align: left;
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f2e8d2, #e2d1ae);
  border: 1px solid rgba(34, 24, 19, 0.4);
  border-radius: 3px;
  padding: 13px 16px;
  box-shadow: 0 2px 0 rgba(34, 24, 19, 0.25);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.choice:hover { background: #f6eeda; border-color: var(--red-ink); transform: translateY(-1px); }
.choice:active { transform: translateY(1px); }
.choice:focus-visible { outline: 2px solid var(--red-ink); outline-offset: 2px; }

/* ---------- consequence / feedback ---------- */
.consequence {
  margin-top: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #f0e6d0, #e0cfac);
  border: 1px solid rgba(34, 24, 19, 0.5);
  border-left: 4px solid var(--gold-dim);
  border-radius: 3px;
  animation: consequence-in 0.45s ease both;
}
@keyframes consequence-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.consequence .c-label {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--red-ink);
  margin: 0 0 6px;
}
.consequence .c-text { margin: 0 0 12px; color: #33271c; font-size: 0.98rem; white-space: pre-line; }

.stat-changes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.sc {
  font-family: var(--sans);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 3px;
  background: rgba(34, 24, 19, 0.06);
}
.sc .sc-name { color: var(--ink-soft); }
.sc .sc-delta { font-weight: 700; }
.sc .sc-delta.pos { color: var(--good); }
.sc .sc-delta.neg { color: var(--bad); }

.btn--continue {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #3a1412, var(--red-ink));
  color: #f3e7cd;
  border-color: #5a1a15;
  padding: 14px;
  font-size: 1rem;
}
.btn--continue:hover { background: linear-gradient(180deg, #461715, var(--red)); }

/* ---------- end / collapse ---------- */
.screen--end {
  margin: auto 0;
  padding: 12px 0;
}
.end-panel {
  background: linear-gradient(180deg, var(--paper-hi) 0%, var(--paper) 55%, var(--paper-2) 100%);
  color: var(--ink);
  border: 1px solid #2b1f13;
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 26px 20px;
  text-align: center;
}
.end-icon { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.end-date { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--red-ink); margin: 0 0 4px; }
.end-title { font-size: clamp(1.5rem, 7vw, 2.1rem); margin: 0 0 6px; color: var(--ink); }
.end-sub { font-style: italic; color: var(--red-ink); margin: 0 0 14px; font-size: 1.05rem; }
.end-body { text-align: left; margin-bottom: 16px; }
.end-body p { margin: 0 0 10px; color: #33271c; white-space: pre-line; }
.end-body p:last-child { margin-bottom: 0; }

.report-card {
  text-align: left;
  margin: 16px 0;
  padding: 12px;
  border: var(--line);
  border-radius: 3px;
  background: rgba(34, 24, 19, 0.05);
}
.report-card h4 {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--red-ink);
  margin: 0 0 10px;
}
.report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 0.84rem;
  padding: 5px 0;
  border-bottom: 1px dotted rgba(34, 24, 19, 0.25);
}
.report-row:last-child { border-bottom: none; }
.report-row .r-name { color: var(--ink-soft); }
.report-row .r-val { font-weight: 700; }
.report-row .r-val.high { color: var(--good); }
.report-row .r-val.low { color: var(--bad); }

.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- footer ---------- */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: var(--line);
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: rgba(230, 216, 189, 0.4);
}

/* ---------- responsive ---------- */
@media (min-width: 640px) {
  .app { padding: 28px 28px 32px; }
  .stats { grid-template-columns: repeat(5, 1fr); gap: 12px; }
  .stat { grid-template-columns: 20px 1fr; }
  .stat .s-value { grid-column: 1 / -1; text-align: left; font-size: 0.95rem; }
  .stat .s-bar { grid-column: 1 / -1; margin-top: 2px; }
  .event { padding: 30px 28px; }
  .event-title { font-size: 1.6rem; }
  .event-icon { width: 66px; height: 66px; font-size: 2.1rem; }
  .choices { gap: 12px; }
  .btn--continue { width: auto; margin-left: auto; padding: 14px 44px; }
  .end-panel { padding: 34px 34px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
