:root {
  color-scheme: dark;
  --bg: #0a0a0e;
  --panel: #0d0d14;
  --panel2: #101018;
  --line: #26262e;
  --line-soft: #1a1a24;
  --text: #e8e8f0;
  --dim: #a8a8b8;
  --faint: #77778a;
  --accent: #8b7ff7;
  --mafia: #ef4444;
  --doctor: #2dd4bf;
  --detective: #7aa2f7;
  --villager: #8a8a99;
  --live: #4ade80;
  --warn: #e0af68;
  --night: #bb9af7;
  --vote: #7aa2f7;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input,
a {
  font: inherit;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:visited {
  color: #756dbf;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
.seat:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button,
select {
  min-height: 40px;
  border: 1px solid #3a3a48;
  border-radius: 0;
  padding: 9px 12px;
  background: var(--panel2);
  color: #c9c9d6;
  transition: border-color 140ms ease-out, color 140ms ease-out, background-color 140ms ease-out;
}

button:hover,
select:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  color: var(--text);
}

button:active {
  background: #151522;
}

#metastrip {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 14px 28px;
  align-items: center;
  flex: 0 0 auto;
  padding: 15px max(20px, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}

.replay-heading {
  min-width: 0;
}

.replay-back {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  color: var(--accent);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 7px;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.replay-back:visited {
  color: var(--accent);
}

#metastrip h1 {
  margin: 2px 0 5px;
  color: var(--text);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  text-wrap: balance;
}

#metastrip .sub {
  display: block;
  color: var(--faint);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 7px;
  letter-spacing: 0.04em;
  line-height: 1.8;
  text-transform: uppercase;
}

.replay-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.game-picker,
.perspective {
  display: grid;
  gap: 4px;
}

.game-picker select {
  width: min(260px, 28vw);
}

.control-caption {
  color: var(--faint);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toggle,
.replay-utility {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 11px;
  background: var(--panel2);
  color: var(--dim);
  font-size: 11px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.toggle {
  gap: 7px;
  cursor: pointer;
}

.toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.replay-utility:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  color: var(--text);
}

#seatsbar {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

#spots {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px max(20px, calc((100vw - 1200px) / 2)) 0;
}

.spots-label {
  margin-right: 3px;
  color: var(--faint);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.spotchip {
  min-height: 32px;
  border: 1px solid color-mix(in srgb, var(--accent) 46%, var(--line));
  border-radius: 0;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel2));
  color: #b8b0ff;
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#reading {
  padding: 9px max(20px, calc((100vw - 1200px) / 2)) 0;
  color: var(--faint);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 6px;
  letter-spacing: 0.04em;
  line-height: 1.8;
}

#reading b {
  color: #bdbdca;
}

#seats {
  gap: 8px;
  padding: 9px max(20px, calc((100vw - 1200px) / 2)) 12px;
  scrollbar-color: #363646 transparent;
  scrollbar-width: thin;
}

.seat {
  min-width: 134px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 9px 10px 10px;
  background: var(--panel2);
  color: var(--text);
  text-align: left;
  transition: opacity 160ms ease-out, border-color 160ms ease-out, background-color 160ms ease-out;
}

.seat:hover {
  background: #13131c;
  border-color: #3a3a48;
}

.seat.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.seat .nm {
  font-size: 13px;
  font-weight: 700;
}

.seat .who,
.seat .model {
  color: var(--faint);
  font-size: 10px;
}

.seat .model {
  max-width: 16ch;
  margin-top: 3px;
  overflow: hidden;
  color: var(--dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  border-radius: 0;
  padding: 2px 6px;
  color: var(--bg);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 6px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  text-transform: uppercase;
}

.chip.hidden {
  color: var(--faint);
}

#feed {
  min-height: 0;
  padding: 13px max(20px, calc((100vw - 1200px) / 2)) 44px;
  scrollbar-color: #363646 transparent;
  scrollbar-width: thin;
}

details.dayblock {
  max-width: 860px;
  margin-top: 14px;
}

