*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }

:root {
  --bg: #0e7c7b;
  --bg-dark: #095c5b;
  --card: rgba(255,255,255,0.10);
  --card-border: rgba(255,255,255,0.18);
  --text: rgba(255,255,255,0.95);
  --muted: rgba(255,255,255,0.70);
  --error: #ffd1d1;
  --btn: #f4d35e;
  --btn-text: #0a4a4a;
  --btn-disabled: rgba(244,211,94,0.40);
  --accent: #ee964b;
  --success: rgba(60,255,170,0.14);
  --success-border: rgba(60,255,170,0.28);
}

body {
  background: radial-gradient(1200px 800px at 20% 20%, rgba(255,255,255,0.08), transparent 60%),
              radial-gradient(1000px 700px at 80% 30%, rgba(0,0,0,0.15), transparent 55%),
              var(--bg);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 18px;
  min-height: 100vh;
}

.wrap {
  width: 100%;
  max-width: 560px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 24px 20px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

h1 {
  margin: 0 0 6px 0;
  font-size: 32px;
  letter-spacing: 0.5px;
  text-align: center;
}

.sub {
  margin: 0 0 18px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 14px;
  padding: 14px 24px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  background: var(--btn);
  color: var(--btn-text);
  transition: transform 0.1s, opacity 0.15s;
  text-decoration: none;
}

.btn:hover { transform: scale(1.02); }
.btn:active { transform: scale(0.98); }

.btn:disabled {
  background: var(--btn-disabled);
  cursor: not-allowed;
  transform: none;
}

.btn-full { width: 100%; }

.msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  display: none;
  font-size: 14px;
  line-height: 1.3;
}

.msg.error {
  display: block;
  background: rgba(255, 60, 60, 0.18);
  border: 1px solid rgba(255, 60, 60, 0.35);
  color: var(--error);
}

.msg.ok {
  display: block;
  background: var(--success);
  border: 1px solid var(--success-border);
  color: rgba(255,255,255,0.92);
}

.footer {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

/* ====== GAME PAGE ====== */
.game-wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 18px;
}

.game-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 22px 18px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  max-width: 720px;
  margin: 0 auto;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.pill-accent {
  background: rgba(238,150,75,0.25);
  border-color: rgba(238,150,75,0.4);
  color: #ffd4a8;
}

.muted { color: var(--muted); font-size: 13px; }

.letters {
  font-size: 56px;
  letter-spacing: 10px;
  text-align: center;
  margin: 10px 0 6px;
  font-weight: 800;
}

@media (max-width: 520px) { .letters { font-size: 40px; letter-spacing: 6px; } }

.category {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--accent);
}

input[type="text"] {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: var(--text);
  padding: 14px;
  font-size: 20px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus {
  border-color: var(--btn);
}

input[type="text"]::placeholder { color: rgba(255,255,255,0.45); }

.entry-textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: var(--text);
  padding: 14px;
  font-size: 20px;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: border-color 0.15s;
  line-height: 1.4;
}

.entry-textarea:focus {
  border-color: var(--btn);
}

.entry-textarea::placeholder { color: rgba(255,255,255,0.45); }

/* Timer bar */
.timer-bar-container {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.15);
  margin: 12px 0;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--btn);
  transition: width 1s linear;
}

.timer-bar.urgent {
  background: #ff6b6b;
}

.timer-text {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.timer-text.urgent {
  color: #ff8a8a;
}

/* Vote list */
.vote-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vote-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  border: 2px solid rgba(255,255,255,0.14);
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s;
}

.vote-item:hover:not(.disabled-self) {
  background: rgba(255,255,255,0.15);
}

.vote-item.selected {
  border-color: var(--btn);
  background: rgba(244,211,94,0.12);
}

.vote-item.disabled-self {
  opacity: 0.45;
  cursor: default;
}

.vote-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.badge {
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: rgba(244,211,94,0.25);
  border: 1px solid rgba(244,211,94,0.40);
  font-size: 13px;
  color: #ffeaa0;
}

/* Results list */
.results-list, .score-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-item, .score-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.result-item.winner {
  background: rgba(244,211,94,0.12);
  border-color: rgba(244,211,94,0.30);
}

.result-item.mine {
  opacity: 0.6;
}

.result-votes, .score-val {
  font-weight: 900;
  white-space: nowrap;
  color: var(--btn);
}

.score-item.first {
  background: rgba(244,211,94,0.15);
  border-color: rgba(244,211,94,0.35);
}

/* Champion screen */
.champion-box {
  text-align: center;
  padding: 20px 10px;
}

.champion-crown {
  font-size: 64px;
  margin-bottom: 10px;
}

.champion-name {
  font-size: 36px;
  font-weight: 900;
  color: var(--btn);
  margin-bottom: 6px;
}

.champion-score {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 20px;
}

/* Waiting dots animation */
@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60% { content: '...'; }
  80%, 100% { content: ''; }
}

.waiting-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}

/* Player count badge */
.player-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  font-size: 12px;
  color: var(--muted);
}

.section-title {
  margin-top: 18px;
  font-size: 16px;
  font-weight: 900;
}

.hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.count-line {
  text-align: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* YOU tag on scoreboards */
.you-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
}

.score-item.is-you {
  background: rgba(244,211,94,0.12);
  border: 2px solid rgba(244,211,94,0.40);
}

.center { text-align: center; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 14px; }
.mt-lg { margin-top: 20px; }
