/* The phone layout also applies at narrow widths if a saved device choice is stale. */
@media (max-width: 600px) {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { width: 100%; max-width: 100%; margin: 0; }

  .app-shell {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 12px max(12px, env(safe-area-inset-right)) 32px max(12px, env(safe-area-inset-left));
  }

  .hero { display: block; text-align: center; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: .95rem; }
  .team { height: 74px; justify-content: center; margin-top: 4px; }
  .team img { width: 56px; height: 72px; }
  .team img + img { margin-left: -14px; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 14px 0 10px; }
  .ledger div { min-width: 0; padding: 9px 10px; }
  .ledger div:nth-child(even) { border-right: 0; }
  .ledger div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .ledger div:last-child { grid-column: auto; }
  .ledger strong { font-size: 1rem; }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tabs button { min-width: 0; min-height: 48px; padding: 8px 4px; font-size: .78rem; }
  .coach { font-size: .85rem; }
  .envelopes>div, .history-chart, .lesson-grid { grid-template-columns: minmax(0, 1fr); }
  .section-heading, .mix-card, .sale-ledger { align-items: stretch; flex-direction: column; }
  .mix-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cup-choice, .insurance-choice, .insurance-quote { grid-column: 1 / -1; }
  .mix-buttons button { min-width: 0; min-height: 48px; }

  #stand-view, .stand-instructions, .place-controls, .stand-board,
  .stand-board > *, .sale-ledger, .sale-picture {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .stand-instructions { gap: 4px; padding: 13px; font-size: .9rem; line-height: 1.45; }
  .stand-instructions strong { white-space: normal; }
  .place-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 13px; }
  .place-controls label { min-width: 0; font-size: .9rem; }
  .place-controls select { width: 100%; min-width: 0; min-height: 48px; font-size: 16px; }
  .place-controls p { font-size: .82rem; }

  .stand-board { display: flex; flex-direction: column; gap: 12px; }
  .stand-board .sign {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
  }
  .stand-board .sign > img,
  .stand-board .sign > span,
  .stand-board .sign .price-choice,
  .stand-board .sign .promotion-choice { display: none; }
  .stand-board .sign .smartphone-pricing { display: grid; gap: 13px; width: 100%; }
  .smartphone-pricing > div { display: grid; gap: 7px; min-width: 0; }
  .smartphone-pricing strong { font-size: .95rem; line-height: 1.2; }
  .smartphone-pricing > div > div { display: grid; gap: 6px; }
  .smartphone-price-options > div { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .smartphone-promotion-options > div { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .smartphone-discount-options > div { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stand-board .sign .smartphone-discount-options[hidden] { display: none; }
  .smartphone-pricing button {
    min-width: 0;
    min-height: 48px;
    padding: 6px 3px;
    border: 2px solid #c5a43f;
    border-radius: 10px;
    background: #fffdf7;
    box-shadow: none;
    font-size: .92rem;
    line-height: 1.1;
  }
  .smartphone-pricing button[aria-pressed="true"] {
    border-color: #4f8050;
    background: #dff3d6;
    color: #254b29;
  }
  .smartphone-pricing button:focus-visible { outline: 3px solid #285a8b; outline-offset: 2px; }
  .stand-board .sign .current-price {
    margin: 2px 0 0;
    text-align: left;
    font-size: 1rem;
  }
  .stand-board .sign small { font-size: .84rem; line-height: 1.4; }

  .stand-scene { height: clamp(270px, 78vw, 350px); min-height: 0; padding: 0; }
  .stand-scene .stand-art { object-fit: cover; }
  .customer { top: 9px; width: min(85%, 280px); min-width: 0; padding: 8px; font-size: .79rem; line-height: 1.25; }
  .customer img { width: 54px; height: 58px; }
  .stand-kid { width: 70px; height: 104px; }
  .stand-kay { left: 5%; }
  .stand-elle { right: 5%; }
  .pitcher-meter { left: 35%; bottom: 20px; width: 88px; height: 106px; }
  .cup { right: 8px; bottom: 8px; min-width: 84px; min-height: 78px; padding: 7px; }
  .cup img { width: 44px; height: 44px; }
  .cup span { font-size: .7rem; }

  .stand-board .stand-stats {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 4px 10px;
    padding: 13px;
  }
  .stand-stats > img { grid-row: 1 / 4; width: 46px; height: 68px; margin: 0; }
  .stand-stats p { margin: 0; font-size: .88rem; line-height: 1.4; }
  .sale-ledger { margin-top: 14px; padding: 14px; }
  .sale-picture { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .sale-picture-cup { grid-column: 1 / -1; }
  .sale-picture-arrow, .sale-picture-plus { display: none; }
  .sale-picture-cup, .sale-picture-box { min-width: 0; grid-template-columns: 42px minmax(0, 1fr); gap: 6px; padding: 8px; font-size: .85rem; }
  .sale-picture-cup img { width: 42px; height: 46px; }
  .sale-picture-box > span { font-size: 1.5rem; }
}

/* The same stand layout remains usable when an iPhone is rotated. */
@media (min-width: 601px) and (max-width: 900px) {
  html[data-jke-device-profile="smartphone"] .app-shell { box-sizing: border-box; width: 100%; max-width: none; }
  html[data-jke-device-profile="smartphone"] .stand-board { display: grid; grid-template-columns: minmax(0, 1fr); }
  html[data-jke-device-profile="smartphone"] .stand-board > * { min-width: 0; }
}
