/* Phone layout (body.compact: width < 760px or height < 480px).
   Top bar with three meters, joystick bottom-left, E/I/Flex bottom-right,
   a bottom taskbar with only Start and the clock, full-screen minigames
   and a bottom-anchored keypad. */

body.compact .hud-top {
  left: 8px; right: 8px; transform: none; top: calc(6px + var(--safe-t)); border-radius: 16px;
  gap: 8px; padding: 6px 10px; justify-content: space-between;
}
body.compact .meter { flex: 1; gap: 4px; font-size: 10px; }
body.compact .meter-bar { width: auto; flex: 1; height: 9px; }
body.compact .meter-val { display: none; }
body.compact .ring-wrap { width: 26px; height: 26px; }
body.compact .strain { position: absolute; top: 100%; right: 8px; margin-top: 4px; }

/* The watch shrinks to a strip under the top bar; tasks fold into it. */
body.compact .hud-side { top: calc(50px + var(--safe-t)); left: 8px; right: 8px; width: auto; gap: 6px; }
body.compact .watch {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "clock day" "clock gains" "clock stats";
  column-gap: 10px; padding: 6px 12px; border-radius: 16px; border-width: 2px;
}
body.compact .watch-clock { grid-area: clock; font-size: 30px; align-self: center; }
body.compact .watch-day { grid-area: day; margin: 0; font-size: 12px; }
body.compact .watch-gains { grid-area: gains; }
body.compact .watch-stats { grid-area: stats; margin: 0; font-size: 11px; }
body.compact .tasks-wrap { display: none; }
body.compact .goal { font-size: 12px; padding: 6px 10px; max-height: 3.2em; overflow: hidden; }

body.compact .notes { top: auto; bottom: calc(240px + var(--safe-b)); left: 8px; right: 8px; width: auto; }
body.compact .note { font-size: 12px; padding: 7px 9px; }
body.compact .notes .note:nth-child(n+3) { display: none; }
body.compact .prompt { bottom: calc(228px + var(--safe-b)); font-size: 14px; }
body.compact.touch .prompt { display: none; } /* the E button shows the label */

body.compact .taskbar { height: calc(46px + var(--safe-b)); }
body.compact .tb-phone { display: none !important; }

/* Menus and dialogs fill the screen. */
body.compact .brand-top { font-size: 46px; }
body.compact .brand-sub { font-size: 22px; }
body.compact .menu-wrap { justify-content: flex-start; padding-top: calc(16px + var(--safe-t)); overflow: auto; }
body.compact .win { width: 100%; max-height: none; }
body.compact .dlg-wrap { justify-content: flex-end; padding: 8px 8px calc(8px + var(--safe-b)); }
body.compact .dlg-wrap .win { max-height: 88dvh; }

/* Minigames: full screen with the controls at the bottom. */
body.compact #screens.minigame > .win {
  left: 0; top: 0; transform: none; width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0;
}
body.compact .mg .win-body { flex: 1; display: flex; padding: 12px 12px calc(12px + var(--safe-b)); }
body.compact .mg .win-body > div { flex: 1; display: flex; flex-direction: column; gap: 12px; }
body.compact .mg .keypad, body.compact .mg .mg-actions:last-of-type { margin-top: auto; }
body.compact .mg .key { min-height: 72px; }
body.compact .btn.push { min-height: 96px; width: 100%; }
body.compact .lift .mg-actions { flex-direction: column; margin-top: auto; }
body.compact .lift .mg-actions .btn { width: 100%; }
body.compact .spot-cards { grid-template-columns: 1fr; }
body.compact .spot-card { flex-direction: row; text-align: left; padding: 10px 12px 10px 28px; }
body.compact .spot-card .spot-face { font-size: 36px; }
body.compact .spot-card b { min-width: 90px; }
body.compact .mg-hint { display: none; }
body.compact .rice-face { font-size: 60px; }

/* Landscape phones: keep the side HUD compact and leave room for thumbs. */
body.compact:not(.portrait) .hud-side { right: auto; width: 260px; }
body.compact:not(.portrait) .goal { display: none; }
body.compact:not(.portrait) .notes { bottom: auto; top: calc(50px + var(--safe-t)); left: auto; width: 300px; }
body.compact:not(.portrait) .prompt { bottom: 60px; }
