/* Peekaboo! — party-pastel theme */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pink: #f8a5c2;
  --pink-deep: #e0568c;
  --blue: #9ec9f5;
  --blue-deep: #3f74c9;
  --ink: #3d2c4a;
  --paper: #fffdf8;
  --shadow: 0 6px 24px rgba(61, 44, 74, 0.14);
  --radius: 20px;
}

html, body {
  height: 100%;
}

body {
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #ffe4ee 0%, #fff6e5 45%, #e2eeff 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 18px 90px;
  min-height: 100dvh;
}

/* ---------- shared bits ---------- */

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 16px 0;
}

h1 { font-size: 2.6rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin-bottom: 10px; }

label { display: block; font-weight: 600; font-size: 0.9rem; margin: 14px 0 6px; }

input[type="text"] {
  width: 100%;
  font-size: 1.1rem;
  padding: 12px 14px;
  border: 2px solid #e8dff0;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus { border-color: var(--pink); }

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.5em;
  font-weight: 700;
  text-align: center;
  font-size: 1.5rem !important;
}

.btn-primary, .btn-big {
  display: block;
  width: 100%;
  border: none;
  cursor: pointer;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(90deg, var(--pink-deep), var(--blue-deep));
  padding: 14px 18px;
  border-radius: 16px;
  margin-top: 18px;
  box-shadow: 0 4px 14px rgba(224, 86, 140, 0.35);
  transition: transform 0.1s, opacity 0.15s;
}
.btn-primary:active, .btn-big:active { transform: scale(0.98); }
.btn-primary:disabled, .btn-big:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-big { font-size: 1.25rem; padding: 18px; }

.btn-ghost {
  display: inline-block;
  border: 2px solid rgba(61, 44, 74, 0.2);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 10px;
}

.error {
  color: #c0392b;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 12px;
  text-align: center;
}

.hint { font-size: 0.88rem; opacity: 0.75; line-height: 1.45; }

.footnote { text-align: center; font-size: 0.85rem; opacity: 0.6; margin-top: 18px; }

/* ---------- home ---------- */

.hero { text-align: center; padding: 26px 0 6px; }
.hero-emoji { font-size: 4rem; animation: bob 2.4s ease-in-out infinite; }
.tagline { margin-top: 8px; font-size: 1.02rem; opacity: 0.85; line-height: 1.5; }

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

.tabs { display: flex; gap: 8px; margin-bottom: 6px; }
.tab {
  flex: 1;
  border: none;
  background: #f1eaf7;
  color: var(--ink);
  font-weight: 700;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  opacity: 0.6;
}
.tab.active { background: var(--ink); color: #fff; opacity: 1; }

.guess-row { display: flex; gap: 10px; }
.guess-btn {
  flex: 1;
  border: 2px solid #e8dff0;
  background: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px;
  border-radius: 14px;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.12s;
}
.guess-btn[data-guess="boy"].selected { background: var(--blue); border-color: var(--blue-deep); }
.guess-btn[data-guess="girl"].selected { background: var(--pink); border-color: var(--pink-deep); }

.practice-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 16px;
}
.practice-row input { margin-top: 3px; }

/* ---------- lobby ---------- */

.lobby-header { text-align: center; padding-top: 12px; }
.lobby-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.6; }
.room-code {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  margin: 4px 0 6px;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}

.practice-banner {
  display: inline-block;
  background: #fff3c9;
  border: 1.5px solid #e8c76a;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  margin-top: 10px;
}

