:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: #020617;
  color: #e5e7eb;
}

.shell {
  width: 100%;
  max-width: 1080px;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
}

.container {
  width: 100%;
  max-width: 960px;
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: radial-gradient(circle at top left, #020617, #020617 55%, #020617);
  box-shadow:
    0 18px 55px rgba(15, 23, 42, 0.8),
    0 0 0 1px rgba(15, 23, 42, 0.7);
  padding: 1.35rem 1.6rem 1.2rem;
  box-sizing: border-box;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.title-pill {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
}

h1 {
  font-size: 1.9rem;
  margin: 0;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.subtitle {
  font-size: 0.9rem;
  color: #9ca3af;
  margin: 0.1rem 0 0;
}

.subtitle a {
  color: #93c5fd;
  text-decoration: none;
}

.subtitle a:hover {
  text-decoration: underline;
}

.badge-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  font-size: 0.75rem;
}

.badge {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at top left, #111827, #020617 80%);
  color: #d1d5db;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
}

.donate-banner {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.75rem;
  border: 1px dashed rgba(253, 224, 71, 0.8);
  background: rgba(133, 77, 14, 0.12);
  color: #facc15;
  max-width: 260px;
  text-align: right;
}

.donate-banner a {
  color: #fef9c3;
  text-decoration: underline;
}

.donate-banner a:hover {
  text-decoration: none;
}

.controls-row {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.btn-group {
  display: inline-flex;
  gap: 1px;
  background: rgba(55, 65, 81, 0.9);
  border-radius: 0.75rem;
  padding: 1px;
}

.btn-group button {
  border-radius: 0;
  margin: 0;
  border: none;
}

.btn-group button:first-child {
  border-top-left-radius: 0.7rem;
  border-bottom-left-radius: 0.7rem;
}

.btn-group button:last-child {
  border-top-right-radius: 0.7rem;
  border-bottom-right-radius: 0.7rem;
}

.controls input[type="text"] {
  flex: 1 1 230px;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: radial-gradient(circle at top left, #020617, #020617 65%, #020617);
  color: #e5e7eb;
  font-size: 0.9rem;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.controls input[type="text"]::placeholder {
  color: #6b7280;
}

.controls input[type="text"]:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
}

.controls button {
  padding: 0.55rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  white-space: nowrap;
  transition:
    transform 0.08s ease,
    box-shadow 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease,
    opacity 0.12s ease;
}

.controls button.secondary {
  background: #020617;
  border-color: rgba(55, 65, 81, 0.9);
  color: #e5e7eb;
}

.controls button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.85);
}

.controls button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.controls button:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.status {
  font-size: 0.82rem;
  min-height: 1.3em;
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status.info {
  background: rgba(31, 41, 55, 0.85);
  color: #e5e7eb;
}

.status.ok {
  background: rgba(22, 163, 74, 0.16);
  color: #bbf7d0;
}

.status.bad {
  background: rgba(220, 38, 38, 0.18);
  color: #fecaca;
}

.status-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.9;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}

.stat-chip {
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.9);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #d1d5db;
}

.stat-chip-label {
  opacity: 0.7;
}

.stat-chip-value {
  font-weight: 500;
}

.game-body {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr);
  gap: 1rem;
  margin-top: 0.25rem;
}

.article-card {
  border-radius: 0.9rem;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: #020617;
  padding: 0.75rem 0.8rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 220px;
}

.article-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0.15rem 0 0.1rem;
  color: #e5e7eb;
}

.article-meta {
  font-size: 0.78rem;
  color: #9ca3af;
}

.article-meta a {
  color: #93c5fd;
  text-decoration: none;
}

.article-meta a:hover {
  text-decoration: underline;
}

.article {
  line-height: 1.7;
  padding: 0.6rem;
  border-radius: 0.6rem;
  border: 1px dashed rgba(75, 85, 99, 0.9);
  background: #020617;
  max-height: 65vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.9rem;
}

.hidden-word {
  background: #020617;
  border-radius: 0.18rem;
  padding: 0 0.08rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.9);
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.9);
}

.revealed-word {
  font-weight: 500;
  color: #e5e7eb;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.panel {
  border-radius: 0.9rem;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: #020617;
  padding: 0.6rem 0.7rem 0.55rem;
}

.panel-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
  margin-bottom: 0.2rem;
}

.guess-list {
  font-size: 0.8rem;
  padding-top: 0.2rem;
  max-height: 160px;
  overflow-y: auto;
}

.guess-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  margin: 0.12rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(55, 65, 81, 0.95);
}

.guess-pill.correct {
  border-color: rgba(34, 197, 94, 0.75);
  background: radial-gradient(circle at top left,
      rgba(22, 163, 74, 0.2),
      rgba(15, 23, 42, 0.96));
}

.guess-pill span.word {
  font-weight: 500;
  font-size: 0.83rem;
}

.guess-pill span.count {
  font-size: 0.75rem;
  color: #9ca3af;
}

.footer {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #6b7280;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer code {
  font-size: 0.72rem;
  background: rgba(15, 23, 42, 0.9);
  padding: 0.1rem 0.25rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.footer span {
  opacity: 0.9;
}

@media (max-width: 900px) {
  .container {
    padding: 1.15rem 1.1rem 1rem;
  }

  .game-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .article {
    max-height: 55vh;
  }

  .badge-row {
    align-items: flex-start;
  }

  .donate-banner {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  h1 {
    font-size: 1.6rem;
  }
}

/* Scoreboard Styles */
.scoreboard-modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
}

.scoreboard-modal.active {
  display: flex;
}

.scoreboard-content {
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 1.25rem;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
}

.close-scoreboard {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 20px;
}

.close-scoreboard:hover,
.close-scoreboard:focus {
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.scoreboard-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
  color: #e5e7eb;
}

.scoreboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.scoreboard-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
}

.scoreboard-item:last-child {
  border-bottom: none;
}

.scoreboard-rank {
  font-weight: bold;
  color: #3b82f6;
  width: 30px;
}

.scoreboard-name {
  flex-grow: 1;
}

.scoreboard-score {
  font-weight: bold;
}