:root {
  color-scheme: dark;
  --background: #100c1a;
  --surface: rgba(31, 24, 48, 0.88);
  --surface-strong: #251c38;
  --surface-soft: #191327;
  --border: rgba(255, 255, 255, 0.12);
  --text: #fbf9ff;
  --muted: #b9afc9;
  --primary: #ff4d7d;
  --primary-hover: #ff6b93;
  --accent: #9b7bff;
  --success: #65e6bd;
  --danger: #ff5470;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -20%, rgba(120, 79, 190, 0.25), transparent 45%),
    var(--background);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(155, 123, 255, 0.55);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.17;
  pointer-events: none;
}

.ambient-one {
  top: 10%;
  left: -130px;
  background: var(--primary);
}

.ambient-two {
  right: -120px;
  bottom: 5%;
  background: var(--accent);
}

.app-shell {
  width: min(100% - 32px, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 0 24px;
}

.back-link {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 38px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 77, 125, 0.18), rgba(155, 123, 255, 0.12));
}

.brand-mark svg {
  width: 30px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.4;
}

.brand h1,
.brand p,
.hero-copy h2,
.hero-copy p,
.centered-screen h2,
.centered-screen p {
  margin: 0;
}

.brand h1 {
  font-size: 1.08rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.eyebrow,
.kicker {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-copy {
  margin-bottom: 26px;
}

.hero-copy h2,
.centered-screen h2 {
  margin-top: 8px;
  font-size: clamp(2rem, 7vw, 3.45rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.hero-copy > p:last-child,
.centered-screen > p:not(.kicker, .player-name) {
  max-width: 610px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.setup-card {
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 9px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  height: 50px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-soft);
}

.stepper input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  text-align: center;
  appearance: textfield;
}

.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.stepper-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.35rem;
  transition: background 160ms ease, color 160ms ease;
}

.stepper-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.field-select {
  margin-top: 18px;
}

.field select,
.player-input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 15px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--text);
}

.field select {
  padding: 0 44px 0 15px;
}

.players-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 12px;
}

.field-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
}

.players-heading small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.text-button {
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 750;
}

.text-button:hover {
  text-decoration: underline;
}

.players-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.player-field {
  position: relative;
}

.player-number {
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 9px;
  background: rgba(155, 123, 255, 0.13);
  color: #c9baff;
  font-size: 0.72rem;
  font-weight: 800;
  pointer-events: none;
}

.player-input {
  padding: 0 13px 0 49px;
}

.player-input::placeholder {
  color: #82778f;
}

.player-input:focus {
  border-color: rgba(155, 123, 255, 0.65);
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #ff9caf;
  font-size: 0.86rem;
}

.primary-button,
.secondary-button {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  width: 100%;
  padding: 0 20px;
  border: 0;
  background: var(--primary);
  box-shadow: 0 14px 30px rgba(255, 77, 125, 0.22);
}

.primary-button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.secondary-button {
  padding: 0 22px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.secondary-button:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.07);
}

.compact-button {
  width: min(100%, 390px);
  margin-top: 26px;
}

.centered-screen {
  display: flex;
  min-height: 660px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 30px 0 60px;
  text-align: center;
}

.progress-block {
  width: min(100%, 450px);
  margin: 0 auto 46px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.progress-track {
  height: 6px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-track span {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 300ms ease;
}

.privacy-symbol {
  display: grid;
  width: 94px;
  height: 94px;
  margin-bottom: 26px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(155, 123, 255, 0.13), rgba(255, 77, 125, 0.1));
}

.privacy-symbol svg {
  width: 58px;
  fill: none;
  stroke: #c8b9ff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.player-name {
  margin-top: 12px !important;
  color: var(--text);
  font-size: clamp(2.2rem, 9vw, 4.4rem);
  font-weight: 850;
  letter-spacing: -0.06em;
}

.handoff-help {
  max-width: 460px !important;
}

.role-card {
  position: relative;
  display: grid;
  width: min(100%, 450px);
  min-height: 310px;
  margin-top: 28px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 0%, rgba(155, 123, 255, 0.18), transparent 50%),
    var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--text);
  isolation: isolate;
}

.role-card::before {
  position: absolute;
  z-index: -1;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  filter: blur(90px);
  opacity: 0.1;
}

.role-card:not(.is-covered) {
  cursor: default;
}

.role-card.is-impostor:not(.is-covered) {
  border-color: rgba(255, 84, 112, 0.48);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 84, 112, 0.22), transparent 55%),
    var(--surface);
}

.card-covered,
.card-revealed {
  display: flex;
  width: 100%;
  padding: 30px;
  align-items: center;
  flex-direction: column;
}

.card-covered {
  gap: 9px;
}

.card-covered strong {
  margin-top: 8px;
  font-size: 1.18rem;
}

.card-covered small,
.role-hint {
  color: var(--muted);
  line-height: 1.5;
}

.card-revealed {
  display: none;
}

.role-card:not(.is-covered) .card-covered {
  display: none;
}

.role-card:not(.is-covered) .card-revealed {
  display: flex;
}

.fingerprint svg {
  width: 92px;
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-width: 2.2;
}

.role-badge {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(101, 230, 189, 0.12);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.is-impostor .role-badge {
  background: rgba(255, 84, 112, 0.13);
  color: #ff93a6;
}

.role-heading {
  margin-top: 29px;
  color: var(--muted);
  font-size: 0.92rem;
}

.secret-word {
  max-width: 100%;
  margin: 8px 0 15px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(2.1rem, 9vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.is-impostor .secret-word {
  color: #ff718a;
}

.success-symbol {
  display: grid;
  width: 94px;
  height: 94px;
  margin-bottom: 28px;
  place-items: center;
  border-radius: 50%;
  background: rgba(101, 230, 189, 0.13);
  color: var(--success);
  font-size: 2.7rem;
  font-weight: 800;
}

.starter-card,
.word-recap {
  display: grid;
  width: min(100%, 430px);
  margin-top: 28px;
  padding: 20px;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
}

.starter-card span,
.word-recap span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.starter-card strong,
.word-recap strong {
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.impostor-names {
  display: flex;
  margin-top: 28px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.impostor-name {
  padding: 12px 18px;
  border: 1px solid rgba(255, 84, 112, 0.36);
  border-radius: 999px;
  background: rgba(255, 84, 112, 0.1);
  color: #ff91a4;
  font-weight: 800;
}

.result-actions {
  display: flex;
  width: min(100%, 540px);
  margin-top: 4px;
  justify-content: center;
  gap: 12px;
}

.result-actions .compact-button {
  flex: 1;
}

footer {
  display: flex;
  margin-top: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 600px) {
  .app-shell {
    width: min(100% - 24px, 760px);
    padding-top: 22px;
  }

  .brand {
    margin-bottom: 29px;
  }

  .settings-grid,
  .players-list {
    grid-template-columns: 1fr;
  }

  .players-heading {
    align-items: start;
  }

  .centered-screen {
    min-height: calc(100vh - 150px);
    padding-top: 10px;
  }

  .progress-block {
    margin-bottom: 32px;
  }

  .result-actions {
    flex-direction: column;
    gap: 0;
  }

  footer {
    align-items: start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .screen:not([hidden]) {
    animation: screen-in 300ms ease both;
  }

  .role-card:not(.is-covered) .card-revealed {
    animation: reveal-in 350ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  @keyframes screen-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }

  @keyframes reveal-in {
    from {
      opacity: 0;
      transform: scale(0.96);
    }
  }
}
