:root {
  --bg-1: #f5fbff;
  --bg-2: #f7f4ff;
  --bg-3: #fff6d9;
  --ink: #20304a;
  --ink-soft: #52627f;
  --primary: #5c6cff;
  --primary-2: #7b6cff;
  --cyan: #40cce2;
  --mint: #7ce6a3;
  --yellow: #ffd663;
  --coral: #ff7e7d;
  --pink: #ff99d0;
  --violet: #9878ff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --shadow: 0 24px 48px rgba(71, 89, 164, 0.18);
  --shadow-soft: 0 14px 32px rgba(78, 96, 166, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --transition: 180ms ease;
}

body.theme-dark {
  --bg-1: #18223d;
  --bg-2: #1d2746;
  --bg-3: #2a2148;
  --ink: #eef2ff;
  --ink-soft: #b4bfdc;
  --panel: rgba(31, 40, 73, 0.86);
  --panel-strong: rgba(34, 44, 80, 0.94);
  --shadow: 0 24px 48px rgba(4, 8, 20, 0.38);
  --shadow-soft: 0 14px 32px rgba(4, 8, 20, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Nunito", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.38), transparent 22%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.background-bubbles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  opacity: 0.45;
  animation: float 18s ease-in-out infinite;
}

.bubble--a { width: 180px; height: 180px; top: -20px; left: -30px; background: rgba(92, 108, 255, 0.16); }
.bubble--b { width: 220px; height: 220px; top: 8%; right: -70px; background: rgba(64, 204, 226, 0.18); animation-delay: -5s; }
.bubble--c { width: 160px; height: 160px; top: 32%; left: -45px; background: rgba(255, 214, 99, 0.22); animation-delay: -8s; }
.bubble--d { width: 240px; height: 240px; bottom: 12%; right: -70px; background: rgba(255, 153, 208, 0.2); animation-delay: -10s; }
.bubble--e { width: 120px; height: 120px; bottom: 24%; left: 12%; background: rgba(124, 230, 163, 0.22); animation-delay: -12s; }
.bubble--f { width: 150px; height: 150px; bottom: -30px; left: 55%; background: rgba(152, 120, 255, 0.18); animation-delay: -3s; }

#app {
  position: relative;
  width: min(100%, 540px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px 26px;
}

.screen {
  display: grid;
  gap: 16px;
  min-height: calc(100vh - 40px);
  align-content: start;
  animation: fadeUp 260ms ease;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand {
  display: grid;
  gap: 4px;
}

.eyebrow {
  margin: 0;
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.title {
  margin: 0;
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  line-height: 0.94;
}

.hero-card,
.panel,
.player-card,
.result-card,
.instruction-card,
.vote-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.44);
  box-shadow: var(--shadow);
}

.hero-card::before,
.panel::before,
.player-card::before,
.result-card::before,
.instruction-card::before,
.vote-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: calc(var(--radius-xl) - 10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.hero-card {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.hero-card__art {
  position: relative;
  min-height: 210px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.9), transparent 18%),
    linear-gradient(135deg, rgba(92, 108, 255, 0.96), rgba(64, 204, 226, 0.92) 40%, rgba(124, 230, 163, 0.92));
  overflow: hidden;
}

.sticker {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  font-size: 2.3rem;
  animation: wobble 6s ease-in-out infinite;
}

.sticker--one {
  width: 120px;
  height: 120px;
  left: 20px;
  top: 28px;
  background: rgba(255, 255, 255, 0.84);
}

.sticker--two {
  width: 100px;
  height: 100px;
  right: 28px;
  top: 40px;
  background: rgba(255, 246, 216, 0.9);
  animation-delay: -1.5s;
}

.sticker--three {
  width: 130px;
  height: 130px;
  right: 78px;
  bottom: 18px;
  background: rgba(255, 236, 245, 0.94);
  animation-delay: -3s;
}

.hero-copy {
  display: grid;
  gap: 12px;
}

.hero-copy p,
.panel p,
.instruction-card p,
.result-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.button-grid {
  display: grid;
  gap: 12px;
}

.btn,
.chip,
.step-btn,
.vote-btn {
  border: 0;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition), background var(--transition);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 14px 18px;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  color: white;
  box-shadow: var(--shadow-soft);
}

.btn:disabled,
.chip:disabled,
.reveal-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
  filter: none;
}

