:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #1a1c20;
  --panel-2: #22252a;
  --text: #f3efe2;
  --muted: #aaa395;
  --line: rgba(243, 239, 226, .13);
  --red: #e1573f;
  --gold: #d5a84f;
  --green: #66c28f;
  --blue: #6aa6d8;
  --shadow: 0 22px 70px rgba(0, 0, 0, .32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(225, 87, 63, .18), transparent 32rem),
    linear-gradient(155deg, #101114 0%, #17181b 48%, #111418 100%);
  color: var(--text);
}

body {
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
}

button, input { font: inherit; }

.shell {
  width: min(100%, 520px);
  min-height: calc(100dvh - 40px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero {
  min-height: 31dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 22px;
  padding: 10px 2px 8px;
}

.brand, .topbar, .share, .qr-panel, .section-title, .player, .stepper, .stepper > div {
  display: flex;
  align-items: center;
}

.brand { gap: 14px; }

.mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--bg);
  font-weight: 950;
  font-size: 2rem;
  box-shadow: var(--shadow);
}

h1, h2, p { margin: 0; }

h1 {
  font-size: clamp(2.45rem, 12vw, 4.2rem);
  line-height: .9;
  letter-spacing: 0;
}

h2 {
  font-size: 1.24rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.lead {
  max-width: 29rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.lead.small { font-size: .97rem; }

.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .08em;
}

.panel, .share, .role-card, .result {
  border: 1px solid var(--line);
  background: rgba(26, 28, 32, .92);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-weight: 740;
  font-size: .84rem;
}

.field input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1013;
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

.field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(213, 168, 79, .16);
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--bg);
  font-weight: 900;
  cursor: pointer;
}

.btn:disabled {
  background: #2f3238;
  color: #8f918f;
  cursor: not-allowed;
}

.primary { background: var(--red); color: white; }
.secondary { background: var(--gold); }
.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.danger { background: rgba(225, 87, 63, .16); color: #ff9a8b; border: 1px solid rgba(225, 87, 63, .34); min-height: 38px; }
.wide { width: 100%; }

.icon {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.35rem;
}

.topbar {
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.topbar h1 {
  font-size: 2.7rem;
}

.share {
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
}

.share strong {
  display: block;
  font-size: 2rem;
  letter-spacing: .08em;
}

.qr-panel {
  gap: 14px;
}

.qr-panel img {
  flex: 0 0 auto;
  width: 116px;
  height: 116px;
  border-radius: 8px;
  background: var(--text);
}

.qr-panel div {
  min-width: 0;
}

.qr-panel h2 {
  margin: 4px 0 8px;
}

.section-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title span, .player span {
  color: var(--muted);
  font-size: .82rem;
}

.player {
  min-height: 56px;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.player:first-of-type { border-top: 0; }
.player.out { opacity: .48; }

.player div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player strong, .player b {
  overflow-wrap: anywhere;
}

.player.revealed b {
  color: var(--gold);
}

.dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #777;
}

.dot.on { background: var(--green); box-shadow: 0 0 0 5px rgba(102, 194, 143, .12); }

.stepper {
  min-height: 54px;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.stepper > span { color: var(--muted); font-weight: 800; }
.stepper > div { gap: 12px; }
.stepper strong { min-width: 2ch; text-align: center; font-size: 1.2rem; }

.role-card, .result {
  min-height: 210px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(145deg, rgba(225, 87, 63, .16), transparent 44%),
    rgba(26, 28, 32, .94);
}

.role-card.open {
  background:
    linear-gradient(145deg, rgba(213, 168, 79, .22), transparent 48%),
    rgba(26, 28, 32, .94);
}

.role-card h2, .result h2 {
  font-size: clamp(2rem, 11vw, 3.7rem);
  overflow-wrap: anywhere;
}

.role-card p:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.role-actions {
  display: flex;
  width: 100%;
}

.result {
  min-height: 180px;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 10;
  width: min(520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-weight: 850;
  box-shadow: var(--shadow);
}

@media (min-width: 740px) {
  body { padding-top: 34px; }
  .shell { min-height: calc(100dvh - 68px); }
}
