:root {
  --bg: #000000;
  --text: #f4f4f4;
  --muted: #9a9a9a;
  --accent: #57c1ff;
  --danger: #ff6f61;
  --font: "Segoe UI", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse at top, #161616 0%, #000 55%),
    #000;
}

.app {
  max-width: 28rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.tag {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.face[hidden] { display: none !important; }

.face {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--text);
  color: #111;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid #333;
}

.hint, .event-line, .pond, .status {
  color: var(--muted);
  margin: 0;
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; }

.join-code {
  margin: 0;
  font-size: 2.6rem;
  letter-spacing: 0.35em;
  font-weight: 700;
  text-align: center;
}

.code-label {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0;
}

.first-pick {
  border: 1px solid #2a2a2a;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
}

.first-pick legend { padding: 0 0.35rem; color: var(--muted); }
.first-pick label { display: inline-flex; gap: 0.4rem; margin-right: 1rem; }

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.wheel-wrap {
  display: grid;
  grid-template-columns: 2.5rem 1fr 2.5rem;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.wheel-nav {
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: #1a1a1a;
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
}

.color-disc {
  position: relative;
  width: min(70vw, 16rem);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  perspective: 900px;
  cursor: pointer;
  padding: 0;
}

.disc-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  transition: transform 0.45s ease;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 3px #222, 0 12px 40px rgba(0,0,0,0.45);
}

.disc-face.front { transform: rotateY(0deg); }
.disc-face.back {
  transform: rotateY(180deg);
  background: #111 !important;
}

.color-disc.flipped .front { transform: rotateY(180deg); }
.color-disc.flipped .back { transform: rotateY(360deg); }

.hex {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.color-name {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 650;
  margin: 0.25rem 0 0;
  min-height: 1.5em;
  color: #fff;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.play-layout {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.65rem;
  align-items: stretch;
  flex: 1;
}

.play-main {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.dots {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  min-height: 8rem;
  padding-top: 2.5rem;
}

.dot {
  appearance: none;
  padding: 0;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 1px solid #333;
  flex-shrink: 0;
  cursor: pointer;
}

.dot.active {
  outline: 2px solid #fff;
  outline-offset: 2px;
  width: 0.9rem;
  height: 0.9rem;
}

.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

.flash-overlay[hidden] { display: none !important; }

.flash-text {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  z-index: 2;
  animation: flash-label 1.15s ease-out forwards;
}

.flash-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.flash-oval {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.55rem;
  height: 1.15rem;
  margin: 0;
  border-radius: 999px;
  background: #57c1ff;
  box-shadow: 0 0 10px rgba(87, 193, 255, 0.55);
  animation: oval-burst 1.05s ease-out forwards;
}

.flash-oval:nth-child(1) { --x: -48px; --y: -36px; --rot: -28deg; animation-delay: 0ms; }
.flash-oval:nth-child(2) { --x: 46px; --y: -38px; --rot: 24deg; animation-delay: 40ms; }
.flash-oval:nth-child(3) { --x: -42px; --y: 40px; --rot: 18deg; animation-delay: 80ms; }
.flash-oval:nth-child(4) { --x: 44px; --y: 38px; --rot: -22deg; animation-delay: 60ms; }
.flash-oval:nth-child(5) { --x: 0px; --y: -56px; --rot: 6deg; animation-delay: 20ms; }
.flash-oval:nth-child(6) { --x: 0px; --y: 54px; --rot: -8deg; animation-delay: 100ms; }

@keyframes oval-burst {
  0% {
    transform: translate(-50%, -50%) scale(0.35) rotate(var(--rot, 0deg));
    opacity: 0;
  }
  25% { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.15) rotate(var(--rot, 0deg));
    opacity: 0;
  }
}

@keyframes flash-label {
  0% { opacity: 0; transform: scale(0.92); }
  20% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.04); }
}

.actions-wait {
  text-align: center;
  min-height: 1.2em;
}

.room-info-btn {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 30;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  border: 1px solid #3a3a3a;
  background: #151515;
  color: #57c1ff;
  font: 700 0.95rem/1 Georgia, "Times New Roman", serif;
  font-style: italic;
  cursor: pointer;
}

.room-info-panel {
  position: fixed;
  top: calc(max(0.75rem, env(safe-area-inset-top)) + 2.35rem);
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 31;
  width: min(14rem, calc(100vw - 1.5rem));
  padding: 0.85rem;
  border-radius: 0.9rem;
  border: 1px solid #2a2a2a;
  background: rgba(10, 10, 10, 0.96);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.room-info-panel[hidden],
.room-info-btn[hidden] { display: none !important; }

.room-info-label {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.room-info-code {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.28em;
  font-weight: 700;
  text-align: center;
}

#face-win {
  align-items: center;
  justify-content: center;
  text-align: center;
}

#win-title { font-size: 2rem; margin: 0; }
