/* Brateng Music v3 — the phone shell (SPEC v3 §6.3, §4.2 Phone, §8.1, §8.4).
 *
 * Carried from the approved mockup (design/build_v3_phone_mockups.py, its CSS
 * string, 428x926) — but as FLUID CSS px, not a scaled canvas: the house has
 * two phones (428x926 and 440x956) and Safari's toolbar takes the bottom band,
 * so the stage is the VISUAL viewport (js/shells/phone.js sets --vvh from
 * visualViewport; 100dvh is the CSS fallback) and the art gives way first.
 * The shared player (base.css, §5) is re-metric'd here for the phone's frame.
 *
 * Every rule is scoped `.phone …` (the class the shell puts on its stage) so
 * nothing here reaches the kid or kiosk shells, which share the page. `dvh`
 * and env() are the phone-only allowances §6.3 names.
 */

/* ---------------------------------------------------------------- stage */
.stage.phone {
  left: 0; top: 0; width: 100%;
  height: 100dvh; height: var(--vvh, 100dvh);
  transform: none;
  font: 16px/1.3 -apple-system, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  overflow: hidden;
}
.phone .wash { background: radial-gradient(520px 620px at 50% 30%, var(--tint) 0%, var(--tint2) 45%, transparent 75%); }
.phone .scr { flex-direction: column; padding: calc(env(safe-area-inset-top, 0px) + 12px) 20px 0; }
.phone .top { display: flex; align-items: center; gap: 10px; height: 48px; flex: 0 0 auto; }
.phone .top .sp { flex: 1; }
.phone .top h1 { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.phone .homebtn, .phone .iconbtn {
  width: 48px; height: 48px; border-radius: 50%; padding: 0;
  background: var(--panel); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--dim); flex: 0 0 auto;
}
.phone .homebtn .ico, .phone .iconbtn .ico { width: 24px; height: 24px; }
.phone .pill {
  height: 48px; padding: 0 18px 0 14px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; color: var(--text);
}
.phone .pill .ico { width: 20px; height: 20px; color: var(--accent2); }

/* Rows: the mockup's phone metrics over base.css's kid ones. */
.phone .tr { gap: 12px; height: 56px; padding: 0 10px; border-radius: 12px; }
.phone .tr .i { width: 24px; font-size: 15px; }
.phone .tr .i .ico { width: 18px; height: 18px; }
.phone .tr .th { width: 42px; height: 42px; border-radius: 8px; background: var(--panel2) center/cover no-repeat; }
.phone .tr .t { font-size: 16px; }
.phone .tr .t small { font-size: 13px; }
.phone .tr .d { font-size: 14px; }
.phone .tr.dim { opacity: .45; }
.phone .sh { font-size: 12px; margin: 14px 0 4px 10px; }
.phone .empty { color: var(--dim); font-size: 16px; font-weight: 600; padding: 18px 10px; }
.phone .sk.row { height: 56px; }
.phone .sk.tile { border-radius: var(--r); }

