:root {
  color-scheme: dark;
  --ink: #f7f1e8;
  --muted: #b8afc3;
  --surface: #211a2c;
  --surface-2: #2a2037;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #e64756;
  --accent-2: #ffb547;
  --success: #56c596;
  --danger: #ff6674;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #120f18; color: var(--ink); }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(230, 71, 86, 0.14), transparent 34rem),
    radial-gradient(circle at 85% 85%, rgba(93, 63, 145, 0.18), transparent 38rem),
    #120f18;
}
button, input, select, textarea { font: inherit; }
button, .button {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 0.78rem 1rem;
  background: var(--accent);
  color: white;
  font-weight: 750;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }
button.secondary, .button.secondary { background: var(--surface-2); border: 1px solid var(--line); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.danger { background: transparent; border: 1px solid rgba(255, 102, 116, 0.48); color: var(--danger); }
a { color: var(--accent-2); }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.055);
  color: var(--ink);
  padding: 0.78rem 0.9rem;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.12); }
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 0.45rem; color: var(--muted); font-size: 0.9rem; }

.shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: 1rem 0 4rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 66px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.7rem; font-weight: 900; letter-spacing: 0.06em; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px rgba(230,71,86,.12); }
.eyebrow { color: var(--accent-2); text-transform: uppercase; letter-spacing: .16em; font-size: .74rem; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 7vw, 5.6rem); line-height: .98; letter-spacing: -0.055em; max-width: 13ch; }
h2 { font-size: clamp(1.45rem, 4vw, 2.35rem); letter-spacing: -0.03em; }
.lead { color: var(--muted); font-size: clamp(1rem, 2.2vw, 1.25rem); line-height: 1.6; max-width: 62ch; }
.hero { min-height: calc(100vh - 100px); display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: 4rem; padding: 3rem 0; }
.hero-actions, .actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-card, .card {
  background: linear-gradient(145deg, rgba(42,32,55,.94), rgba(27,22,36,.94));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(1rem, 3vw, 1.6rem);
  box-shadow: var(--shadow);
}
.hero-card { transform: rotate(1.4deg); }
.role-stack { display: grid; gap: .7rem; }
.role-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: .8rem 0; }
.role-row:last-child { border: 0; }
.dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--accent); }

.page { max-width: 780px; margin: 0 auto; padding: 1rem 0 4rem; }
.page.wide { max-width: 1080px; }
.stack { display: grid; gap: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem; }
.form { display: grid; gap: 1rem; }
.meta { display: flex; flex-wrap: wrap; gap: .55rem; color: var(--muted); font-size: .9rem; }
.pill { padding: .35rem .65rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.045); }
.callout { border-left: 4px solid var(--accent-2); padding: .8rem 1rem; background: rgba(255,181,71,.08); border-radius: 0 12px 12px 0; color: #f5dfba; }
.error-box { border-left-color: var(--danger); background: rgba(255,102,116,.08); color: #ffd2d6; }
.status { display: inline-flex; gap: .45rem; align-items: center; color: var(--muted); }
.status::before { content: ""; width: .58rem; height: .58rem; background: var(--success); border-radius: 50%; box-shadow: 0 0 0 4px rgba(86,197,150,.12); }

.player-list { display: grid; gap: .6rem; }
.player {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 58px;
  padding: .65rem .8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.player.dead { opacity: .52; filter: grayscale(.65); }
.player-color { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); }
.player-main { flex: 1; min-width: 0; }
.player-name { font-weight: 750; overflow: hidden; text-overflow: ellipsis; }
.player-sub { color: var(--muted); font-size: .82rem; margin-top: .15rem; }
.ruby { background: #e64756; } .amber { background: #f5a623; } .lime { background: #94c83d; }
.emerald { background: #35b77a; } .cyan { background: #36a9c9; } .blue { background: #4f79df; }
.violet { background: #8d63da; } .fuchsia { background: #cc5fc8; } .rose { background: #e86c96; }
.slate { background: #778397; } .orange { background: #e87939; } .teal { background: #35a99f; }
.color-options { display: grid; grid-template-columns: repeat(6, 1fr); gap: .65rem; }
.color-choice { position: relative; min-height: 44px; padding: 0; border-radius: 50%; border: 3px solid transparent; }
.color-choice.selected { border-color: white; box-shadow: 0 0 0 3px var(--accent); }

.phase-card { text-align: center; padding: clamp(1.4rem, 5vw, 3rem); }
.phase-name { color: var(--accent-2); text-transform: uppercase; letter-spacing: .13em; font-weight: 900; font-size: .78rem; }
.timer { font-size: clamp(3rem, 14vw, 7rem); line-height: 1; font-variant-numeric: tabular-nums; font-weight: 900; letter-spacing: -.06em; margin: .8rem 0; }
.role-card { position: relative; overflow: hidden; text-align: center; border-color: rgba(230,71,86,.42); }
.role-card::after { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: rgba(230,71,86,.12); right: -55px; top: -75px; }
.role-title { font-size: clamp(2rem, 10vw, 4.5rem); font-weight: 950; letter-spacing: -.05em; margin: .4rem 0; }
.target-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: .7rem; }
.target { min-height: 66px; background: var(--surface-2); border: 1px solid var(--line); text-align: left; }
.target.selected { outline: 3px solid var(--accent-2); background: rgba(255,181,71,.12); }
.private-result { border: 1px solid rgba(255,181,71,.4); background: rgba(255,181,71,.08); padding: 1rem; border-radius: 14px; }
.separator { height: 1px; background: var(--line); margin: .5rem 0; }

.screen {
  min-height: 100vh;
  width: 100%;
  padding: clamp(1.5rem, 4vw, 4rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1.5rem;
}
.screen-header { display: flex; justify-content: space-between; align-items: center; gap: 2rem; }
.screen-phase { font-size: clamp(2rem, 5vw, 5rem); letter-spacing: -.045em; font-weight: 900; }
.screen-main { display: grid; grid-template-columns: minmax(260px, .72fr) 1.28fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: center; }
.screen-pin { font-size: clamp(3rem, 8vw, 7rem); font-weight: 950; letter-spacing: .12em; line-height: 1; }
.qr { width: min(38vh, 330px); aspect-ratio: 1; background: #fffaf0; padding: 10px; border-radius: 20px; }
.screen .player-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.screen-footer { display: flex; justify-content: space-between; align-items: end; gap: 1rem; color: var(--muted); }
.screen-announcement { font-size: clamp(1.1rem, 2.3vw, 2rem); max-width: 44ch; color: var(--ink); }
.screen .timer { font-size: clamp(3rem, 8vw, 7rem); margin: 0; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 1.25rem; transform: translate(-50%, 140%); background: #fff; color: #17131f; padding: .8rem 1rem; border-radius: 12px; box-shadow: var(--shadow); transition: transform .22s ease; max-width: min(520px, calc(100% - 2rem)); }
.toast.visible { transform: translate(-50%, 0); }
.loading { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-card { transform: none; }
  .screen-main { grid-template-columns: 1fr; }
  .screen { padding: 1.1rem; }
  .screen .player-list { grid-template-columns: 1fr; }
  .screen-header { align-items: flex-start; }
  .screen-footer { align-items: flex-start; flex-direction: column; }
  .color-options { grid-template-columns: repeat(6, 1fr); }
}

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

