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

:root {
  --bg: #14121f;
  --card: #1f1c2e;
  --accent: #ff4d7d;
  --accent2: #7c5cff;
  --text: #f2f0fa;
  --muted: #9a94b8;
  --ok: #3ddc84;
  --bad: #ff5c5c;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.screen {
  display: none;
  width: 100%;
  max-width: 480px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  flex-direction: column;
  gap: 16px;
}
.screen.active { display: flex; }

h1 { text-align: center; font-size: 2rem; margin-top: 8vh; }
#screen-end h1 { margin-top: 4vh; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1rem; color: var(--muted); font-weight: 600; }
.tagline { text-align: center; color: var(--muted); }

input[type="text"] {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid #38334f;
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
}
input[type="text"]:focus { outline: none; border-color: var(--accent2); }
#input-code { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; }

button {
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: default; }
button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; }

.error { color: var(--bad); text-align: center; min-height: 1.2em; }
.hint { color: var(--muted); text-align: center; }
.privacy { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: auto; }

.code {
  background: var(--card);
  padding: 2px 12px;
  border-radius: 8px;
  letter-spacing: 0.25em;
  color: var(--accent);
  font-family: ui-monospace, monospace;
}

.player-list { display: flex; flex-direction: column; gap: 8px; }
.player-row {
  display: flex;
  justify-content: space-between;
  background: var(--card);
  padding: 12px 14px;
  border-radius: 12px;
}
.player-row.winner { border: 2px solid var(--accent); }
.ready { color: var(--ok); }
.not-ready { color: var(--muted); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.thumb { position: relative; aspect-ratio: 1; }
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 10px;
}
.thumb .del {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  font-size: 0.8rem;
  line-height: 1;
}

.upload-btn {
  display: block;
  text-align: center;
  padding: 14px;
  border: 2px dashed #38334f;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.game-header { display: flex; flex-direction: column; gap: 8px; }
#round-label { font-weight: 700; color: var(--muted); }
.timer {
  height: 8px;
  background: var(--card);
  border-radius: 4px;
  overflow: hidden;
}
#timer-bar {
  height: 100%;
  width: 100%;
  background: var(--accent2);
  border-radius: 4px;
  transition: width 0.1s linear;
}
#timer-bar.urgent { background: var(--bad); }

.photo-frame {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40dvh;
  max-height: 52dvh;
}
.photo-frame img { max-width: 100%; max-height: 52dvh; object-fit: contain; }

#game-prompt { text-align: center; font-weight: 600; min-height: 1.4em; }

.guess-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.guess.selected { outline: 3px solid var(--accent2); }

#reveal-panel { display: flex; flex-direction: column; gap: 12px; }
#reveal-owner { text-align: center; font-size: 1.15rem; }
#reveal-guesses { display: flex; flex-direction: column; gap: 6px; }
.guess-row {
  background: var(--card);
  padding: 10px 14px;
  border-radius: 10px;
}
.guess-row.correct { border-left: 4px solid var(--ok); }
.guess-row.wrong { border-left: 4px solid var(--bad); }
