/* Layout for tablets and phones, reduced motion. Must load last. */

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .dgrid { grid-template-columns: 1fr 1fr; }
  .dfoot, .receiptwrap { grid-template-columns: 1fr; }
  .receiptwrap { justify-items: center; text-align: center; }
  .inside { grid-template-columns: 1fr; }
  .grid2.even { grid-template-columns: 1fr; }
  .nums.three { grid-template-columns: 1fr 1fr; }
  .cgrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .keylist { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 8px; justify-items: center; text-align: center; }
  .gauge { width: 206px; height: 206px; }
  .legend { margin-top: 2px; }
  .big { font-size: 60px; }
  .big small { font-size: 24px; }
  .bubble { margin-top: 10px; padding: 9px 14px; font-size: 14px; }
  .after { margin-top: 6px; }
  .dockhead { margin: 10px 0 8px; }
  .dbtn { min-height: 102px; padding: 9px 4px 8px; }
  .dbtn svg { height: 46px; margin-bottom: 4px; }
  .readout { justify-content: center; }
  .bubble::before { left: 50%; top: -8px; margin: 0 0 0 -7px; transform: rotate(135deg); }
  .facts { grid-template-columns: 1fr 1fr; gap: 16px 0; text-align: left; width: 100%; }
  .fact:nth-child(3) { border-left: 0; padding-left: 0; }
  .dock { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dockhead { justify-content: center; }
  .droplabel { display: none; }
}
@media (max-width: 700px) {
  html { scroll-padding-top: 0; scroll-padding-bottom: 90px; }   /* tab bar moves to the bottom on phones */
  .app { padding: max(16px, calc(env(safe-area-inset-top) + 4px)) max(14px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .live, #keysBtn, .kbdhint, .deskonly { display: none !important; }
  .mobonly { display: inline; }
  #soundBtn { margin-left: auto; }
  .ttl p { display: none; }
  .card { padding: 18px; }
  .tabs { position: fixed; top: auto; left: 0; right: 0; bottom: 0; margin: 0; border-radius: 18px 18px 0 0; border-width: 1px 0 0;
    padding: 6px 6px max(6px, calc(env(safe-area-inset-bottom) - 10px)); }   /* clear of the iPhone home indicator, without a big empty strip */
  .tab { flex-direction: column; gap: 3px; font-size: 11px; padding: 7px 2px; }
  .tab svg { width: 21px; height: 21px; }
  .tab .badge { position: absolute; top: 2px; left: calc(50% + 6px); }
  /* phones: Undo bar at the top so it never covers the drink buttons; trophy popup (click-through) above the tab bar */
  #snack { top: calc(10px + env(safe-area-inset-top)); bottom: auto; transform: translate(-50%, -160%); }
  #snack.show { transform: translate(-50%, 0); }
  #snackUndo { order: 1; }
  #snack .retime { order: 2; flex-basis: 100%; justify-content: center; }
  #achPop { top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, calc(100% + 120px)); }
  #achPop.show { transform: translate(-50%, 0); }
  .modal { place-items: end stretch; padding: 0; }
  .modal .box { width: 100%; border-radius: 24px 24px 0 0; max-height: 88vh; animation: sheetUp .3s cubic-bezier(.2,1,.3,1); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  #intro, #talk { place-items: center; padding: 16px; }
  #intro .box, #talk .box { border-radius: 24px; animation: popIn .28s ease; }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .receipt { width: 100%; max-width: 340px; }
}
@media (max-width: 760px) and (max-height: 740px) {   /* short phones: ring and number side by side so the drinks stay on screen */
  .hero { grid-template-columns: 136px 1fr; justify-items: stretch; text-align: left; gap: 6px 12px; }
  .heroL { grid-column: 1; grid-row: 1 / span 3; }
  .heroR { display: contents; }
  .gauge { width: 136px; height: 136px; }
  .legend { display: none; }
  .readout { justify-content: flex-start; gap: 6px; }
  .big { font-size: 44px; }
  .big small { font-size: 19px; }
  .bigsub { font-size: 12px; }
  .bubble { margin-top: 0; font-size: 13px; padding: 8px 12px; }
  .bubble::before { left: -8px; top: 50%; margin: -7px 0 0; transform: rotate(45deg); }
  .dockhead, .dock { grid-column: 1 / -1; }
}
@media (max-width: 370px) {   /* small phones: nothing may stick out sideways */
  .nums, .nums.three { grid-template-columns: minmax(0, 1fr); }
  .dbtn .mg { white-space: normal; font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  body main, body .top, body .big, body h1, body .gauge .ring, body .tabs, #banner .bt { animation: none !important; }
  .kofik *, .kofik, .cs { animation: none !important; }
}
