:root {
  --gold: #E5BC10;
  --charcoal: #434345;
  --sand: #E2E0D7;
  --gray: #737373;
  --white: #FFFFFF;
  --black: #000000;
  --danger: #C0392B;
  --success: #2E7D32;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--charcoal);
  background: var(--white);
  letter-spacing: -0.01em;
  line-height: 1.5;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  min-height: 100vh;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-header .hex {
  width: 14px; height: 14px;
  background: var(--gold);
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.brand-header h1 {
  font-family: "Lexend", sans-serif;
  font-weight: 700;
  font-size: 20px;
  margin: 0;
  color: var(--charcoal);
}

.brand-header .tag {
  color: var(--gray);
  font-size: 12px;
  margin-left: auto;
}

h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
}

h3 { font-size: 16px; font-weight: 700; margin: 0 0 10px; }

.sub { color: var(--gray); font-size: 14px; margin: 0 0 20px; }

.card {
  background: var(--sand);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card.dark {
  background: var(--charcoal);
  color: var(--white);
}

input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #cfcbbd;
  font-size: 16px;
  font-family: inherit;
  background: var(--white);
  color: var(--charcoal);
}

input[type="text"]:focus {
  outline: 2px solid var(--gold);
  border-color: var(--gold);
}

button {
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  cursor: pointer;
  transition: opacity 0.15s ease;
  letter-spacing: -0.01em;
}

button:hover { opacity: 0.88; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--gold); color: var(--charcoal); }
.btn-dark { background: var(--charcoal); color: var(--white); }
.btn-outline { background: transparent; color: var(--charcoal); border: 1.5px solid var(--charcoal); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }

.row { display: flex; gap: 10px; align-items: center; }
.space-between { display: flex; justify-content: space-between; align-items: center; }

.room-code {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--charcoal);
  background: var(--gold);
  display: inline-block;
  padding: 6px 18px;
  border-radius: 10px;
}

.player-list { list-style: none; margin: 12px 0 0; padding: 0; }
.player-list li {
  padding: 10px 14px;
  background: var(--white);
  border-radius: 8px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.player-list .badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--charcoal);
  background: var(--gold);
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 6px;
}
.player-list .offline { color: var(--gray); font-style: italic; }

.word-display {
  font-size: 34px;
  font-weight: 700;
  text-align: center;
  padding: 24px 10px;
  background: var(--charcoal);
  color: var(--gold);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.progress-note {
  text-align: center;
  color: var(--gray);
  font-size: 14px;
  margin-top: 10px;
}

.clue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--white);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 15px;
}
.clue-row.struck .clue-text {
  text-decoration: line-through;
  color: var(--gray);
}
.clue-row .clue-name { color: var(--gray); font-size: 12px; }
.clue-row .clue-text { font-weight: 600; font-size: 16px; }

.toast {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  padding: 14px 22px;
  border-radius: 10px;
  font-weight: 700;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast.correct { background: var(--success); color: var(--white); }
.toast.incorrect { background: var(--danger); color: var(--white); }

.score-track {
  font-size: 15px;
  color: var(--gray);
}
.score-track b { color: var(--charcoal); font-size: 20px; }

.hidden { display: none !important; }

.error-banner {
  background: #FDEDEC;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}

.history-item {
  padding: 12px 14px;
  background: var(--white);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}
.history-item .result-icon { font-weight: 700; margin-right: 6px; }
.history-item.correct .result-icon { color: var(--success); }
.history-item.incorrect .result-icon { color: var(--danger); }

.rating-banner {
  text-align: center;
  padding: 30px 10px;
  background: var(--gold);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.rating-banner .big-score { font-size: 48px; font-weight: 700; }
.rating-banner .rating-label { font-size: 18px; font-weight: 700; margin-top: 4px; }

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.leaderboard-table th {
  text-align: left;
  color: var(--gray);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 8px;
  border-bottom: 2px solid var(--gold);
}
.leaderboard-table th:not(:first-child),
.leaderboard-table td:not(:first-child) {
  text-align: center;
}
.leaderboard-table td {
  padding: 8px;
  background: var(--white);
}
.leaderboard-table tr:nth-child(even) td { background: #f7f6f2; }
.leaderboard-table td.lb-name { font-weight: 600; }
.leaderboard-table td.lb-total { font-weight: 700; color: var(--charcoal); }
.leaderboard-table tr.lb-leader td { color: var(--charcoal); }
.leaderboard-table tr.lb-leader .lb-name::before { content: "👑 "; }

a.link { color: var(--charcoal); text-decoration: underline; }

@media (max-width: 480px) {
  .word-display { font-size: 26px; }
  .room-code { font-size: 30px; }
}
