/* Avalon — styles. The screen, lobby, chat, modal, tip and overlay chrome is
   the collection's shared shell; everything under "the round table" below
   is this game's own. */

:root {
  --bg-1: #1a2544;
  --bg-2: #070b17;
  --ink: #f2e8cf;
  --dim: #a3abc2;
  --panel: #131c33;
  --panel-2: #1b2746;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #e3c46a;
  --accent-dim: rgba(227, 196, 106, 0.16);
  /* Arthur's sigil on blue, Mordred's on red, as the Character cards print them */
  --good: #5b9cf0;
  --good-ink: #a9cbff;
  --good-dim: rgba(91, 156, 240, 0.16);
  --evil: #e0574f;
  --evil-ink: #ff9e96;
  --evil-dim: rgba(224, 87, 79, 0.16);
  --maybe: #b48cf0;
  --yes: #6fcf97;
  --no: #ef6b62;
  --grass: #23305a;
  --grass-2: #1a2445;
  --win: #7ddc8f;
  --lose: #ff8a7a;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
  --radius: 14px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Avenir Next', Avenir, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: var(--bg-2);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* The backdrop is pinned to the screen. Painted on the body it would be one
   screen tall and start over below that, and the lobby and the table on a
   phone are longer than a screen. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 700px at 50% -10%, rgba(227, 196, 106, 0.10), transparent 60%),
    radial-gradient(800px 500px at 8% 112%, rgba(91, 156, 240, 0.14), transparent 60%),
    radial-gradient(800px 500px at 92% 112%, rgba(224, 87, 79, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
}

a {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------- screens */

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#screen-home,
#screen-lobby {
  justify-content: center;
  padding: 24px;
  gap: 14px;
}

/* the long tagline fills a phone, so leave room for the fixed "← Collection"
   link above the logo and the version badge below the small print */
#screen-home {
  padding-block: 64px 44px;
}

.back-home {
  position: fixed;
  top: 14px;
  left: 16px;
  color: var(--dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  z-index: 5;
}

.back-home:hover {
  color: var(--ink);
}

/* ---------------------------------------------------------------- home */

.logo {
  margin: 0;
  font-size: clamp(34px, 8vw, 58px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.55);
}

@keyframes sway {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(10deg) translateY(-3px); }
}

.tagline {
  margin: 0 0 10px;
  color: var(--dim);
  text-align: center;
  max-width: 47em;
  line-height: 1.6;
}

.field {
  width: min(340px, 86vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 17px;
  padding: 13px 16px;
  outline: none;
}

.field:focus {
  border-color: rgba(255, 194, 51, 0.55);
}

.field::placeholder {
  color: #6c839a;
}

.btn {
  border-radius: var(--radius);
  padding: 13px 22px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  filter: grayscale(0.55) brightness(0.65);
  cursor: default;
}

.btn.primary {
  background: linear-gradient(180deg, #ffd25e, #f0a91f);
  color: #2a1d00;
  width: min(340px, 86vw);
}

.btn.secondary {
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--dim);
  font-weight: 600;
  padding: 9px 16px;
  font-size: 14px;
}

.join-row {
  display: flex;
  gap: 10px;
  width: min(340px, 86vw);
}

.join-row .field {
  flex: 1;
  width: auto;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.divider {
  color: #6c839a;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(340px, 86vw);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

#home-status {
  min-height: 22px;
  color: var(--dim);
  text-align: center;
  max-width: 36em;
}

#home-status.error {
  color: #ff9c9c;
}

.small-print {
  color: #6c839a;
  font-size: 12.5px;
  text-align: center;
  max-width: 47em;
  line-height: 1.55;
}

/* ---------------------------------------------------------------- lobby */

.lobby-panel {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 28px;
  width: min(430px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.lobby-label {
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

#lobby-code {
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 0.32em;
  margin-right: -0.32em;
  color: var(--accent);
  text-shadow: 0 4px 18px rgba(255, 194, 51, 0.25);
  user-select: all;
}

.copy-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#lobby-players {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.seat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}

.seat-row.empty {
  opacity: 0.4;
  border-style: dashed;
}

.seat-name {
  font-weight: 700;
}

.seat-name.dim {
  color: var(--dim);
  font-weight: 500;
}

.chip {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--dim);
}

.chip.you {
  background: var(--accent-dim);
  color: var(--accent);
}

.chip.bot {
  background: rgba(63, 159, 216, 0.22);
  color: #9fd2f0;
}

.kick {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--dim);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  flex: none;
}

.kick:hover {
  background: rgba(229, 72, 77, 0.32);
  color: #ffb4b4;
}

/* Two lines reserved, not one. The hint rewrites itself as the table fills
   ("Share the code or link — or add a bot" becoming "4 aboard — ten rounds"),
   and the long one wraps: every button below it moved down the moment somebody
   joined. It is the only thing on this screen whose height depends on content. */
#lobby-hint {
  color: var(--dim);
  font-size: 14px;
  text-align: center;
  line-height: 1.5; min-height: 3em;
}

