:root {
  --table: #18121c;
  --table-deep: #0f0b12;
  --paper: #f8f2e9;
  --paper-muted: #cec4c0;
  --coral: #f07163;
  --coral-dark: #cf5148;
  --plum: #2a1e31;
  --line: rgba(248, 242, 233, .16);
  --line-strong: rgba(248, 242, 233, .32);
  --danger: #ff9a8e;
  --focus: #fff1a8;
}

* { box-sizing: border-box; }

html { background: var(--table-deep); }

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 88% 6%, rgba(240, 113, 99, .11), transparent 30rem),
    radial-gradient(circle at 4% 100%, rgba(89, 62, 105, .3), transparent 34rem),
    var(--table-deep);
  color: var(--paper);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, input, select { min-height: 48px; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.app-shell { width: min(100%, 42rem); min-height: 100dvh; margin: 0 auto; }
.game-stage { min-height: 100dvh; padding: clamp(1.35rem, 5vw, 2.75rem); display: flex; flex-direction: column; }
.brand { margin: 0 0 clamp(2.25rem, 8vh, 5rem); color: var(--paper); font-size: 1rem; font-weight: 800; letter-spacing: -.06em; }
.screen { flex: 1; display: flex; flex-direction: column; width: 100%; }

.eyebrow {
  overflow-wrap: anywhere;
  margin: 0 0 .8rem;
  color: var(--coral);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 {
  max-width: 11ch;
  margin-bottom: 1.2rem;
  color: var(--paper);
  font-size: clamp(2.75rem, 13vw, 5.6rem);
  font-weight: 750;
  line-height: .92;
  letter-spacing: -.075em;
}
h2 { margin-bottom: .15rem; color: var(--paper); font-size: 1.1rem; letter-spacing: -.035em; }
.lead { max-width: 32rem; margin-bottom: 1.5rem; color: var(--paper-muted); font-size: clamp(1rem, 4.2vw, 1.15rem); line-height: 1.48; }
.stack { display: grid; gap: 1rem; }

.setup-form { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.setup-section { display: grid; gap: .9rem; padding: 1.25rem 0; border-top: 1px solid var(--line); }
.setup-section:last-of-type { border-bottom: 1px solid var(--line); }
.player-row { position: relative; display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .75rem; align-items: end; }
.player-drag-handle {
  min-width: 48px;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: rgba(255, 255, 255, .03);
  color: var(--paper-muted);
  font-size: 1.3rem;
  font-weight: 800;
  touch-action: none;
}
.player-drag-handle:hover { border-color: var(--line-strong); color: var(--paper); }
.player-row[data-dragging] { opacity: .45; }
.player-row[data-drop-target]::before { position: absolute; top: -.45rem; right: 0; left: 0; height: 2px; border-radius: 99px; background: var(--coral); content: ''; }
label { display: grid; gap: .5rem; color: var(--paper-muted); font-size: .8rem; font-weight: 700; letter-spacing: .015em; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: rgba(255, 255, 255, .05);
  color: var(--paper);
  padding: .75rem .85rem;
}
option { color: #1a151d; background: var(--paper); }

.button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: .9rem;
  background: var(--paper);
  color: var(--table-deep);
  padding: .82rem 1rem;
  font-weight: 800;
  letter-spacing: .005em;
  text-align: center;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}
.button:hover { transform: translateY(-1px); background: #fff; }
.button--accent { border-color: var(--coral); background: var(--coral); color: #251319; }
.button--accent:hover { background: #ff897a; }
.button--quiet { width: auto; border-color: var(--line-strong); background: transparent; color: var(--paper); }
.button--quiet:hover { border-color: var(--paper); background: rgba(255, 255, 255, .08); }
.button--text { width: auto; min-height: auto; align-self: center; background: transparent; color: var(--paper-muted); padding: .45rem .2rem; font-size: .9rem; font-weight: 700; }
.button--text:hover { background: transparent; color: var(--paper); transform: none; }
.button--danger { color: var(--danger); }
.screen-actions { display: grid; gap: .65rem; margin-top: auto; padding-top: 1.5rem; }

.error, .notice {
  margin: 0;
  border-left: 2px solid var(--coral);
  background: rgba(240, 113, 99, .1);
  padding: .85rem 1rem;
  color: var(--paper);
  line-height: 1.45;
}

.role-card {
  min-height: clamp(19rem, 52dvh, 31rem);
  display: grid;
  align-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.75rem;
  padding: 1.5rem;
  background: linear-gradient(145deg, rgba(61, 45, 70, .92), rgba(20, 14, 24, .98));
  box-shadow: 0 1.4rem 4rem rgba(0, 0, 0, .25), inset 0 1px rgba(255, 255, 255, .08);
  color: var(--paper);
  text-align: center;
}
.role-card > p { margin: 0; }
.role-card--citizen { background: linear-gradient(145deg, rgba(42, 30, 49, .96), rgba(15, 11, 18, .99)); border-color: var(--line); color: var(--paper); }
.role-word { margin: 0; font-size: clamp(2rem, 10vw, 4rem); font-weight: 760; line-height: 1.08; letter-spacing: -.045em; overflow-wrap: anywhere; hyphens: auto; text-wrap: balance; }
.role-label { margin: 0; color: var(--paper-muted); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.role-card:not(.role-card--citizen) .role-label { color: var(--coral); }
.role-card--citizen .role-label { color: var(--paper-muted); }

.player-choice { display: grid; gap: .55rem; }
.player-choice .button { border-color: var(--line); background: rgba(255, 255, 255, .04); color: var(--paper); text-align: left; }
.player-choice .button:hover { border-color: var(--coral); background: rgba(240, 113, 99, .12); }

.result-stage { margin-bottom: 1rem; padding: 1.25rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.vote-result { margin: 0; color: var(--paper); font-size: clamp(2.75rem, 13vw, 5rem); font-weight: 760; line-height: .92; letter-spacing: -.07em; }
.vote-result--imposter { color: var(--coral); }
.result-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.result-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.result-list li:last-child { border-bottom: 0; }
.status { color: var(--paper-muted); }
.status--imposter { color: var(--coral); font-weight: 800; }
.divider { height: 1px; margin: .5rem 0; background: var(--line); }

@media (min-width: 42rem) {
  .game-stage { padding: 2.75rem 3.5rem; }
  .role-card { padding: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

input { font-size: 16px; }
select { font-size: 16px; }
.team-summary { margin: 0; color: var(--paper-muted); line-height: 1.5; }
.legal-links { display: flex; justify-content: center; gap: 1rem; margin-top: 1rem; }
.legal-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--paper-muted); font-size: .8rem; }
.legal-links a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.remove-player { width: 48px; min-width: 48px; padding: .5rem; display: grid; place-items: center; }
.error { border: 0; background: transparent; padding: 0; color: var(--danger); }
.field-error { font-size: .85rem; font-weight: 500; line-height: 1.4; letter-spacing: normal; }
[aria-invalid="true"] { border-color: var(--danger); }
summary { cursor: pointer; min-height: 48px; padding: .75rem 0; font-weight: 700; }
details .stack { padding: .5rem 0; }
.screen:focus { outline: none; }
h1, .result-list li, .player-choice button { overflow-wrap: anywhere; }
.button--text { min-height: 44px; }
@media (max-width: 36rem) { .brand { margin-bottom: 1.5rem; } h1 { font-size: clamp(2.5rem, 11vw, 3.7rem); } .setup-section { padding: .9rem 0; gap: .65rem; } .player-row { gap: .4rem; } }
