:root {
  --bg: #14121c;
  --panel: #1f1c2c;
  --border: #322c46;
  --text: #f0eefa;
  --text-dim: #a79fc4;
  --accent: #ff4fd8;
  --accent-2: #4fe6ff;
  --danger: #ff5c5c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

h1, h2 { font-family: Georgia, serif; letter-spacing: 0.02em; }

.landing, .game {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.landing h1 {
  font-size: 2.6rem;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.25rem;
}

.tagline { color: var(--text-dim); margin-top: 0; }

.panel-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.panel {
  flex: 1 1 260px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.panel label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.hint { color: var(--text-dim); font-size: 0.85rem; }

input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.6rem;
  background: #0f0d17;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
}

.btn-primary { background: var(--accent); color: #1a0a17; font-weight: 600; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-small { background: var(--accent-2); color: #061a1e; font-weight: 600; padding: 0.4rem 0.8rem; font-size: 0.85rem; }

.error { color: var(--danger); min-height: 1.2em; }

.game-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

#player-list { list-style: none; padding: 0; }
#player-list li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.4rem;
}

#draw-canvas {
  border-radius: 8px;
  touch-action: none;
  max-width: 100%;
  display: block;
}

.canvas-tools { margin-top: 0.75rem; display: flex; gap: 0.5rem; }

.shirt-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.shirt-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}

.shirt-card img {
  width: 100%;
  border-radius: 6px;
  background: #fff;
}

.shirt-slogan {
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
  overflow-wrap: break-word;
}

.shirt-meta { color: var(--text-dim); font-size: 0.8rem; overflow-wrap: break-word; }

/* --- Timer bar --- */
.timer-bar {
  position: relative;
  height: 22px;
  background: #0f0d17;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  width: 100%;
  transition: width 0.25s linear;
}
.timer-text {
  position: absolute;
  top: 0; left: 0; right: 0;
  text-align: center;
  font-size: 0.75rem;
  line-height: 22px;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* --- Header group code --- */
.group-code-wrap { display: flex; align-items: center; gap: 0.4rem; }
#group-code-label { font-weight: 600; color: var(--text); letter-spacing: 0.05em; }

.btn-tiny {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-danger { background: var(--danger); color: #2a0a0a; font-weight: 600; }

.progress-badge { font-size: 0.9rem; color: var(--text-dim); font-weight: normal; }

/* --- Slogan list --- */
.slogan-add-row { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.slogan-add-row input { margin-top: 0; flex: 1; }
.slogan-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.slogan-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.4rem;
}
.slogan-list li span { overflow-wrap: anywhere; padding-right: 0.5rem; }

/* --- Shirt picker (SELECTING phase) --- */
.shirt-picker {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.picker-column {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.picker-arrow {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.1rem;
  cursor: pointer;
  flex: 0 0 auto;
}
.picker-preview {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.picker-preview img { width: 100%; border-radius: 6px; background: #fff; }
.picker-meta { color: var(--text-dim); font-size: 0.8rem; margin: 0.4rem 0 0; }
.picker-slogan-text { font-weight: 600; font-size: 1.1rem; overflow-wrap: break-word; }

.shirt-preview-final { margin: 1rem 0; }
.shirt-preview-final .shirt-card { max-width: 260px; }

/* --- Results host menu --- */
.host-menu { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1.25rem; }
.host-menu-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.75rem; }

.big-code {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  margin: 1rem 0 1.5rem;
}

/* --- Drawing tools --- */
.draw-tools-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.75rem;
}
.tool-group { display: flex; align-items: center; gap: 0.5rem; }
.tool-label { color: var(--text-dim); font-size: 0.8rem; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; margin-top: 0; }

.swatch-row { display: flex; gap: 0.3rem; }
.swatch {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}
.swatch-active { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(79, 230, 255, 0.3); }

/* --- Winners callout --- */
.winners-callout {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.winner-row { margin: 0.3rem 0; }
.winner-medal { margin-right: 0.4rem; }

/* --- Podium ceremony --- */
.persist-toggle-row { margin: 0.75rem 0; }
.persist-toggle-row label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-dim); }
.persist-toggle-row input { width: auto; margin: 0; }

.podium-matchup-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1rem 0;
}
.podium-choice { flex: 1 1 220px; max-width: 260px; }
.podium-choice button { width: 100%; margin-top: 0.75rem; }
.podium-vs { font-weight: 700; color: var(--text-dim); font-size: 1.2rem; }

.podium-reveal-callout {
  background: var(--panel);
  border: 1px solid var(--accent-2);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.podium-reveal-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0;
}
.podium-reveal-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: #fff;
}
.podium-reveal-slogan { font-weight: 600; overflow-wrap: break-word; }

/* --- Submitted/waiting button state --- */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-waiting {
  background: var(--accent-2) !important;
  color: #06232b !important;
  opacity: 1 !important;
  cursor: default !important;
}

/* --- Round winner reveal --- */
.round-winner-card {
  max-width: 320px;
  margin: 1rem auto;
  border: 2px solid var(--accent);
  box-shadow: 0 0 24px rgba(255, 79, 216, 0.25);
}

/* --- Ranked voting / tiebreaker --- */
.medal-badge {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
}

/* --- Leaderboard --- */
.leaderboard-callout {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.leaderboard-row { margin: 0.35rem 0; display: flex; align-items: baseline; gap: 0.4rem; }
.leaderboard-rank { color: var(--text-dim); font-weight: 700; width: 1.5rem; }
.leaderboard-points { margin-left: auto; color: var(--accent-2); font-weight: 700; }
