*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: #f5f5f5;
  background: radial-gradient(circle at top left, #232046, #050511 55%, #020208);
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.app-shell {
  flex: 1;
  max-width: 1200px;
  padding: 18px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 999px;
  backdrop-filter: blur(18px);
  background: linear-gradient(
    135deg,
    rgba(27, 26, 58, 0.9),
    rgba(14, 14, 38, 0.9)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #101018;
  background: radial-gradient(circle at 30% 30%, #ffdf6b, #f3a13c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4),
    0 10px 20px rgba(255, 223, 107, 0.28);
}

.brand-title {
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 15px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.glass {
  border-radius: 24px;
  background: radial-gradient(circle at top, rgba(46, 54, 104, 0.9), rgba(9, 10, 24, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(18px);
}

.game-panel {
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.65);
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
}

.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

canvas {
  border-radius: 18px;
  background: radial-gradient(circle at top, #303465, #101020 60%, #050510);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7),
    0 18px 40px rgba(0, 0, 0, 0.9);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  padding: 14px 16px 16px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
}

.leaderboard-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 9px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.02)
  );
  font-size: 13px;
}

.leaderboard-rank {
  font-weight: 600;
  margin-right: 6px;
}

.leaderboard-name {
  flex: 1;
}

.leaderboard-score {
  font-weight: 600;
}

.leaderboard-mode {
  font-size: 11px;
  opacity: 0.75;
  margin-left: 6px;
}

.help-text {
  margin: 4px 0 10px;
  font-size: 13px;
  color: rgba(232, 232, 255, 0.9);
}

.help-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: rgba(234, 234, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quote-card {
  font-size: 13px;
}

.quote-card p {
  margin: 0;
  color: rgba(232, 232, 255, 0.95);
}

.primary-btn,
.ghost-btn {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.08s ease, box-shadow 0.08s ease,
    background-color 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}

.primary-btn {
  background: linear-gradient(135deg, #ffdf6b, #f3a13c);
  color: #251a07;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.7);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.26);
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ghost-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.full-width {
  width: 100%;
  justify-content: center;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(9, 9, 18, 0.85), rgba(1, 1, 4, 0.95));
  backdrop-filter: blur(14px);
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: 100%;
  max-width: 360px;
  padding: 18px 18px 16px;
}

.modal-content h2 {
  margin: 0 0 10px;
}

.modal-score {
  margin: 0 0 12px;
  font-size: 14px;
}

.score-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.score-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.score-form input {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 7px 10px;
  background: rgba(3, 3, 10, 0.9);
  color: #fefefe;
  font-size: 13px;
}

.score-form input:focus {
  outline: none;
  border-color: #ffdf6b;
  box-shadow: 0 0 0 1px rgba(255, 223, 107, 0.5);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-panel {
    order: -1;
  }

  canvas {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 640px) {
  .top-bar {
    border-radius: 18px;
  }

  .game-header {
    gap: 6px;
  }

  .stat-value {
    font-size: 18px;
  }

  .app-shell {
    padding-inline: 12px;
  }
}