.side-pick {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.side-pick.on {
  background: var(--accent-dim);
  border-color: rgba(255, 194, 51, 0.6);
  color: var(--accent);
}

.side-pick:disabled {
  cursor: default;
}

.av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex: none;
  color: #101418;
}

.av.empty {
  background: rgba(255, 255, 255, 0.07);
  color: var(--dim);
}

.av.bot {
  background: #1f3a5a;
  color: #ffd25e;
  font-size: 17px;
}

.av.s0 { background: #8fd6a8; }
.av.s1 { background: #58b7ff; }
.av.s2 { background: #ffd166; }
.av.s3 { background: #ff5d8f; }
.av.s4 { background: #b98aff; }
.av.s5 { background: #63e0dc; }
.av.s6 { background: #ff9c5e; }
.av.s7 { background: #d3e15c; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;
  min-height: 50px;
}

.topbar .spacer {
  flex: 1;
}

/* ---------------------------------------------------------------- action bar */

#action-bar {
  width: min(1080px, 100%);
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 66px;
}

.pick {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.pick:hover:not(:disabled) {
  border-color: rgba(255, 194, 51, 0.6);
}

.pick:disabled {
  opacity: 0.35;
  cursor: default;
}

.pick.go {
  background: linear-gradient(180deg, #ffd25e, #f0a91f);
  color: #2a1d00;
  border: 0;
}

.pick.warn {
  background: rgba(229, 72, 77, 0.12);
  border-color: rgba(229, 72, 77, 0.45);
}

/* ---------------------------------------------------------------- feed */

#feed {
  position: fixed;
  right: 12px;
  top: 58px;
  width: 300px;
  max-height: min(300px, 34dvh);
  overflow-y: auto;
  background: rgba(6, 14, 26, 0.6);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--dim);
  z-index: 6;
}

.feed-line {
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.feed-line:last-child {
  border-bottom: 0;
}

/* ---------------------------------------------------------------- chat */

#chat {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 7;
}

#chat-panel {
  width: 300px;
  height: 340px;
  max-height: 46dvh;
  background: rgba(8, 14, 11, 0.96);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-head {
  padding: 9px 13px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
}

#chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-msg {
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

.chat-time {
  color: #5d7489;
  font-size: 11px;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}

.chat-name {
  font-weight: 800;
  margin-right: 6px;
}

.chat-name.s0 { color: #8fd6a8; }
.chat-name.s1 { color: #58b7ff; }
.chat-name.s2 { color: #ffd166; }
.chat-name.s3 { color: #ff5d8f; }
.chat-name.s4 { color: #b98aff; }
.chat-name.s5 { color: #63e0dc; }
.chat-name.s6 { color: #ff9c5e; }
.chat-name.s7 { color: #d3e15c; }

.chat-msg.mine .chat-text {
  color: #d5f2e0;
}

#chat-form {
  display: flex;
  border-top: 1px solid var(--line);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--ink);
  font-size: 14px;
  padding: 11px 12px;
}

.chat-send {
  padding: 0 14px;
  color: var(--accent);
  cursor: pointer;
  font-size: 16px;
}

#chat-toggle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  position: relative;
}

#chat-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

#chat-peek {
  max-width: 300px;
  background: rgba(8, 14, 11, 0.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
}

#chat-peek .chat-text {
  color: var(--dim);
}

.chat-bubble {
  position: absolute;
  top: -8px;
  left: 10px;
  transform: translateY(-100%);
  background: #fff;
  color: #1a2a20;
  border-radius: 12px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 600;
  max-width: 240px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  z-index: 8;
  pointer-events: none;
  word-break: break-word;
}

.chat-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 16px;
  border: 6px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

/* ---------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 5, 0.74);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 18px;
}

.panel {
  background: linear-gradient(180deg, #1b3552, #0d1d31);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 26px;
  width: min(440px, 94vw);
  max-height: 88dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
  text-align: center;
}

.panel.wide {
  width: min(700px, 94vw);
  text-align: left;
  align-items: stretch;
}

.panel h2 {
  margin: 0;
  font-size: 24px;
}

.rules {
  margin: 0;
  padding-left: 20px;
  color: var(--dim);
  line-height: 1.6;
  font-size: 14.5px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rules b,
.rules i {
  color: var(--ink);
}

.credit {
  color: #6c839a;
  font-size: 12.5px;
  line-height: 1.55;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#go-table th,

#go-rank {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}

.rank-row.me {
  border-color: rgba(255, 194, 51, 0.5);
}

.rank-pos {
  font-weight: 900;
  font-size: 16px;
  width: 22px;
  text-align: center;
  color: var(--dim);
}

.rank-name {
  font-weight: 700;
  flex: 1;
  text-align: left;
}

.rank-score {
  font-weight: 800;
  color: var(--accent);
}

#go-wait {
  color: var(--dim);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- toasts, flash */

#toasts {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: rgba(10, 17, 13, 0.95);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.toast.gone {
  opacity: 0;
  transform: translateY(-8px);
}

.flash {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(24px, 5.4vw, 40px);
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 14px 34px;
  border-radius: 18px;
  background: rgba(6, 11, 8, 0.94);
  border: 2px solid var(--accent);
  color: var(--accent);
  z-index: 25;
  animation: flashpop 1.7s ease forwards;
  text-align: center;
  pointer-events: none;
}

.flash.plain {
  border-color: var(--line);
  color: var(--ink);
}

@keyframes flashpop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  12% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
  22% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 26;
  overflow: hidden;
}

#confetti i {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(-10px) rotate(0); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(105dvh) rotate(660deg); opacity: 0; }
}

/* ---------------------------------------------------------------- layout: desktop gutter */

@media (min-width: 1000px) {
  #screen-game {
    /* keep the docked log + chat column clear of the play area */
    padding-right: 320px;
  }
}

/* ---------------------------------------------------------------- narrow screens
   (keep this block at the END of the file: it must win the cascade) */

@media (max-width: 999px) {
  #feed {
    position: static;
    width: auto;
    margin: 8px 14px;
    max-height: 150px;
    order: 9;
  }

  #screen-game {
    padding-bottom: 90px;
  }

  #chat {
    bottom: 10px;
    right: 10px;
  }

  #chat-panel {
    width: min(300px, calc(100vw - 20px));
  }

  #board-wrap {
    align-self: center;
  }
}

/* Disconnect banner: the table stalls until the player returns or the host
   resolves it (neutral tones so it reads on any of our palettes) */
#dc-banner { display: none; }
#dc-banner.on { display: flex; flex-direction: column; gap: 6px; margin: 10px auto 2px; max-width: 620px; padding: 0 10px; }
#dc-banner .dc-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; background: rgba(255, 92, 92, 0.14); border: 1px solid rgba(255, 92, 92, 0.55); border-radius: 10px; padding: 7px 12px; font-size: 13px; line-height: 1.35; }
#dc-banner .dc-row.covered { background: rgba(127, 127, 127, 0.12); border-color: rgba(127, 127, 127, 0.45); }
#dc-banner .dc-btn { border: 1px solid rgba(127, 127, 127, 0.55); background: rgba(127, 127, 127, 0.16); color: inherit; border-radius: 8px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
#dc-banner .dc-btn:hover { background: rgba(127, 127, 127, 0.28); }

/* Observers: watch chip, lobby note, and the shadow-a-player bar */
#watch-chip { display: none; }
#watch-chip.on { display: inline-block; margin-left: 8px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(127, 127, 127, 0.16); border: 1px solid rgba(127, 127, 127, 0.4); vertical-align: middle; }
#lobby-watch { display: none; }
#lobby-watch.on { display: block; margin: 6px auto 0; font-size: 12.5px; opacity: 0.85; text-align: center; }
#ob-bar { display: none; }
#ob-bar.on { display: flex; flex-direction: column; gap: 6px; margin: 10px auto 2px; max-width: 620px; padding: 0 10px; }
#ob-bar .ob-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; background: rgba(120, 160, 255, 0.12); border: 1px solid rgba(120, 160, 255, 0.5); border-radius: 10px; padding: 7px 12px; font-size: 13px; line-height: 1.35; }
#ob-bar .ob-switch { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
#ob-bar .ob-btn { border: 1px solid rgba(127, 127, 127, 0.55); background: rgba(127, 127, 127, 0.16); color: inherit; border-radius: 8px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
#ob-bar .ob-btn:hover { background: rgba(127, 127, 127, 0.28); }
#ob-bar .ob-btn.on { background: rgba(120, 160, 255, 0.3); border-color: rgba(120, 160, 255, 0.75); cursor: default; }

/* Seat claiming / resigning */
#ob-bar .ob-btn.claim { background: rgba(120, 230, 160, 0.18); border-color: rgba(120, 230, 160, 0.6); }
#ob-bar .ob-btn.claim:hover { background: rgba(120, 230, 160, 0.3); }
#lobby-watch button { margin-left: 8px; border: 1px solid rgba(120, 230, 160, 0.6); background: rgba(120, 230, 160, 0.18); color: inherit; border-radius: 8px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
#lobby-watch button:hover { background: rgba(120, 230, 160, 0.3); }

/* Announcements must survive any browser width: wrap instead of clipping */
.flash { max-width: min(92vw, 780px); width: max-content; white-space: normal; overflow-wrap: break-word; text-align: center; box-sizing: border-box; }


/* ---------------------------------------------------------------- tips and card texts */

.tb-tip {
  position: fixed;
  z-index: 40;
  max-width: min(300px, calc(100vw - 16px));
  pointer-events: none;
  background: #0b1122;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  padding: 9px 11px;
}

.tb-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  line-height: 1.42;
  color: var(--ink);
  text-align: left;
}

