:root {
  --bg: #1a1d29;
  --card: #242837;
  --card-2: #2d3244;
  --text: #eef0f6;
  --muted: #9aa1b5;
  --accent: #ffb454;
  --accent-2: #6ee7a0;
  --danger: #ff6b6b;
  --line: #3a4056;
  --radius: 14px;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 800px at 70% -10%, #2b3050 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.screen { display: none; }
.screen.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.hidden { display: none !important; }

/* ---------- Ecran principal ---------- */
.home-card {
  max-width: 420px;
  margin: 8vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.logo {
  font-size: 2.6rem;
  letter-spacing: 1px;
  color: var(--accent);
}

.tagline { color: var(--muted); margin-bottom: 10px; }

label { text-align: left; color: var(--muted); font-size: 0.9rem; }

input, select {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
  width: 100%;
}

input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }

#input-code { text-transform: uppercase; letter-spacing: 6px; text-align: center; font-weight: 700; }

.btn {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 18px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
}

.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1e1502;
  font-weight: 700;
}

.btn.small { padding: 7px 12px; font-size: 0.85rem; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

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

/* ---------- Lobby ---------- */
.lobby-card { max-width: 460px; margin: 6vh auto 0; text-align: center; }
.lobby-card h3 { margin: 20px 0 10px; }

.room-code {
  color: var(--accent);
  letter-spacing: 6px;
  font-family: "Consolas", monospace;
}

.hint { color: var(--muted); font-size: 0.9rem; margin: 6px 0; }

.player-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.player-list li {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.player-list .you { border-color: var(--accent); }
.player-list .disconnected { opacity: 0.45; }
.player-list .turn { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2); }

.tag {
  font-size: 0.72rem;
  background: var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--muted);
}

.score-value { font-weight: 700; color: var(--accent); }

.host-controls {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

/* ---------- Joc ---------- */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}

.game-main { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.game-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.85rem;
}

.badge.category { color: var(--accent); border-color: var(--accent); }

.turn-label { margin-left: auto; font-weight: 600; color: var(--accent-2); }

.timer-bar {
  width: 100%;
  height: 6px;
  background: var(--card-2);
  border-radius: 999px;
  overflow: hidden;
}

#timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent-2);
  border-radius: 999px;
  transition: width 0.25s linear;
}

#timer-fill.low { background: var(--danger); }

.budget-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 260px;
}

.budget-title { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.budget-dots { display: flex; gap: 8px; }

.budget-dots .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 2px solid var(--accent-2);
}

.budget-dots .dot.spent { background: transparent; border-color: var(--muted); opacity: 0.5; }

.budget-hint { max-width: 320px; text-align: center; }

.danger-text { color: var(--danger); font-weight: 600; }

.tag.danger { background: var(--danger); color: #2b0505; font-weight: 700; }

.kick-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  width: 24px;
  height: 24px;
  margin-left: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
}

.kick-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- Indicii ---------- */
.hints-panel {
  width: 100%;
  max-width: 480px;
  background: var(--card-2);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
}

.hints-panel h4 { color: var(--accent); font-size: 0.85rem; margin-bottom: 6px; }

.hints-panel ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }

.hints-panel li { font-size: 0.9rem; }
.hints-panel li b { color: var(--accent); font-weight: 600; }

.hint-btn { border-color: var(--accent); }
.hint-btn:disabled { border-color: var(--line); }

.word-display {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
}

.word-display .slot {
  width: 34px;
  height: 46px;
  border-bottom: 3px solid var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.word-display .slot.revealed { border-color: var(--accent); color: var(--accent); }

.keyboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 480px;
}

.key {
  width: 42px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
}

.key:hover:not(:disabled) { background: var(--line); }
.key:disabled { cursor: not-allowed; }
.key.hit { background: var(--accent-2); border-color: var(--accent-2); color: #06240f; opacity: 1; }
.key.miss { background: var(--danger); border-color: var(--danger); color: #2b0505; opacity: 0.8; }
.key.spent:disabled { opacity: 1; }
.key:disabled:not(.hit):not(.miss) { opacity: 0.4; }

.keyboard-hint { font-size: 0.78rem; }

.word-form { display: flex; gap: 10px; width: 100%; max-width: 480px; }
.word-form input { flex: 1; }

/* ---------- Panou lateral ---------- */
.game-side { display: flex; flex-direction: column; gap: 16px; }
.game-side h3 { margin-bottom: 10px; }

.chat-card { display: flex; flex-direction: column; }

.chat-log {
  height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  margin-bottom: 10px;
  padding-right: 4px;
}

.chat-log .msg b { color: var(--accent); }
.chat-log .sys { color: var(--muted); font-style: italic; }

.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; padding: 8px 10px; font-size: 0.88rem; }

/* ---------- Overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 20, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.overlay-card {
  max-width: 440px;
  width: calc(100% - 32px);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.overlay-word {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent);
}

.podium { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.podium li {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
}

.podium li:first-child { border-color: var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 30;
  max-width: 90vw;
  text-align: center;
}

.toast.error { border-color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .game-layout { grid-template-columns: 1fr; }
  .chat-log { height: 140px; }
}