/* ================================================================== HOME */
.phone .card {
  margin-top: 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line);
  padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 0 0 auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45); cursor: pointer; text-align: left; width: 100%;
}
.phone .card .row { display: flex; align-items: center; gap: 14px; }
.phone .card .a { width: 96px; height: 96px; border-radius: 14px; flex: 0 0 auto; box-shadow: 0 10px 24px rgba(0, 0, 0, .45); background: var(--panel2) center/cover no-repeat; }
.phone .card .tt { flex: 1; min-width: 0; }
.phone .card .tt b { display: block; font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone .card .tt small { display: block; color: var(--dim); font-size: 14px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone .grp { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 14px; font-weight: 600; }
.phone .card .grp { margin-top: 8px; }
.phone .grp .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); flex: 0 0 auto; }
.phone .grp .dot.off { background: #3a4358; box-shadow: none; }
.phone .card .pbar { height: 5px; border-radius: 3px; background: #2a3347; position: relative; overflow: hidden; }
.phone .card .pbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: var(--accent2); }
.phone .card .tx { display: flex; align-items: center; justify-content: center; gap: 26px; margin: -2px 0 0; padding: 0; }
.phone .card .tx .k { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: none; border: 0; padding: 0; }
.phone .card .tx .k .ico { width: 26px; height: 26px; }
/* §7.21: a live station — no skip on the card either. */
.phone .card.live .k[data-key="prev"], .phone .card.live .k[data-key="next"] { visibility: hidden; }
.phone .card .tx .k.play { width: 60px; height: 60px; background: var(--text); color: #0b0d12; }
.phone .card .tx .k.play .ico { width: 30px; height: 30px; }
/* No room selected: "Pick a room", inert (§4.2 branch 3). Selected but
   nothing loaded: the rooms line stands, the keys are still live (Play
   resumes the queue) — an idle group is not a missing one. */
.phone .card.pick { cursor: default; }
.phone .card.pick .tt b { color: var(--dim); }
.phone .card.pick .tx, .phone .card.pick .pbar, .phone .card.idle .pbar { display: none; }
.phone .card.pick .a, .phone .card.idle .a { box-shadow: none; }
.phone .card .a.blank { background: var(--panel2); }
.phone .acts { display: flex; gap: 10px; margin: 12px 0 0; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); flex: 0 0 auto; }
.phone .acts .pill { flex: 1; justify-content: center; }
.phone .grid {
  margin-top: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px;
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; align-content: start; padding-bottom: 12px;
  -webkit-mask-image: linear-gradient(#000 92%, transparent); mask-image: linear-gradient(#000 92%, transparent);
}
/* `width: 100%`, not auto: kid.css's bare `.tile` (220px, its own grid's
   track) loads on this page too and would set the phone's 1fr tracks to 220
   — the kiosk carries the same override (kiosk.css `.kiosk .tile`). */
.phone .tile { display: flex; flex-direction: column; color: var(--text); text-align: left; min-width: 0; width: 100%; padding: 0; }
.phone .tile .t { flex-shrink: 1; width: auto; }
.phone .tile .a { width: 100%; aspect-ratio: 1; border-radius: var(--r); box-shadow: 0 10px 26px rgba(0, 0, 0, .45); background: var(--panel2) center/cover no-repeat; position: relative; }
.phone .tile .a .noart { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; color: var(--dim); font-size: 15px; font-weight: 700; line-height: 1.25; }
.phone .tile .t { margin-top: 8px; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone .grid .empty { grid-column: 1 / -1; }

/* ================================================================ PLAYER
 * The shared player's DOM (§5) in the mockup's column: art (or the playing
 * list) on top, then the rooms line, the origin line / announcement badge
 * under it (26a), the title row with the list button, artist, progress,
 * back · play · stop · next, group volume, and the Speakers button at the
 * foot naming the group. */
.phone .player { padding: calc(env(safe-area-inset-top, 0px) + 12px) 20px 0; flex-direction: column; }
.phone .player .top { height: 48px; }
.phone .player .body { flex: 1; min-height: 0; flex-direction: column; align-items: stretch; margin-top: 0; }
/* The art gives way first: a square that is as tall as the room left over,
   capped at the mockup's 348. Absolute inside the flexible band so the
   percentage height resolves against the band's laid-out size. */
.phone .player .lft { width: auto; height: auto; flex: 1 1 auto; min-height: 120px; position: relative; margin-top: 10px; }
.phone .art {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  height: 100%; max-height: 348px; width: auto; aspect-ratio: 1; max-width: 100%;
  border-radius: 22px; box-shadow: 0 26px 60px rgba(0, 0, 0, .6);
}
.phone .player.idle .art { background: var(--panel2); box-shadow: none; display: grid; place-items: center; color: #3a4358; font-size: 120px; }
.phone.pane-list .player.idle .art { display: none; }
.phone .player.idle .art::before { content: "♪"; }
.phone .pq { position: absolute; inset: 0; height: auto; }
.phone .pq .cap { display: none; }
.phone .pq .tr { height: 56px; }
.phone .player .col { margin-left: 0; height: auto; flex: 0 0 auto; justify-content: flex-start; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
.phone .player .grp { margin-top: 18px; font-size: 15px; }
.phone .player .from { margin-top: 6px; font-size: 14px; }
.phone .player .from .ico { width: 16px; height: 16px; }
.phone .player .from.ann { height: 34px; padding: 0 14px; font-size: 14px; }
.phone .ttlrow { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.phone .ttl { margin-top: 0; flex: 1; min-width: 0; font-size: 30px; line-height: 1.1; }
.phone .stage .listbtn, .phone .listbtn { width: 52px; height: 52px; border-radius: 50%; }
.phone .listbtn .ico { width: 26px; height: 26px; }
.phone .listbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.phone .artist { margin-top: 4px; font-size: 17px; }
.phone .prog { margin-top: 14px; }
.phone .prog.seekable { padding: 10px 0; margin-top: 6px; }
.phone .prog .bar { height: 6px; border-radius: 3px; }
.phone .prog .bar b { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.phone .prog .t { font-size: 13px; margin-top: 8px; }
.phone .tx { justify-content: space-between; gap: 0; margin-top: 12px; padding: 0 6px; }
.phone .tx button { width: 66px; height: 66px; }
.phone .tx button .ico { width: 30px; height: 30px; }
.phone .tx button.play { width: 84px; height: 84px; }
.phone .tx button.play .ico { width: 40px; height: 40px; }
.phone .tx button[data-act="stop"] .ico { width: 26px; height: 26px; }
.phone .vol { gap: 12px; margin-top: 14px; }
.phone .vol .ico { width: 26px; height: 26px; }
.phone .vol .n { width: 40px; font-size: 18px; }
.phone.stage input[type=range], .phone input[type=range] { height: 44px; }
.phone input[type=range]::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; }
.phone input[type=range]::-webkit-slider-thumb { width: 30px; height: 30px; margin-top: -10px; }
.phone .spkbtn {
  margin-top: 14px; height: 52px; border-radius: 999px; width: 100%;
  background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 16px;
}
.phone .spkbtn .ico { width: 22px; height: 22px; color: var(--accent2); flex: 0 0 auto; }
/* A short layout viewport (an old small phone, a split view; neither house
   phone gets here — Safari's layout viewport never drops below ~740 pt on
   them): a tighter column so the transport stays on screen. */
@media (max-height: 640px) {
  .phone .player .grp { margin-top: 10px; }
  .phone .tx { margin-top: 6px; }
  .phone .tx button { width: 56px; height: 56px; }
  .phone .tx button.play { width: 70px; height: 70px; }
  .phone .vol { margin-top: 8px; }
  .phone .spkbtn { margin-top: 8px; height: 46px; }
}

/* ======================================================== SPEAKERS SHEET
 * Over whichever screen opened it; closes back to it (§6.3). Toggles edit a
 * DRAFT; one POST /api/zones on close (§4.2). */
.phone .dimm { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); display: none; z-index: 20; }
.phone.sheet .dimm { display: block; }
.phone .sheetp {
  position: absolute; left: 0; right: 0; bottom: 0; height: 640px; max-height: 84%;
  border-radius: 26px 26px 0 0; background: var(--panel); border-top: 1px solid var(--line);
  display: none; flex-direction: column; padding: 10px 16px 0; z-index: 21;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
}
.phone.sheet .sheetp { display: flex; }
.phone .sheetp .hand { width: 44px; height: 5px; border-radius: 3px; background: #3a4358; margin: 0 auto 12px; flex: 0 0 auto; }
.phone .sheetp h2 { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.phone .sheetp h2 small { color: var(--dim); font-size: 14px; font-weight: 600; margin-left: auto; }
.phone .sheetp .done { height: 36px; padding: 0 16px; border-radius: 999px; background: var(--text); color: #0b0d12; font-size: 14px; font-weight: 800; }
.phone .zl { margin-top: 10px; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; -webkit-mask-image: linear-gradient(#000 92%, transparent); mask-image: linear-gradient(#000 92%, transparent); }
.phone .z { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 6px 0 4px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.phone .z .tog { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; background: var(--panel2); border: 2px solid var(--line); color: transparent; padding: 0; }
.phone .z .tog .ico { width: 22px; height: 22px; }
.phone .z.on .tog { background: var(--accent); border-color: var(--accent); color: #fff; }
.phone .z .nm { width: 132px; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 0 auto; }
/* A slider is live only for a zone ALREADY IN the group (§4.2) — a drafted-in
   zone still belongs to another group. */
.phone .z input[type=range] { opacity: .22; height: 40px; pointer-events: none; }
.phone .z.live input[type=range] { opacity: 1; pointer-events: auto; }
.phone .z input[type=range]::-webkit-slider-runnable-track { height: 8px; }
.phone .z input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -9px; }
.phone .z .n { width: 34px; text-align: right; font-size: 15px; font-weight: 700; color: var(--dim); font-variant-numeric: tabular-nums; }
.phone .z.live .n { color: var(--text); }
.phone .zfoot { height: 64px; display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 16px; font-weight: 700; border-top: 1px solid var(--line); flex: 0 0 auto; margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); }
.phone .zfoot .ico { width: 24px; height: 24px; flex: 0 0 auto; }
.phone .zfoot .n { width: 40px; text-align: right; font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.phone .zfoot.off input[type=range] { opacity: .22; pointer-events: none; }
/* Every volume control dimmed and inert while the group is ducked or
   announcing (§5 — the restore overwrites member volumes). */
.phone .sheetp.quiet input[type=range] { opacity: .22; pointer-events: none; }

/* ============================================================== PLAYLIST */
.phone .pld { display: flex; gap: 16px; align-items: flex-end; margin-top: 18px; flex: 0 0 auto; }
.phone .pld .a { width: 132px; height: 132px; border-radius: 16px; flex: 0 0 auto; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); background: var(--panel2) center/cover no-repeat; position: relative; }
.phone .pld .a .noart { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; color: var(--dim); font-size: 15px; font-weight: 700; }
.phone .pld .a.round { border-radius: 50%; }
.phone .pld > div { min-width: 0; }
.phone .pld h2 { font-size: 26px; font-weight: 800; line-height: 1.05; letter-spacing: -.015em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.phone .pld .m { color: var(--dim); font-size: 14px; margin-top: 4px; min-height: 18px; }
.phone .pld .go { margin-top: 12px; display: flex; gap: 8px; }
.phone .pld .go button { height: 44px; padding: 0 18px; border-radius: 999px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.phone .pld .go .p { background: var(--text); color: #0b0d12; }
.phone .pld .go .s { background: var(--panel2); border: 1px solid var(--line); color: var(--text); }
.phone .pld .go .ico { width: 18px; height: 18px; }
.phone .plist .list { margin-top: 14px; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); -webkit-mask-image: linear-gradient(#000 92%, transparent); mask-image: linear-gradient(#000 92%, transparent); }
/* kid.css's `.plist .list .tr` rules (60 px rows, a two-column 4n stripe)
   outrank `.phone .tr` on specificity; restated here at the same weight,
   later in the cascade, for the phone's one-column list. */
.phone .plist .list .tr { height: 56px; overflow: visible; }
.phone .plist .list .tr:nth-child(odd) { background: none; }
.phone .plist .list .tr:nth-child(even) { background: rgba(255, 255, 255, .03); }
.phone .plist .list .tr.now { background: linear-gradient(90deg, rgba(79, 140, 255, .22), rgba(79, 140, 255, .04)); }

/* ================================================================ SEARCH */
.phone .sbar { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.phone .sbox { flex: 1; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 12px 0 16px; border-radius: 999px; background: var(--panel); border: 2px solid var(--accent); min-width: 0; }
.phone .sbox .ico { width: 22px; height: 22px; color: var(--accent2); flex: 0 0 auto; }
.phone .sbox input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 19px; font-weight: 600; -webkit-appearance: none; appearance: none; }
.phone .sbox input::-webkit-search-cancel-button, .phone .sbox input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.phone .sbox input::placeholder { color: var(--dim); font-weight: 500; }
.phone .sbox .x { width: 34px; height: 34px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; color: var(--dim); flex: 0 0 auto; padding: 0; }
.phone .sbox .x .ico { width: 16px; height: 16px; color: var(--dim); }
.phone .hits { margin-top: 6px; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }

/* The phone's toast: above the bottom Speakers / Search row, clear of the
   home indicator (§8.3). On <body>, so scoped by the body class. */
body.shell-phone .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); font-size: 15px; padding: 12px 18px; max-width: 86%; }
