:root {
  --bg: #0b1017;
  --bg-mid: #101722;
  --bg-2: #171f2c;
  --panel: rgba(15, 20, 29, 0.94);
  --panel-strong: #101722;
  --panel-soft: rgba(255, 255, 255, 0.04);
  --ink: #edf3fb;
  --ink-soft: #9aabbe;
  --hero-ink: #f4f7fc;
  --hero-soft: rgba(237, 243, 251, 0.82);
  --hero-border: rgba(255, 255, 255, 0.08);
  --hero-surface: rgba(12, 16, 24, 0.76);
  --accent: #df7a38;
  --accent-2: #55a57e;
  --accent-3: #d35b5b;
  --highlight: #f2cf63;
  --border: rgba(255, 255, 255, 0.08);
  --input-border: rgba(255, 255, 255, 0.1);
  --badge-bg: rgba(255, 255, 255, 0.06);
  --badge-border: rgba(255, 255, 255, 0.08);
  --surface-muted: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --meter-bg: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
}

:root[data-theme="light"] {
  --bg: #19130f;
  --bg-mid: #2a160f;
  --bg-2: #4d1f14;
  --panel: rgba(244, 224, 192, 0.94);
  --panel-strong: rgba(255, 241, 220, 0.98);
  --panel-soft: rgba(255, 247, 235, 0.72);
  --ink: #23160f;
  --ink-soft: #5f4b3d;
  --hero-ink: #f8ead3;
  --hero-soft: rgba(255, 241, 220, 0.88);
  --hero-border: rgba(255, 217, 177, 0.16);
  --hero-surface: rgba(30, 16, 11, 0.72);
  --accent: #b53f17;
  --accent-2: #35634b;
  --accent-3: #7f1111;
  --highlight: #c28a04;
  --border: rgba(52, 32, 22, 0.18);
  --input-border: rgba(40, 24, 18, 0.16);
  --badge-bg: rgba(255, 234, 211, 0.1);
  --badge-border: rgba(255, 212, 171, 0.18);
  --surface-muted: rgba(255, 247, 235, 0.72);
  --surface-strong: rgba(35, 22, 15, 0.08);
  --meter-bg: rgba(35, 22, 15, 0.12);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(223, 122, 56, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(85, 165, 126, 0.14), transparent 24%),
    linear-gradient(160deg, var(--bg), var(--bg-mid) 45%, var(--bg-2));
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

.hero {
  padding: 22px 24px;
  border: 1px solid var(--hero-border);
  border-radius: 24px;
  color: var(--hero-ink);
  background:
    linear-gradient(135deg, rgba(223, 122, 56, 0.12), transparent),
    var(--hero-surface);
  box-shadow: var(--shadow);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 0.76rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #f4b97c;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 0.95;
}

.hero p {
  max-width: 780px;
  margin: 12px 0 0;
  line-height: 1.55;
  color: var(--hero-soft);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  font-size: 0.92rem;
}

.theme-toggle {
  border: 1px solid var(--badge-border);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--badge-bg);
  color: var(--hero-ink);
  font: inherit;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(360px, 1fr) minmax(320px, 400px);
  gap: 18px;
  margin-top: 18px;
}

.side-column {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel {
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.panel-header {
  padding: 18px 18px 0;
}

.panel-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
}

.panel-header p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.setup-panel {
  padding: 0 0 18px;
}

.setup-body,
.player-body {
  padding: 18px;
}

.control-group {
  margin-bottom: 14px;
}

.control-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.control-group textarea,
.control-group input,
.control-group select {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--input-border);
  background: var(--panel-strong);
  color: var(--ink);
  padding: 14px 16px;
  font: inherit;
}

.control-group textarea {
  min-height: 210px;
  resize: vertical;
}

.button-row {
  display: grid;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  font-weight: 700;
  color: #fff9f1;
  background: linear-gradient(135deg, #ce5b2f, var(--accent));
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.secondary {
  background: linear-gradient(135deg, #42785d, var(--accent-2));
}

.danger {
  background: linear-gradient(135deg, #b72b2b, var(--accent-3));
}

.hint {
  margin: 12px 0 0;
  color: var(--ink-soft);
  line-height: 1.4;
}

.log-panel {
  overflow: hidden;
}

.event-log {
  list-style: none;
  margin: 0;
  padding: 12px 18px 18px;
  max-height: 920px;
  overflow: auto;
}

.event-item,
.event-empty {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.event-item:last-child {
  border-bottom: 0;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.event-text {
  line-height: 1.55;
}

.round-summary {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.summary-line {
  display: block;
  line-height: 1.6;
}

.summary-line + .summary-line {
  margin-top: 10px;
}

.event-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(53, 99, 75, 0.12);
  color: var(--accent-2);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.event-tag.player {
  background: rgba(181, 63, 23, 0.12);
  color: var(--accent);
}

.event-tag.lethal {
  background: rgba(127, 17, 17, 0.12);
  color: var(--accent-3);
}

.text-highlight {
  color: var(--highlight);
  font-weight: 700;
}

.player-name {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
}

.player-status {
  margin-top: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(53, 99, 75, 0.12);
  color: var(--accent-2);
  font-weight: 700;
}

.status-pill.dead {
  background: rgba(127, 17, 17, 0.12);
  color: var(--accent-3);
}

.player-meta {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--panel-soft);
}

.meta-line span {
  color: var(--ink-soft);
}

.meta-line strong {
  text-align: right;
}

.player-stats {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.stat-row {
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  align-items: center;
  gap: 12px;
}

.stat-label,
.stat-value {
  font-size: 0.92rem;
}

.stat-value {
  text-align: right;
  color: var(--ink-soft);
}

.meter {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: var(--meter-bg);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #d79d2f, #b43b1b);
}

.player-inventory {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.inventory-chip,
.inventory-empty {
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(53, 99, 75, 0.12);
  color: var(--accent-2);
  font-size: 0.9rem;
}

.inventory-empty {
  background: var(--surface-strong);
  color: var(--ink-soft);
}

.memorial-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.memorial-item,
.memorial-empty {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--panel-soft);
}

.memorial-item strong,
.memorial-item span {
  display: block;
}

.memorial-item span,
.memorial-empty {
  margin-top: 4px;
  color: var(--ink-soft);
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1440px);
    padding-top: 10px;
  }

  .hero,
  .panel {
    border-radius: 18px;
  }

  .hero-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-row {
    gap: 8px;
  }

  .stat-row {
    grid-template-columns: 64px 1fr 30px;
    gap: 10px;
  }
}