.tb-card-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding-left: 7px;
  border-left: 3px solid var(--set, var(--dim));
}


.tb-card-glyph { font-size: 18px; line-height: 1; align-self: center; }
.tb-card-name { font-size: 14.5px; }

.tb-card-str {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.tb-card-cry { color: var(--accent); opacity: 0.9; }
.tb-card-note { color: var(--dim); font-size: 12.5px; }
.tb-card-why { color: #ffb4a0; font-size: 12.5px; }

.tb-card-base {
  margin-top: 2px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}

/* the Troop you are holding, above the prompt that says where it can go */
.tb-held {
  width: min(460px, 100%);
  align-self: center;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: 10px;
  padding: 8px 11px;
}


/* ================================================================ the round table */

.logo-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.logo-post {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--dim);
  padding-left: 0.5em;
  margin-top: 2px;
}
.logo-pre {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--accent);
  padding-left: 0.42em;
}
.logo {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.16em;
  padding-left: 0.16em;
  font-size: clamp(40px, 10vw, 72px);
  background: linear-gradient(180deg, #fff6dc 10%, #e3c46a 60%, #b8913b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 { font-family: var(--serif); font-weight: 700; letter-spacing: 0.02em; }

/* ---------------------------------------------------------------- lobby: Characters */

/* the options, in four groups */
#option-picker { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.opt-group { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.opt-title { color: var(--dim); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; cursor: help; }
.pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
}

.role-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  border-radius: 999px;
  padding: 6px 12px 6px 9px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.role-pick:disabled { cursor: default; }
.role-pick.fixed { cursor: help; }
.role-pick.fixed:not(.on) { opacity: 0.55; }
.role-pick.on.side-good { background: var(--good-dim); border-color: rgba(91, 156, 240, 0.65); color: var(--good-ink); }
.role-pick.on.side-evil { background: var(--evil-dim); border-color: rgba(224, 87, 79, 0.65); color: var(--evil-ink); }
.role-pick.lady.on { background: rgba(94, 200, 210, 0.14); border-color: rgba(94, 200, 210, 0.6); color: #9fe6ee; }
.role-pick.plain.on,
.role-pick.mod.on,
.role-pick.rule.on { background: var(--accent-dim); border-color: rgba(227, 196, 106, 0.6); color: var(--accent); }
.role-pick.sub { font-size: 12px; padding: 4px 10px; border-style: dashed; }
.role-pick:not(.on):not(:disabled):hover { border-color: rgba(255, 255, 255, 0.3); color: var(--ink); }
.role-ic { font-size: 15px; line-height: 1; }

#cast-summary {
  width: 100%;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cast-head { color: var(--dim); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.cast-good { color: var(--good-ink); }
.cast-evil { color: var(--evil-ink); }
.cast-bad { color: var(--evil-ink); font-weight: 700; }
.cast-advice { color: var(--accent); font-size: 12.5px; }

/* ---------------------------------------------------------------- topbar and layout */

#screen-game .topbar #quest-chip,
#screen-game .topbar #phase-chip {
  font-size: 12.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  white-space: nowrap;
  cursor: help;
}
#phase-chip { color: var(--accent); border-color: var(--accent-dim) !important; }

#table {
  width: min(1280px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  padding: 6px 14px 16px;
  align-items: start;
}
#stage { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
#side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.side-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 6px;
}
.dim { color: var(--dim); }

/* the log lives in the side panel, under the vote record */
#feed {
  position: static;
  width: auto;
  max-height: 280px;
  z-index: auto;
}

