/* The player's game. Builds on bench.css (body.bench) for the theme, buttons and stage. */
body.game {
  header .btns { align-self: center; }
  /* Physics changed in the sandbox: always visible, one tap back to the real thing. */
  header .custom { display: inline-flex; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--gold); border-radius: 6px; color: var(--gold); }
  header .custom[hidden] { display: none; }
  header .custom a { color: var(--gold); text-decoration: none; }
  button.round { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-weight: 500; }
  button.link { background: none; border: none; padding: 0; color: var(--sky); text-decoration: underline; text-underline-offset: 3px; }

  .lvl small { color: var(--muted); font-family: var(--mono); font-size: 13px; font-weight: 400; margin-right: 6px; }
  .hintline { min-height: 1.4em; }
  .stats { color: var(--muted); font-variant-numeric: tabular-nums; }
  .stats b { color: var(--text); font-weight: 500; }
  .stats .best { font-size: 12px; }
  .bests { font-size: 12px; margin-top: 2px; }

  dialog.sheet {
    background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
    padding: 22px; width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-sizing: border-box;
    box-shadow: 0 20px 60px rgb(0 0 0 / .5);
  }
  dialog.sheet::backdrop { background: rgb(4 6 11 / .6); backdrop-filter: blur(3px); }
  dialog.sheet h2 { font-size: 22px; margin-bottom: 12px; }
  dialog.sheet .btns { justify-content: flex-end; margin-top: 16px; }
  dialog.sheet p { margin: 8px 0 0; }

  .stars { color: var(--gold); letter-spacing: .12em; }
  h2.stars { font-size: 34px; text-align: center; }
  .winrow { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; color: var(--muted); }
  .winrow span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .winrow b { color: var(--text); font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
  .winrow b.new { color: var(--gold); }
  .style { color: var(--sky); text-align: center; }
  [data-game-target="winText"] { color: var(--muted); text-align: center; }

  .howto { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 10px; line-height: 1.5; }
  .howto b { font-weight: 500; color: var(--text); }
  .howto .sw { margin: 0 2px; vertical-align: -1px; }
  .legend { font-size: 12px; margin-top: 14px; }
  .demo { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; line-height: 0; }
  .demo canvas { display: block; width: 100%; }

  /* The tutorial's coach points at Launch. */
  button.nudge { animation: nudge 1.2s ease-in-out infinite; }
  @keyframes nudge { 50% { box-shadow: 0 0 0 6px rgb(255 106 19 / .35); transform: scale(1.04); } }
  @media (prefers-reduced-motion: reduce) { button.nudge { animation: none; box-shadow: 0 0 0 3px rgb(255 106 19 / .5); } }

  .levelpath { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 55dvh; overflow-y: auto; }
  .levelpath button { width: 100%; display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; align-items: center; text-align: left; }
  .levelpath button[aria-current="true"] { border-color: var(--gold); }
  .levelpath .num { color: var(--muted); font-variant-numeric: tabular-nums; }
  .levelpath button:disabled .title { color: var(--muted); }
}

/* Portrait phones (PORTRAIT in field.js): the page fills the screen and the field turns to fit the stage. */
@media (orientation: portrait) and (max-width: 600px) {
  body.bench.game {
    height: 100dvh; box-sizing: border-box; overflow: hidden;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));

    .wrap { height: 100%; gap: 8px; }
    header { flex-wrap: nowrap; align-items: center; }
    h1 { font-size: 26px; }
    .stage { flex: 1 1 0; min-height: 0; display: grid; place-items: center; border: none; border-radius: 0; background: none; }
    .stage canvas { border-radius: 8px; }
    .bar { gap: 6px 10px; }
    .info { flex-basis: 100%; gap: 2px; }
    .lvl { font-size: 16px; }
    .hint { font-size: 12px; }
    .stats { font-size: 11.5px; }
    .bar .btns { flex: 1 1 100%; }
    .bar .btns button { flex: 1; min-height: 44px; }
  }
}
