:root {
  --font: 'Baloo 2', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  --ink: #2b3a55;
  --accent: #ff8fb1;
  --accent2: #4cc2ff;
  --cream: #fff7ee;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font);
  background: #0a3b66;
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: radial-gradient(circle at 50% 30%, rgba(120, 210, 255, 0.35), rgba(8, 40, 80, 0.65));
  backdrop-filter: blur(2px);
}

.overlay.hidden,
.banner.hidden {
  display: none;
}

.card {
  width: min(92vw, 430px);
  background: linear-gradient(180deg, #ffffff, #fff2f6);
  border: 4px solid #ffffff;
  border-radius: 28px;
  box-shadow: 0 18px 50px rgba(10, 40, 80, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.8);
  padding: 26px 26px 22px;
  text-align: center;
  animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.5, 1);
}

@keyframes pop {
  from {
    transform: scale(0.85) translateY(10px);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.logo {
  font-size: 44px;
  font-weight: 800;
  margin: 6px 0 2px;
  color: var(--accent2);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
  letter-spacing: 0.5px;
}
.logo span {
  color: var(--accent);
}

.tagline {
  margin: 0 0 18px;
  font-weight: 600;
  color: #5a6b86;
  font-size: 15px;
}

.name-input {
  width: 100%;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  padding: 12px 16px;
  border: 3px solid #ffd6e4;
  border-radius: 16px;
  outline: none;
  text-align: center;
  color: var(--ink);
  background: #fffafc;
  transition: border-color 0.15s;
}
.name-input:focus {
  border-color: var(--accent);
}

.role-label {
  margin: 16px 0 8px;
  font-weight: 700;
  color: #7a89a3;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.roles {
  display: flex;
  gap: 12px;
}

.role-btn {
  flex: 1;
  font-family: var(--font);
  cursor: pointer;
  border: 3px solid #e6ecf5;
  background: #fbfdff;
  border-radius: 18px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.role-btn:hover {
  transform: translateY(-2px);
}
.role-btn .role-emoji {
  font-size: 34px;
  line-height: 1;
}
.role-btn .role-name {
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
}
.role-btn .role-desc {
  font-size: 12px;
  font-weight: 600;
  color: #8493ad;
}
.role-btn .role-desc em {
  font-style: normal;
  color: var(--accent);
  font-weight: 800;
}
.role-btn.selected {
  border-color: var(--accent2);
  background: #eaf7ff;
  box-shadow: 0 6px 16px rgba(76, 194, 255, 0.25);
}
.role-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.play-btn {
  margin-top: 20px;
  width: 100%;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  border: none;
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, #ff9ec0, #ff6fa3);
  box-shadow: 0 8px 0 #e25287, 0 12px 22px rgba(226, 82, 135, 0.4);
  transition: transform 0.1s, box-shadow 0.1s;
}
.play-btn:hover {
  transform: translateY(-1px);
}
.play-btn:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #e25287, 0 6px 12px rgba(226, 82, 135, 0.4);
}

.join-msg {
  min-height: 18px;
  margin-top: 10px;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}

.controls-hint {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: #8493ad;
}

.hand-setting {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hand-setting.hidden {
  display: none;
}
.hand-label {
  font-size: 13px;
  font-weight: 700;
  color: #7a89a3;
}
.hand-toggle {
  display: flex;
  gap: 6px;
}
.hand-btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
  background: #fbfdff;
  border: 3px solid #e6ecf5;
  border-radius: 12px;
  padding: 7px 14px;
  transition: border-color 0.12s, background 0.12s;
}
.hand-btn.selected {
  border-color: var(--accent2);
  background: #eaf7ff;
  box-shadow: 0 4px 12px rgba(76, 194, 255, 0.25);
}

.gameover-title {
  font-size: 40px;
  font-weight: 800;
  margin: 4px 0 6px;
  color: var(--accent2);
}
.death-by {
  font-weight: 600;
  color: #5a6b86;
  margin: 0 0 14px;
}
.death-by strong {
  color: var(--accent);
}
.final-score-wrap {
  background: #eaf7ff;
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 6px;
}
.final-score-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7a89a3;
}
.final-score {
  font-size: 52px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

/* Banners */
.banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(10, 40, 80, 0.25);
  max-width: 90vw;
  text-align: center;
}
.banner-bad {
  background: #fff0f0;
  color: #b03a3a;
}
.link-btn {
  font-family: var(--font);
  font-weight: 800;
  color: var(--accent2);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  font-size: 14px;
}
