/* Iris's own look: deep green, gold, and her mark (mark.svg). Dark only, as she is. */
:root {
  color-scheme: dark;
  --bg: #1a221c; --bg2: #243028; --glow: #3a4a38; --card: #243028; --well: rgba(0, 0, 0, .25);
  --ink: #e8efe6; --soft: #9aab9c; --line: rgba(232, 239, 230, .14);
  --accent: #c4a35a; --accent-ink: #1a1508; --them: #45432a; --iris: rgba(0, 0, 0, .25); --bad: #e07070; --warn: #4a3d10;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, select { touch-action: manipulation; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, var(--glow) 0%, transparent 55%), linear-gradient(160deg, var(--bg), var(--bg2));
  background-attachment: fixed; background-color: var(--bg); color: var(--ink);
  font: 17px/1.45 "Segoe UI", "IBM Plex Sans", system-ui, -apple-system, Roboto, sans-serif;
}
h1 { font-family: Georgia, "Iowan Old Style", serif; font-weight: 600; font-size: 1.5rem; letter-spacing: -0.02em; margin: 0; }
a { color: var(--accent); }
.screen {
  min-height: 100%;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.narrow { max-width: 440px; margin: 0 auto; padding-top: 10vh; }
.mark { width: 28px; height: 28px; flex: none; }
.mark.big-mark { display: block; width: 92px; height: 92px; margin: 0 auto 14px; }
#signin h1 { text-align: center; font-size: 2.1rem; }
#signin > p { text-align: center; }
#welcome h1 { text-align: center; font-size: 2rem; }
#welcome > p { text-align: center; }
#welcome > button, #welcome-form button { display: block; width: 100%; margin-top: 12px; }
.welcome-video { margin: 18px 0 0; text-align: center; }
.welcome-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; margin-top: 6px; border-radius: 10px; background: #171d17; }
.soft { color: var(--soft); }
.small { font-size: .85rem; }
.bad { color: var(--bad); min-height: 1.2em; margin: 6px 0; }
label { display: block; margin: 12px 0 4px; }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--well); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px;
}
textarea { resize: none; }
::placeholder { color: var(--soft); opacity: .8; }
button {
  font: inherit; font-weight: 600; color: var(--ink); background: transparent; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; min-height: 46px; cursor: pointer;
}
button:disabled { opacity: .5; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
button.quiet { border-color: transparent; color: var(--soft); font-weight: 500; }
button.big { font-size: 1.4rem; padding: 16px 40px; background: var(--accent); color: var(--accent-ink); border: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#signin-form button { width: 100%; margin-top: 16px; }
#pass-form button { width: 100%; margin-top: 12px; }
label.check { display: flex; align-items: center; gap: 10px; }
label.check input { width: auto; accent-color: var(--accent); }
/* Home: name and buttons share a line when they fit; with a longer name the buttons drop below, still in one row. */
#home .top { flex-wrap: wrap; }
/* What is left of their money, in the corner of a game's screen by the hangout button; a tap shows the rest (app.js). */
#game .top { position: relative; }
.wallet-chip { font-size: .8rem; }
.wallet-chip.low { color: var(--bad); border-color: var(--bad); }
.wallet-pop { position: absolute; right: 0; top: 100%; z-index: 5; width: min(320px, 92vw); font-size: .85rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.wallet-pop p { margin: 4px 0 0; }
/* The line under a game's name saying what it is, and the box to change it (app.js, src/about.js). */
.about-row { display: flex; gap: 8px; align-items: baseline; justify-content: center; margin: -2px 0 8px; }
.about-text { margin: 0; text-align: center; overflow-wrap: anywhere; }
.about-edit { flex: none; font-size: .78rem; padding: 2px 8px; min-height: 0; }
.about-form { margin-bottom: 8px; }
.about-form textarea { width: 100%; resize: none; }
.about-form .composer-row { flex-wrap: wrap; }
/* On a narrow phone the back button is just its arrow, so the game's name keeps its room beside the hangout and wallet buttons. */
@media (max-width: 440px) { #game .top .back-word { display: none; } #game .top > button { padding-left: 8px; padding-right: 8px; } }
.top-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.top-buttons button { font-size: .88rem; padding: 8px; white-space: nowrap; }
.brand h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#home-note:empty { display: none; }
ul.notice { padding-left: 20px; }
ul.notice li { margin: 12px 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.top .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top .title { flex: 1; text-align: center; min-width: 0; }
.top .title b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .title small { color: var(--soft); display: block; }
/* Their game's name is the button that renames it. */
.top .title button.rename {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 0; padding: 2px 6px; border-color: transparent;
}
/* Two lines before a name is cut: on a phone it shares the row with Games and Reading. */
.top .title button.rename b {
  min-width: 0; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  font-size: .95rem; line-height: 1.2;
}
#game .top > button { padding: 8px 4px; white-space: nowrap; }
#rename-form .composer-row { margin-top: 10px; }
.rename .pen { font-size: .75rem; }
.top .title button.rename:disabled { opacity: 1; cursor: default; }
.rename:disabled .pen { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.card > label { margin-top: 0; }
.composer { display: flex; flex-direction: column; gap: 8px; }
/* What their screen showed, about to go with their next words to Iris (src/shots.js). */
.msg-shots { display: block; margin-top: 4px; opacity: .7; font-size: .75rem; }
.composer-row { display: flex; gap: 8px; }
.composer-row button { flex: 1; }
/* The voice list sits between Talk and Send, and gives way to them on a narrow phone. */
.composer-row select {
  flex: 1 1 0; min-width: 0; font: inherit; font-size: .82rem; color: var(--soft); background: transparent;
  border: 1px solid var(--line); border-radius: 8px; padding: 0 4px; min-height: 40px; cursor: pointer;
}
.composer-row select option { color: var(--ink); background: var(--card); }
.mic.on { background: #e5484d; border-color: #e5484d; color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .7; } }
/* Home. Wide enough for two columns (a PC, a tablet, a phone on its side): theirs on the left, the box to ask in over
   their own games, and what others share down the whole right side. Narrower (a phone held upright, further down): the
   box across the top and the two lists side by side under it. Each list scrolls by itself. It goes by width only, so a
   keyboard coming up never swaps one for the other, and turning the device swaps them with nothing typed lost. */
#home { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.lists {
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  column-gap: 16px;
}
.home-left {
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.home-left > * { flex: none; }
/* Their games take what is left of their column; when that is too little, the column scrolls to them. */
.home-left > #mine { flex: 1 0 220px; margin-top: 12px; }
#wallet { margin: 0 0 8px; }
/* The small buttons across the top of home: their player, mail, the hangout, their wallet (index.html), each a picture over a word. */
.home-tiles { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin: 0 0 8px; }
.home-tiles:not(:has(> :not([hidden]))) { display: none; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1px; min-height: 90px; padding: 3px 2px 7px; font-size: .86rem; font-weight: 650; white-space: nowrap; overflow: hidden; }
.tile span { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tile .tile-ico { height: 66px; font-size: 1.7rem; line-height: 66px; }
/* Their player, by themselves: nothing behind them, strolling in their spot (toystage.js). */
.tile canvas { flex: none; width: 76px; height: 66px; }
/* Their card is a button for My style and, beside it, the friends who are on (src/here.js): up to six, three across. With any
   there, the card is wider than the buttons by it, and takes a row of its own where the row is too narrow for that (a phone,
   a small window). */
.player { flex-direction: row; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; }
#home-tiles > .tile.player { padding: 0; } /* the button inside keeps the room a small button keeps */
.player > .me { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: inherit; min-width: 0; min-height: 0; padding: 3px 2px 7px; border: 0; border-radius: inherit; font-weight: inherit; }
.player > .me:disabled { opacity: 1; cursor: default; }
.player > .me:focus-visible { outline-offset: -3px; }
.here { flex: 0 1 168px; display: grid; grid-template-columns: repeat(3, minmax(0, 50px)); gap: 4px; align-content: center; justify-content: end; min-width: 0; margin: 0; padding: 6px 6px 6px 0; list-style: none; }
.here li { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--well); }
.here img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.here .more { display: flex; align-items: center; justify-content: center; font-size: .9rem; color: var(--soft); }
.home-tiles.has-friends { display: flex; flex-wrap: wrap; container: tiles / inline-size; }
.home-tiles.has-friends > .tile { flex: 1 1 0; min-width: 0; }
.home-tiles.has-friends > .player { flex: 0 0 256px; }
@container tiles (max-width: 559px) { .home-tiles.has-friends > .player { flex-basis: 100%; } }
.tile-badge { position: absolute; top: 8px; left: calc(50% + 10px); min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font-size: .72rem; line-height: 19px; }
.tile.fresh { border-color: var(--accent); }
.tile[aria-expanded="true"] { border-color: var(--accent); }
.tile.busy { border-color: var(--accent); color: var(--accent); }
.tile.low { border-color: var(--bad); color: var(--bad); }
/* A friend who only plays has nothing of their own: what is shared takes the whole width, under their name. */
.lists.one { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.lists.one > .halves { margin-top: 12px; }
/* The shared side in two halves, family over friends, each scrolling by itself. */
.halves { gap: 10px; }
.halves > .list { flex: 1 1 0; }
.list { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list h2 { margin: 0 0 6px; }
.games {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 3px;
  display: grid; gap: 8px; align-content: start; grid-auto-rows: max-content; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.games p { margin: 0; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.list-head h2, #home .panel .list-head h2 { margin: 0; min-width: 0; }
.list-head button.sort { flex: none; min-height: 30px; padding: 2px 8px; font-size: .75rem; font-weight: 600; color: var(--soft); white-space: nowrap; }
.games button small.on-shelf { margin-top: 3px; color: var(--accent); }
/* What a game is, in a line or two under its name (src/about.js). */
.games button small.about { margin: 2px 0 3px; font-size: .78rem; font-weight: 400; line-height: 1.3; color: var(--ink); opacity: .78; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#mine.drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.games button { text-align: left; padding: 12px; background: var(--card); border-radius: 12px; overflow-wrap: anywhere; }
.games button small { display: block; color: var(--soft); font-weight: 500; }
#new-say:empty { display: none; }
@media (max-height: 700px) { #new-text { height: 58px; } }

/* Their family's alerts have stopped (src/watching.js): above everything on the home screen. */
.alerts-down { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 8px; background: var(--warn); border-color: var(--accent); font-size: .92rem; }
.alerts-down span { min-width: 0; }
.alerts-down button { flex: none; min-height: 40px; }

/* Something newly shared with them: a card above the lists, or over an open game. */
.news { display: flex; gap: 10px; align-items: center; margin-top: 12px; border-color: var(--accent); }
#news-list { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.news .news-line { text-align: left; border: 0; padding: 2px 0; min-height: 32px; }
#news-list p { margin: 0; }
#news-ok { flex: none; }
/* Home: theirs and what is shared each in a box of its own, so where one ends is plain; family over friends. */
#home .panel { border: 1px solid rgba(196, 163, 90, .45); border-radius: 14px; background: var(--well); padding: 10px 8px 8px; }
#home .panel h2 { margin: 0 0 8px; padding: 0 4px; color: var(--ink); }
/* The bar between the two shelves, dragged up or down (app.js): wide enough for a thumb, with a grip on its line. */
.halves > .list { overflow: hidden; }
.shelf-bar { flex: none; position: relative; height: 20px; margin: -5px 0; cursor: row-resize; touch-action: none; user-select: none; -webkit-user-select: none; }
.shelf-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: rgba(196, 163, 90, .45); }
.shelf-bar::after { content: ""; position: absolute; left: 50%; top: 5px; width: 46px; height: 8px; margin-left: -23px; border-radius: 6px; background: var(--card); border: 1px solid var(--accent); }
.shelf-bar:hover::after, .shelf-bar.held::after, .shelf-bar:focus-visible::after { background: var(--accent); }
.shelf-bar:focus-visible { outline: none; }
/* The family shelf's name folds it away: only the name is left, and the friends shelf takes the room. With the Public
   Library as a third shelf (app.js), each of the three folds so. */
.shelf-name { min-height: 32px; padding: 2px 10px; font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.shelf-name::after { content: " ▾"; color: var(--soft); }
#family-part.folded { flex: 0 0 auto; }
#family-part.folded > .games, #family-part.folded .sort { display: none; }
#family-part.folded > .list-head { margin-bottom: 0; }
#family-part.folded .shelf-name::after { content: " ▸"; }
#family-part.folded ~ #friends-part:not([hidden]) { border-top: 2px solid rgba(196, 163, 90, .45); padding-top: 10px; }
/* The Library under the shelves: as tall as what is in it, up to half the side. A shelf above it with nothing on it keeps
   to its name and that line; with nothing on either, the Library has all they leave (app.js). */
#library-part { flex: 0 1 auto; max-height: 50%; border-top: 2px solid rgba(196, 163, 90, .45); padding-top: 10px; }
.halves > .list.bare { flex: 0 0 auto; }
.halves > .list.bare > .games { flex: 0 0 auto; }
.halves > .list.bare .sort { display: none; } /* nothing to put in order, and its name then fits on one line on a phone */
#library-part.roomy { flex: 1 1 0; max-height: none; }
/* Three shelves: each takes its share (app.js), the Public Library like the others, and a shelf with no bar over it keeps
   a line of its own. */
#shelves.three > #library-part { max-height: none; }
#shelves.three > .list { border-top: 0; padding-top: 0; }
#shelves.three > .list:not(.bare):not(.folded) { flex: 1 1 0; min-height: 54px; } /* never less than its name */
#shelves.three > .list.bare, #shelves.three > .list.folded { flex: 0 0 auto; }
#shelves.three > .list.folded > .games, #shelves.three > .list.folded .sort { display: none; }
#shelves.three > .list.folded > .list-head { margin-bottom: 0; }
#shelves.three > .list.folded .shelf-name::after { content: " ▸"; }
#shelves.three > .list.ruled { border-top: 2px solid rgba(196, 163, 90, .45); padding-top: 8px; }
/* Which shelves one of their own is on, on its card. */
.games button .shelf-marks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.games button .shelf-marks small { padding: 0 7px; border: 1px solid var(--accent); border-radius: 9px; color: var(--accent); font-size: .72rem; line-height: 1.6; }
.games button .shelf-marks small.none { border-color: var(--line); color: var(--soft); }
.voice-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 10px 0 0; font-size: .85rem; color: var(--soft); }
.voice-row select {
  min-width: 0; max-width: 60%; min-height: 40px; padding: 0 6px; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
/* A button of their own game carries a small one for its name and colour. */
.games .own { position: relative; display: grid; }
.games .own > button:first-child { padding-right: 44px; }
.games button.edit {
  position: absolute; top: 4px; right: 4px; width: 36px; min-height: 36px; padding: 0; text-align: center; background: transparent;
  border-color: transparent; color: var(--soft);
}
/* A game made for players' styles (app.js, styleMark): a little picture of the player in the card's lower corner. Said
   with #home so the closer-set cards of a phone keep the room for it. */
#home .games button.styled:not(.edit) { position: relative; padding-right: 46px; }
.games button .style-mark { position: absolute; right: 4px; bottom: 4px; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--well); border: 1px solid var(--accent); }
/* Their own card has the pencil in its upper corner: tall enough that the two never meet. */
#home .games .own > button.styled:first-child { min-height: 80px; }
.games button.c-red, .swatches button.c-red { background: #6b2f2f; }
.games button.c-orange, .swatches button.c-orange { background: #6e4420; }
.games button.c-gold, .swatches button.c-gold { background: #66551b; }
.games button.c-green, .swatches button.c-green { background: #22573a; }
.games button.c-teal, .swatches button.c-teal { background: #1d5558; }
.games button.c-blue, .swatches button.c-blue { background: #27426b; }
.games button.c-purple, .swatches button.c-purple { background: #473465; }
.games button.c-pink, .swatches button.c-pink { background: #6b2f55; }
.games button[class*="c-"] small { color: var(--ink); }
.games button[class*="c-"] .turn-dot { box-shadow: 0 0 0 2px var(--ink); }
.look { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .6); }
.look form { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; }
.look label, .look p { margin: 0; }
.look p:empty { display: none; }
.swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.swatches button { padding: 4px; min-height: 44px; font-size: .85rem; }
.swatches button[aria-pressed="true"] { outline: 3px solid var(--accent); }

/* Little height (a phone on its side): everything on home sits closer, and cards go two across sooner. */
@media (max-height: 500px) {
  #home .top { margin-bottom: 4px; }
  #home-tiles .tile { min-height: 56px; padding: 1px 1px 3px; font-size: .76rem; }
  #home-tiles .tile canvas { width: 44px; height: 38px; }
  #home-tiles .player > .me { padding: 1px 1px 3px; }
  #home-tiles .here { flex-basis: 108px; grid-template-columns: repeat(3, minmax(0, 30px)); gap: 3px; padding: 4px 4px 4px 0; }
  #home-tiles .here li { border-radius: 7px; }
  #home-tiles .here .more { font-size: .75rem; }
  #home-tiles.has-friends > .player { flex: 0 0 170px; } /* little height: kept in the row, with smaller pictures */
  #home-tiles .tile .tile-ico { height: 38px; line-height: 38px; font-size: 1.3rem; }
  #home-tiles .tile-badge { top: 3px; }
  #new-form, #wallet { padding: 8px; }
  #new-form label { font-size: .85rem; }
  #new-text { height: 44px; padding: 8px; }
  #new-form .composer-row button { min-height: 38px; padding: 4px 10px; }
  #home .panel { padding: 6px; }
  #home .panel .list-head { margin-bottom: 4px; }
  .list-head button.sort { min-height: 24px; padding: 0 6px; }
  #home .halves { gap: 4px; }
  .shelf-name { min-height: 26px; padding: 0 8px; }
  #home .games { gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
  #home .games button:not(.edit) { padding: 6px 8px; min-height: 40px; }
}

/* A phone held upright is too narrow for the box in half of it: it goes across the top, closer set, and the two lists
   share what is under it. */
@media (max-width: 599px) {
  .lists, .lists.one {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "top top" "note note" "down down" "tiles tiles" "earned earned" "hang hang" "wallet wallet" "new new" "voice voice" "come come" "news news" "mine shared";
    grid-template-rows: repeat(11, auto) minmax(260px, 1fr); column-gap: 10px; overflow-y: auto; align-content: start;
  }
  .home-left { display: contents; }
  .home-left > .top { grid-area: top; }
  #home-note { grid-area: note; }
  #alerts-down { grid-area: down; margin: 0 0 6px; padding: 8px; font-size: .85rem; }
  #home-tiles { grid-area: tiles; margin-bottom: 6px; gap: 6px; }
  #home-tiles .tile { gap: 0; min-height: 84px; padding: 2px 1px 6px; font-size: .82rem; }
  #home-tiles .tile canvas { width: 70px; height: 61px; }
  #home-tiles .player > .me { padding: 2px 1px 6px; }
  #home-tiles .tile .tile-ico { height: 61px; line-height: 61px; }
  #home-tiles.has-friends > .player { flex-basis: 100%; } /* a phone: a row of its own (said here too, for one without container queries) */
  #home-tiles.has-friends > .player canvas { width: 92px; height: 80px; }
  #avatar-news { grid-area: earned; }
  #hang-home { grid-area: hang; }
  #wallet { grid-area: wallet; margin-bottom: 6px; padding: 8px 10px; font-size: .85rem; }
  #new-form { grid-area: new; padding: 8px; }
  #voice-row { grid-area: voice; align-self: center; margin-top: 6px; gap: 6px; font-size: .8rem; }
  #voice-row select { min-height: 36px; max-width: 100%; }
  #news-list p { display: none; } /* the NEW tags on the cards say the same */
  #come { grid-area: come; }
  #news { grid-area: news; }
  #home .news { margin-top: 6px; padding: 8px; font-size: .9rem; }
  .home-left > #mine { grid-area: mine; margin-top: 8px; }
  .lists > .halves { grid-area: shared; margin-top: 8px; }
  .lists.one > .halves { grid-column: 1 / -1; }
  #new-form label { font-size: .85rem; }
  #new-text { height: 48px; padding: 8px 10px; }
  #new-form .composer-row button { min-height: 40px; padding: 4px 10px; }
  #home .games { gap: 6px; }
  #home .games button:not(.edit) { padding: 8px 10px; }
  /* Three shelves in half a phone: the two lists are taller, and each shelf's name keeps to one line beside an arrow
     that changes its order. */
  .lists:has(> #shelves.three) { grid-template-rows: repeat(11, auto) minmax(520px, 1fr); }
  #shelves.three .shelf-name { padding: 2px 5px; font-size: .82rem; white-space: nowrap; }
  #shelves.three .list-head { gap: 3px; }
  #shelves.three .list-head button.sort { width: 28px; padding: 0; overflow: hidden; font-size: 0; }
  #shelves.three .list-head button.sort::before { content: "↕"; font-size: .85rem; }
}

/* A game where it is their go. */
.games button.turn { border-color: var(--accent); }
.turn-dot { display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 50%; background: var(--accent); }
.tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; vertical-align: middle;
  background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 700;
}
.toast {
  position: fixed; z-index: 20; top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right)); max-width: 520px; margin: 0 auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.toast { flex-wrap: wrap; justify-content: flex-end; }
.toast span { flex: 1 1 180px; min-width: 0; }
/* On a phone an ask takes a line of its own, so Not now and Join stay side by side under it. */
@media (max-width: 480px) { .toast:has(#toast-no:not([hidden])) span { flex-basis: 100%; } }

#game { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }
.split { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.stage-side { display: flex; flex-direction: column; gap: 6px; }
.stage {
  position: relative; background: #0f140f; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  height: 38vh; min-height: 200px; display: flex; align-items: center; justify-content: center;
}
#say-form textarea { height: 52px; }
#say-form button, .player-bar button, .broken button { min-height: 40px; padding: 6px 12px; white-space: nowrap; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.stage iframe:fullscreen { background: #000; }
.stage iframe:-webkit-full-screen { background: #000; }
.stage-idle { text-align: center; padding: 16px; }
.player-bar { display: flex; gap: 8px; flex-wrap: wrap; }
/* The Public Library tick, beside Invite and Share: drawn as they are. */
label.bar-tick { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin: 0; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; white-space: nowrap; cursor: pointer; }
label.bar-tick input { width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--accent); }
label.bar-tick:has(input:checked) { border-color: var(--accent); }
#lib-form button { flex: none; }
#lib-form input[hidden] + button { flex: 1; } /* no password to type: the one button takes the row */
.building { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
#building-say { flex: 1; min-width: 0; }
#think-open { flex: none; min-height: 34px; padding: 4px 10px; font-size: .85rem; white-space: nowrap; }
/* Her thinking: a few lines under the game; all of it scrolls by itself. */
/* On a phone the button takes a short line of its own, so the words beside the mark keep their width. */
@media (max-width: 599px) {
  .building { flex-wrap: wrap; row-gap: 4px; }
  #building-say { flex-basis: calc(100% - 40px); }
  #think-open { margin-left: auto; min-height: 28px; padding: 1px 10px; }
}
.think { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; font-size: .9rem; }
.think p { margin: 0; }
/* All of it lies over the game, as the other cards there do, so nothing is pushed off a phone's screen. */
.think.all { position: absolute; inset: 0; z-index: 2; min-height: 0; }
.think-all { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--well); border-radius: 8px; padding: 8px; }
.think button { min-height: 36px; padding: 4px 10px; }
/* Her mark turns while she works; the upright slot is what shows the turning. */
.spin { width: 22px; height: 22px; animation: spin 2.8s linear infinite; }
.wallet { padding: 8px 12px; }
.wallet p { margin: 2px 0 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin, .mic.on { animation: none; } }
.live { background: var(--card); border: 1px solid var(--accent); border-radius: 10px; padding: 4px 12px; font-size: .9rem; }
.live:not([hidden]) { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.live button { flex: none; min-height: 36px; padding: 4px 18px; }
#game.together-on #invite-open, #game.together-on #ask-open { display: none; } /* keeps the buttons to two rows on a phone */
.broken { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--warn); border-radius: 10px; padding: 8px 12px; }
.chat-side { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 8px; min-height: 60px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.them { align-self: flex-end; background: var(--them); border-bottom-right-radius: 4px; }
.msg.iris { align-self: flex-start; background: var(--iris); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.iris::before {
  content: "Iris"; display: block; color: var(--accent); font-size: .68rem; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 2px;
}
.msg.ready { border-color: var(--accent); font-weight: 600; }
.msg button { display: block; margin-top: 8px; }
/* A tap on one of Iris's messages reads it out again, and a second tap stops her (public/app.js). The pointer is also
   what makes an iPhone or iPad count a tap on a message at all. */
.chat.can-hear .msg.iris, .chat.can-hear .msg.sent { cursor: pointer; }
.chat.can-hear .msg.iris::before { content: "Iris 🔊"; }
.chat.can-hear .msg.sent::after { content: "🔊 tap to hear"; display: block; color: var(--soft); font-size: .68rem; margin-top: 2px; }
.chat.can-hear .msg.iris:hover { border-color: var(--accent); }
.chat.can-hear .msg.iris:focus-visible, .chat.can-hear .msg.sent:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat.can-hear .msg.reading { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.chat.can-hear .msg.iris.reading::before { content: "Iris 🔊 reading, tap to stop"; }
.chat.can-hear .msg.sent.reading::after { content: "🔊 reading, tap to stop"; }
/* Typing to the other player takes Iris's place while both are playing. A friend who only plays has it too. */
.talk-side { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#game.talking .chat-side { display: none; }
.talk-head { margin: 0 0 4px; }
.talk-row { display: flex; gap: 8px; }
.talk-row input { flex: 1; min-width: 0; padding: 9px 12px; }
.talk-row button { flex: none; min-height: 40px; padding: 6px 16px; }
#talk-note { margin: 4px 0 0; min-height: 1.2em; }
.msg.friend { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.friend::before { content: attr(data-name); display: block; color: var(--soft); font-size: .68rem; font-weight: 650; margin-bottom: 2px; }
.msg.them.renamed {align-self: center; background: transparent; color: var(--soft); font-size: .8rem; padding: 0 8px; }
#say-note { margin: 4px 0 0; min-height: 1.2em; }

h2 { font-size: .95rem; font-weight: 600; margin: 22px 0 0; }
/* The invite box lies over the game, so opening it pushes nothing off a phone's screen (and the game keeps running). */
.stage-side { position: relative; }
.invite { display: flex; flex-direction: column; gap: 8px; position: absolute; top: 0; left: 0; right: 0; max-height: 100%; overflow-y: auto; z-index: 2; }
.invite p { margin: 0; }
.invite p:empty { display: none; }
/* Whom to ask over (app.js, hangout.js): a tick for each, with a gold dot by those who are on. */
.ask-list { display: grid; gap: 8px; max-height: 38vh; overflow-y: auto; flex: 0 0 auto; }
#ask .ask-list { max-height: none; }
.ask-list p { margin: 0; }
.ask-list .ask-row { display: flex; align-items: center; gap: 4px; margin: 0; border: 1px solid var(--line); border-radius: 10px; }
.ask-list label.ask-row, .ask-row label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 48px; margin: 0; cursor: pointer; }
.ask-list label.ask-row, .ask-row label { padding: 4px 12px; }
.ask-row input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.ask-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ask-name b { overflow-wrap: anywhere; }
.ask-row.on .ask-name small::before { content: "● "; color: var(--accent); }
.ask-row.off label { opacity: .6; cursor: default; }
.ask-row button.ask-off { flex: none; min-width: 44px; }
.ask-after { display: grid; gap: 8px; }
.ask-after:empty { display: none; }
/* The card a friend's little picture opens, and the party picker. */
.friend-card { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; }
.friend-card p { margin: 0; }
.friend-card p:empty { display: none; }
.friend-head { display: flex; align-items: center; gap: 12px; }
.friend-head img { flex: none; width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: var(--well); }
.friend-head div { display: flex; flex-direction: column; min-width: 0; }
.friend-head b { font-size: 1.15rem; }
.friend-acts, .friend-list { display: grid; gap: 8px; }
.friend-list { max-height: 34vh; overflow-y: auto; }
.friend-list button { text-align: left; overflow-wrap: anywhere; }
.here li button.friend-face { position: absolute; inset: 0; width: 100%; min-height: 0; padding: 0; border: 0; border-radius: inherit; background: transparent; font: inherit; color: inherit; }
.shelf-part { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.shelf-part p { margin: 4px 0 8px; }
.shelf-part .composer-row:not(:has(button:not([hidden]))) { display: none; }
#store-say { margin: 0; }
/* Building together: a line saying who is here, and the list of changes in the chat's place. */
.plan-bar { display: flex; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px 4px 12px; font-size: .85rem; }
#game.shared .plan-bar { border-color: var(--accent); }
.plan-bar span { flex: 1; min-width: 0; }
.plan-bar button { flex: none; min-height: 38px; padding: 4px 10px; white-space: nowrap; }
#game.shared #voice { display: none; }
#game.together-on #help-open { display: none; }
#help-list { display: grid; gap: 8px; max-height: 30vh; overflow-y: auto; }
.msg.talk { border-style: dashed; }
.msg.sent { align-self: stretch; max-width: 100%; background: transparent; border: 1px solid var(--accent); font-size: .85rem; }
.msg.friend.renamed { align-self: center; background: transparent; border: 0; color: var(--soft); font-size: .8rem; padding: 0 8px; }
.plan-panel { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; padding-top: 6px; }
.list-items { flex: 1; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.list-items p { margin: 0; }
.plan-line { display: flex; flex: none; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px 4px 10px; }
.plan-line.open { border-style: dashed; }
.plan-line input[type="checkbox"] { flex: none; width: 22px; height: 22px; padding: 0; accent-color: var(--accent); }
.plan-line .words { flex: 1; min-width: 0; text-align: left; border: 0; padding: 4px 0; font-weight: 500; overflow-wrap: anywhere; }
.plan-line .words small { display: block; color: var(--soft); }
.plan-line .words:disabled { opacity: .7; cursor: default; }
.plan-line .off { flex: none; padding: 4px 10px; }
.plan-line.editing { flex-wrap: wrap; padding: 8px; }
.plan-line.editing input { flex: 1 1 100%; padding: 9px 12px; }
.plan-line.editing button { flex: 1; min-height: 40px; padding: 4px 8px; }
.plan-panel > .talk-row input { padding: 9px 12px; }
.plan-panel button { min-height: 40px; padding: 6px 12px; }
#list-note { margin: 0; min-height: 1.2em; }
#game.listing .chat, #game.listing #say-form, #game.listing #say-note { display: none; }
/* On a phone the list takes most of the game's room while it is open (put back on a wide screen, below). */
#game.listing .stage { height: 18vh; min-height: 110px; }
#game.listing .player-bar { display: none; }
@media (min-aspect-ratio: 1/1) and (min-width: 700px) {
  #game.listing .stage { height: auto; min-height: 200px; }
  #game.listing .player-bar { display: flex; }
}

/* Their own friend list. */
#myfriends > button { padding: 6px 0; }
.mf-list { display: grid; gap: 8px; margin: 12px 0; }
/* The address to send a friend stays whole on a narrow screen, and can be picked up by hand. */
.address-say { overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
#mf-address { width: 100%; margin-top: 12px; }
/* Mail (public/mail.js, src/mail.js): the list of conversations, one of them, and someone new. */
.narrow.mail { max-width: 600px; padding-top: 12px; }
.mail-view { display: flex; flex-direction: column; gap: 8px; min-height: calc(100vh - 40px); min-height: calc(100dvh - 40px); }
.mail-view > .quiet:first-child { align-self: flex-start; padding: 4px 0; min-height: 36px; }
.mail-view h1 { margin: 0; }
.mail-view p { margin: 0; }
#mail-list-say:empty, #mail-say:empty { display: none; }
.mail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mail-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mail-who h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-list { display: grid; gap: 8px; align-content: start; }
.mail-face { display: flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 50%; font-weight: 700; font-size: 1.1rem; color: #1a1508; }
.mail-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 0 10px; align-items: center; width: 100%; padding: 8px 12px; text-align: left; background: var(--card); border-radius: 12px; font-weight: 500; }
.mail-row .mail-face { grid-row: 1 / span 2; }
.mail-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-when { justify-self: end; font-size: .76rem; color: var(--soft); }
.mail-line { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; color: var(--soft); }
.mail-row.unread { border-color: var(--accent); }
.mail-row.unread .mail-line { color: var(--ink); font-weight: 650; }
.mail-dot { grid-column: 3; justify-self: end; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; line-height: 19px; text-align: center; }
.mail-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; text-align: left; background: var(--card); border-radius: 12px; }
.mail-pick b { flex: 1; }
.mail-menu { display: grid; gap: 8px; }
/* The conversation takes the room that is left, the newest at the bottom. */
#mail-thread-view { height: calc(100vh - 28px); height: calc(100dvh - 28px); min-height: 0; }
.mail-lines { flex: 1 1 auto; min-height: 80px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.mail-lines > :first-child { margin-top: auto; }
.mail-bubble { max-width: 80%; padding: 8px 12px; border-radius: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.mail-bubble small { display: block; margin-top: 1px; font-size: .68rem; opacity: .65; }
.mail-bubble.them { align-self: flex-start; background: var(--them); border-bottom-left-radius: 4px; }
.mail-bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.mail-bubble.held { background: transparent; border: 1px dashed var(--bad); color: var(--ink); }
.mail-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.mail-chips button { min-height: 36px; padding: 3px 12px; border-radius: 18px; font-size: .86rem; font-weight: 550; }
.mail-write { display: flex; gap: 8px; flex: none; }
.mail-write textarea { flex: 1; padding: 9px 12px; }
.mail-write button { min-width: 78px; }
.mail-foot { text-align: center; flex: none; }
#mail-list-view .mail-foot { margin-top: auto; }
body.typing #mail-thread-view { height: calc(var(--seen) - 16px); }
body.typing #mail-chips { display: none; }

/* Looking after (public/parentpage.js, src/parent.js): a card for each person, and one slim row for each game on a shelf. */
.narrow.pa { max-width: 820px; padding-top: 12px; }
.pa h2 { font-size: 1.1rem; margin: 18px 0 6px; }
.pa h3 { font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); margin: 12px 0 2px; }
.pa-list, .pa-shelf, .pa-people { display: grid; gap: 6px; }
.pa-list p, .pa-shelf p { margin: 0; }
.pa-item { padding: 8px 10px; }
.pa-item > div, .pa-item > b { margin-bottom: 3px; }
.pa-buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.pa-sm, .pa-buttons button { font-size: .85rem; padding: 3px 10px; min-height: 34px; border-radius: 7px; }
.pa-waiting { color: var(--accent); }
.pa-bad { color: var(--bad); }
#pa-describe { margin-top: 12px; font-size: .92rem; }
.pa-add label { margin: 8px 0 3px; font-size: .92rem; }
.pa-add label.check { margin: 6px 0; align-items: flex-start; }
.pa-add label.check input { margin-top: 4px; }
.pa-add input:not([type="checkbox"]):not([type="radio"]) { padding: 8px 10px; }
.pa-add .pa-pick label.pa-small { margin: 0; align-items: center; }
.pa-add .pa-pick label.pa-small input { margin-top: 0; }
#pa-add-say:empty { display: none; }
#pa-add-reach:empty, #pa-link-mail:empty, #pa-link-say:empty { display: none; }
.pa-link img, .address-qr { display: block; width: min(230px, 70vw); height: auto; margin: 8px auto; border-radius: 6px; image-rendering: pixelated; }
.pa-link img.pa-textcode { width: min(300px, 78vw); } /* more in it than a link: bigger squares for the camera */
.pa-asbutton { display: inline-flex; align-items: center; min-height: 34px; padding: 3px 10px; border: 1px solid var(--accent); border-radius: 7px;
  font-size: .85rem; font-weight: 600; background: var(--accent); color: var(--accent-ink); text-decoration: none; }
/* One device that takes alerts (public/parentalerts.js). */
.pa-alert { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; overflow-wrap: anywhere; }
#pa-alerts-note:empty, #pa-alerts-on:empty { display: none; }
.pa-words { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--well); border-radius: 8px; padding: 8px; }
.pa-look iframe { width: 100%; height: 65vh; border: 0; background: #fff; border-radius: 8px; margin-top: 8px; }
.pa-look .pa-buttons { justify-content: space-between; margin-top: 0; }
/* A game on a shelf: its name and where it stands, with small buttons at the side (under, on a phone). */
.pa-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.pa-row.pa-wait { border-color: var(--accent); }
.pa-rowname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.pa-rowstatus { font-size: .8rem; overflow-wrap: anywhere; }
.pa-rowabout { font-size: .85rem; line-height: 1.3; overflow-wrap: anywhere; margin: 1px 0; }
.pa-row .pa-buttons { margin-top: 4px; }
@media (min-width: 600px) {
  .pa-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pa-row > .pa-rowname, .pa-row > .pa-rowabout, .pa-row > .pa-rowstatus { grid-column: 1; }
  .pa-row > .pa-main { grid-column: 2; grid-row: 1 / span 3; margin: 0; justify-content: flex-end; }
  .pa-row > .pa-rest { grid-column: 1 / -1; justify-content: flex-end; }
}
/* A person's card: shut, a line; open, their options in groups with one Save. */
.pa-card { padding: 0; overflow: hidden; }
.pa-card.pa-changed { border-color: var(--accent); }
.pa-head { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; width: 100%; min-height: 48px; padding: 7px 34px 7px 12px; border: 0; border-radius: 0; background: transparent; text-align: left; font-weight: 500; }
.pa-name { font-weight: 650; }
.pa-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pa-tag { font-size: .7rem; line-height: 1.5; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--soft); }
.pa-tag-bad { border-color: var(--bad); color: var(--bad); }
.pa-tag-off { border-color: var(--accent); color: var(--accent); }
.pa-sum { margin-left: auto; }
.pa-chev { position: absolute; right: 12px; top: 50%; width: 1em; transform: translateY(-50%); text-align: center; color: var(--soft); }
.pa-body { padding: 2px 12px 10px; border-top: 1px solid var(--line); }
.pa-ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 0 18px; }
.pa-ticks label.check { margin: 3px 0; font-size: .92rem; align-items: flex-start; }
.pa-ticks label.check input { margin-top: 4px; }
.pa-pick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; margin: 4px 0; }
.pa-picklabel { font-size: .88rem; color: var(--soft); }
.pa-ticks label.pa-small { margin: 0; align-items: center; }
.pa-ticks label.pa-small input { margin-top: 0; }
.pa-ticks label.pa-choice { display: flex; flex-direction: column; gap: 2px; margin: 3px 0; font-size: .92rem; }
.pa-ticks label.pa-choice select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: inherit; font: inherit; max-width: 22em; }
#pa-across-box > label.check { margin: 0 0 8px; }
.pa-nums { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.pa-num { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.pa-num input { width: 8.5em; padding: 6px 8px; border-radius: 8px; }
.pa-games { margin: 8px 0 2px; }
.pa-games .pa-shelf { margin-top: 6px; }
.pa-games .pa-shelf > p { margin: 0 0 2px; }
.pa-games .pa-row { grid-template-columns: minmax(0, 1fr) auto; }
.pa-games .pa-row > .pa-rowname, .pa-games .pa-row > .pa-rowabout, .pa-games .pa-row > .pa-rowstatus { grid-column: 1; }
.pa-games .pa-row > .pa-main { grid-column: 2; grid-row: 1 / span 3; margin: 0; }
.pa-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }
/* A card's chats, saved entries and account (public/parentpowers.js). */
.pa-chat { display: grid; gap: 6px; margin-top: 6px; max-height: 60vh; overflow-y: auto; }
.pa-chat > p { margin: 0; }
.pa-said { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; min-width: 0; }
.pa-said.pa-saidflag { border-color: var(--bad); }
.pa-said .pa-words { margin-top: 3px; }
.pa-shot { display: block; max-width: 100%; width: 360px; margin-top: 6px; border-radius: 6px; }
.pa-games .pa-row > .pa-rest { grid-column: 1 / -1; }
.pa-row > .pa-saved { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: 6px; }
.pa-account { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.pa-account h3 { margin: 4px 0 0; }
.pa-form { display: grid; gap: 4px; margin-top: 8px; }
.pa-form input { padding: 8px 10px; max-width: 24em; }
.pa-form .pa-buttons { margin-top: 2px; }
.pa-savebar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 10px; padding: 8px 0 2px; background: linear-gradient(transparent, var(--card) 35%); }
.pa-save { min-height: 40px; padding: 4px 18px; font-size: .95rem; }
.mf-list p { margin: 0; }
.mf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; }
.mf-row b { overflow-wrap: anywhere; }
.mf-row button { min-height: 40px; padding: 4px 10px; }
.mf-row .check, .mf-row small { grid-column: 1 / -1; margin: 0 0 4px; font-size: .9rem; color: var(--soft); }
#mf-form button { width: 100%; margin-top: 10px; }
#mf-form p { margin: 6px 0 0; }
#mf-note:empty { display: none; }

/* A friend's game: the player takes the room; no chat. */
#game.play-only .chat-side, #game.play-only #aloud { display: none; }
#game.play-only .stage-side { flex: 1; min-height: 0; }
#game.play-only .stage { flex: 1; height: auto; }
/* A friend with the chat open: the game gives up room for it. */
#game.play-only.talking .stage-side { flex: none; }
#game.play-only.talking .stage { flex: none; height: 46vh; }

@media (min-aspect-ratio: 1/1) and (min-width: 700px) {
  .split { flex-direction: row; }
  .stage-side { flex: 3; min-width: 0; }
  .stage { flex: 1; height: auto; }
  .chat-side { flex: 2; min-width: 280px; }
  .talk-side { flex: 2; min-width: 260px; }
  #game.play-only.talking .stage-side { flex: 3; }
  #game.play-only.talking .stage { flex: 1; height: auto; }
}

/* Full screen where the browser has none (an iPhone): the game is laid over the whole page, clear of the notch. */
#game.screen.big .stage { position: fixed; inset: 0; z-index: 10; height: auto; min-height: 0; border: 0; border-radius: 0; background: #000; }
#game.screen.big .stage iframe {
  top: env(safe-area-inset-top); left: env(safe-area-inset-left);
  width: calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right));
  height: calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.stage .unbig, .stage .stage-sound {
  position: absolute; z-index: 1; top: max(6px, env(safe-area-inset-top)); right: max(6px, env(safe-area-inset-right));
  width: 40px; min-height: 40px; padding: 0; border-radius: 20px; background: rgba(0, 0, 0, .55); color: #fff;
}

/* Game sound (gamesound.js): its button over a full screen game, beside the way out where there is one, and the note for
   someone playing with a controller, which lets the tap through to the game. */
.stage .stage-sound { opacity: .6; }
#game.big .stage .stage-sound { right: calc(max(6px, env(safe-area-inset-right)) + 48px); }
.sound-note {
  position: absolute; z-index: 1; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; padding: 6px 14px;
  border-radius: 18px; background: rgba(0, 0, 0, .75); color: #fff; white-space: nowrap; pointer-events: none;
}
.stage:fullscreen { border: 0; border-radius: 0; background: #000; }
.stage:-webkit-full-screen { border: 0; border-radius: 0; background: #000; }

/* An iPhone or iPad with the keyboard up (app.js): the game screen takes only what is left above it. */
body.typing #game { height: var(--seen); padding-bottom: 8px; }
body.typing #game.screen .stage { flex: none; height: calc(var(--seen) * .22); min-height: 60px; }
body.typing .chat { min-height: 0; }
body.typing #say-note:empty, body.typing #talk-note:empty { display: none; }
body.typing #game .player-bar { display: none; }
@media (min-aspect-ratio: 1/1) and (min-width: 700px) {
  body.typing #game.screen .stage { flex: 1; height: auto; }
}

/* iPhone and iPad only: the background cannot be pinned there, and a smaller list zooms the page when tapped. */
@supports (-webkit-touch-callout: none) {
  body { background-attachment: scroll; }
  .composer-row select { font-size: 16px; }
}

/* Small text buttons on a friend's chat line: Tell my parent, Mute. */
.come { border-color: var(--accent); }
.come .news-line { font-weight: 650; }
.say-extras { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 4px 0 0; }
.say-extras button { font-size: .85rem; padding: 4px 8px; }
.say-extras .ai-note { margin: 0; align-self: center; font-size: .75rem; }
#game.play-only .say-extras, #game.listing .say-extras { display: none; }
.reader-list { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.story-lines { max-height: 40vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.story-lines p { margin: 0; overflow-wrap: anywhere; }
/* Planning first, by themselves: one row; what it means is said in the typing box. */
#game.solo .plan-bar { border-color: var(--accent); gap: 6px; }
.offer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
button.danger { border-color: var(--bad); color: var(--bad); font-weight: 650; }
.versions-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; max-height: 50vh; overflow-y: auto; }
.version-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.version-row button { margin-left: auto; }
/* The Light panel (lightpanel.js) takes the chat's place, under the game or beside it, so the game is seen as it is set.
   On a phone the game's other buttons, its description and the panel's opening words give the settings their room, drawn
   closer, so the sliders are in sight and the game keeps its size. */
#game.lighting .chat-side, #game.lighting .talk-side { display: none; }
@media (max-width: 599px) {
  #game.lighting .player-bar, #game.lighting .about-row, #game.lighting .light-intro { display: none; }
  .light-side .light-picks button { padding: 4px 9px; font-size: .85rem; }
}
.light-side .composer-row button { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.light-side { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.light-side > * { flex: none; }
.light-side p { margin: 0; }
.light-side p:empty { display: none; }
@media (min-aspect-ratio: 1/1) and (min-width: 700px) { .light-side { flex: 2; min-width: 280px; } }
.light-body { display: flex; flex-direction: column; gap: 8px; }
.light-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.light-picks button { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.light-picks button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.light-row { display: flex; flex-direction: column; gap: 0; margin: 0; border-top: 1px solid var(--line); padding-top: 6px; }
.light-row input { width: 100%; min-height: 32px; margin: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); touch-action: pan-y; }
.light-ends { display: flex; justify-content: space-between; margin: 0; }
.light-body .light-back { align-self: flex-start; }

/* The Sounds panel (soundpanel.js): a block for each sound, the buttons staying in reach below them. */
.sound-list { display: flex; flex-direction: column; gap: 10px; }
.sound-row { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.sound-head { display: flex; align-items: center; gap: 8px; }
.sound-head .sound-play { margin-left: auto; min-height: 40px; white-space: nowrap; }
.sound-row select { width: 100%; min-height: 40px; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; }
.sound-more summary { cursor: pointer; padding: 6px 0; }
.sound-slider { display: grid; grid-template-columns: 4.6em 1fr 3.8em; align-items: center; gap: 8px; margin: 0; font-size: .8rem; }
.sound-slider[hidden] { display: none; }
.sound-slider input { width: 100%; min-width: 0; min-height: 36px; margin: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.sound-slider span:last-child { text-align: right; }
.sound-row .sound-back { align-self: flex-start; }
.sound-ask summary { cursor: pointer; padding: 6px 0; }
.sound-ask p { margin: 4px 0 0; }
.sound-ask-line { display: flex; gap: 8px; }
.sound-ask-line input { flex: 1; min-width: 0; min-height: 40px; }
.sound-ask-line button { min-height: 40px; white-space: nowrap; }
.sound-foot { position: sticky; bottom: -12px; background: var(--card); padding: 8px 0 12px; margin-bottom: -12px; display: flex; flex-direction: column; gap: 6px; }
.sound-foot p:empty { display: none; }

button.link { background: none; border: 0; padding: 0 0.2em; color: inherit; text-decoration: underline; font: inherit; font-size: 0.8em; opacity: 0.75; cursor: pointer; }

/* The hangout (hangout.js): its card on the home screen, and a small window over whatever is open. */
.hang-home { align-items: center; border-color: var(--accent); margin: 0 0 8px; }
.hang-home { flex-wrap: wrap; justify-content: flex-end; }
.hang-home span { flex: 1 1 180px; min-width: 0; font-weight: 650; }
.hang-home button { flex: none; }
#hang-open.busy { color: var(--accent); border-color: var(--accent); }
/* Above a game laid over the whole page (z-index 10), under the pop-up and the dialogs. */
.hang {
  position: fixed; z-index: 15; right: max(8px, env(safe-area-inset-right)); top: calc(env(safe-area-inset-top) + 62px);
  width: min(264px, calc(100vw - 16px)); max-height: calc(100dvh - 70px); display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.hang-head { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.hang-head b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.hang-head button { min-height: 36px; min-width: 40px; padding: 2px 8px; }
#hang-mic[aria-pressed="false"] { background: var(--warn); }
.hang.small { width: auto; min-width: 180px; }
.hang.small .hang-body { display: none; }
.hang.over .hang-tiles, .hang.over #hang-small, .hang.over #hang-cam, .hang.over #hang-mic, .hang.over #hang-hear, .hang.over #hang-invite { display: none; }
.hang-body { display: flex; flex-direction: column; gap: 6px; padding: 0 8px 8px; overflow-y: auto; min-height: 0; }
.hang-body p { margin: 0; }
.hang-body p:empty { display: none; }
.hang-body button { min-height: 38px; padding: 4px 8px; font-size: .85rem; }
.hang-body button.link { min-height: 28px; align-self: center; }
.hang-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.hang-tile { position: relative; aspect-ratio: 4 / 3; display: flex; align-items: flex-end; justify-content: space-between; overflow: hidden; border-radius: 8px; border: 2px solid transparent; background: var(--well); }
.hang-tile.talking { border-color: var(--accent); }
.hang-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.hang-tile.seen video { display: block; }
.hang-tile.self video { transform: scaleX(-1); } /* themselves as in a mirror */
.hang-name { position: relative; max-width: 72%; padding: 2px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .75rem; font-weight: 650; background: rgba(0, 0, 0, .55); border-radius: 0 6px 0 0; }
.hang-tile button.hang-quiet { position: relative; min-height: 30px; min-width: 32px; padding: 0 4px; border: 0; background: rgba(0, 0, 0, .55); }
.hang-body .composer-row { flex-wrap: wrap; }
.hang-body .composer-row button { flex: 1 1 auto; white-space: nowrap; } /* a button's words stay on one line; the row wraps */
/* Five or more: three across, in a wider window. */
.hang.crowd { width: min(348px, calc(100vw - 16px)); }
.hang.crowd .hang-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.hang.crowd .hang-name { max-width: 100%; padding: 1px 4px; font-size: .66rem; }
.hang.crowd .hang-tile button.hang-quiet { position: absolute; top: 0; right: 0; min-height: 24px; min-width: 26px; padding: 0 2px; font-size: .7rem; border-radius: 0 0 0 6px; }
.hang.crowd.small { width: auto; }
/* On a phone it takes less of the screen. */
@media (max-width: 599px) {
  .hang { width: 216px; }
  .hang.crowd { width: min(270px, calc(100vw - 16px)); }
  .hang.crowd.small { width: auto; }
  .hang-body .composer-row { flex-direction: column; gap: 4px; }
  .hang-body button { min-height: 34px; }
}

/* My style (src/styles.js) */
.ms-preview { display: block; width: 100%; height: min(54vw, 300px); border: 1px solid var(--line); border-radius: 12px; background: #000; margin: 12px 0; }
.ms-head { font-size: 1.05rem; margin: 14px 0 6px; font-family: inherit; }
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.ms-pick { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; padding: 8px 6px; min-height: 130px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-size: .9rem; }
.ms-pick[aria-pressed="true"] { border-color: var(--accent); }
.ms-pick img { height: 84px; width: 100%; object-fit: contain; }
.ms-pick.world img { object-fit: cover; border-radius: 8px; height: 72px; }
.ms-pick[disabled] { opacity: .6; }
.ms-pick small { color: var(--soft); line-height: 1.2; }
.ms-preview { position: sticky; top: 6px; z-index: 3; height: min(36vw, 220px); }
/* The 3D toy: a little taller, and a finger drawn across turns it (up and down still scrolls the page). */
.ms-toy { height: min(48vw, 250px); background: var(--card); cursor: grab; touch-action: pan-y; user-select: none; }
.ms-toy:active { cursor: grabbing; }
.ms-sub { font-size: .95rem; margin: 10px 0 4px; font-family: inherit; color: var(--soft); }
.ms-card { width: 100%; }
.ms-stage { position: relative; display: block; width: 100%; height: 84px; border-radius: 8px; overflow: hidden; background: #000; }
.ms-stage img { position: absolute; }
.ms-stage .w { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ms-stage .c { bottom: 2px; left: 50%; height: 88%; width: auto; max-width: 96%; transform: translateX(-50%); object-fit: contain; object-position: center bottom; }
.ms-card[disabled] .ms-stage { filter: grayscale(.7); }
.ms-stage .badge { top: 4px; right: 4px; width: 30px; height: 30px; padding: 2px; object-fit: contain; background: rgba(255, 255, 255, .88); border-radius: 50%; box-sizing: border-box; }
.ms-stage .badge.face { top: auto; bottom: 4px; }
.ms-stage .badge.neck { top: auto; bottom: 4px; right: auto; left: 4px; }
.ms-stage .badge.back { right: auto; left: 4px; }
/* The first pick, and the row of themes above the characters. */
.ms-start { border-color: var(--accent); margin: 12px 0; }
.ms-start .ms-head { margin-top: 0; }
.ms-starters { grid-template-columns: repeat(3, 1fr); }
.ms-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 8px; }
.ms-chips .ms-chip { flex: none; min-height: 36px; padding: 4px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: .85rem; white-space: nowrap; }
.ms-chips .ms-chip[aria-pressed="true"] { border-color: var(--accent); }
#ms-library-more { margin-top: 6px; }
/* Dark glasses need an edge to be seen on a dark card. */
#ms-faces .ms-pick img { filter: drop-shadow(0 0 2px rgba(255, 255, 255, .75)); }
.ms-none { display: flex; align-items: center; justify-content: center; height: 84px; font-size: 2rem; color: var(--soft); }
.ms-look { display: flex; flex-direction: column; gap: 4px; }
.ms-look .quiet { font-size: .85rem; }
.ms-save { margin: 10px 0; }
/* What they earned or were given, said once under the home buttons (public/app.js). */
.avatar-news { display: grid; gap: 6px; margin: 0 0 8px; }
.news-piece { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--accent); border-radius: 10px; background: rgba(255, 255, 255, .04); }
.news-piece img { flex: none; width: 40px; height: 40px; object-fit: contain; }
.news-piece span { flex: 1; min-width: 0; }
.news-piece button { flex: none; min-height: 36px; }
.new-tag { color: var(--accent); font-weight: 700; }
.ms-save-row { display: flex; gap: 8px; margin-top: 4px; }
.ms-save-row input { flex: 1; min-width: 0; }
/* A game made in Godot: while its engine is fetched, the words over the stage (public/app.js). */
.godot-loading { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; font-size: 14px; opacity: 0.85; pointer-events: none; z-index: 2; }
#godot-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }

/* Something's wrong (public/index.html, src/fixit.js). */
.wrong-box { display: grid; gap: 8px; }
.wrong-box label { margin: 0; }
.wrong-row { display: flex; flex-wrap: wrap; gap: 8px; }
.wrong-row input { flex: 1 1 220px; min-width: 0; }

/* A controller in use (padnav.js): a highlight that can be seen from the sofa, the line saying which button does what, and the
   portal's own keyboard, list and yes/no box, over everything else. */
body.pad-on :focus, body.pad-on .pad-at { outline: 3px solid #ffd54a !important; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(0, 0, 0, .55); }
body.pad-on .screen { padding-bottom: 46px; }
.padnav-hint {
  position: fixed; z-index: 55; left: 50%; bottom: max(6px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0;
  padding: 4px 14px; border-radius: 16px; background: rgba(0, 0, 0, .8); color: #fff; font-size: .85rem; white-space: nowrap;
  max-width: 98vw; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.padnav-over { position: fixed; z-index: 50; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 10px 10px 44px; background: rgba(0, 0, 0, .55); }
#padnav-ask, #padnav-list { align-items: center; }
.padnav-card { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 640px; max-height: 100%; overflow-y: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#padnav-ask .padnav-card, #padnav-list .padnav-card { max-width: 400px; }
.padnav-card p { margin: 0; }
.padnav-line { min-height: 2.8em; max-height: 5.8em; overflow-y: auto; padding: 8px 10px; border-radius: 10px; background: var(--well); white-space: pre-wrap; overflow-wrap: anywhere; }
.padnav-line::after { content: "▏"; color: var(--accent); }
.padnav-keys { display: flex; flex-direction: column; gap: 6px; }
.padnav-row { display: flex; gap: 6px; }
.padnav-row button { flex: 1; min-width: 0; padding: 8px 2px; }
.padnav-tools button { font-size: .85rem; }
.padnav-tools button[aria-pressed="true"] { border-color: var(--accent); }
.padnav-choices { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; padding: 8px; }
