/* Device layouts share one ordered stylesheet. Edit this file for all profiles. */
/* Desktop: keep the three parts of the stand visible together. */
@media (min-width: 901px) {
  html[data-jke-device-profile="desktop"] .app-shell {
    box-sizing: border-box;
    width: min(100%, 1160px);
  }

  html[data-jke-device-profile="desktop"] .stand-board {
    grid-template-columns: minmax(220px, .8fr) minmax(0, 2.4fr) minmax(220px, .95fr);
  }

  html[data-jke-device-profile="desktop"] .stand-scene {
    min-width: 0;
  }
}

/* Tablet: larger tap targets and a readable single-column stand in portrait. */
html[data-jke-device-profile="tablet"] .app-shell {
  box-sizing: border-box;
  width: 100%;
  max-width: 980px;
  padding: 28px 30px 54px;
}

html[data-jke-device-profile="tablet"] .hero h1 { font-size: 3rem; }
html[data-jke-device-profile="tablet"] .team img { width: 108px; height: 136px; }
html[data-jke-device-profile="tablet"] .tabs { gap: 10px; }
html[data-jke-device-profile="tablet"] .tabs button,
html[data-jke-device-profile="tablet"] button { min-height: 52px; }
html[data-jke-device-profile="tablet"] .ledger div { padding: 16px 18px; }
html[data-jke-device-profile="tablet"] .envelopes { padding: 16px; }
html[data-jke-device-profile="tablet"] .stand-scene { min-height: 360px; }
html[data-jke-device-profile="tablet"] .cup { min-width: 170px; min-height: 90px; }
html[data-jke-device-profile="tablet"] .history-marker { width: 36px; height: 36px; font-size: .9rem; }
html[data-jke-device-profile="tablet"] .lesson,
html[data-jke-device-profile="tablet"] .product { padding: 20px; }

@media (max-width: 900px) {
  html[data-jke-device-profile="tablet"] .stand-board {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 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 .phone-pricing { display: grid; gap: 13px; width: 100%; }
  .phone-pricing > div { display: grid; gap: 7px; min-width: 0; }
  .phone-pricing strong { font-size: .95rem; line-height: 1.2; }
  .phone-pricing > div > div { display: grid; gap: 6px; }
  .phone-price-options > div { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .phone-promotion-options > div { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .phone-discount-options > div { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stand-board .sign .phone-discount-options[hidden] { display: none; }
  .phone-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;
  }
  .phone-pricing button[aria-pressed="true"] {
    border-color: #4f8050;
    background: #dff3d6;
    color: #254b29;
  }
  .phone-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; }
}

/* Keep the stand and its price in the same reading order on small screens. */
*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
.app-shell,.view,.stand-board>*{min-width:0}
.save-tools{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;margin:12px 0;font-size:.9rem}
.save-tools p{margin:6px 0;line-height:1.5}
.save-tools details{max-width:100%}
.save-actions{display:flex;flex-wrap:wrap;gap:10px;margin:12px 0}
.save-tools input{max-width:100%}
#save-status[data-failed="true"]{padding:10px;border:2px solid #a94767;border-radius:10px;background:#fff0ef}
.first-sale ol{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;list-style:none;padding:0}
.first-sale li{padding:12px;border:2px solid var(--line);border-radius:12px;background:var(--paper)}
.first-sale li span{display:inline-grid;place-items:center;width:1.6em;height:1.6em;border-radius:50%;background:#fff2a8;font-weight:bold}
.first-sale .done{background:#eef8e8;border-color:#4f8050}
.first-sale [aria-current="step"]{border-color:#285a8b}
.first-sale p{line-height:1.5}
.extra-choice{border:1px solid var(--line);border-radius:12px;padding:12px;margin:10px 0;background:var(--paper)}
summary{cursor:pointer;font-weight:700;line-height:1.5}
.insurance-options{grid-column:1/-1;width:100%}
.insurance-options .insurance-choice{display:flex;margin-top:12px}
.insurance-options small{display:block;margin-top:8px}
.stand-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:10px 12px;background:#eef8e8;border-radius:12px;margin:12px 0}
.stand-toolbar strong{flex:1;min-width:120px}
.sign .desktop-deals{width:100%}
.sign .desktop-deals label{display:grid;gap:6px;margin-top:10px}
.sign .desktop-deals [hidden]{display:none}
.phone-pricing .phone-deals{margin:0}
.batch-comparison{padding:14px;background:#eef8e8;border-radius:12px;line-height:1.6}
button,select,summary,input[type="file"]{min-height:44px}
button,select,input{max-width:100%}
button:focus-visible,select:focus-visible,input:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid #285a8b;outline-offset:3px}
.statement-row span,.statement-row strong,.transaction strong{overflow-wrap:anywhere;min-width:0}
dialog{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}
dialog .rescue-card{overflow-wrap:anywhere}
@media(max-width:900px){
 .first-sale ol{grid-template-columns:repeat(2,minmax(0,1fr))}
 .stand-board{display:flex!important;flex-direction:column;gap:12px}
 .stand-board .sign{order:0}
 .stand-board .stand-scene{order:1;width:100%}
 .stand-board .stand-stats{order:2}
 .stand-toolbar{position:sticky;top:0;z-index:5}
 .stand-instructions{font-size:.9rem}
 .sign .desktop-deals{margin:0}
}
@media(max-width:600px){
 .sign .desktop-deals{display:none}
 .phone-pricing .phone-deals[open]>div{display:grid;gap:8px;margin-top:10px}
 .phone-pricing .phone-promotion-options>div{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
 .phone-pricing .phone-discount-options>div{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
 .stand-board .sign .phone-discount-options[hidden]{display:none}
 .stand-board .sign{padding:10px;gap:8px}
 .phone-pricing{gap:8px!important}
 .stand-scene{height:clamp(245px,68vw,300px);scroll-margin-top:70px}
 .customer{font-size:.9rem}
 .rescue-card{padding:16px}
 .dialog-actions{flex-wrap:wrap}
 .shop-grid,.toy-grid{grid-template-columns:repeat(auto-fit,minmax(min(160px,100%),1fr))}
 .first-sale li{font-size:.9rem;padding:8px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
