/* Womp design system — token sheet from design/womp-design-brief.md.
   Chrome stays muted (ivory + ink + sage); saturated color is reserved for
   player identity and moment-of-glory feedback. Vibrancy is an event. */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@700;800;900&family=Figtree:wght@400;600;700;800&family=Fraunces:opsz,wght@9..144,400;9..144,500&display=swap");

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

/* Author display rules (.overlay, .screen) would otherwise defeat the HTML
   hidden attribute — this guarantees hidden always means invisible.
   (Must stay the first style rule; only the font @import may precede it.) */
[hidden] { display: none !important; }

:root {
  /* color roles */
  --canvas: #FFFFEB;
  --card: #FFFDF9;
  --track: #E4E4D0;
  --muted: #8A8A80;
  --ink: #1A1A1A;
  --accent: #E8871E; /* player 1 / brand orange — the only saturated chrome color */
  --p2: #0D6E5C;
  --p3: #8A5FD6;
  --p4: #D64550;
  --p5: #2E7BC4;
  --p6: #C4407E;
  --danger: #D64550;

  /* type */
  --font-brand: "Archivo", "Arial Black", sans-serif;
  --font-ui: "Figtree", -apple-system, system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;

  /* shape */
  --radius-card: 14px;
  --radius-field: 12px;
  --border: 2.5px solid var(--ink);
  --shadow-pop: 0 6px 0 var(--ink);
}

@keyframes popIn {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

body {
  font-family: var(--font-ui);
  background: var(--canvas);
  color: var(--ink);
  min-height: 100dvh;
}

/* brand strip along the top of every screen — takes the player's identity
   color once they're seated (--me), brand orange before that */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--me, var(--accent));
  z-index: 5;
}

.screen {
  max-width: 420px;
  margin: 0 auto;
  padding: 30px 22px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100dvh;
}

/* ---- join screen ---- */

#join { align-items: center; justify-content: center; gap: 22px; }

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: popIn 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.25) both;
}
.brand-lockup img.icon { height: 84px; width: auto; }
.brand-lockup img.wordmark { height: 22px; width: auto; }

.join-kicker {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.join-fields {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 17px;
  width: 100%;
  background: var(--card);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius-field);
  padding: 14px 16px;
  outline: none;
}
input::placeholder { color: var(--muted); font-weight: 500; }
input:focus { border-color: var(--accent); }

#room {
  font-family: var(--font-brand);
  font-weight: 900;
  font-size: 30px;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 10px 16px 10px calc(16px + 0.3em);
}

button {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 16px;
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  background: var(--ink);
  color: var(--canvas);
  border: var(--border);
  border-radius: 999px;
  cursor: pointer;
}
button:active { background: var(--accent); color: var(--ink); transform: translateY(2px); }

.error {
  color: var(--danger);
  font-weight: 600;
  text-align: center;
}

/* ---- connection overlay ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.overlay-card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  padding: 28px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: popIn 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.25) both;
}
.overlay-icon { font-size: 2.6rem; }
.overlay-card h2 { font-family: var(--font-brand); font-weight: 800; letter-spacing: 0.02em; }
.overlay-card p { color: var(--muted); font-weight: 600; line-height: 1.4; }

body.degraded #game { filter: grayscale(0.6) opacity(0.55); }

/* ---- game screen (re-tokened only; design iteration comes later) ---- */

#game header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
}
.wordmark-sm { height: 14px; width: auto; }
#roomTag {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* lobby: you're in */
#lobbyBlock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
#meCircle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--me, var(--accent));
  border: 4px solid var(--ink);
  animation: popIn 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.25) both;
}
.me-label { font-weight: 600; font-size: 14px; color: var(--muted); }
#meName {
  font-family: var(--font-brand);
  font-weight: 900;
  font-size: 44px;
  letter-spacing: 0.02em;
  line-height: 1;
}
#meScore { font-weight: 700; font-size: 15px; color: var(--muted); }

#roundKicker {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.06em;
}

/* association tile picker (shown to whoever buzzed first) */
#pickWrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pick-kicker {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.08em;
  text-align: center;
}
.pick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}
.pick-grid button,
.pick-center {
  aspect-ratio: 1;
  min-height: 0;
  width: 100%;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--card);
  color: var(--ink);
  border: var(--border);
  border-radius: 14px;
}
.pick-grid button:active { background: var(--track); transform: scale(0.96); }
.pick-grid button.claimed { opacity: 0.5; }
.pick-center {
  background: var(--track);
  color: var(--muted);
  font-family: var(--font-brand);
  font-weight: 900;
  font-size: 26px;
}
.pick-emoji { font-size: 30px; line-height: 1; }
.pick-art {
  /* The association's riso print, framed as a card on the tile */
  width: 100%;
  min-height: 0;
  flex: 1;
  object-fit: contain;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
}
.pick-label {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
}

/* Correct / wrong feedback flash (see detectFeedback in app.js) */
#resultFlash {
  width: 100%;
  padding: 12px 14px;
  border: var(--border);
  border-radius: 14px;
  text-align: center;
  font-family: var(--font-brand);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.06em;
  animation: flash-pop 0.25s ease-out;
}
#resultFlash.flash-good {
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
}
#resultFlash.flash-bad {
  background: var(--card);
  color: var(--danger);
  border-color: var(--danger);
}
@keyframes flash-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
}

#phaseMsg {
  color: var(--muted);
  font-weight: 600;
  animation: pulse 2.2s ease-in-out infinite;
}

.buzzer {
  width: min(70vw, 280px);
  min-height: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--me, var(--accent));
  color: var(--ink);
  border: 4px solid var(--ink);
  font-family: var(--font-brand);
  font-weight: 900;
  font-size: 2.1rem;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 0 var(--ink);
}
.buzzer:active { box-shadow: 0 2px 0 var(--ink); transform: translateY(6px); background: var(--accent); }
.buzzer:disabled { filter: grayscale(1) opacity(0.5); }