/* ---------------------------------------------------------------- the ring of seats */

.ring { position: relative; }

/* round on a wide screen: the seats about an oval table, you at the bottom */
.ring.round {
  height: clamp(440px, 52vw, 580px);
  margin: 4px 0;
}
.ring.round::before {
  content: '';
  position: absolute;
  inset: 13% 11%;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, rgba(227, 196, 106, 0.08), transparent),
    radial-gradient(closest-side, #172243, #10182f);
  border: 2px solid rgba(227, 196, 106, 0.28);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5), 0 0 0 8px rgba(0, 0, 0, 0.18);
}
.ring.round .seat {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 132px;
}
.ring.round.n9 .seat,
.ring.round.n10 .seat { width: 120px; }
.ring.round .tableau {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(400px, 52%);
}

/* a list on a phone: the Quests first, then the seats two to a row */
.ring:not(.round) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.ring:not(.round) .tableau { grid-column: 1 / -1; margin-bottom: 4px; }

.seat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 8px 8px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  text-align: left;
  min-width: 0;
  z-index: 1;
}
button.seat { cursor: pointer; transition: border-color 120ms ease, background 120ms ease; }
button.seat:hover { border-color: rgba(227, 196, 106, 0.55); background: var(--panel-2); }
button.seat:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.seat.me { background: linear-gradient(180deg, #1d2a4d, var(--panel)); border-color: rgba(255, 255, 255, 0.22); }
.seat.leader { border-color: rgba(227, 196, 106, 0.75); box-shadow: 0 0 0 1px rgba(227, 196, 106, 0.35), 0 6px 16px rgba(0, 0, 0, 0.35); }
.seat.team { background: linear-gradient(180deg, rgba(91, 156, 240, 0.22), var(--panel)); border-color: rgba(91, 156, 240, 0.7); }
.seat.aimed { box-shadow: 0 0 0 3px var(--evil), 0 6px 16px rgba(0, 0, 0, 0.4); }
.act-lady ~ * .seat.aimed,
.seat.aimed.lady-aim { box-shadow: 0 0 0 3px #5ec8d2; }
.seat.named { box-shadow: 0 0 0 3px var(--evil), 0 0 18px rgba(224, 87, 79, 0.5); }
.seat.gone { opacity: 0.6; }

.seat-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.seat .av { width: 28px; height: 28px; font-size: 13px; }
.seat-name {
  font-weight: 800;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.seat-marks { display: flex; flex-wrap: wrap; gap: 4px; min-height: 18px; }
.you-tag {
  margin-left: auto;
  flex: none;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.tok,
.mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--dim);
  white-space: nowrap;
  cursor: help;
}
.tok.leader { background: rgba(227, 196, 106, 0.18); border-color: rgba(227, 196, 106, 0.6); color: var(--accent); }
.tok.lady { background: rgba(94, 200, 210, 0.14); border-color: rgba(94, 200, 210, 0.55); color: #9fe6ee; }
.tok.team { background: var(--good-dim); border-color: rgba(91, 156, 240, 0.6); color: var(--good-ink); }
.tok.pip.done { color: var(--ink); border-color: rgba(255, 255, 255, 0.3); }
.tok.vote.yes { background: rgba(111, 207, 151, 0.16); border-color: rgba(111, 207, 151, 0.6); color: var(--yes); }
.tok.vote.no { background: rgba(239, 107, 98, 0.16); border-color: rgba(239, 107, 98, 0.6); color: var(--no); }
.tok.said.good { color: var(--good-ink); border-color: rgba(91, 156, 240, 0.45); }
.tok.said.evil { color: var(--evil-ink); border-color: rgba(224, 87, 79, 0.45); }
.mark.evil { background: var(--evil-dim); border-color: rgba(224, 87, 79, 0.7); color: var(--evil-ink); }
.mark.good { background: var(--good-dim); border-color: rgba(91, 156, 240, 0.7); color: var(--good-ink); }
.mark.maybe { background: rgba(180, 140, 240, 0.16); border-color: rgba(180, 140, 240, 0.65); color: #d6c1ff; }
.mark.role.side-good { background: var(--good-dim); border-color: rgba(91, 156, 240, 0.6); color: var(--good-ink); }
.mark.role.side-evil { background: var(--evil-dim); border-color: rgba(224, 87, 79, 0.6); color: var(--evil-ink); }
.mark.role .role-ic { font-size: 12px; }
.mark.role.peek { opacity: 0.7; border-style: dashed; }
.mark.role.revealed { box-shadow: 0 0 0 1px rgba(224, 87, 79, 0.5); }
.mark.shown { border-style: dashed; }
.tok.excalibur { background: rgba(227, 196, 106, 0.12); border-color: rgba(227, 196, 106, 0.5); color: var(--accent); }
.tok.watch { background: rgba(180, 140, 240, 0.14); border-color: rgba(180, 140, 240, 0.55); color: #d6c1ff; }
.tok.up,
.tok.switched,
.tok.trapped { border-style: dashed; color: var(--ink); }
.tok.qcard.success { background: var(--good-dim); border-color: rgba(91, 156, 240, 0.6); color: var(--good-ink); }
.tok.qcard.fail { background: var(--evil-dim); border-color: rgba(224, 87, 79, 0.6); color: var(--evil-ink); }
.tok.qcard.magic { background: rgba(180, 140, 240, 0.16); border-color: rgba(180, 140, 240, 0.6); color: #d6c1ff; }
.tok.plot { color: #e9d9a8; border-color: rgba(227, 196, 106, 0.35); background: rgba(227, 196, 106, 0.08); font-weight: 700; }
.tok.plot.always { border-color: rgba(111, 207, 151, 0.5); color: #a8e8c3; }
.tok.plot.chosen { box-shadow: 0 0 0 2px var(--accent); }
.seat.asked { border-color: rgba(227, 196, 106, 0.55); }

/* ---------------------------------------------------------------- the tableau: Quests and the Vote Track */

.tableau {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  z-index: 0;
}
.ring:not(.round) .tableau {
  background: rgba(16, 24, 47, 0.75);
  border: 1px solid rgba(227, 196, 106, 0.25);
  border-radius: 16px;
}

.quests { display: flex; gap: 7px; justify-content: center; flex-wrap: nowrap; }
.qt {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #263459, #151e38);
  border: 2px solid rgba(227, 196, 106, 0.35);
  color: var(--ink);
  cursor: help;
  flex: none;
}
.qt b { font-family: var(--serif); font-size: 22px; line-height: 1; }
.qt small { font-size: 9.5px; color: var(--dim); letter-spacing: 0.04em; }
.qt .qt-n { position: absolute; top: -15px; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.qt .qt-two {
  position: absolute;
  bottom: -9px;
  font-style: normal;
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  background: #3a1515;
  color: var(--evil-ink);
  border: 1px solid rgba(224, 87, 79, 0.6);
  white-space: nowrap;
}
.qt .qt-toks {
  position: absolute;
  top: -27px;
  font-style: normal;
  font-size: 9.5px;
  white-space: nowrap;
  color: var(--ink);
}
.tab-extra { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; }
.tx { font-size: 11.5px; color: var(--dim); cursor: help; }
.plot-hand { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; align-items: center; }
.qt.now { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227, 196, 106, 0.22), 0 0 16px rgba(227, 196, 106, 0.25); }
.qt.won { background: radial-gradient(circle at 50% 35%, #4d8fe6, #23488a); border-color: #9ec4ff; }
.qt.lost { background: radial-gradient(circle at 50% 35%, #d9534b, #7d221d); border-color: #ff9e96; }
.qt.won small,
.qt.lost small { color: rgba(255, 255, 255, 0.85); }

.vtrack { display: flex; align-items: center; gap: 5px; cursor: help; }
.vt-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-right: 3px; }
.vt {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--dim);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.vt.last { border-color: rgba(224, 87, 79, 0.6); color: var(--evil-ink); }
.vt.used { background: #5a2420; border-color: rgba(224, 87, 79, 0.6); color: var(--evil-ink); }
.vt.now { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 2px rgba(227, 196, 106, 0.25); }

.score { display: flex; gap: 8px; align-items: baseline; font-family: var(--serif); font-size: 15px; cursor: help; }
.sc.good { color: var(--good-ink); }
.sc.evil { color: var(--evil-ink); }
.sc-sep { color: var(--dim); }

/* ---------------------------------------------------------------- the action panel */

#action {
  background: rgba(16, 24, 47, 0.82);
  border: 1px solid rgba(227, 196, 106, 0.28);
  border-radius: 14px;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  min-height: 92px;
}
#action p { margin: 0; max-width: 60ch; }
.act-head { font-family: var(--serif); font-size: 17px; line-height: 1.35; text-wrap: balance; }
.act-sub { color: var(--dim); font-size: 13.5px; line-height: 1.45; }
.act-warn { color: var(--evil-ink); font-size: 13.5px; font-weight: 700; }
.act-head.lady-good { color: var(--good-ink); }
.act-head.lady-evil { color: var(--evil-ink); }
.act-head.win-good { color: var(--good-ink); }
.act-head.win-evil { color: var(--evil-ink); }
.act-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 3px; }
.act-row .btn { min-width: 132px; }

.btn.vote-yes,
.btn.quest-yes { color: #062311; border: 0; }
.btn.vote-yes { background: linear-gradient(180deg, #8fe3b2, #4fb87d); }
.btn.quest-yes { background: linear-gradient(180deg, #8dbcff, #3f7fd8); color: #061633; }
.btn.vote-no,
.btn.quest-no { color: #fff4f2; border: 0; background: linear-gradient(180deg, #ef6b62, #b73a32); }
.btn.quest-magic { color: #fff; border: 0; background: linear-gradient(180deg, #b48cf0, #6d4bb3); }
.btn.small { padding: 6px 12px; font-size: 13px; min-width: 0 !important; }
.btn.vote-yes:disabled,
.btn.quest-yes:disabled,
.btn.vote-no:disabled,
.btn.quest-no:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------------------------------------------------------------- the vote record */

#tracker { min-width: 0; }
.tr-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); background: rgba(9, 14, 28, 0.6); }
.tracker { border-collapse: collapse; font-size: 11.5px; width: 100%; font-variant-numeric: tabular-nums; }
.tracker th,
.tracker td { padding: 4px 3px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.tracker th { color: var(--dim); font-weight: 700; white-space: nowrap; }
.tracker tr > th:first-child { padding-left: 7px; text-align: left; }
.tracker th.me { color: var(--accent); }
.tracker td { min-width: 22px; height: 22px; cursor: help; color: #fff; font-weight: 800; }
.tracker td.yes { background: rgba(111, 207, 151, 0.32); }
.tracker td.no { background: rgba(239, 107, 98, 0.32); }
.tracker tr.live td.in { background: rgba(255, 255, 255, 0.12); }
.tracker td.tr-res { white-space: nowrap; padding: 4px 7px; font-weight: 700; font-size: 11px; color: var(--dim); background: none; cursor: default; text-align: left; }
.tracker td.tr-res.won { color: var(--good-ink); }
.tracker td.tr-res.lost { color: var(--evil-ink); }
.tracker td.tr-res.rej { color: var(--dim); }
.tr-key { font-size: 11px; margin: 5px 0 0; }
.tr-empty { font-size: 12.5px; margin: 0; }

/* ---------------------------------------------------------------- your Character */

.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 16px 16px;
  border-radius: 16px;
  text-align: center;
}
.role-card.side-good { background: linear-gradient(180deg, rgba(91, 156, 240, 0.28), rgba(91, 156, 240, 0.06)); border: 1px solid rgba(91, 156, 240, 0.6); }
.role-card.side-evil { background: linear-gradient(180deg, rgba(224, 87, 79, 0.3), rgba(224, 87, 79, 0.06)); border: 1px solid rgba(224, 87, 79, 0.6); }
.rc-icon { font-size: 44px; line-height: 1; }
.rc-name { font-family: var(--serif); font-size: 26px; font-weight: 700; }
.rc-side { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.role-card.side-good .rc-side { color: var(--good-ink); }
.role-card.side-evil .rc-side { color: var(--evil-ink); }
.rc-power { margin: 4px 0 0; line-height: 1.5; max-width: 40ch; }
.rc-facts { margin: 12px 0 0; padding-left: 20px; text-align: left; line-height: 1.55; }
.rc-win { color: var(--dim); font-size: 13px; line-height: 1.5; margin: 10px 0 4px; text-align: left; }
.rc-secret { color: var(--dim); font-size: 12px; font-style: italic; margin: 6px 0 12px; }

/* ---------------------------------------------------------------- game over */

#go-title.win-good { color: var(--good-ink); }
#go-title.win-evil { color: var(--evil-ink); }
#go-rank { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 5px; }
#go-rank .rank-row { border-left: 3px solid var(--line); }
#go-rank .rank-row.side-good { border-left-color: var(--good); }
#go-rank .rank-row.side-evil { border-left-color: var(--evil); }
#go-rank .rank-score { display: inline-flex; align-items: center; gap: 2px; }
.go-named { color: var(--evil-ink); font-weight: 700; }
.go-partial { color: var(--accent); font-weight: 700; }
.rules-h { margin: 10px 0 0; font: 700 18px/1.2 var(--serif); color: var(--accent); }
.rules-intro { margin: 0; color: var(--dim); font-size: 14px; }
#go-rank .rank-row.side-good .rank-score { color: var(--good-ink); }
#go-rank .rank-row.side-evil .rank-score { color: var(--evil-ink); }

/* banners in the sides' colours */
.flash.good { background: linear-gradient(180deg, #3f7fd8, #23488a); color: #fff; }
.flash.bad { background: linear-gradient(180deg, #d9534b, #8b2620); color: #fff; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 999px) {
  #table { grid-template-columns: minmax(0, 1fr); padding: 4px 10px 16px; }
  #side { order: 2; }
}

@media (max-width: 640px) {
  .qt { width: 52px; height: 52px; }
  .qt b { font-size: 18px; }
  .quests { gap: 5px; }
  .act-row .btn { min-width: 0; flex: 1 1 40%; }
  #screen-game .topbar .btn.ghost { padding: 6px 12px; font-size: 13.5px; }
}

@media (min-width: 1000px) {
  #screen-game { padding-right: 0; }
  /* keep clear of the fixed ⚙ and log toggle in the corner */
  #screen-game .topbar { padding-right: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  button.seat { transition: none; }
}
