:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #222; background: #f5f5f5; color-scheme: light; font-synthesis: none;
  --border: #ddd; --muted: #737373;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 2px solid #555; outline-offset: 4px; }
header { height: 48px; padding: 0 22px; border-bottom: 1px solid #e3e3e3; display: flex; align-items: center; justify-content: space-between; }
.wordmark { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; letter-spacing: 2px; text-decoration: none; color: inherit; }
.mark { width: 15px; height: 15px; border: 1.5px solid #222; border-radius: 3px; position: relative; }
.mark::after { content: ""; position: absolute; inset: 3px; border: 1.5px solid #222; border-radius: 1px; }
.live-badge { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.live-badge > span { width: 5px; height: 5px; border-radius: 50%; background: #999; }
.live-badge.ready > span { background: #628768; }
.live-badge.error { color: #ad4034; }
.live-badge.error > span { background: #ad4034; }
main { width: min(100% - 36px, 510px); margin: 0 auto; }
.intro { padding: 30px 0 24px; text-align: center; }
h1 { font-size: 34px; font-weight: 400; line-height: 1.08; letter-spacing: -1.6px; margin: 0 0 14px; }
.intro p { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0; }
.game { border: 1px solid #d2d2d2; border-radius: 7px; background: white; overflow: hidden; }
.scores { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); padding: 13px 17px; }
.scores > div { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.scores > div:not(:first-child) { justify-content: flex-end; }
.scores strong { color: #262626; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.board-wrap { position: relative; aspect-ratio: 1; background: #fafafa; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: #fafafaeb; padding: 22px; }
.overlay[hidden] { display: none; }
.overlay-inner { width: 100%; max-width: 300px; }
.overline { color: var(--muted); font-size: 12px; }
h2 { font-size: 25px; font-weight: 400; letter-spacing: -.8px; margin: 13px 0 12px; }
.overlay p { font-size: 14px; line-height: 1.65; color: #737373; margin: 0 0 23px; }
.primary { background: #202020; color: #fff; border: 1px solid #202020; border-radius: 5px; font-size: 14px; padding: 10px 26px; min-width: 134px; }
.primary:hover { background: #363636; }
.primary:disabled { opacity: .45; cursor: wait; }
.overlay small { display: block; font-size: 12px; line-height: 1.6; color: #888; margin: 15px auto 0; }
.board-bottom { min-height: 49px; display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; border-top: 1px solid var(--border); }
.legend, .legend > span, .actions { display: flex; align-items: center; }
.legend { gap: 15px; font-size: 12px; color: var(--muted); }
.legend > span { gap: 6px; }
.apple-dot, .food-dot, .snake-dot { display: inline-block; width: 7px; height: 7px; border-radius: 1px; background: #ed715d; }
.apple-dot { background: #75aa58; }
.snake-dot { background: #292929; }
.actions { gap: 7px; }
.actions button { font-size: 12px; background: #fff; color: #444; border: 1px solid #ddd; padding: 5px 9px; border-radius: 4px; }
.actions button:hover { background: #f6f6f6; }
.actions button:disabled { opacity: .4; cursor: default; }
kbd, .key { font: inherit; color: #888; font-size: 10px; margin-left: 5px; }
.catch-pop { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); border: 1px solid #ddd; background: #fff; padding: 10px 16px; border-radius: 5px; font-size: 13px; color: #444; opacity: 0; pointer-events: none; transition: opacity .12s; white-space: nowrap; }
.catch-pop.show { opacity: 1; }
.play-area { position: relative; }
.model-details { position: absolute; top: 0; left: calc(100% + 24px); width: 250px; border: 1px solid var(--border); border-radius: 5px; background: #fff; font-size: 12px; }
.model-heading { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; }
.model-heading h2 { font-size: 13px; font-weight: 500; letter-spacing: 0; margin: 0; }
.model-heading > span { color: #888; font-size: 11px; }
.snake-cards { margin: 0 16px 17px; border-bottom: 1px solid #eee; }
.snake-card { padding: 12px 0; border-top: 1px solid #eee; }
.snake-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.snake-card h3 { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; margin: 0; }
.snake-card h3::before { content: ""; width: 7px; height: 7px; border-radius: 1px; background: #303030; }
#snake-card-2 h3::before { background: #65756d; }
#snake-card-3 h3::before { background: #78808e; }
.snake-length { font-size: 11px; color: #888; font-variant-numeric: tabular-nums; }
.snake-tactic { font-size: 12px; color: #666; line-height: 1.5; margin: 6px 0 0; }
.details-content { padding: 3px 16px 16px; }
.decision { font-size: 14px; color: #222; }
.details-content > p { font-size: 12px; line-height: 1.5; color: #777; margin: 6px 0 15px; }
.probabilities { display: grid; gap: 14px; }
.prob-row { display: grid; grid-template-columns: 75px 1fr 34px; gap: 8px; align-items: center; color: #888; font-size: 11px; }
.prob-row > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.prob-row.picked { color: #222; }
.prob-row[hidden] { display: none; }
.track { height: 5px; background: #eee; border-radius: 2px; overflow: hidden; }
.fill { height: 100%; background: #aaa; transition: width .15s, background .15s; }
.picked .fill { background: #333; }
.telemetry { margin-top: 20px; padding-top: 13px; border-top: 1px solid #eee; display: grid; gap: 10px; color: #888; font-size: 11px; }
.telemetry > span { display: flex; justify-content: space-between; }
.telemetry strong { color: #444; font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }
.game-note { text-align: center; color: #999; font-size: 12px; line-height: 1.6; margin: 15px 0 0; }
footer { text-align: center; padding: 22px 16px; font-size: 12px; color: #999; }
footer a { color: #777; text-decoration: none; }
footer a:hover { text-decoration: underline; }
.touch-controls { display: none; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.touch-controls > div { display: grid; gap: 8px; }
.touch-controls button { background: #fff; border: 1px solid #d5d5d5; color: #333; width: 48px; height: 42px; border-radius: 5px; font-size: 20px; touch-action: none; }
.touch-controls button:active { background: #e8e8e8; }
@media (max-width: 1119px) {
  .model-details { position: static; width: 100%; margin-top: 16px; }
  .telemetry { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (max-width: 600px) {
  header { padding: 0 16px; height: 44px; }
  .wordmark { font-size: 11px; letter-spacing: 1.6px; }
  .live-badge { font-size: 11px; }
  main { width: min(100% - 28px, 510px); }
  .intro { padding: 25px 0 21px; }
  h1 { font-size: 30px; }
  .intro p { max-width: 290px; margin: auto; font-size: 13px; }
  .scores { padding: 12px; }
  .scores > div { gap: 5px; font-size: 11px; }
  .scores strong { font-size: 12px; }
  .touch-controls { display: flex; }
  .telemetry { grid-template-columns: 1fr; }
}
@media (min-width: 601px) and (max-height: 850px) {
  main { max-width: 440px; }
  .intro { padding: 22px 0 18px; }
  h1 { font-size: 30px; margin-bottom: 10px; }
  footer { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