.btn:hover,
.btn:focus-visible,
.chip:hover,
.chip:focus-visible,
.reveal-btn:hover,
.reveal-btn:focus-visible,
.step-btn:hover,
.step-btn:focus-visible,
.vote-btn:hover,
.vote-btn:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.03);
  outline: none;
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.btn--secondary {
  background: linear-gradient(135deg, var(--cyan), #52d5b4);
}

.btn--accent {
  background: linear-gradient(135deg, var(--coral), #ff9b66);
}

.btn--ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.btn--tiny {
  width: auto;
  min-height: 40px;
  padding: 10px 14px;
  font-size: 0.92rem;
}

.panel {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel__title {
  margin: 0;
  font-family: "Baloo 2", cursive;
  font-size: 1.55rem;
  line-height: 1;
}

.score-strip,
.setting-row,
.choice-grid,
.category-grid,
.name-list,
.reveal-grid,
.vote-grid,
.summary-grid {
  display: grid;
  gap: 12px;
}

.score-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.score-pill {
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
  text-align: center;
}

.score-pill strong,
.summary-box strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.score-pill span,
.summary-box span {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
  font-weight: 800;
}

.setting-row {
  gap: 10px;
}

.setting-row label,
.choice-label {
  font-size: 0.97rem;
  font-weight: 800;
}

.range-wrap,
.select-wrap,
.toggle-wrap {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.players-note {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.range-value {
  font-size: 2rem;
  font-family: "Baloo 2", cursive;
  line-height: 1;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-grid--duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.name-list {
  grid-template-columns: 1fr;
}

.name-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 20px;
  background: var(--panel-strong);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.name-index {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-family: "Baloo 2", cursive;
  font-size: 1.35rem;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
}

.text-input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(92, 108, 255, 0.12);
}

.text-input:focus {
  outline: 3px solid rgba(92, 108, 255, 0.18);
}

.chip {
  min-height: 62px;
  padding: 12px 10px;
  border-radius: 18px;
  cursor: pointer;
  background: var(--panel-strong);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.audience-option {
  display: grid;
  align-content: center;
}

.chip.is-active {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.chip small {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  font-weight: 700;
}

.category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-chip {
  position: relative;
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.category-chip .emoji {
  font-size: 1.5rem;
}

.toggle-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.switch {
  position: relative;
  width: 60px;
  height: 34px;
  border-radius: 999px;
  background: rgba(92, 108, 255, 0.22);
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition);
  box-shadow: 0 8px 16px rgba(61, 76, 140, 0.18);
}

.switch.is-on {
  background: linear-gradient(135deg, var(--primary), var(--cyan));
}

.switch.is-on::after {
  transform: translateX(26px);
}

.player-card,
.instruction-card,
.result-card,
.vote-card {
  padding: 24px;
  display: grid;
  gap: 18px;
  text-align: center;
}

.player-badge {
  width: 100px;
  height: 100px;
  margin: 0 auto;
  border-radius: 28px;
  display: grid;
  place-items: center;
  font-family: "Baloo 2", cursive;
  font-size: 2.4rem;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--coral));
  box-shadow: var(--shadow-soft);
}

.card-reveal {
  display: grid;
  gap: 14px;
  min-height: 320px;
  align-content: center;
  border-radius: 28px;
  padding: 20px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.58), transparent 24%),
    linear-gradient(160deg, rgba(124, 230, 163, 0.3), rgba(255, 255, 255, 0.66));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}

.secret-card {
  position: relative;
  min-height: 240px;
  border-radius: 28px;
  padding: 24px;
  display: grid;
  gap: 14px;
  align-content: center;
  background: linear-gradient(165deg, #5c6cff, #7b6cff 36%, #40cce2);
  color: white;
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
  animation: revealCard 320ms ease;
}

.secret-card.is-impostor {
  background: linear-gradient(165deg, #ff7e7d, #ffb45f 40%, #ffd663);
  box-shadow: 0 28px 56px rgba(255, 126, 125, 0.34);
}

.role-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
}

.role-banner.is-team {
  color: #20304a;
  background: rgba(255, 255, 255, 0.88);
}

.role-banner.is-impostor {
  color: #fff6ec;
  background: linear-gradient(135deg, rgba(150, 37, 37, 0.96), rgba(255, 126, 125, 0.96));
  box-shadow: 0 10px 22px rgba(145, 45, 44, 0.28);
  animation: impostorPulse 1.5s ease-in-out infinite;
}

.secret-card__emoji {
  font-size: 4rem;
  line-height: 1;
}

.secret-card__title {
  font-family: "Baloo 2", cursive;
  font-size: clamp(2rem, 10vw, 3rem);
  line-height: 0.96;
}

.secret-card__hint {
  font-size: 1.08rem;
  color: rgba(255, 255, 255, 0.86);
}

.warning-chip,
.status-chip,
.timer-pill,
.vote-turn {
  display: inline-flex;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
}

.warning-chip {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
}

.status-chip {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.reveal-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reveal-btn {
  min-height: 96px;
  padding: 14px 12px;
  border: 0;
  border-radius: 22px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  align-content: center;
  background: var(--panel-strong);
  color: var(--ink);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition), background var(--transition);
}

.reveal-btn small {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.reveal-btn.is-done {
  color: white;
  background: linear-gradient(135deg, rgba(124, 230, 163, 0.95), rgba(64, 204, 226, 0.9));
}

.reveal-btn.is-done small {
  color: rgba(255, 255, 255, 0.9);
}

.timer-panel {
  display: grid;
  gap: 12px;
}

.timer-circle {
  width: 148px;
  height: 148px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, rgba(92, 108, 255, 0.32), rgba(64, 204, 226, 0.26));
  box-shadow: var(--shadow-soft);
  font-family: "Baloo 2", cursive;
  font-size: 2.6rem;
  color: var(--primary);
}

.timer-circle small {
  display: block;
  font-size: 0.95rem;
  line-height: 1;
}

.hint-list {
  display: grid;
  gap: 10px;
  text-align: left;
}

.hint-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--panel-strong);
  list-style: none;
}

.vote-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vote-btn {
  min-height: 88px;
  padding: 12px;
  border-radius: 20px;
  cursor: pointer;
  background: var(--panel-strong);
  color: var(--ink);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.vote-btn.is-picked {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.vote-btn small {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-box {
  padding: 14px;
  border-radius: 20px;
  background: var(--panel-strong);
}

.vote-summary {
  display: grid;
  gap: 8px;
}

.vote-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--panel-strong);
}

.vote-line.is-top {
  outline: 3px solid rgba(92, 108, 255, 0.28);
}

.confetti-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 20px;
  border-radius: 6px;
  opacity: 0.9;
  animation: confettiFall 1600ms ease-in forwards;
}

@keyframes confettiFall {
  to {
    transform: translate3d(var(--x-end), 115vh, 0) rotate(540deg);
    opacity: 0.2;
  }
}

@keyframes revealCard {
  from {
    opacity: 0;
    transform: rotateY(-14deg) scale(0.94);
  }
  to {
    opacity: 1;
    transform: rotateY(0) scale(1);
  }
}

@keyframes impostorPulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.03);
    filter: brightness(1.06);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -18px, 0) scale(1.06); }
}

@keyframes wobble {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(6deg) translateY(-4px); }
}

@media (max-width: 380px) {
  .choice-grid,
  .summary-grid,
  .reveal-grid,
  .vote-grid {
    grid-template-columns: 1fr;
  }

  .score-strip {
    grid-template-columns: 1fr;
  }
}