details.dayblock > summary {
  min-height: 42px;
  margin: 10px 0 8px;
  color: var(--text);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 7px;
  letter-spacing: 0.04em;
}

details.dayblock > summary::after,
.divider::after {
  background: var(--line);
}

.sumn,
.sumx {
  color: var(--faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.divider {
  max-width: 820px;
  margin: 22px 0 10px;
  color: var(--faint);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 6px;
  letter-spacing: 0.04em;
}

.bubble,
.act,
.deathcard,
.banner {
  max-width: 820px;
  border-radius: 0;
  box-shadow: none;
}

.bubble {
  margin: 9px 0;
  border: 1px solid var(--line);
  border-left-width: 2px;
  padding: 11px 14px;
  background: var(--panel);
}

.bubble.mafiachat {
  background: color-mix(in srgb, var(--mafia) 6%, var(--panel));
}

.bubble .hd {
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 11px;
}

.bubble .txt {
  color: #d1d1dc;
  line-height: 1.7;
}

.thought {
  max-width: 820px;
  margin: 12px 0 4px;
  border-left: 1px dashed #444454;
  padding: 9px 14px;
  color: #858596;
  font-size: 12.5px;
  line-height: 1.7;
}

.thought .hd {
  margin-bottom: 4px;
  color: var(--faint);
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 6px;
  font-style: normal;
  text-transform: uppercase;
}

.evt {
  max-width: 820px;
  margin: 7px 0;
  color: var(--dim);
}

.act {
  border: 1px solid var(--line);
  border-left-width: 2px;
  padding: 9px 13px;
  background: var(--panel2);
}

.deathcard {
  border: 1px solid color-mix(in srgb, var(--warn) 48%, var(--line));
  border-left: 2px solid var(--warn);
  padding: 11px 14px;
  background: color-mix(in srgb, var(--warn) 7%, var(--panel));
  color: var(--warn);
}

.banner {
  border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--line));
  padding: 14px 16px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  color: #c9c4ff;
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  font-size: 9px;
  line-height: 1.7;
}

.spot {
  border-radius: 0;
  outline-color: var(--accent);
}

#empty {
  color: var(--faint);
}

@media (max-width: 1100px) {
  #metastrip {
    grid-template-columns: 1fr;
  }

  .replay-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  #metastrip {
    gap: 12px;
    padding: 12px;
  }

  .replay-back {
    min-height: 44px;
  }

  #metastrip h1 {
    margin-top: 0;
    font-size: 18px;
  }

  .replay-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .game-picker,
  .perspective {
    grid-column: 1 / -1;
  }

  #gameSel,
  #modeSel,
  #foldBtn,
  .toggle,
  .replay-utility {
    width: 100%;
    min-height: 44px;
  }

  #spots,
  #reading,
  #seats,
  #feed {
    padding-inline: 12px;
  }

  #spots {
    padding-top: 10px;
  }

  .spotchip {
    min-height: 44px;
  }

  #reading {
    padding-top: 8px;
  }

  #seats {
    scroll-snap-type: x proximity;
  }

  .seat {
    min-width: 146px;
    scroll-snap-align: start;
  }

  #feed {
    padding-top: 10px;
    padding-bottom: 30px;
  }

  .control-caption,
  .spots-label,
  .spotchip,
  #reading,
  .divider,
  .thought .hd {
    font-size: 7px;
  }

  details.dayblock > summary {
    min-height: 44px;
  }

  .bubble,
  .act,
  .deathcard,
  .thought {
    width: 100%;
    font-size: 13px;
  }

  .bubble .txt {
    line-height: 1.65;
  }

  .deathcard {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 600px) and (max-height: 650px) {
  .replay-controls {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .game-picker {
    flex: 0 0 235px;
  }

  .perspective {
    flex: 0 0 190px;
  }

  #gameSel,
  #modeSel,
  #foldBtn,
  .toggle,
  .replay-utility {
    flex: 0 0 auto;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
