:root {
  --bg: #0d0710;
  --bg-panel: #1c1018;
  --pink: #ec1f8f;
  --cyan: #e8b95c;
  --purple: #9b4dff;
  --yellow: #ffe94d;
  --green: #3dff9a;
  --red: #ff3d6a;
  --text: #f7ecf2;
  --text-dim: #c9a8bd;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #2a1030 0%, var(--bg) 60%);
  color: var(--text);
  font-family: 'Segoe UI', 'Arial', sans-serif;
  overflow-x: hidden;
}

body {
  background-image:
    radial-gradient(circle at 15% 15%, rgba(236, 31, 143, 0.16), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(232, 185, 92, 0.10), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(155, 77, 255, 0.10), transparent 35%);
}

#app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.title-neon {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
  color: var(--text);
  text-shadow: 0 0 8px var(--pink), 0 0 24px rgba(236, 31, 143, 0.6);
}

.title-neon.huge {
  font-size: 3.2rem;
  line-height: 1.15;
}

.hint {
  color: var(--text-dim);
  text-align: center;
  margin: 0;
}

.panel {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid rgba(155, 77, 255, 0.35);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 0 20px rgba(155, 77, 255, 0.08);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(232, 185, 92, 0.5);
}

.add-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

input[type="text"], input[type="number"], textarea {
  background: #0d0d20;
  border: 1px solid rgba(155, 77, 255, 0.4);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
  font-family: inherit;
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(232, 185, 92, 0.4);
}

#group-name-input { flex: 1; }

.group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
}

.group-list .remove-btn {
  background: none;
  border: none;
  color: var(--red);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 6px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.field-row:last-child { margin-bottom: 0; }

.field-row label { color: var(--text-dim); }
.field-row input { width: 100px; text-align: center; }

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 26px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  color: #0a0a14;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  font-family: inherit;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-pink { background: var(--pink); box-shadow: 0 0 18px rgba(255, 47, 208, 0.55); }
.btn-cyan { background: var(--cyan); box-shadow: 0 0 18px rgba(232, 185, 92, 0.55); }
.btn-success { background: var(--green); box-shadow: 0 0 22px rgba(61, 255, 154, 0.6); }
.btn-fail { background: var(--red); box-shadow: 0 0 22px rgba(255, 61, 106, 0.6); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }

.btn-big { padding: 18px 36px; font-size: 1.2rem; }
.btn-huge { padding: 26px; font-size: 1.5rem; flex: 1; border-radius: 20px; }

.btn-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.btn-row-game { width: 100%; max-width: 700px; }

.error-text {
  color: var(--red);
  font-weight: 600;
  min-height: 1.2em;
  text-align: center;
}

.top-bar {
  position: fixed;
  top: 14px;
  right: 14px;
  left: 14px;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link, .reset-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
}
.nav-link:hover { color: var(--cyan); border-color: var(--cyan); }
.reset-btn:hover { color: var(--red); border-color: var(--red); }

.words-textarea {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  line-height: 1.5;
}

.words-textarea.small { min-height: 100px; margin-bottom: 10px; }

.words-count { color: var(--text-dim); text-align: center; }

.bank-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.bank-header h2 { margin: 0; }

.btn-small { padding: 8px 14px; font-size: 0.85rem; }

.theme-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.theme-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(155, 77, 255, 0.4);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.theme-chip:hover { border-color: var(--cyan); }

.theme-chip.added {
  background: rgba(236, 31, 143, 0.18);
  border-color: var(--pink);
  color: var(--pink);
}
.theme-chip.added::after { content: ' ✓'; }

.manche-tag {
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 233, 77, 0.6);
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.group-name-huge {
  color: var(--pink);
  font-style: italic;
  text-shadow: 0 0 10px var(--pink), 0 0 40px rgba(236, 31, 143, 0.6);
}

.score-recap {
  color: var(--text-dim);
  text-align: center;
  font-size: 1.1rem;
}

.game-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-weight: 700;
}

.scores-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.score-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 700;
}

.score-chip.active {
  border-color: var(--pink);
  color: var(--pink);
  box-shadow: 0 0 12px rgba(255, 47, 208, 0.5);
}

.timer-wrap {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.timer-bar-bg {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: width 1s linear, background 0.3s ease;
}

.timer-bar.warn { background: linear-gradient(90deg, var(--yellow), var(--red)); }
.timer-bar.danger { background: var(--red); }

.timer-number {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-dim);
}

.game-word {
  font-size: 6vw;
  font-weight: 900;
  text-align: center;
  padding: 20px;
  color: var(--text);
  text-shadow: 0 0 14px var(--pink), 0 0 50px rgba(255, 47, 208, 0.6);
  min-height: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-word.buzzed {
  color: var(--red);
  text-shadow: 0 0 14px var(--red), 0 0 50px rgba(255, 61, 106, 0.7);
}

.ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: default;
}

.ranking-list li .rank-name { display: flex; align-items: center; gap: 10px; }
.ranking-list li .rank-score { color: var(--cyan); }

.ranking-list li.selectable { cursor: pointer; transition: border-color 0.15s ease; }
.ranking-list li.selectable:hover { border-color: var(--text-dim); }

.ranking-list li.eliminated-pick {
  border-color: var(--red);
  box-shadow: 0 0 14px rgba(255, 61, 106, 0.35);
}

.ranking-list li.eliminated-pick .rank-score { color: var(--red); }

.ranking-list li.winner-row {
  border-color: var(--yellow);
  box-shadow: 0 0 16px rgba(255, 233, 77, 0.4);
}

.elim-hint { margin-top: -8px; }

.pool-count { color: var(--text-dim); margin-top: 8px; font-size: 0.9rem; }

.confetti-emoji { font-size: 2.4rem; }

.winner-name { font-size: 4rem; }

@media (max-width: 640px) {
  .game-word { font-size: 9vw; }
  .title-neon.huge { font-size: 2.2rem; }
  .winner-name { font-size: 2.6rem; }
}
