/* Phones: the lesson is a 16:9 scene, so it plays in landscape, full screen. Portrait shows a rotate prompt.
   The frame still scales as a whole; the control strip, cards and captions are enlarged so they stay readable
   and tappable at phone scale. `html.phone` is set by mobile.js on coarse-pointer devices with a short side ≤ 600 px. */
html, body { height: 100dvh; }
#frame { touch-action: manipulation; }
:root { --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }

/* Rotate prompt, shown over everything while a phone is held upright. */
.rotate { position: fixed; inset: 0; z-index: 50; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 32px; background: var(--page); color: var(--chalk); text-align: center; font: 500 20px/1.4 var(--ui); }
.rotate svg { width: 96px; height: 96px; color: var(--task); animation: turn 2.4s ease-in-out infinite; }
@keyframes turn { 0%, 20% { transform: rotate(0); } 50%, 70% { transform: rotate(90deg); } 100% { transform: rotate(90deg); } }
.rotate p { margin: 0; max-width: 24em; color: var(--dim); }
.rotate b { display: block; margin-bottom: 6px; font-size: 24px; color: var(--chalk); }
html.phone.portrait .rotate { display: flex; }

html.phone {
  /* Frame pinned by mobile.js (--fx/--fy); the control rail stands to its right, unscaled, as tall as the scene. */
  & #frame { overflow: visible; left: var(--fx, 0px); top: var(--fy, 0px); transform: scale(var(--k)); transform-origin: 0 0; transition: none; }
  & #bar { left: 1600px; top: 0; width: 56px; height: var(--rail-h, 300px); padding: 6px 0; flex-direction: column; justify-content: flex-start; gap: 6px;
    transform: scale(calc(1 / var(--k))); transform-origin: 0 0; border-top: 0; border-left: 1px solid var(--edge); background: var(--page); }
  & #bar .icon { width: 40px; height: 40px; }
  & .step, & #bHelp, & #bFull, & .volume { display: none; }        /* phones have volume buttons; keys and full screen do not apply */
  /* Progress: the row of segments turned upright in the space between the transport and the other buttons. */
  & #bar .segs { flex: 1; width: 10px; min-width: 0; max-width: 10px; min-height: 60px; height: auto; margin: 6px 0; flex-direction: column; gap: 3px; align-items: stretch; }   /* the engine's narrow-screen rule sets min-width 80px */
  & #bar { overflow: hidden; }
  & .seg { width: 10px; height: auto; min-height: 3px; border-radius: 5px; }
  & .seg i { width: 100% !important; height: 100%; transform-origin: top; transform: scaleY(var(--p, 0)); }

  /* Bigger type and targets inside the scene (everything here is in 1600×900 units, scaled by --k ≈ 0.43). */
  & .cover .go { font-size: 40px; padding: 24px 48px; }
  & .cover small { display: none; }                            /* its text is about keys */
  & .caption { font-size: 36px; bottom: 60px; max-width: 1400px; }
  & .paused-mark div { font-size: 30px; }
  & .card { padding: 22px 28px; }
  & .kicker { font-size: 24px; }
  & .prompt { font-size: 36px; }
  & .fb { font-size: 29px; }
  & .keys { display: none; }                                    /* keyboard hints mean nothing on a touch screen */
  & .btn { font-size: 29px; padding: 14px 32px; }
  & .btn kbd, & .opt kbd { display: none; }
  & .opt { font-size: 31px; min-height: 76px; padding: 10px 28px; }
  & .card.band .mascot, & .card.side .mascot { display: none; }
  & .card.band { grid-template-columns: minmax(300px, 1fr) minmax(0, max-content) auto; grid-template-areas: "head body acts" "fb body acts"; }
  & .sound-note { font-size: 26px; }
}

/* iPhone hint: open the book from the Home Screen for a full screen. */
.a2hs { position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--sab)); z-index: 40; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--edge); color: var(--chalk); font: 500 14px/1.35 var(--ui); }
.a2hs b { color: var(--task); font-weight: 600; }
.a2hs button { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--edge); background: transparent; color: var(--dim); font-size: 18px; }
html.portrait .a2hs { display: none; }
