/* A PHONE HELD SIDEWAYS (owner, 28 Nov 2026, from the iPhone app).
 *
 * "the layout, if you can see at the code area, everything is really messed
 * up ... when on the phone, the simulator side should default be hide ... it
 * need to always show when I click on it ... so we get enough space for the
 * code", "the steps should be very easy for you to click on next ... you have
 * to scroll all the way down before you can click on next", and "the serial
 * monitor also covers like a lot of space".
 *
 * A phone on its side is about 850 by 390: as wide as a small laptop's
 * window, so every desktop rule applies, and half as tall, which none of
 * them was drawn for. So the phone gets its own layer, keyed on what is
 * short, not on what is narrow, and loaded last so it wins over the rules it
 * replaces. Nothing here applies on a desktop or a phone held upright (the
 * IDE's iPhone app only turns sideways).
 *
 * A SMALL TABLET IS THAT SHAPE TOO (owner, 29 Nov 2026, from the Play app on
 * a Galaxy tablet: "it does not have updates we did"). Its screen is 1340 by
 * 800 at 1.33 pixels to the point, so the app had 1005 by 522: wider than a
 * phone and just as short, and 22 points too tall for this layer, so it got
 * the desktop's rules and a top bar whose buttons sat on each other. A touch
 * screen without a mouse (pointer: coarse, hover: none) gets this layer up
 * to 600 tall. A laptop's short window has a mouse and keeps the desktop's
 * rules, as does a tablet taller than that (an iPad is 744 or more; in the
 * app, in-app.css keeps its top bar to one row). app.js asks the same.
 *
 * The plan, in one place:
 *   - The top bar is one slim row of the project's own controls. The logo,
 *     the edition, the account and the theme are on the hub, one Back away.
 *   - Code first: the simulator is hidden until Sim is pressed (app.js
 *     setSimFocus), and the switch has two states, Blocks and Sim.
 *   - The categories are a narrow rail of icons over short names; the robot
 *     buttons are a column down the canvas's right edge, because height is
 *     what a phone lacks and width is what it has.
 *   - The simulator, when shown, has the whole width, with one row of
 *     controls.
 *   - The serial monitor is a sheet over the bottom half, with only the
 *     controls a phone needs, and it shuts with one tap.
 *   - Creating a project: Back and Next are always on screen; the steps
 *     scroll between them.
 *   - The hub's pages show what they are for without scrolling: smaller
 *     headings and cards, more of them to a row.
 *   - A dialog being typed in keeps above the keyboard (keyboard-room.js),
 *     and signing in sits there from the start.
 */

