:root {
  color-scheme: dark;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #2e2b28;
  color: #f4f2ec;
  --bg: #2e2b28;
  --sidebar: #252320;
  --panel: #34312d;
  --panel-2: #2c2a27;
  --card: #3a3632;
  --border: #45403a;
  --border-soft: #514a43;
  --muted: #b8b0a4;
  --text: #f4f2ec;
  --accent: #81b64c;
  --accent-strong: #6aa23d;
  --accent-soft: #3c4c2f;
  --danger: #d46a5e;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --board: #272521;
  --snake: #81b64c;
  --snake-head: #a9d470;
  --food: #d46a5e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(129, 182, 76, 0.1), transparent 24%),
    linear-gradient(180deg, #322f2c 0%, #2b2926 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 18px 16px;
  border-right: 1px solid var(--border);
  background: #262320;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 6px 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #1f231a;
  font-weight: 800;
  font-size: 1.2rem;
}

.brand-eyebrow,
.sidebar-label,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: #c9c1b4;
}

.brand strong {
  display: block;
  font-size: 1.1rem;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px;
  border-radius: 12px;
  color: #ddd6cb;
  font-weight: 700;
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #3a3632;
  color: #efe8db;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.nav-item.active,
.nav-item:hover {
  background: #312d29;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #1f231a;
}

.sidebar-card {
  margin-top: auto;
  padding: 16px 14px;
  border-radius: 16px;
  background: #302d2a;
  border: 1px solid var(--border);
}

.sidebar-card.muted {
  margin-top: 0;
}

.sidebar-card strong {
  display: block;
  margin-top: 6px;
  margin-bottom: 6px;
}

.sidebar-card p:last-child {
  margin-bottom: 0;
}

.page {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.panel,
.profile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 26px;
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 320px;
  gap: 20px;
  align-items: start;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.8rem, 6vw, 4.4rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.intro,
.instructions,
.stat span,
.profile-note,
.sidebar-card p {
  color: var(--muted);
}

.profile-card {
  padding: 18px;
  background: linear-gradient(180deg, #3b3833 0%, #2f2c28 100%);
}

.profile-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.profile-note {
  margin: 12px 0 0;
  min-height: 44px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  margin-top: 18px;
}

.section-title {
  margin-bottom: 16px;
}

.game-shell,
.controls-panel {
  padding: 22px;
}

.stats {
  display: grid;
  gap: 12px;
}

.stat {
  min-width: 88px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #383530 0%, #302d29 100%);
}

.stat span,
.stat strong {
  display: block;
}

.stat span {
  font-size: 0.8rem;
}

.stat strong {
  font-size: 1.8rem;
}

.board-wrap {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--board);
  overflow: hidden;
}

.board {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 1px;
  padding: 1px;
  background: rgba(255, 255, 255, 0.03);
}

.cell {
  background: rgba(255, 255, 255, 0.04);
}

.cell.snake {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.cell.head {
  background: var(--snake-head);
}

.cell.food {
  background: var(--food);
}

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

button {
  appearance: none;
  border: 0;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #1f231a;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

.instructions {
  margin-top: 16px;
}

.controls {
  margin-top: 18px;
  display: grid;
  gap: 10px;
  justify-content: center;
}

.controls button {
  min-width: 76px;
}

.controls > button {
  justify-self: center;
}

.controls-row {
  display: flex;
  gap: 10px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .hero-top,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 14px;
  }

  .hero-card,
  .game-shell,
  .controls-panel {
    padding: 18px;
  }
}
