.ag-game {
  --ag-accent: #ff755b;
  --ag-bg: #121418;
  --ag-border: #36393f;
  --ag-ink: #f3f1ed;
  --ag-muted: #b6b6bb;
  width: min(100%, 920px);
  min-width: 0;
  margin-inline: auto;
  color: var(--ag-ink);
  color-scheme: dark;
}
.ag-game[data-game="snake"] { --ag-accent: #bada63; }
.ag-game * { box-sizing: border-box; }
.ag-dashboard {
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vw, 38px);
  margin-bottom: 12px;
}
.ag-stat { display: grid; gap: 2px; }
.ag-stat-label {
  font: 700 .75rem/1.3 ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ag-muted);
}
.ag-stat-value {
  color: var(--ag-ink);
  font: 760 clamp(1.2rem, 3vw, 1.65rem)/1.1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.ag-stat:first-child .ag-stat-value { color: var(--ag-accent); }
.ag-game button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid var(--ag-border);
  border-radius: 8px;
  background: #22252a;
  color: var(--ag-ink);
  font-family: inherit;
  font-weight: 650;
  line-height: 1.2;
  font-size: .95rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ag-game button:hover:enabled { border-color: var(--ag-accent); }
.ag-game button:active:enabled { transform: translateY(1px); }
.ag-game button:focus-visible,
.ag-game canvas:focus-visible {
  outline: 2px solid var(--ag-accent);
  outline-offset: 3px;
}
.ag-game button:disabled { opacity: .42; cursor: default; }
.ag-pause { margin-left: auto; }
.ag-icon { width: 16px; height: 16px; flex: 0 0 auto; }
.ag-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--ag-border);
  border-radius: 12px;
  background: var(--ag-bg);
}
.ag-game[data-game="snake"] .ag-screen { aspect-ratio: 24 / 14; }
.ag-game canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.ag-game canvas:focus-visible { outline-offset: -3px; }
.ag-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  background: rgba(8, 10, 12, .22);
}
.ag-game [hidden] { display: none !important; }
.ag-panel {
  width: min(100%, 355px);
  padding: clamp(15px, 3.7vw, 28px);
  text-align: center;
  background: rgba(23, 25, 29, .97);
  border: 1px solid #484a50;
  border-radius: 12px;
  box-shadow: 0 12px 38px #090b0d75;
}
.ag-panel h2 {
  margin: 0;
  color: var(--ag-ink);
  font-family: inherit;
  font-size: clamp(1.25rem, 3.5vw, 1.85rem);
  line-height: 1.12;
  letter-spacing: -.035em;
}
.ag-panel p {
  color: #cccdd0;
  margin: 8px auto 16px;
  font-size: .9375rem;
  line-height: 1.42;
}
.ag-game .ag-primary {
  border-color: var(--ag-accent);
  color: #161914;
  background: var(--ag-accent);
}
.ag-game .ag-primary:hover { filter: brightness(1.08); }
.ag-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.ag-help p { color: var(--ag-muted); font-size: .94rem; line-height: 1.5; margin: 0; }
.ag-help kbd {
  background: #23262a;
  color: var(--ag-ink);
  border: 1px solid var(--ag-border);
  border-radius: 4px;
  font: .8125rem/1.2 ui-monospace, "SFMono-Regular", Consolas, monospace;
  padding: 2px 5px;
  white-space: nowrap;
}
.ag-pad {
  display: grid;
  grid-template-columns: repeat(3, 45px);
  grid-template-rows: repeat(2, 42px);
  gap: 4px;
  flex-shrink: 0;
}
.ag-game .ag-pad button { padding: 0; min-height: 0; touch-action: none; }
.ag-pad [data-dir="up"] { grid-column: 2; }
.ag-pad [data-dir="left"] { grid-column: 1; }
.ag-pad [data-dir="down"] { grid-column: 2; }
.ag-pad [data-dir="right"] { grid-column: 3; }
.ag-pad [data-dir="down"] svg { transform: rotate(180deg); }
.ag-pad [data-dir="left"] svg { transform: rotate(-90deg); }
.ag-pad [data-dir="right"] svg { transform: rotate(90deg); }
.ag-game .ag-jump { min-width: 140px; touch-action: none; }
.ag-hint-mobile { display: none; }
@media (pointer: coarse), (max-width: 620px) {
  .ag-hint-desktop { display: none; }
  .ag-hint-mobile { display: inline; }
  .ag-screen { aspect-ratio: 4 / 3; }
  .ag-game[data-game="snake"] .ag-screen { aspect-ratio: 1.35; }
  .ag-help { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .ag-help p { text-align: center; }
  .ag-pad { align-self: center; grid-template-columns: repeat(3, 53px); grid-template-rows: repeat(2, 45px); }
  .ag-jump { align-self: center; width: min(100%, 260px); }
}
@media (max-width: 360px) {
  .ag-dashboard { gap: 11px; }
  .ag-game .ag-pause { padding-inline: 9px; }
}