@media (max-height: 500px) and (orientation: landscape), (max-height: 600px) and (orientation: landscape) and (pointer: coarse) and (hover: none) {

  /* ------------------------------------------------- the screen's edges */

  /* Clear of the Dynamic Island or the notch, on whichever side it is, and of
     the home bar. The page covers the whole screen (index.html's
     viewport-fit=cover) and keeps its own margins by what iOS says it needs;
     in the iPhone app the island sat over the middle of the category rail.
     Nothing on a screen without an island (env() is 0 there). */
  body {
    padding-right: env(safe-area-inset-right, 0px);
    padding-left: env(safe-area-inset-left, 0px);
  }
  /* The full pages over the app are fixed to the screen's own edges, so the
     body's margins never reach them: the island sat over the League's
     sign-in, its words and its stage numbers (owner, 28 Nov 2026, from the
     iPhone app: "the camera side end up covering some of the text and
     logo"). Each keeps the same margins itself, and its background still
     reaches the edge. The portals are fixed pages only on their own; inside
     the League they move with it. */
  #league-view,
  #studio-view,
  .adp,
  .sap {
    padding-right: env(safe-area-inset-right, 0px);
    padding-left: env(safe-area-inset-left, 0px);
  }
  /* The field chooser is one over the simulator (a panel of the Practice
     tab in the hub), with its own margins as well. */
  .field-setup:not(.is-embedded) {
    padding-right: calc(env(safe-area-inset-right, 0px) + 16px);
    padding-left: calc(env(safe-area-inset-left, 0px) + 16px);
  }
  #workspace-view,
  #workspace-view.xp-workspace {
    height: calc(var(--xp-shell-height, 100vh) - env(safe-area-inset-bottom, 0px));
  }

  /* ------------------------------------------------------------ top bar */

  /* Its own height, never less: the body is a column the workspace fills,
     and a bar allowed to shrink was squeezed to 21px by the workspace's
     measured height (app.js measureChrome). */
  .topbar {
    flex: 0 0 auto;
    min-height: 0;
    height: 46px;
    padding-block: 0;
    padding-inline: 10px;
    gap: 8px;
  }
  .topbar .brand-logo { height: 24px; width: auto; }
  .topbar .secondary-button.compact,
  .topbar .topbar-pill-btn {
    min-height: 0;
    height: 34px;
  }

  /* Inside a project the bar is the project's: Back leads to everything else. */
  .topbar:has(> #project-bar:not([hidden])) > .brand,
  .topbar:has(> #project-bar:not([hidden])) > .topbar-actions { display: none; }
  #project-bar {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
  }
  #project-bar > * { flex: 0 0 auto; }
  #project-bar > #workspace-title {
    flex: 1 1 auto;
    min-width: 40px;
    overflow: hidden;
    font-size: 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  #project-bar > #save-state {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 92px;
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  #project-bar #xp-device-name,
  #project-bar .xp-device-caret,
  #project-bar #xp-connection .xp-long { display: none; }
  /* Coach keeps its icon; the word is in its tooltip and its label. */
  #open-coach { font-size: 0; gap: 0; width: 34px; padding-inline: 0; justify-content: center; }
  #open-coach svg { width: 16px; height: 16px; }

  /* Two states. Split shares a phone's width between two things too narrow
     to use; the switch is the way between them. */
  #focus-toggle .focus-tab[data-focus="split"],
  #focus-toggle .xp-long { display: none; }
  #focus-toggle .focus-tab { min-height: 0; height: 28px; padding-inline: 12px; }

  /* One project at a time: the tab row's height is the code's. */
  .project-tabs { display: none; }

  /* The hub's bar is one row (owner, 28 Nov 2026: "where we have the ID
     logo, let's have the project, home, practice, learn, and everything on
     the same line so that you can get some space"): the logo, the sections,
     then the account and the theme. The sections are icons, and the one you
     are on has its name too ("only the test home will show with the icon,
     but all the others will show just the icon"); the others' names are
     still read out. The row they had under the bar goes to the page.
     The sections sit between the logo (--xp-bar-start) and the connection,
     Remote, account and theme buttons (--xp-bar-end). */
  :root { --xp-bar-start: 160px; --xp-bar-end: 172px; }
  #hub-view > .home-nav {
    position: fixed;
    top: 0;
    right: calc(env(safe-area-inset-right, 0px) + var(--xp-bar-end));
    left: calc(env(safe-area-inset-left, 0px) + var(--xp-bar-start));
    z-index: 1000;
    height: 46px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .home-nav .home-tab { flex: 0 0 auto; min-height: 0; height: 34px; padding-inline: 10px; }
  .home-nav .home-tab:not(.is-active) { width: 34px; padding: 0; justify-content: center; }
  /* In the middle of the bar (owner: "it should be at the center"), by
     margins that give way when the row is full, so a narrow phone slides
     the row instead of cutting its start off as centring would. */
  #hub-view > .home-nav > .home-tab:first-child { margin-left: auto; }
  #hub-view > .home-nav > .home-tab-end { margin-right: auto; }
  /* About in the row, as on any screen under 900px. Pinned to the row's
     right end, it sat over Challenges on a phone wider than that: an iPhone
     Pro Max on its side is 956. */
  .home-nav .home-tab-end { position: static; transform: none; }

  /* The bar's right end, icons too: Online is its dot, and Remote and Sign
     in are their pictures, their names read out and in their tooltips. The
     edition's badge goes (owner: "the personal at the top, let's take it
     off"); About says which edition this is. */
  .topbar #edition-badge { display: none; }
  .topbar #connection-badge { gap: 0; padding-inline: 4px; }
  .topbar #use-as-remote,
  .topbar #profile-menu-button { gap: 0; width: 34px; padding: 0; justify-content: center; }
  .home-nav .home-tab:not(.is-active) > span,
  .topbar #connection-label,
  .topbar #use-as-remote > span,
  .topbar #profile-btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  /* "Start here" whole on the screen with its button, and what comes next
     showing under it (owner, 28 Nov 2026: "the start here card need to be a
     bit smaller so that it fits in the screen perfectly ... reduce the
     pattern size a little"). The art drawn to the card's height, not the
     card to the art's. */
  #panel-home { padding-top: 10px; }
  .start-here {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 14px 24px;
    border-radius: 16px;
  }
  .start-here-eyebrow { margin: 0 0 6px; font-size: 11px; }
  .start-here h1 { font-size: 36px; white-space: nowrap; }
  .start-here-copy p:not(.eyebrow) { max-width: 40ch; margin: 8px 0 12px; font-size: 13px; line-height: 1.45; }
  .start-button { min-height: 0; height: 40px; padding-inline: 24px; }
  .start-here-art { width: auto; height: 150px; max-width: none; }

  /* ------------------------------------------------- creating a project */

  /* Its own height, so the steps scroll between a head and a foot that stay:
     Next was under the fold, and nothing said there was one. */
  #wizard-view {
    height: calc(var(--xp-shell-height, calc(100vh - 46px)) - env(safe-area-inset-bottom, 0px));
    min-height: 0;
  }
  .wizard-head {
    padding: 6px 12px;
    gap: 10px;
  }
  .wizard-back { min-height: 0; height: 32px; font-size: 13px; }
  .wizard-steps { gap: 14px; }
  .wizard-step { font-size: 13px; }
  .wizard-step-mark { width: 22px; height: 22px; font-size: 12px; }
  .wizard-body { padding: 12px 14px 14px; }
  .wizard-panel h1 { font-size: 20px; }
  .wizard-lede { margin: 4px 0 12px; font-size: 13px; }
  .wizard-actions { gap: 12px; padding: 8px 14px; }
  .wizard-hint { font-size: 12px; line-height: 1.3; }
  .wizard-buttons .secondary-button,
  .wizard-buttons .primary-button { min-height: 0; height: 38px; }

  /* Step one: each type a short row, picture beside its name, all six in two
     rows of three. */
  .type-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .type-card {
    --type-card-pad: 8px;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
    min-height: 0;
    padding: 8px;
    border-radius: 12px;
  }
  .type-card-art {
    grid-row: 1 / 3;
    width: 64px;
    height: 64px;
    margin: 0;
    border-radius: 9px;
    overflow: hidden;
  }
  .type-card-art img,
  .type-card-picture { width: 100%; height: 100%; object-fit: cover; }
  .type-card-name { grid-column: 2; align-self: end; font-size: 14px; }
  .type-card-blurb { grid-column: 2; align-self: start; font-size: 12px; line-height: 1.3; }
  .type-card-choose { display: none; }
  .type-card-tick { top: 6px; right: 6px; }
  /* "Sign in to unlock" under the words, where the card has room for it. */
  .type-card-badge {
    position: static;
    grid-column: 2;
    justify-self: start;
    margin: 2px 0 0;
    padding: 1px 7px;
    font-size: 11px;
  }
  .type-card:has(.type-card-badge) { grid-template-rows: auto auto auto; }
  .type-card:has(.type-card-badge) .type-card-art { grid-row: 1 / 4; }
  .wizard-back { white-space: nowrap; }

  /* Step two: the form alone; the summary beside it is the review on a
     wide screen and a second column of the same words here. */
  .setup-columns {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 10px;
  }
  .setup-summary { display: none; }
  .setup-form { padding: 12px; border-radius: 12px; }
  .setup-name { min-height: 0; height: 40px; }
  .setup-options { gap: 8px; }
  .setup-option { flex-direction: row; gap: 8px; padding: 8px 10px; text-align: left; }
  .setup-option-art,
  .setup-option-picture { width: 32px; height: 32px; flex: 0 0 auto; }
  .setup-option-blurb { font-size: 12px; line-height: 1.3; }

  /* Step three, made: Open project and Back to home on the first screen.
     Under a 200px picture and 60px of space they were below the fold, and
     the step said "Open it now" over nothing to press. */
  .wizard-creating { padding-top: 4px; }
  .creating-art { margin-bottom: 4px; }
  .creating-art img { width: 92px; }
  .creating-actions { margin-top: 10px; }
  .creating-actions .primary-button,
  .creating-actions .secondary-button {
    min-height: 0;
    height: 40px;
    padding: 0 20px;
    font-size: 14px;
  }

  /* ------------------------------------------------------ the workspace */

  #workspace-view.xp-workspace {
    --palette-open-width: 64px;
    --palette-folded-width: 64px;
  }
  /* Code first: the simulator has no column until it is asked for. */
  #workspace-view.xp-workspace[data-view="blocks-focus"] {
    --palette-open-width: 64px;
    grid-template-columns: var(--palette-rail-width) minmax(0, 1fr) 0px;
  }
  /* Hidden at its full size, behind the code, not squeezed to nothing: a
     camera framed in a column 0px wide showed the field off to one side when
     Sim was pressed. The whole workspace is the size it will have. */
  #workspace-view.xp-workspace[data-view="blocks-focus"] > #simulate-view {
    position: absolute;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
  }
  /* And the simulator has the whole width when it is. */
  #workspace-view.xp-workspace[data-view="simulator-focus"] {
    --palette-open-width: 0px;
    grid-template-columns: 0px 0px minmax(0, 1fr);
  }
  #workspace-view.xp-workspace[data-view="simulator-focus"] > .xp-palette-rail,
  #workspace-view.xp-workspace[data-view="simulator-focus"] > #blockly-canvas,
  #workspace-view.xp-workspace[data-view="simulator-focus"] > #action-bar,
  #workspace-view.xp-workspace[data-view="simulator-focus"] > #code-view,
  #workspace-view.xp-workspace[data-view="simulator-focus"] > #editor-shell { visibility: hidden; }

  /* The switch does what the seams and the peek did on a wide screen. */
  #workspace-view.xp-shell .xp-fold,
  #workspace-view.xp-shell .xp-grip-palette,
  #workspace-view.xp-shell .xp-sim-peek { display: none; }

  /* The categories: an icon over a short name, the way a tablet's block
     editors show them, and scrolling when there are more than fit. */
  #workspace-view.xp-shell > .xp-palette-rail {
    gap: 2px;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #workspace-view.xp-shell > .xp-palette-rail button,
  #workspace-view.xp-shell[data-palette="folded"] .xp-palette-rail button {
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 0;
    height: 50px;
    padding: 4px 2px;
    border-radius: 10px;
  }
  #workspace-view.xp-shell .xp-cat-icon { width: 22px; height: 22px; }
  #workspace-view.xp-shell > .xp-palette-rail .xp-cat-label,
  #workspace-view.xp-shell[data-palette="folded"] .xp-cat-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* The robot buttons: a column down the canvas's right edge, not a strip
     across its top. The strip took a sixth of a phone's height from the
     blocks; the column takes a sliver of its width. */
  #workspace-view.xp-shell[data-language="blocks"]:has(> #action-bar:not([hidden])),
  #workspace-view.xp-shell[data-language="text"] {
    --xp-code-strip: 0px;
  }
  #workspace-view.xp-shell[data-language="blocks"]:has(> #action-bar:not([hidden])) > #blockly-canvas,
  #workspace-view.xp-shell[data-language="blocks"]:has(> #action-bar:not([hidden])) > #code-view,
  #workspace-view.xp-shell[data-language="text"] > #editor-shell {
    padding-top: 0;
    padding-right: 50px;
    background-image: linear-gradient(var(--xp-border), var(--xp-border));
    background-position: right 49px top 0;
    background-size: 1px 100%;
    background-repeat: no-repeat;
  }
  #workspace-view.xp-shell:is([data-language="text"], [data-language="blocks"]) > #action-bar {
    top: 6px;
    right: 6px;
  }
  #workspace-view.xp-shell > .action-bar,
  #workspace-view.xp-shell > .action-bar .action-group {
    flex-direction: column;
  }
  #workspace-view.xp-shell:is([data-language="text"], [data-language="blocks"]) > #action-bar .action-group,
  #workspace-view.xp-shell:is([data-language="text"], [data-language="blocks"]) > #action-bar[data-ready="true"] .action-group {
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
  }
  #workspace-view.xp-shell:is([data-language="text"], [data-language="blocks"]) > #action-bar .action-button,
  #workspace-view.xp-shell:is([data-language="text"], [data-language="blocks"]) > #action-bar[data-ready="true"] .action-button {
    width: 38px;
    height: 38px;
  }
  /* Its menus open to the left of the column, inside the canvas, and
     upwards from the column's foot, where connect is: opened downwards
     from there, Connectivity ran off the bottom of the screen (owner, 28
     Nov 2026, from the iPhone: "when you click on it, I think some part of
     it is hiding"). Never taller than the workspace; it scrolls inside. */
  #workspace-view.xp-shell:is([data-language="text"], [data-language="blocks"]) > #action-bar .connect-popover {
    top: auto;
    right: calc(100% + 8px);
    bottom: 0;
    left: auto;
    max-height: calc(var(--xp-shell-height, 100vh) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* ------------------------------------------------------- the simulator */

  /* One row of controls under the picture. Run selected, a desktop's
     shortcut, goes: a phone runs the program. */
  #workspace-view.xp-shell .sim-controls {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 6px 8px;
    overflow-x: auto;
  }
  #workspace-view.xp-shell .sim-controls > button {
    flex: 0 0 auto;
    min-height: 0;
    height: 34px;
    padding-inline: 12px;
    font-size: 14px;
  }
  #workspace-view.xp-shell #sim-run-selected { display: none; }
  /* The camera's buttons: smaller, and the two a pinch does already go. */
  #workspace-view.xp-shell .sim-rail { gap: 4px; top: 8px; right: 8px; }
  #workspace-view.xp-shell .sim-rail .rail-button { width: 32px; height: 32px; }
  #workspace-view.xp-shell #rail-in,
  #workspace-view.xp-shell #rail-out { display: none; }
  /* The field's name top left. Simulator Focus puts it top right, out of
     the way of a desktop's camera buttons, which it moves to the left; on a
     phone they stay down the right edge, and the name was drawn under them. */
  #workspace-view.xp-shell[data-view="simulator-focus"] .sim-where {
    right: auto;
    left: 14px;
    align-items: flex-start;
    text-align: left;
  }

  /* ------------------------------------------ a lesson's guide in a project */

  /* A Try it lesson's guide beside its practice project. Under 960px wide it
     was a sheet over three-quarters of the screen, edge to edge, with its
     close button under the island, and every phone on its side is under 960.
     On a phone it is a column on the right, as on a desktop: the blocks stay
     in view beside it, and the robot buttons stay at the canvas's right edge,
     to its left. It is clear of the island and the home bar. */
  :root { --xp-guide-width: min(290px, 36vw); }
  .learning-practice-rail {
    inset: 52px calc(env(safe-area-inset-right, 0px) + 6px) calc(env(safe-area-inset-bottom, 0px) + 6px) auto;
    width: var(--xp-guide-width);
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
  }
  /* The robot buttons are placed in the grid's own area, so the padding
     brings them in with the canvas. */
  body.has-learning-practice-rail #workspace-view { padding-right: calc(var(--xp-guide-width) + 12px); }
  .learning-practice-rail > header p { margin-bottom: 2px; font-size: 10px; }
  .learning-practice-rail > header h2 { font-size: 17px; }
  .learning-practice-rail > header button { flex-basis: 30px; width: 30px; height: 30px; font-size: 18px; }
  .learning-practice-rail .learning-practice-course { margin: 0; font-size: 12px; }
  .learning-practice-rail section { padding: 8px 10px; border-radius: 12px; }
  .learning-practice-rail section h3 { margin-bottom: 4px; font-size: 11px; }
  .learning-practice-rail section p { font-size: 13px; line-height: 1.45; }
  .learning-practice-steps { gap: 6px; }
  .learning-practice-steps li { padding: 8px; border-radius: 10px; }
  .learning-practice-steps label { font-size: 13px; line-height: 1.4; }
  .learning-practice-steps small { font-size: 12px; line-height: 1.4; }
  .learning-practice-open {
    top: 60px;
    right: env(safe-area-inset-right, 0px);
    min-height: 0;
    padding: 8px 10px;
    font-size: 13px;
  }

  /* ------------------------------------------------- the serial monitor */

  /* A sheet over the lower half, the code still above it, shut with × or
     the button that opened it, which it leaves uncovered: from the rail to
     the robot buttons' column. The desktop centres the dock with a
     translate, which here put half of it off the screen. */
  #workspace-view .dock {
    position: absolute;
    z-index: 60;
    grid-column: 2 / -1;
    grid-row: 1 / -1;
    top: auto;
    right: 50px;
    bottom: 0;
    left: 0;
    width: auto;
    transform: none;
    height: 56%;
    max-height: none;
    margin: 0;
    border-radius: 14px 14px 0 0;
    border-bottom: 0;
    box-shadow: 0 -10px 28px rgb(0 0 0 / .18);
  }
  /* Over the simulator there is no column of buttons to leave clear. */
  #workspace-view.xp-workspace[data-view="simulator-focus"] .dock { right: 0; }
  .dock-tabs {
    gap: 2px;
    padding: 4px 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .dock-tab { min-height: 0; height: 30px; padding: 0 10px; font-size: 13px; }
  .serial-bar { gap: 4px; margin-left: auto; }
  .serial-bar #serial-baud,
  .serial-bar .serial-status,
  .serial-bar #serial-view,
  .serial-bar #serial-find,
  .serial-bar .serial-toggle:has(#serial-times),
  .serial-bar #serial-copy,
  .serial-bar #serial-save { display: none; }
  .serial-connect { min-height: 0; height: 30px; padding-inline: 10px; font-size: 13px; }
  .dock-close { width: 34px; height: 30px; }
  .dock-pane { padding: 6px 10px; }
  .serial-log { font-size: 12px; }
  .serial-send input { min-height: 0; height: 34px; }
  .serial-send button { min-height: 0; height: 34px; }

  /* ------------------------------------------------------ the hub's pages */

  /* Owner, 28 Nov 2026, with a screenshot of every page: "reduce the space
     at the top, reduce the card ... without me even scrolling", "three
     practice field on the row", and Learn's "whole lot of things" at the
     top. Each page's heading is a line, not a block, and its cards are
     small enough that a screenful shows several. */
  #hub-view > .home-panel { padding-top: 10px; }
  #hub-view .section-heading { align-items: center; padding-bottom: 8px; }
  #hub-view .section-heading .eyebrow { display: none; }
  #hub-view .section-heading h2,
  #hub-view .strip-title,
  #hub-view .learning-home-row h2 { font-size: 19px; }
  #hub-view .section-heading .secondary-button {
    display: inline-flex;
    align-items: center;
    min-height: 0;
    height: 32px;
    padding: 0 14px;
  }
  #hub-view .section-heading > div > p,
  #hub-view .section-heading-side p { font-size: 12px; }
  #hub-view .status:empty { display: none; }
  #hub-view .form-note { margin: 6px 0; font-size: 12px; }

  /* Project cards, on My projects and the home page alike: four to a row. */
  .project-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
  .project-card { border-radius: 12px; }
  .project-visual { height: 64px; }
  .project-card .type-badge { top: 6px; left: 6px; padding: 1px 6px; font-size: 9px; }
  .project-card .card-more { top: 4px; right: 4px; width: 24px; height: 24px; }
  .project-card .card-more svg { width: 14px; height: 14px; }
  .project-body { padding: 6px 10px 8px; }
  .project-meta { gap: 4px; font-size: 10px; }
  .project-meta > * { padding-block: 1px; font-size: 10px; }
  .project-body h3 { margin: 4px 0 0; overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
  .project-body .target { margin: 2px 0 0; overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
  .project-body .card-footer { margin-top: 6px; padding-top: 6px; font-size: 11px; }

  /* The home page under Start here: Continue learning, the recent
     projects, and Your robots with Import, together on one screen
     ("let's have all of them showing at the screen at once"). Your robots
     and Import go beside Continue learning as two tiles, and the heading
     over Continue learning goes: its card says what it is. */
  #panel-home {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "hero hero"
      "learn more"
      "head head"
      "strip strip";
    column-gap: 10px;
  }
  #panel-home > .start-here { grid-area: hero; }
  #panel-home > .learning-home-row { grid-area: learn; }
  #panel-home > .home-cards { grid-area: more; }
  #panel-home > .strip-head { grid-area: head; }
  #panel-home > #recent-strip { grid-area: strip; }
  .learning-home-row { margin-top: 10px; }
  .learning-home-row > h2 { display: none; }
  #panel-home > .home-cards {
    grid-template-columns: repeat(2, 112px);
    align-self: stretch;
    margin-top: 10px;
  }
  #panel-home .home-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 8px 12px;
  }
  #panel-home .home-card p { display: none; }
  #panel-home .home-card h3 { font-size: 14px; line-height: 1.2; }
  /* The strip's cards: the picture, the name and what it is for; whether it
     is saved is on My projects. */
  .recent-strip .project-card .card-footer { display: none; }
  .lh-home {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
  }
  .lh-home .lh-track-icon { width: 34px; height: 34px; }
  .lh-home .lh-home-copy h3 { margin: 0; font-size: 14px; }
  .lh-home .lh-home-copy p { display: none; }
  .lh-home .lh-home-copy h3 { line-height: 1.25; }
  .lh-home .lh-home-copy .lh-eyebrow,
  .lh-home .lh-home-copy small { font-size: 10px; }
  .lh-home .lh-button {
    grid-column: auto;
    grid-row: auto;
    justify-self: end;
    width: auto;
    min-height: 0;
    height: 34px;
    padding-inline: 14px;
    font-size: 13px;
  }
  .strip-head { align-items: center; margin-top: 12px; padding-bottom: 6px; }
  .strip-head .strip-title,
  .learning-home-row .strip-title { margin: 0; }
  .recent-strip .project-card .project-visual,
  .project-grid .project-card .project-visual { height: 64px; }
  .strip-chip { min-height: 0; height: 28px; padding-inline: 10px; font-size: 12px; }
  .recent-strip { gap: 10px; }
  .recent-strip > .project-card,
  .recent-strip > .recent-new { flex: 0 0 150px; width: 150px; min-height: 0; }
  .recent-new { gap: 4px; border-radius: 12px; }
  .recent-new .recent-plus { font-size: 22px; }
  .recent-new .recent-new-label { font-size: 13px; }
  .home-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
  }
  .home-card { padding: 10px 14px; border-radius: 12px; }
  .home-card h3 { margin: 0; font-size: 15px; }
  .home-card p { margin: 2px 0 0; font-size: 12px; line-height: 1.35; }

  /* Robots: the whole range on one screen. */
  .robot-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
  .robot-card { padding: 8px 12px 10px; border-radius: 12px; }
  .robot-card .robot-art { height: 110px; margin: -8px -12px 8px; }
  .robot-card .robot-art img { height: 100%; object-fit: contain; }
  .robot-card h3 { margin: 2px 0 0; font-size: 15px; }
  .robot-card p { margin: 2px 0 0; font-size: 12px; }
  .robot-card .robot-version,
  .robot-card .robot-status { font-size: 11px; }

  /* Practice: the fields three to a row, the chosen one beside them in a
     column of its own that scrolls, instead of above them, 1,400px tall. */
  .field-setup.is-embedded { padding: 8px 12px 12px; }
  .field-setup.is-embedded .fs-top { display: none; }
  .fs-head { margin: 0 0 8px; text-align: left; }
  .fs-head h1 { font-size: 19px; }
  .fs-head p { display: none; }
  .fs-body { grid-template-columns: minmax(0, 1fr) 230px; gap: 10px; }
  .fs-panel,
  .field-setup.is-embedded .fs-panel {
    position: sticky;
    top: 8px;
    order: 0;
    max-height: calc(var(--xp-shell-height, 100vh) - 24px);
    padding: 10px;
    overflow-y: auto;
    border-radius: 12px;
  }
  /* The chosen field's buttons at the top of its panel, under "Selected
     field": at the foot they were under the robot's setup and its sensors,
     below the screen, a scroll away that nothing showed. */
  .fs-panel { display: flex; flex-direction: column; }
  /* Each part its own height, the panel scrolling: a column of a limited
     height otherwise squeezes the picture to nothing. */
  .fs-panel > * { flex-shrink: 0; }
  .fs-panel > .fs-panel-head { order: -2; }
  .fs-panel .fs-actions {
    order: -1;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 0 0 8px;
  }
  .fs-panel .fs-actions .fs-button { gap: 4px; padding: 8px 6px; font-size: 12px; }
  .fs-panel .fs-actions .fs-button svg { width: 14px; height: 14px; }
  .fs-panel-head h2 { font-size: 14px; }
  .fs-panel-thumb { max-height: 120px; overflow: hidden; }
  .fs-panel h3 { margin-top: 8px; font-size: 15px; }
  .fs-panel h4 { margin-top: 10px; font-size: 12px; }
  .fs-search { margin-bottom: 6px; }
  .fs-search input { min-height: 0; height: 34px; font-size: 13px; }
  .fs-chips {
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .fs-chips > * { flex: 0 0 auto; min-height: 0; height: 30px; padding-inline: 10px; font-size: 12px; }
  .fs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .fs-card { gap: 4px; padding: 6px; border-radius: 10px; }
  /* A field is a wide picture; drawn wide, two rows of three show at once. */
  .fs-card .fs-thumb { height: 72px; aspect-ratio: auto; overflow: hidden; }
  .fs-card .fs-thumb svg,
  .fs-card .fs-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .fs-card > * { margin-block: 0; }
  .fs-card .fs-tag { align-self: flex-start; padding: 1px 6px; font-size: 10px; }
  .fs-card .fs-card-foot { margin-top: auto; padding-top: 2px; font-size: 11px; }
  /* The search and the kinds on one line above the fields. */
  .fs-browse {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    grid-template-areas:
      "search chips"
      "grid grid"
      "foot foot";
    column-gap: 8px;
    align-items: center;
  }
  .fs-browse > .fs-search { grid-area: search; margin: 0 0 8px; }
  .fs-browse > .fs-chips { grid-area: chips; }
  .fs-browse > .fs-grid { grid-area: grid; }
  .fs-browse > .fs-foot { grid-area: foot; }
  .fs-card h3 { margin: 2px 0 0; font-size: 13px; }
  .fs-card p { margin: 0; font-size: 11px; line-height: 1.3; }

  /* Learn: the studio's tabs and the learner's numbers on one slim row
     where three rows were; the trail of where you are is the tab that is
     lit. */
  .lh-top {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
  }
  .lh-top .lh-crumbs { display: none; }
  .lh-top .lh-tabs { display: flex; flex: 1 1 auto; width: auto; min-width: 0; gap: 4px; }
  .lh-top .lh-tabs button { min-height: 0; height: 32px; padding-inline: 10px; font-size: 13px; }
  .lh-top .lh-tabs button svg { width: 15px; height: 15px; }
  .lh-top-stats { flex: 0 0 auto; flex-wrap: nowrap; gap: 10px; font-size: 13px; }
  .lh-top-stats .lh-pill { padding: 2px 8px; font-size: 11px; }
  .lh-page { padding-top: 8px; }
  .lh-page-head { margin-bottom: 8px; }
  .lh-page-head h1 { font-size: 20px; }
  .lh-page-head p { display: none; }
  /* Under the studio's own selectors (.lh …), which outrank plain ones. */
  .lh.lh-studio .lh-continue { padding: 12px 18px; border-radius: 14px; }
  .lh.lh-studio .lh-continue .lh-continue-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; align-items: center; }
  .lh.lh-studio .lh-continue .lh-continue-copy > .lh-eyebrow,
  .lh.lh-studio .lh-continue .lh-continue-copy > h2,
  .lh.lh-studio .lh-continue .lh-continue-copy > p { grid-column: 1; margin: 0; }
  .lh.lh-studio .lh-continue .lh-continue-copy > .lh-eyebrow { font-size: 10px; }
  .lh.lh-studio .lh-continue .lh-continue-copy > h2 { font-size: 22px; line-height: 1.15; }
  .lh.lh-studio .lh-continue .lh-continue-copy > p { font-size: 12px; }
  .lh.lh-studio .lh-continue .lh-continue-copy > .lh-button {
    grid-column: 2;
    grid-row: 1 / 4;
    min-height: 0;
    height: 36px;
    margin: 0;
    padding-inline: 14px;
    font-size: 13px;
  }
  .lh.lh-studio .lh-row-head { margin-top: 12px; }
  .lh.lh-studio .lh-row-head h2 { font-size: 17px; }
  .lh.lh-studio .lh-filters button { min-height: 0; height: 30px; font-size: 12px; }
  .lh.lh-studio .lh-course-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .lh.lh-studio .lh-course-card { border-radius: 12px; }
  .lh.lh-studio .lh-course-card .lh-course-art { height: 64px; }
  .lh.lh-studio .lh-course-card .lh-course-art .lh-track-icon { width: 42px; height: 42px; }
  .lh.lh-studio .lh-course-card .lh-course-art .lh-track-icon img { width: 28px; height: 28px; }
  .lh.lh-studio .lh-course-card .lh-course-body { gap: 4px; padding: 8px 10px 10px; }
  .lh.lh-studio .lh-course-card h3 { margin: 0; font-size: 14px; }
  .lh.lh-studio .lh-course-card .lh-level { font-size: 11px; }
  .lh.lh-studio .lh-course-card p { margin: 0; font-size: 12px; line-height: 1.35; }
  .lh.lh-studio .lh-course-card .lh-course-progress { margin-top: 2px; padding-top: 0; }
  .lh.lh-studio .lh-course-card .lh-course-progress b { font-size: 12px; }
  .lh.lh-studio .lh-course-card .lh-course-foot {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 4px;
  }
  .lh.lh-studio .lh-course-card .lh-course-foot > span { font-size: 12px; }
  .lh.lh-studio .lh-course-card .lh-course-foot .lh-button { width: auto; min-height: 0; height: 30px; padding-inline: 12px; font-size: 12px; }

  /* A lesson, compact (owner, 28 Nov 2026, of a lesson on the iPhone: "the
     information here is a lot let make it compact and clean"). The lesson's
     words began 505px down a 440px screen, under its title, a summary and
     three badges, the course's progress in words and pills, and the steps
     as large buttons. Now one row says where you are, the lesson's name on
     the left and the course's lessons on the right; the steps are a slim
     row under it (still sticky as you read); and the lesson starts at once.
     The summary and "Simulator ready" go: the lesson says both. */
  .lh .lh-lesson-main {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }
  .lh .lh-lesson-main > * { grid-column: 1 / -1; }
  /* The time and the points on the small line over the name, so the name
     has the row's width: beside it they cut it short. */
  .lh .lh-lesson-main > .lh-lesson-head {
    display: grid;
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "eyebrow meta"
      "title title";
    gap: 2px 12px;
    align-items: center;
    min-width: 0;
  }
  .lh .lh-lesson-head > div:first-child { display: contents; }
  .lh .lh-lesson-head .lh-eyebrow { grid-area: eyebrow; }
  .lh .lh-lesson-head h1 { grid-area: title; }
  .lh .lh-lesson-head .lh-head-meta { grid-area: meta; }
  .lh .lh-lesson-main > .lh-pathbar {
    grid-column: 2;
    grid-row: 1;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 4px 4px 4px 10px;
    border-radius: 12px;
  }
  .lh .lh-lesson-head .lh-eyebrow { margin: 0; font-size: 10px; }
  .lh .lh-lesson-head h1 {
    overflow: hidden;
    font-size: 20px;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .lh .lh-lesson-head .lh-sub,
  .lh .lh-lesson-head .lh-ready,
  .lh .lh-lesson-main > .lh-pathbar .lh-pathbar-text { display: none; }
  .lh .lh-lesson-head .lh-head-meta { flex-wrap: nowrap; gap: 10px; font-size: 11px; line-height: 1; }
  .lh .lh-lesson-head .lh-head-meta svg { width: 12px; height: 12px; }
  .lh .lh-lesson-head .lh-meta-time,
  .lh .lh-lesson-head .lh-meta-xp { gap: 4px; font-size: 11px; }
  .lh .lh-pathbar-pills { gap: 8px; }
  .lh .lh-pathbar-pills li + li::before { width: 6px; }
  .lh .lh-pill-step { width: 22px; height: 22px; font-size: 11px; }
  .lh .lh-pill-step.is-current { box-shadow: 0 0 0 3px var(--ls-peach); }
  .lh .lh-pill-step svg { width: 11px; height: 11px; }
  .lh .lh-pathbar-more summary { min-height: 0; height: 30px; padding: 0 8px; font-size: 13px; }
  .lh .lh-stepper { padding: 2px 0; }
  .lh .lh-stepper ol { gap: 4px; padding: 3px; border-radius: 12px; }
  .lh .lh-stepper button {
    gap: 6px;
    min-height: 0;
    height: 32px;
    padding: 0 6px;
    border-radius: 9px;
    font-size: 13px;
  }
  .lh .lh-step-mark { width: 20px; height: 20px; font-size: 11px; }
  .lh .lh-step-mark svg { width: 11px; height: 11px; }
  .lh .lh-stepper li.is-current .lh-step-mark i { width: 7px; height: 7px; }

  /* The League's sign-in: its story beside the form, both on one screen. */
  #league-view .lg-access {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    padding: 12px 18px;
  }
  #league-view .lg-access-brand img { width: 110px; margin-bottom: 8px; }
  #league-view .lg-access-brand .lg-eyebrow { font-size: 10px; letter-spacing: 3px; }
  #league-view .lg-access h1 { margin: 4px 0; font-size: 24px; }
  #league-view .lg-access-brand .lg-subtitle { margin: 0; font-size: 13px; line-height: 1.4; }
  #league-view .lg-access-stages { gap: 6px; margin-top: 10px; }
  #league-view .lg-access-stage { gap: 10px; }
  #league-view .lg-access-stage i { width: 24px; height: 24px; font-size: 11px; }
  #league-view .lg-access-stage b { font-size: 13px; }
  #league-view .lg-access-stage small { font-size: 11px; }
  #league-view .lg-access-card { gap: 10px; padding: 16px; }
  #league-view .lg-access-card h2 { font-size: 18px; }
  #league-view .lg-access-card .lg-field input { min-height: 0; height: 40px; }
  #league-view .lg-access-card .lg-field-hint { font-size: 12px; }
  #league-view .lg-access-card .lg-button { min-height: 0; height: 40px; }
  #league-view .lg-access-links { gap: 12px; margin-top: 0; }
  #league-view .lg-access-links .lg-text-link { min-height: 0; height: 32px; }

  /* ------------------------------------------- dialogs and the keyboard */

  /* The keyboard and its bar cover more than half of a phone held sideways,
     and iOS slid the page up under a dialog to show the box being typed in
     (owner: "the keypad is like covering a lot of parts. So even when you
     hide the keypad, it's still not showing"). While a box in a dialog is
     typed in, keyboard-room.js marks the dialog and says which part of the
     screen the keyboard leaves: the dialog keeps to that part, at its top,
     and scrolls inside itself if it is taller. */
  dialog[open][data-keyboard] {
    margin-top: calc(var(--xp-visible-top, 0px) + 8px);
    margin-bottom: auto;
    max-height: calc(var(--xp-visible-height, 100dvh) - 16px);
    overflow-y: auto;
  }

  /* Signing in: the words beside the code box, not above it, and at the top
     of the screen, so the box and its buttons are above where the keyboard
     comes up before it does. The box was 355px tall, centred on a 393px
     screen; it is about 150 now, and the keyboard leaves about 170. Clear of
     the island on both sides, whichever side it is on. */
  #signin-dialog[open] {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 22px;
    align-content: start;
    width: min(calc(100vw - 2 * max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)) - 24px), 760px);
    margin-top: calc(var(--xp-visible-top, 0px) + 8px);
    margin-bottom: auto;
    max-height: calc(var(--xp-visible-height, 100dvh) - 16px);
    overflow-y: auto;
    padding: 14px 18px;
    border-radius: 16px;
  }
  #signin-dialog > .eyebrow,
  #signin-dialog > h2,
  #signin-dialog > #signin-step { grid-column: 1; }
  #signin-dialog > form { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
  #signin-dialog > .eyebrow { margin-bottom: 2px; font-size: 11px; }
  #signin-dialog > h2 { margin-bottom: 4px; font-size: 20px; }
  #signin-dialog > #signin-step { align-self: start; margin: 0; font-size: 13px; line-height: 1.4; }
  #signin-dialog .field { margin: 0; }
  #signin-dialog .field > span { margin-bottom: 4px; font-size: 12px; }
  #signin-dialog .signin-code-input {
    height: 46px;
    min-height: 0;
    padding: 0 12px;
    font-size: 20px;
    border-radius: 12px;
  }
  #signin-dialog #signin-name-input { height: 40px; min-height: 0; }
  #signin-dialog .signin-consent { margin: 6px 0; font-size: 12px; line-height: 1.35; }
  #signin-dialog .signin-problem { margin: 6px 0 0; padding: 6px 10px; font-size: 12px; line-height: 1.4; }
  #signin-dialog .dialog-actions { margin-top: 10px; }
  #signin-dialog .dialog-actions > button { min-height: 0; height: 38px; padding-block: 0; }
  /* The leaderboard name, asked straight after: its buttons beside the box
     and the consent under both, so Save is above the keyboard too. */
  #signin-dialog #signin-name-form:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 10px;
    align-items: end;
  }
  #signin-dialog #signin-name-form > .field { grid-column: 1; grid-row: 1; }
  #signin-dialog #signin-name-form > .dialog-actions { grid-column: 2; grid-row: 1; margin-top: 0; }
  #signin-dialog #signin-name-form > .signin-consent { grid-column: 1 / -1; grid-row: 2; }
  #signin-dialog #signin-name-form > .signin-problem { grid-column: 1 / -1; grid-row: 3; }
}
