/* Responsive fixes (tester report, 15 Oct 2026: checked at 360, 390, 768 and 1280 wide). Loaded last. */

/* Nothing may push the page sideways on a small phone. */
html, body { overflow-x: clip; }
/* 25 Oct 2026 (founder: "Some part of the screen is cut off. Please ensure this something which never happens right across
   vazi"): the clipping above hid the overflow but not its cause. A card or column is a grid whose one column was as wide
   as its widest content (the row of the outfit's pieces), so on a phone the whole outfit screen came out about 20px
   wider than the screen and its right edge was cut off. Every column now fits the screen, and content too wide for it
   (a row of pieces, a long word) scrolls or wraps inside it instead. */
.stack, .stack-s, .outfit, .sheet, .empty, .auth, .field { grid-template-columns: minmax(0, 1fr); }
.stack > *, .stack-s > *, .outfit > *, .sheet > *, .empty > *, .auth > *, .field > *, .screen > * { min-width: 0; }
.spread > *, .row > * { min-width: 0; }
/* ...but a short link or button beside the text ("Change") keeps its own width and never breaks mid-word (founder's
   screenshot, 25 Oct 2026: "Chan / ge"). */
.spread > .linkbtn, .row > .linkbtn, .spread > a, .spread > button:not(.btn) { flex: none; white-space: nowrap; }
.screen img, .screen video, .screen canvas { max-width: 100%; }
.screen { overflow-wrap: break-word; }

/* Chip rows wrap instead of scrolling sideways, so every option is visible ("Formal", "Dancing", "Buttoned to the top",
   "Being repaired"). A chip whose words are longer than the row wraps its text rather than poking out. */
.chips { flex-wrap: wrap; overflow-x: visible; padding-bottom: 2px; }
.chips .chip { max-width: 100%; white-space: normal; text-align: left; }

/* Today's options on a phone: the next card shows clearly at the edge, so it reads as "there's more". */
.option { flex-basis: 80%; }

/* The floating feedback button: content scrolls clear of it at the end of a screen, and it hides while a sheet is open. */
.screen { padding-bottom: calc(var(--tab-h) + 96px + env(safe-area-inset-bottom, 0px)); }
body:has(dialog[open]) > button[aria-label="Send feedback"] { visibility: hidden !important; }

/* Sheets (an item's details, questions): never taller than the screen, scroll inside, and keep the last button clear of
   the bottom edge. */
dialog { max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.sheet { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }

/* Tablet and desktop */
@media (min-width: 720px) {
  /* The tab bar sits under the content column instead of across the whole window. */
  .tabs { left: 50%; right: auto; width: min(600px, 100%); transform: translateX(-50%); border-radius: 20px 20px 0 0; }
  /* Sheets open as a centred card rather than a strip glued to the bottom. */
  dialog { margin: auto; border-radius: 22px; max-height: calc(100dvh - 48px); }
}
@media (min-width: 900px) {
  /* Today's options side by side: the row breaks out of the narrow column to use the spare width. */
  .options {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; overflow: visible;
    width: min(1080px, calc(100vw - 64px)); margin: 0 0 0 calc(50% - min(540px, 50vw - 32px)); padding: 4px 0 12px;
  }
  .option, .option:only-child { flex: none; }
  .options:has(> .option:only-child) { width: auto; margin: 0; display: block; }
}

/* A save button that follows the person once they have changed something (16 Oct 2026): it stays in view at the
   bottom while its card or sheet is on screen, so nobody has to scroll down to find it. */
.stickysave { position: sticky; bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom, 0px)); z-index: 3; box-shadow: 0 8px 22px rgba(21, 27, 51, 0.22); }
dialog .stickysave { bottom: 10px; }
/* The floating feedback button would sit on top of it; it steps aside while a save is waiting. */
body:has(.stickysave) > button[aria-label="Send feedback"] { visibility: hidden !important; }

/* While "Here's what I understood" waits for Dress me, the earlier options are hidden (switch hide_old_options). */
body.vz-confirming #app .options, body.vz-confirming #app .options-all, body.vz-confirming #app .vz-more,
body.vz-confirming #app p.small.muted:has(+ .options) { display: none !important; }
