/* =========================================
   WHODUNNIT — MOOD LABS BRAND STYLES
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800;900&display=swap');

/* ---------- VARIABLES ---------- */
:root {
  --chalk:      #F2E9DB;
  --black:      #282828;
  --pink:       #DD90BE;
  --tang:       #F16022;
  --brick:      #711611;
  --leaf:       #088846;
  --pine:       #162F19;
  --ink:        #191348;

  --bg:         var(--chalk);
  --card:       rgba(255,255,255,0.75);
  --card-border: rgba(40,40,40,0.1);

  --text:       var(--black);
  --text-muted: rgba(40,40,40,0.45);

  --radius:     20px;
  --radius-sm:  12px;

  --shadow-sm: 0 2px 8px rgba(40,40,40,0.07);
  --shadow-md: 0 8px 28px rgba(40,40,40,0.12);
  --shadow-lg: 0 16px 48px rgba(40,40,40,0.16);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--chalk);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

/* Subtle warm grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  padding: 14px 32px;
  border-radius: 50px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover:not(:disabled)  { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.32; cursor: not-allowed; }

.btn-primary {
  background: var(--tang);
  color: white;
  box-shadow: 0 4px 18px rgba(241,96,34,0.32);
}
.btn-primary:hover:not(:disabled) {
  background: #d9521a;
  box-shadow: 0 8px 32px rgba(241,96,34,0.42);
}

.btn-dark {
  background: var(--black);
  color: white;
}
.btn-dark:hover:not(:disabled) { background: #3d3d3d; }

.btn-outline {
  background: transparent;
  border-color: rgba(40,40,40,0.2);
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 10px 22px;
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--tang);
  color: var(--tang);
  background: rgba(241,96,34,0.06);
}

.btn-yes {
  background: var(--leaf);
  color: white;
  font-size: 1.5rem;
  padding: 28px 40px;
  box-shadow: 0 4px 18px rgba(8,136,70,0.28);
}
.btn-yes:hover:not(:disabled) { background: #066a37; }

.btn-no {
  background: var(--brick);
  color: white;
  font-size: 1.5rem;
  padding: 28px 40px;
  box-shadow: 0 4px 18px rgba(113,22,17,0.28);
}
.btn-no:hover:not(:disabled) { background: #5a1010; }

/* ---------- CARD ---------- */
.card {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

/* ---------- TIMER BAR ---------- */
.timer-wrap {
  width: 100%;
  height: 7px;
  background: rgba(40,40,40,0.1);
  border-radius: 999px;
  overflow: hidden;
}
.timer-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--tang), var(--pink));
  transition: width 0.5s linear;
}
.timer-label {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--tang);
  min-width: 48px;
  text-align: right;
}

/* ---------- PLAYER CHIP ---------- */
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 8px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.25s ease;
}
.player-chip .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: white;
}
.player-chip.done {
  background: rgba(8,136,70,0.1);
  border: 1.5px solid rgba(8,136,70,0.28);
  color: var(--leaf);
}
.player-chip.waiting {
  background: rgba(40,40,40,0.05);
  border: 1.5px solid rgba(40,40,40,0.1);
  color: var(--text-muted);
}

/* ---------- SCOREBOARD ROW ---------- */
.score-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  background: white;
  border: 1.5px solid rgba(40,40,40,0.07);
  box-shadow: var(--shadow-sm);
  transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.score-row .rank   { font-size: 1.2rem; width: 32px; text-align: center; }
.score-row .name   { flex: 1; font-weight: 700; font-size: 1rem; }
.score-row .pts    { font-weight: 800; font-size: 1.35rem; color: var(--tang); }
.score-row .delta  { font-size: 0.8rem; color: var(--leaf); font-weight: 700; min-width: 44px; text-align: right; }

/* ---------- ANIMATIONS ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.06); }
}
@keyframes popIn {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

.fade-up { animation: fadeUp 0.4s ease forwards; }
.pop-in  { animation: popIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

/* ---------- FOOTER (TV) ---------- */
#game-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 50px;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  z-index: 100;
}
#game-footer strong { color: var(--tang); font-weight: 700; }

/* ---------- INPUT (PHONE) ---------- */
.input-field {
  width: 100%;
  background: white;
  border: 2px solid rgba(40,40,40,0.14);
  border-radius: var(--radius-sm);
  padding: 15px 18px;
  font-size: 1.05rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: var(--black);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  box-shadow: var(--shadow-sm);
}
.input-field::placeholder { text-transform: none; letter-spacing: 0; color: var(--text-muted); font-weight: 400; }
.input-field:focus { border-color: var(--tang); box-shadow: 0 0 0 4px rgba(241,96,34,0.1); }
.input-field.name-field { text-transform: none; letter-spacing: 0; }

/* ---------- DOTS LOADER ---------- */
.dots span {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--tang);
  margin: 0 4px;
  animation: pulse 1.2s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: 0.2s; background: var(--pink); }
.dots span:nth-child(3) { animation-delay: 0.4s; background: var(--leaf); }

/* ---------- GUESS PICKER (PHONE) ---------- */
.guess-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.guess-picker .pick-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(40,40,40,0.14);
  background: white;
  color: var(--black);
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.guess-picker .pick-btn:active { transform: scale(0.9); background: var(--tang); color: white; border-color: var(--tang); }
.guess-picker .pick-num {
  font-weight: 900;
  font-size: 5rem;
  color: var(--tang);
  min-width: 120px;
  text-align: center;
  line-height: 1;
}
