:root {
  color-scheme: light;
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #0d0f14;
  --muted: #667085;
  --accent: #111827;
  --accent-dark: #0b1220;
  --border: #d6dbe8;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
}

.title {
  font-size: 1.1rem;
}

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

button {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

button.primary {
  background: var(--accent);
  color: white;
}

button.primary:hover {
  background: var(--accent-dark);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.link {
  background: none;
  color: var(--accent);
  padding: 0;
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 28px 20px 64px;
  max-width: 980px;
  margin: 0 auto;
}

.hud {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.stat {
  display: grid;
  gap: 4px;
  padding: 10px 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  min-width: 110px;
  text-align: center;
}

.stat .label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat .value {
  font-size: 1.25rem;
  font-weight: 700;
}

.stat.user .value {
  font-size: 1rem;
}

.game-wrap {
  position: relative;
  background: #f9fafc;
  border-radius: 28px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}

#game-canvas {
  width: 100%;
  max-width: 720px;
  height: auto;
  border-radius: 20px;
  background: #f6f7fb;
  border: 1px solid #e1e7f0;
  cursor: pointer;
}

.message {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.85);
  color: white;
  padding: 14px 18px;
  border-radius: 16px;
  font-weight: 600;
  text-align: center;
}

.info {
  background: var(--card);
  border-radius: 20px;
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  align-content: start;
}

.info h1 {
  margin: 0;
  font-size: 1.6rem;
}

.info p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.faq h2 {
  margin: 12px 0 6px;
  font-size: 1.1rem;
}

.faq p {
  margin: 6px 0;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal-card {
  background: white;
  padding: 28px;
  border-radius: 20px;
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.modal-card label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.modal-card input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 1rem;
}

.modal-close {
  position: absolute;
  background: white;
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  top: -18px;
  right: -18px;
  box-shadow: var(--shadow);
}

.fineprint {
  font-size: 0.8rem;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 1024px) {
  .topbar {
    padding: 14px 16px;
  }
}