.player-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.player-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f7f2fb;
  border-radius: 999px;
  padding: 7px 14px 7px 9px;
  font-weight: 600;
  font-size: 0.95rem;
  animation: popIn 0.25s ease-out;
}
.player-list .avatar { font-size: 1.25rem; }
.player-list .team { font-size: 0.8rem; }
.player-list .host-tag { font-size: 0.7rem; background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 6px; }

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.secret-status { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.secret-status.locked { color: #1d8348; }

.lobby-actions { text-align: center; }

/* ---------- game ---------- */

.game-header { text-align: center; padding: 8px 0 4px; }
#turn-banner { font-size: 1.3rem; min-height: 1.6em; }
#turn-banner.mine { animation: pulseText 1.2s ease-in-out infinite; }

@keyframes pulseText {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.turn-strip {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.turn-strip .turn-chip {
  font-size: 1.3rem;
  padding: 5px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  opacity: 0.5;
  transition: all 0.2s;
}
.turn-strip .turn-chip.current {
  opacity: 1;
  background: #fff;
  box-shadow: var(--shadow);
  transform: scale(1.15);
}

.cup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.cup {
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px 0 0;
  -webkit-tap-highlight-color: transparent;
}

.cup .cup-body {
  width: 66px;
  height: 74px;
  margin: 0 auto;
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  background: repeating-linear-gradient(
    45deg,
    var(--pink) 0 12px,
    #fff 12px 24px,
    var(--blue) 24px 36px,
    #fff 36px 48px
  );
  border-radius: 6px 6px 10px 10px;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.08), 0 5px 10px rgba(61, 44, 74, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.cup .cup-num {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  min-width: 30px;
  padding: 3px 6px;
}

.cup.pickable:hover .cup-body,
.cup.pickable:focus-visible .cup-body { transform: translateY(-6px) rotate(-3deg); }

.cup.disabled { cursor: default; }
.cup.disabled:not(.opened) { opacity: 0.9; }

.cup.opened .cup-body { display: none; }
.cup .prize {
  display: none;
  font-size: 2.3rem;
  height: 78px;
  align-items: center;
  justify-content: center;
}
.cup.opened .prize { display: flex; animation: flipIn 0.5s ease-out; }
.cup.opened.just-opened .prize { animation: flipIn 0.5s ease-out, glow 1.2s ease-out; }

@keyframes flipIn {
  0% { transform: rotateY(90deg) scale(0.5); opacity: 0; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}
@keyframes glow {
  0% { filter: drop-shadow(0 0 18px gold); }
  100% { filter: none; }
}

.feed-wrap { max-height: 150px; overflow-y: auto; }
.feed { list-style: none; display: flex; flex-direction: column-reverse; gap: 6px; }
.feed li {
  background: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.9rem;
  animation: popIn 0.25s ease-out;
}

.game-footer { text-align: center; margin-top: 12px; }

/* ---------- reveal ---------- */

#view-reveal {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: fixed;
  inset: 0;
  z-index: 40;
  max-width: none;
  background: linear-gradient(160deg, #ffe4ee 0%, #fff6e5 45%, #e2eeff 100%);
}

.reveal-suspense p { font-size: 1.4rem; font-weight: 700; margin-top: 18px; }
.big-cup { font-size: 7rem; }
.shake { animation: shake 0.4s ease-in-out infinite; }

@keyframes shake {
  0%, 100% { transform: rotate(-7deg) translateX(-4px); }
  50% { transform: rotate(7deg) translateX(4px); }
}

.reveal-result { padding: 20px; animation: popIn 0.4s ease-out; }
.reveal-lead { font-size: 1.2rem; font-weight: 600; }
.reveal-title {
  font-size: clamp(3rem, 12vw, 5.5rem);
  margin: 12px 0;
  animation: revealPop 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.reveal-title.boy { color: var(--blue-deep); text-shadow: 0 4px 0 rgba(158, 201, 245, 0.6); }
.reveal-title.girl { color: var(--pink-deep); text-shadow: 0 4px 0 rgba(248, 165, 194, 0.6); }

@keyframes revealPop {
  0% { transform: scale(0.2) rotate(-10deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.reveal-team { font-size: 1.1rem; font-weight: 700; margin-top: 8px; }
.reveal-winners { list-style: none; margin-top: 10px; font-size: 1rem; }
.reveal-winners li { padding: 2px; }
.reveal-congrats { margin-top: 22px; font-size: 1.3rem; font-weight: 800; }

/* ---------- fake-out overlay ---------- */

.fakeout-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: linear-gradient(160deg, #ffe4ee 0%, #fff6e5 45%, #e2eeff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.fakeout-lead { font-size: 1.15rem; font-weight: 700; margin-top: 16px; opacity: 0.8; }
.fakeout-its { font-size: 2.2rem; font-weight: 900; margin-top: 12px; animation: pulseText 0.9s ease-in-out infinite; }

#fakeout-result { animation: popIn 0.35s ease-out; }
.fakeout-emoji { font-size: 6rem; animation: revealPop 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28); }
#fakeout-text { font-size: 1.6rem; margin-top: 10px; }
.fakeout-sub { margin-top: 14px; font-size: 1.05rem; font-weight: 600; opacity: 0.75; }

/* ---------- capture overlay ---------- */

.capture-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #0d0a12;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: left;
}

#capture-stage { max-width: 420px; width: 100%; }
#capture-instructions h2 { font-size: 1.5rem; margin-bottom: 14px; }
#capture-instructions ol { padding-left: 22px; display: flex; flex-direction: column; gap: 10px; line-height: 1.5; }
#capture-instructions .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.35); background: transparent; display: block; width: 100%; text-align: center; }

.capture-countdown {
  font-size: 9rem;
  font-weight: 900;
  text-align: center;
  animation: pulseText 1s ease-in-out infinite;
}

.capture-busy { text-align: center; font-size: 1.15rem; line-height: 1.6; }
.capture-busy .hint { color: rgba(255, 255, 255, 0.6); }
.capture-result { text-align: center; font-size: 1.15rem; line-height: 1.6; }
.capture-result .big { font-size: 3.5rem; display: block; margin-bottom: 10px; }

.spinner {
  width: 46px;
  height: 46px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- misc ---------- */

#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.mute-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 70;
  border: none;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}
