/* Studio shell (P0.2). Tokens come from the manifest theme (set on :root by config.js); nothing here is studio-specific. */
:root {
  --plaster: #efeae0; --panel: #f8f5ef; --ink: #23271f; --muted: #6b6f62; --accent: #a07a32; --accent2: #5d6d53; --warm: #6b4428;
  --line: #d9d2c4; --stage: #1b1d19;
  --display: system-ui, sans-serif; --body: system-ui, sans-serif; --mono: ui-monospace, Menlo, monospace;
  --panel2: color-mix(in srgb, var(--panel) 90%, var(--ink));
  --on-accent: var(--stage);
  --on-accent2: var(--panel);
  --glass: rgba(20, 22, 18, .72); --glass-ink: #ece7dc;
  /* text tokens: the studio's colours darkened (light theme) or lightened (dark theme) toward the ink so small text keeps 4.5:1 on panel and plaster */
  --muted-t: color-mix(in srgb, var(--muted) 78%, var(--ink));
  --accent-t: color-mix(in srgb, var(--accent) 62%, var(--ink));
  --accent2-t: color-mix(in srgb, var(--accent2) 55%, var(--ink));
  --bad-t: color-mix(in srgb, var(--bad) 70%, var(--ink));
}
:root[data-theme="dark"] { --on-accent2: var(--stage); }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--stage); color: var(--ink); font: 15px/1.4 var(--body); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

/* ---- shell grid ---- */
.app { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 52px 1fr; height: 100vh; height: 100dvh; background: var(--plaster); position: relative; overflow: hidden; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 1rem var(--display); min-width: 0; }
.brand img { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.brand b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 4px; background: var(--plaster); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tabs button { border: 0; background: transparent; border-radius: 999px; padding: 5px 14px; font-weight: 600; font-size: .82rem; color: var(--muted-t); }
.tabs button.on { background: var(--panel2); color: var(--ink); }
.top .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: .78rem; font-weight: 600; background: transparent; white-space: nowrap; }
.chip.on { border-color: var(--accent); color: var(--accent-t); }
.chip.look { color: var(--accent2-t); border-color: color-mix(in srgb, var(--accent2) 50%, transparent); }
button.chip:hover, .tabs button:hover, .icon:hover, .st:hover { border-color: var(--accent); }
.icon { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 1rem; display: grid; place-items: center; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- station rail ---- */
.rail { grid-column: 1; grid-row: 2; border-right: 1px solid var(--line); background: var(--panel); padding: 14px 12px; display: flex; flex-direction: column; gap: 14px; overflow: auto; min-height: 0; }
.lbl { font: 600 .66rem var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted-t); }
.railhead { display: flex; justify-content: space-between; align-items: center; }
.railhead button { border: 1px solid var(--line); background: transparent; border-radius: 8px; width: 26px; height: 26px; font-size: .9rem; color: var(--muted-t); line-height: 1; padding: 0; }
.stations { display: grid; gap: 4px; }
.st { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; text-align: left; width: 100%; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 5px; }
.st img { width: 52px; height: 39px; object-fit: cover; border-radius: 6px; background: var(--plaster); }
.st b { display: block; font-size: .88rem; } .st span { display: block; font-size: .78rem; color: var(--muted-t); line-height: 1.25; }
.st.on { border-color: var(--accent); background: var(--plaster); }
.st.on b { color: var(--accent-t); }
.angles { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 4px 6px 62px; }
.recent { display: flex; gap: 6px; flex-wrap: wrap; } .recent img { width: 60px; height: 45px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.recent .more { width: 60px; height: 45px; border-radius: 6px; border: 1px dashed var(--line); display: grid; place-items: center; font-size: .7rem; color: var(--muted-t); }
.recent .empty { margin: 0; font-size: .74rem; color: var(--muted-t); }
.app.rail-min { grid-template-columns: 64px 1fr; }
.app.rail-min .rail { padding: 10px 6px; gap: 8px; align-items: center; }
.app.rail-min .rail .lbl, .app.rail-min .recentbox, .app.rail-min .st div, .app.rail-min .rail .angles { display: none; }
.app.rail-min .railhead { justify-content: center; }
.railbtns { display: flex; gap: 4px; }
.railhead button.pptog, .sfstrip .pptog { display: grid; place-items: center; color: var(--muted-t); }
.pptog[aria-pressed="true"] { color: var(--accent-t); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.app.rail-min .pptog { display: none !important; }
.sfstrip { position: relative; padding-right: 46px; }
.sfstrip .pptog { position: absolute; top: 8px; right: 12px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; width: 26px; height: 26px; padding: 0; }
.app.rail-min .stations { gap: 6px; }
.app.rail-min .st { grid-template-columns: 1fr; padding: 3px; }
.app.rail-min .st img { width: 44px; height: 34px; }

/* ---- viewfinder ---- */
.stage { grid-column: 2; grid-row: 2; position: relative; background: var(--stage); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; }
.gl { position: absolute; inset: 0; }
.gl canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.view::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.18), transparent 30%, transparent 60%, rgba(0,0,0,.4)); pointer-events: none; z-index: 1; }
.frame { position: absolute; z-index: 1; border: 2px solid var(--accent); border-radius: 3px; box-shadow: 0 0 0 4000px rgba(0,0,0,.42); pointer-events: none; transition: box-shadow .2s, border-color .2s; }
.frame .safe { position: absolute; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); }
.frame .tag { position: absolute; left: 6px; top: 6px; font: 500 .68rem var(--mono); color: var(--glass-ink); background: rgba(10,11,9,.74); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.ring { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; overflow: visible; }
.ring .halo { fill: none; stroke: color-mix(in srgb, var(--accent) 28%, transparent); stroke-width: 9; }
.ring .line { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--accent); stroke-width: 2; }
.ringlbl { position: absolute; z-index: 2; transform: translate(-50%, 0); font: 600 .7rem var(--body); color: var(--glass-ink); white-space: nowrap; background: rgba(10,11,9,.74); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.hud { position: absolute; z-index: 3; display: flex; gap: 8px; align-items: center; }
.hud.l { left: 16px; bottom: 14px; font: 500 .76rem var(--mono); color: var(--glass-ink); background: rgba(10,11,9,.74); padding: 6px 10px; border-radius: 8px; backdrop-filter: blur(6px); }
.hud.r { right: 16px; bottom: 14px; }
.hud .popover { left: auto; right: 0; }
.pill { border: 1px solid rgba(255,255,255,.22); background: var(--glass); color: var(--glass-ink); border-radius: 999px; padding: 7px 12px; font-size: .78rem; font-weight: 600; backdrop-filter: blur(6px); }
.pill.on { border-color: var(--accent); color: var(--glass-ink); box-shadow: inset 0 0 0 1px var(--accent); }
.pill:hover { border-color: var(--accent); }

.styling-btn { position: absolute; right: 16px; top: 14px; z-index: 3; }
.angles2 { position: absolute; left: 16px; top: 14px; z-index: 3; display: none; gap: 4px; flex-wrap: wrap; max-width: calc(100% - 130px); }
.angles2 .pill { padding: 5px 10px; font-size: .72rem; }
.app.rail-min .angles2 { display: flex; }
.hud { pointer-events: none; } .hud > button, .hud > .has-pop { pointer-events: auto; }   /* the HUD frame never swallows a tap meant for the picture */   /* the text hint and the HUD frame never swallow a tap meant for the picture */
.loading { position: absolute; inset: 0; z-index: 9; display: grid; place-content: center; gap: 10px; background: var(--stage); color: var(--glass-ink); font: 14px var(--body); text-align: center; }
.loading i { display: block; height: 3px; width: 0; background: var(--accent); justify-self: start; transition: width .2s; }

/* ---- composer ---- */
.composer { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); z-index: 5; background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; backdrop-filter: blur(10px); box-shadow: 0 12px 36px rgba(0,0,0,.35); display: grid; gap: 8px; transition: left .2s, width .2s; }
.row1 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--plaster); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 4px 11px; font-size: .76rem; font-weight: 600; color: var(--muted-t); }
.seg button.on { background: var(--accent2); color: var(--on-accent2); }
.food { display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--accent); border-radius: 999px; padding: 4px 12px 4px 6px; font-size: .78rem; font-weight: 600; color: var(--accent-t); background: transparent; }
.food .plus { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; }
.food.add.compact { padding: 4px; } .food.add.compact .txt { display: none; }
.subjects { display: contents; }
.subj { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px 4px 4px; font-size: .78rem; font-weight: 600; max-width: 190px; }
.subj img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.subj .nm { min-width: 0; } .subj .nm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 84px; }
.subj small { display: block; font-weight: 500; color: var(--muted-t); font-size: .68rem; white-space: nowrap; }
.subj .x { border: 0; background: none; color: var(--muted-t); padding: 2px 4px; }
.row2 { display: flex; gap: 8px; align-items: center; }
.composer input[type="text"] { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--plaster); color: var(--ink); border-radius: 12px; padding: 11px 14px; font: .9rem var(--body); }
.composer input::placeholder { color: var(--muted-t); }
.go { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 12px; padding: 11px 18px; font-weight: 700; font-size: .9rem; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.go.mini { display: none; padding: 8px 14px; font-size: .84rem; border-radius: 999px; }
.row3 { display: flex; gap: 8px; align-items: flex-start; }
.sugg { flex: 1; min-width: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.sugg .chip { font-weight: 500; color: var(--muted-t); padding: 3px 10px; font-size: .74rem; }
.has-pop { position: relative; }
.popover { position: absolute; bottom: calc(100% + 8px); left: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: none; z-index: 6; box-shadow: 0 10px 30px rgba(0,0,0,.3); min-width: 210px; }
.popover.open { display: block; }
.popover button { display: flex; width: 100%; justify-content: space-between; gap: 14px; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-size: .8rem; text-align: left; }
.popover button:hover { background: var(--panel2); } .popover button.on { color: var(--accent-t); }
.popover small { color: var(--muted-t); font-family: var(--mono); font-size: .68rem; }
.popover p { margin: 4px 8px; font-size: .78rem; color: var(--muted-t); }

/* ---- styling drawer ---- */
.drawer { position: absolute; right: 0; top: 52px; bottom: 0; width: 292px; background: var(--panel); border-left: 1px solid var(--line); padding: 14px 14px 20px; display: none; flex-direction: column; gap: 16px; overflow: auto; z-index: 6; }
.drawer h3 { margin: 0; font: 700 1rem var(--display); display: flex; justify-content: space-between; align-items: center; }
.drawer h3 button { border: 0; background: none; color: var(--muted-t); font-size: 1rem; }
.drawer .note { font-size: .78rem; color: var(--muted-t); margin: 0; }
.app.drawer-open .drawer { display: flex; }
.app.drawer-open .composer { left: calc((100% - 292px) / 2); width: min(760px, calc(100% - 292px - 32px)); }
.app.drawer-open .styling-btn { right: 308px; }
.app.drawer-open .hud.r { right: 308px; }

/* ---- panels: library + admin placeholders ---- */
.libpanel { position: absolute; inset: 52px 0 0 0; background: var(--plaster); display: none; flex-direction: column; gap: 8px; padding: 22px; z-index: 8; overflow: auto; }
.libpanel h2 { margin: 0; font: 700 1.25rem var(--display); }
.libpanel p, .admin p { margin: 0; font-size: .86rem; color: var(--muted-t); }
.app[data-tab="library"] .libpanel { display: flex; }
.admin { position: absolute; inset: 52px 0 0 0; z-index: 20; background: rgba(10,11,9,.7); display: none; place-items: center; }
.admin.on { display: grid; }
.admin .box { width: min(520px, 92%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 12px; }
.admin h3 { margin: 0; font: 700 1.05rem var(--display); display: flex; justify-content: space-between; }
.admin h3 button { border: 0; background: none; color: var(--muted-t); }
.toast { position: fixed; left: 50%; top: 62px; transform: translateX(-50%); z-index: 60; background: var(--accent2); color: var(--on-accent2); font-weight: 600; font-size: .84rem; padding: 9px 16px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.35); opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.on { opacity: 1; }

/* ---- focus mode: stations collapsed, Styling closed (both can be opened), a one-line composer ---- */
.app.focus .composer .row2, .app.focus .composer .row3, .app.focus .seg, .app.focus .angles2 { display: none !important; }
.app.focus .composer { width: auto; max-width: calc(100% - 32px); padding: 8px 10px; border-radius: 999px; left: 50%; }
.app.focus .composer .row1 { flex-wrap: nowrap; }
.app.focus .go.mini { display: inline-flex; }
.app.focus.drawer-open .composer { left: calc((100% - 292px) / 2); max-width: calc(100% - 292px - 32px); }

/* ---- phone ---- */
@media (max-width: 760px) {
  body { overflow: auto; }
  .app, .app.rail-min, .app.focus { grid-template-columns: 1fr; grid-template-rows: 52px auto minmax(0, 1fr); }
  .top { gap: 8px; padding: 0 12px; }
  .brand b, .chip.look { display: none; }
  .tabs button { padding: 5px 10px; }
  .rail, .app.rail-min .rail { grid-column: 1; grid-row: 2; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; overflow-x: auto; overflow-y: hidden; align-items: center; gap: 0; }
  .railhead, .recentbox, .rail .angles, .st div { display: none !important; }
  .stations, .app.rail-min .stations { display: flex; gap: 6px; }
  .st, .app.rail-min .st { width: auto; flex: none; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; gap: 6px; font-size: .78rem; font-weight: 600; }
  .st img, .app.rail-min .st img { display: none; }
  .st::after { content: attr(data-label); }
  .st.on { border-color: var(--accent); color: var(--accent-t); }
  .stwrap { flex: none; }
  .stage { grid-column: 1; grid-row: 3; overflow: auto; }
  .view { flex: none; aspect-ratio: 4 / 5; width: 100%; }
  .angles2, .app.rail-min .angles2 { display: flex; left: 10px; top: 10px; }
  .angles2 .pill { padding: 4px 9px; font-size: .68rem; }
  .styling-btn { right: 10px; top: 10px; font-size: .7rem; padding: 5px 10px; }
  .hud.l { left: 10px; bottom: 10px; font-size: .62rem; max-width: 52%; }
  .hud.r { right: 10px; bottom: 10px; flex-direction: column; align-items: flex-end; gap: 6px; }
  .hud.r .pill { font-size: .7rem; padding: 5px 10px; }
  .composer, .app.drawer-open .composer, .app.focus .composer {
    position: sticky; left: auto; bottom: 0; transform: none; width: 100%; max-width: none; margin-top: auto; border-radius: 16px 16px 0 0; border-width: 1px 0 0; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(0,0,0,.25); }
  .row1, .app.focus .composer .row1 { flex-wrap: wrap; }
  .subj small { display: none; }
  .rail, .row3, .sugg { scrollbar-width: none; } .rail::-webkit-scrollbar, .row3::-webkit-scrollbar { display: none; }
  .sugg { flex-wrap: nowrap; overflow-x: auto; }
  .sugg .chip { flex: none; }
  .go { padding: 10px 14px; font-size: .84rem; }
  .popover { position: fixed; left: 12px; right: 12px; bottom: 140px; }
  .drawer, .app.drawer-open .drawer { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 55vh; border: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; z-index: 30; box-shadow: 0 -10px 30px rgba(0,0,0,.35); }
  .app.drawer-open .styling-btn { right: 10px; }
  .app.drawer-open .hud.r { right: 10px; }
  .row3 { overflow-x: auto; }
  .app.focus .rail { display: none; }
  .app.focus .view { aspect-ratio: auto; flex: 1; }
  .libpanel, .admin { inset: 52px 0 0 0; }
}

/* ---- shot flow (P0.3): progress strip in the composer ---- */
:root { --bad: #b4553c; }
.making-wrap { display: grid; gap: 8px; }
.composer.making .row1, .composer.making .row2, .composer.making .row3 { display: none !important; }
.app.focus .composer.making { width: min(760px, calc(100% - 32px)); border-radius: 16px; padding: 10px 12px; }
.prog { display: flex; gap: 12px; align-items: center; }
.prog .ptxt { min-width: 0; flex: 0 1 62%; }
.prog b { font-size: .86rem; } .prog span { font-size: .76rem; color: var(--muted-t); display: block; }
.prog .bar { flex: 1; min-width: 40px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.prog .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .5s; }
.go.quiet { background: transparent; color: var(--muted-t); border: 1px solid var(--line); font-weight: 600; padding: 8px 14px; font-size: .82rem; }
.notice { border: 1px solid var(--bad); color: var(--bad-t); background: color-mix(in srgb, var(--bad) 10%, transparent); border-radius: 10px; padding: 7px 11px; font-size: .78rem; font-weight: 600; }
.gentle { color: var(--muted-t); background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 10px; padding: 6px 10px; font-size: .74rem; font-weight: 500; }
.attempts { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.attempts figure { margin: 0; font-size: .66rem; color: var(--muted-t); text-align: center; }
.attempts img, .attempts .ph { width: 66px; height: 50px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.attempts .ph { border-style: dashed; }
.attempts figure.bad img { border-color: var(--bad); } .attempts figure.ok img { border-color: var(--accent2); }
.attempts figure.now img { border-color: var(--accent); opacity: .6; } .attempts figure.now .ph { border-color: var(--accent); }

/* ---- result overlay ---- */
.result { position: absolute; inset: 52px 0 0 232px; z-index: 7; display: grid; place-items: center; background: rgba(10,11,9,.78); backdrop-filter: blur(8px); overflow: auto; }
.app.rail-min .result { inset: 52px 0 0 64px; }
.app.focus .result { inset: 52px 0 0 0; }
.rcard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; display: grid; grid-template-columns: auto 300px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); max-width: 96%; }
.ba { position: relative; background: #000; overflow: hidden; touch-action: none; cursor: ew-resize; width: 640px; height: 480px; max-width: 100%; }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.ba .after { clip-path: inset(0 0 0 44%); }
.ba .handle { position: absolute; top: 0; bottom: 0; left: 44%; width: 2px; background: #fff; pointer-events: none; }
.ba .handle::after { content: "◀ ▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: #fff; color: #1b1d19; font-size: .62rem; font-weight: 700; padding: 6px 8px; border-radius: 999px; letter-spacing: 1px; white-space: nowrap; }
.ba .cap { position: absolute; bottom: 10px; font: 500 .68rem var(--mono); background: rgba(10,11,9,.74); color: #f1ede3; padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.ba .cap.l { left: 10px; } .ba .cap.r { right: 10px; }
.rside { padding: 16px; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--line); min-width: 0; }
.rside h3 { margin: 0; font: 700 1.05rem var(--display); }
.rside .meta { font-size: .76rem; color: var(--muted-t); }
.rside .ok { color: var(--accent2-t); font-weight: 600; }
.rside input { border: 1px solid var(--line); background: var(--plaster); color: var(--ink); border-radius: 10px; padding: 9px 12px; font: .84rem var(--body); }
.btn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 9px 14px; font-weight: 600; font-size: .82rem; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn small { color: var(--muted-t); font-weight: 500; font-size: .7rem; }
.btn.primary small { color: inherit; opacity: .7; }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 5px; }
.dl button { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 7px 4px; font-size: .64rem; display: grid; gap: 2px; justify-items: center; text-align: center; }
.dl button b { font-family: var(--mono); font-weight: 500; font-size: .74rem; }
.dl button:hover, .dl button.on { border-color: var(--accent); } .dl button.on { color: var(--accent-t); }
.rside .foot { margin-top: auto; display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted-t); }
.rside .foot button { border: 0; background: none; color: var(--muted-t); text-decoration: underline; font-size: .76rem; }
.result.narrow { place-items: start center; padding: 8px 0; }
.result.narrow .rcard { grid-template-columns: 1fr; }
.result.narrow .rside { border-left: 0; border-top: 1px solid var(--line); }
.result.narrow .ba { margin: 0 auto; }
@media (max-width: 760px) { .result, .app.rail-min .result { inset: 52px 0 0 0; } }
@media (max-width: 899px) {
  .prog { flex-wrap: wrap; } .prog .ptxt { flex: 1 1 100%; }
}

/* ---- P0.4: record overlay (library) ---- */
.result.saved [data-regen] { display: none; }

/* ---- P0.4: styling drawer ---- */
.dbody { display: flex; flex-direction: column; gap: 16px; }
.drawer .lbl { margin-bottom: 6px; }
.sets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.set { border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: left; background: transparent; min-width: 0; }
.set b { display: block; font-size: .8rem; }
.set span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: .68rem; color: var(--muted-t); line-height: 1.3; margin-top: 2px; }
.set.on { border-color: var(--accent); background: var(--plaster); } .set.on b { color: var(--accent-t); }
.set:hover { border-color: var(--accent); }
.props { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.prop { border: 1px solid var(--line); border-radius: 10px; padding: 8px 2px 6px; background: transparent; display: grid; justify-items: center; gap: 4px; font-size: .62rem; color: var(--muted-t); min-width: 0; text-align: center; }
.prop i { font-style: normal; font-size: 1.15rem; }
.prop.on { border-color: var(--accent); color: var(--accent-t); } .prop.wait { background: var(--plaster); border-style: dashed; }
.prop:hover { border-color: var(--accent); }
.drawer .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.toggles { display: grid; gap: 6px; margin-top: 10px; }
.tog { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; border: 0; background: none; padding: 2px 0; width: 100%; text-align: left; }
.sw { width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.sw.on { background: var(--accent2); } .sw.on::after { left: 17px; background: var(--on-accent2); }
.reset { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 7px 12px; font-size: .78rem; font-weight: 600; }
.reset:hover { border-color: var(--accent); }
.pmarks { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; display: none; }
.app.drawer-open .pmarks { display: block; }     /* the prop is a real 3D object; the handle shows only while the drawer is open */
.pmark { position: absolute; transform: translate(-50%, 14px); pointer-events: auto; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; background: rgba(0,0,0,.6); border: 1px solid var(--accent); color: var(--glass-ink); border-radius: 999px; padding: 2px 8px 2px 4px; font: 600 .66rem var(--body); white-space: nowrap; }
.pmark i { font-style: normal; font-size: .95rem; }
.pmark:hover { border-color: var(--glass-ink); }
/* selected 3D prop: name, rotate, remove */
.p3hud { position: absolute; z-index: 3; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.62); border: 1px solid var(--accent); border-radius: 999px; padding: 3px 4px 3px 11px; color: var(--glass-ink); font: 600 .72rem var(--body); backdrop-filter: blur(6px); white-space: nowrap; }
.p3hud[hidden] { display: none; }
.p3b { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: var(--glass-ink); font-size: .95rem; line-height: 1; display: inline-grid; place-items: center; cursor: pointer; }
.p3b:hover { background: var(--accent); color: var(--on-accent, #111); }
.app.focus .p3hud { display: none; }
@media (max-width: 760px) { .p3b { width: 34px; height: 34px; } }

/* ---- P0.4: library ---- */
.libpanel { padding: 0; gap: 0; }
.libhead { display: flex; gap: 8px; align-items: center; padding: 16px 22px 10px; flex-wrap: wrap; }
.libhead h2 { margin: 0 14px 0 0; }
.libhead .sep { width: 1px; height: 22px; background: var(--line); }
.libhead .search { margin-left: auto; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: .82rem var(--body); width: 240px; max-width: 100%; }
.libgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; padding: 6px 22px 30px; }
.libempty { padding: 6px 22px; font-size: .9rem; color: var(--muted-t); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; position: relative; min-width: 0; }
.card .th { padding: 0; border: 0; background: #000; width: 100%; display: block; }
.card .th img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card .body { padding: 9px 11px 11px; }
.card .body b { display: block; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .body span { font-size: .72rem; color: var(--muted-t); }
.card .badge { position: absolute; top: 8px; left: 8px; font: 500 .66rem var(--mono); background: rgba(10,11,9,.76); color: #f1ede3; padding: 2px 7px; border-radius: 6px; }
.card.pending img { opacity: .8; }
.card .fstatus { margin: 8px 0 0; font-size: .74rem; font-weight: 600; color: var(--muted-t); }
.card .fstatus.bad { color: var(--bad-t); }
.card.pending button:disabled { opacity: .55; cursor: default; }
.card.pending .badge { background: var(--accent2); color: #1a1a14; font-weight: 700; }
.card .badge.set { left: auto; right: 8px; background: rgba(10,11,9,.76); color: #f1ede3; border: 1px solid var(--accent2); font-weight: 700; }
.card .acts { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.card .acts button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 9px; font-size: .68rem; font-weight: 600; }
.card .acts button:hover { border-color: var(--accent); }
.card .acts button.del { color: var(--bad-t); }
.card .acts button.more, .card .acts button.x { margin-left: auto; }
.card .th { cursor: zoom-in; }
.card.isset .th { cursor: pointer; }
.libhead .fsel { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 7px 12px; font: 600 .78rem var(--body); max-width: 180px; }
.libhead .fsel.on { border-color: var(--accent); color: var(--accent-t); }
.app[data-tab="library"] .result { inset: 52px 0 0 0; z-index: 9; }
@media (max-width: 760px) { .libhead { padding: 14px 12px 8px; } .libgrid { padding: 6px 12px 24px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } .libhead .search { margin-left: 0; width: 100%; } .libhead .sep { display: none; } }

/* ---- P0.4: admin ---- */
.admin { overflow: auto; align-items: start; padding: 18px 0; }
.admin .box { width: min(640px, 94%); gap: 14px; margin: auto; }
.admin .box h3 { align-items: center; }
.admin .abody { display: grid; gap: 14px; }
.admin textarea, .admin input[type="text"] { width: 100%; border: 1px solid var(--line); background: var(--plaster); color: var(--ink); border-radius: 10px; padding: 9px 12px; font: .82rem var(--body); }
.admin textarea { min-height: 150px; resize: vertical; font-family: var(--mono); font-size: .74rem; line-height: 1.45; }
.admin .arow { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: center; font-size: .8rem; }
.admin .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin .lbl { margin-bottom: 4px; }
.admin .thr { display: flex; gap: 10px; align-items: center; font-size: .8rem; } .admin .thr input { flex: 1; }
.admin .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin .msg { font-size: .78rem; color: var(--accent2-t); font-weight: 600; } .admin .msg.err { color: var(--bad-t); }
.admin .keys { font-size: .74rem; }
.admin hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 0; }
.admin .pkg { font: 500 .72rem var(--mono); color: var(--muted-t); }
@media (max-width: 760px) { .admin .arow { grid-template-columns: 1fr; gap: 3px; } }

/* ---- account (P2): credits chip, workspace switcher ---- */
.chip.credits { color: var(--accent2-t); }
.chip.credits.low { color: #b3261e; border-color: #b3261e; }
select.chip { appearance: auto; background: var(--panel); color: var(--ink); max-width: 160px; }

/* ---- layout preset "subject-first" (studio.layout): upload tile first, stations as a strip above the composer, no left rail ---- */
.app.sf { grid-template-columns: 1fr; }
.app.sf .rail, .app.sf .angles2 { display: none !important; }
.app.sf .stage { grid-column: 1; }
.app.sf .result, .app.sf.rail-min .result { inset: 52px 0 0 0; }
.uptile { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; width: min(440px, calc(100% - 40px)); display: grid; justify-items: center; gap: 8px; text-align: center; padding: 30px 24px; border: 2px dashed var(--accent); border-radius: 20px; background: color-mix(in srgb, var(--panel) 90%, transparent); color: var(--ink); backdrop-filter: blur(8px); box-shadow: 0 16px 48px rgba(0,0,0,.35); }
.uptile:hover { background: var(--panel); }
.app.placing .uptile { opacity: 0; pointer-events: none; }
.app.hasprops .uptile { top: auto; bottom: 56px; left: 14px; transform: none; width: auto; padding: 6px 14px 6px 6px; grid-auto-flow: column; gap: 8px; border-radius: 999px; }
.app.hasprops .uptile .upplus { width: 28px; height: 28px; font-size: 1.2rem; }
.app.hasprops .uptile b { font-size: .86rem; } .app.hasprops .uptile small { display: none; }
.uptile .upplus { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font: 600 2rem/1 var(--display); }
.uptile b { font: 700 1.25rem var(--display); }
.uptile small { font-size: .84rem; color: var(--muted-t); max-width: 34ch; }
.sfstrip { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 12px 6px; display: grid; gap: 6px; min-width: 0; }
.sfstrip .sfst .stations { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.sfstrip .stwrap { flex: none; }
.sfstrip .st { width: auto; display: grid; grid-template-columns: 44px auto; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; }
.sfstrip .st img { width: 44px; height: 34px; border-radius: 999px; }
.sfstrip .st span { display: none; }
.sfstrip .st.on { border-color: var(--accent); }
.sfstrip .angles { padding: 0; }
.sfstrip .sfang:empty { display: none; }
.app.sf .composer { position: relative; left: auto; bottom: auto; transform: none; width: auto; margin: 0; border-radius: 0; border-width: 1px 0 0; box-shadow: none; backdrop-filter: none; }
.app.sf.nosubj .food.add { display: none; }
.app.sf.focus .sfstrip { display: none; }
.app.sf.focus .composer, .app.sf.drawer-open .composer { left: auto; width: auto; max-width: none; border-radius: 0; padding: 10px 12px; }
.app.sf.focus .composer.making { width: auto; border-radius: 0; }
@media (min-width: 761px) {
  .app.sf.drawer-open .stage { margin-right: 292px; }
  .app.sf.drawer-open .styling-btn, .app.sf.drawer-open .hud.r { right: 16px; }
  .app.sf.drawer-open .composer { width: auto; left: auto; }
}
@media (max-width: 760px) {
  .app.sf, .app.sf.rail-min, .app.sf.focus { grid-template-rows: 52px minmax(0, 1fr); }
  .app.sf .stage { grid-row: 2; }
  .app.sf .composer, .app.sf.drawer-open .composer, .app.sf.focus .composer { position: sticky; border-radius: 16px 16px 0 0; }
  .sfstrip { padding: 6px 12px 4px; }
  .sfstrip .angles { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sfstrip .angles .chip { flex: none; }
  .sfstrip .st, .app.sf .st { display: inline-flex; }
  .uptile { padding: 22px 16px; }
}

/* ---- P4.1: studio switcher, workspaces admin, library studio tag, discard confirm ---- */
.swwrap { position: relative; display: inline-flex; flex: none; }
.swchip i { font-style: normal; font-size: .7rem; opacity: .7; }
.swmenu { top: calc(100% + 8px); bottom: auto; left: 0; right: auto; min-width: 250px; padding: 6px; display: none; z-index: 60; }
.swmenu.open { display: grid; gap: 4px; }
.switem { display: flex; align-items: center; gap: 10px; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 6px; text-align: left; color: var(--ink); }
.switem:hover { border-color: var(--accent); }
.switem.on { border-color: var(--accent); }
.switem img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; }
.switem .swt { display: grid; min-width: 0; } .switem small { color: var(--muted-t); font-size: .7rem; }
.card .from { display: block; font: 500 .66rem var(--mono); color: var(--accent2-t); margin-top: 2px; }
[data-discard].armed { color: var(--bad-t); border-color: var(--bad); font-weight: 700; }
@media (max-width: 760px) { .top .right { min-width: 0; } .top .right .icon { flex: none; } .acctname { display: none; } .chip.acct { padding: 4px; } .swchip { padding: 5px 8px; } .brand { flex: none; } .swmenu { position: absolute; left: 0; right: auto; top: calc(100% + 8px); bottom: auto; width: 270px; } }
.switem { justify-content: flex-start !important; }

/* ---- shot pop-ups (P4.2): screen-space card, leader, pinned dot, hollow rings, overview pins ---- */
.pp { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; --pp-th-w: 64px; --pp-th-h: 48px; --pp-halo: color-mix(in srgb, var(--stage) 55%, transparent); }
.pp.narrow { --pp-th-w: 52px; --pp-th-h: 39px; }
.pp-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; opacity: 0; transition: opacity .16s; }
.pp-svg.show { opacity: 1; }
.pp-svg line, .pp-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pp-svg .halo { stroke: var(--pp-halo); stroke-width: 3; } .pp-svg .lead { stroke: var(--accent); stroke-width: 1.25; } .pp-svg .chev { stroke: var(--accent); stroke-width: 2; }
.pp-card { position: absolute; left: 0; top: 0; pointer-events: auto; background: color-mix(in srgb, var(--panel) 90%, transparent); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 8px 8px; backdrop-filter: blur(6px); box-shadow: 0 6px 18px rgba(0,0,0,.16); width: max-content; max-width: calc(100% - 24px);
  opacity: 0; visibility: hidden; transform: translateY(4px) scale(.97); transition: opacity .16s, transform .16s, visibility 0s linear .16s; }
.pp-card.on { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .16s; }
.pp-link { border: 0; background: none; padding: 2px 0 6px; font: 600 .74rem var(--body); color: var(--ink); cursor: pointer; text-align: left; }
.pp-link:hover { text-decoration: underline; }
.pp-thumbs { display: flex; gap: 6px; align-items: center; }
.pp-th { border: 1px solid var(--line); border-radius: 6px; padding: 0; min-height: 44px; min-width: 44px; background: var(--line); overflow: hidden; display: grid; place-items: center; }
.pp-th:hover, .pp-more:hover { border-color: var(--accent); }
.pp-th img { width: var(--pp-th-w); height: var(--pp-th-h); object-fit: cover; display: block; }
.pp-more { border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); font: 600 .72rem var(--body); padding: 5px 9px; min-height: 32px; white-space: nowrap; }
.pp-more:hover { color: var(--accent-t); }
.pp-dot, .pp-pin, .pp-ring { position: absolute; left: 0; top: 0; }
.pp-dot { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--accent); pointer-events: none; opacity: 0; transition: opacity .16s;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 9px color-mix(in srgb, var(--accent) 35%, transparent); }
.pp-dot.show { opacity: 1; }
.pp-dot.pulse { animation: pppulse .6s ease-out 1; }
@keyframes pppulse { 0% { box-shadow: 0 0 0 2px var(--panel), 0 0 0 9px color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 0 0 2px var(--panel), 0 0 0 20px color-mix(in srgb, var(--accent) 10%, transparent); }
  100% { box-shadow: 0 0 0 2px var(--panel), 0 0 0 9px color-mix(in srgb, var(--accent) 35%, transparent); } }
.pp-ring { width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: transparent; border: 2px solid var(--accent); padding: 0; cursor: pointer; pointer-events: auto; box-shadow: 0 0 0 2px var(--pp-halo); }
.pp-ring::after { content: ""; position: absolute; inset: -10px; }
/* a tap is about to place something (a prop waiting, or a subject ring to move): rings, pins and the card must not steal it */
.app.placing .pp-ring, .app.placing .pp-pin, .app.placing .pp-card, .app:not(.nosubj) .pp-ring, .app:not(.nosubj) .pp-pin { pointer-events: none; }
.pp-pin { pointer-events: auto; display: inline-flex; align-items: center; gap: 5px; font: 700 .7rem var(--mono); color: var(--on-accent); background: var(--accent); border-radius: 999px;
  padding: 3px 8px 3px 7px; border: 2px solid var(--panel); cursor: pointer; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.pp-pin span { font: 600 .66rem var(--body); letter-spacing: .02em; }
.pp-pin:hover { background: var(--ink); color: var(--panel); }
.pp-card :focus-visible, .pp-pin:focus-visible, .pp-ring:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .pp-card, .pp-card.on { transition: opacity .08s, visibility 0s; transform: none; } .pp-svg, .pp-dot { transition: none; } .pp-dot.pulse { animation: none; } }

/* ---- attempt viewer: every attempt opens full size, the creator decides ---- */
.attempts figure.viewable { cursor: zoom-in; } .attempts figure.viewable:hover img { border-color: var(--accent); }
.attempts figure.kept img { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.athint { font-size: .78rem; font-weight: 600; color: var(--muted-t); }
.rattempts .attempts img { width: 56px; height: 42px; }
.avw { position: absolute; inset: 52px 0 0 0; z-index: 12; background: rgba(10,11,9,.9); display: grid; place-items: center; }
.avbox { display: grid; grid-template-columns: 1fr 300px; width: min(1240px, 98%); height: min(92%, 860px); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.avstage { position: relative; background: #0d0e0c; overflow: hidden; display: grid; place-items: center; cursor: zoom-in; touch-action: none; user-select: none; min-height: 0; }
.avstage.zoomed { cursor: grab; }
.avstage img { position: absolute; left: 50%; top: 50%; max-width: none; max-height: none; transform-origin: center; will-change: transform; -webkit-user-drag: none; pointer-events: none; }
.avnav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border: 0; border-radius: 10px; background: var(--glass); color: var(--glass-ink); font-size: 1.6rem; line-height: 1; padding: 0; }
.avnav.l { left: 10px; } .avnav.r { right: 10px; } .avnav:disabled { opacity: .3; }
.avside { padding: 16px; display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--line); min-width: 0; min-height: 0; overflow: auto; }
.avhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; } .avhead h3 { margin: 0; font: 700 1rem var(--display); }
.avx { border: 0; background: none; color: var(--muted-t); font-size: 1rem; padding: 4px; }
.avverdict { font-weight: 700; font-size: 1.05rem; } .avverdict.ok { color: var(--accent2-t); } .avverdict.bad { color: var(--bad-t); }
.avnotes { margin: 0; padding-left: 18px; font-size: .84rem; display: grid; gap: 4px; }
.avhint { font-size: .78rem; color: var(--muted-t); }
.avactions { margin-top: auto; display: grid; gap: 8px; }
@media (max-width: 760px) {
  .avbox { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; width: 100%; height: 100%; border-radius: 0; border: 0; }
  .avside { border-left: 0; border-top: 1px solid var(--line); max-height: 48vh; max-height: 48dvh; }
  .avactions { grid-template-columns: 1fr 1fr; }
}

/* ======================================================================================================
   UX changes A-J (2026-10-26)
   ====================================================================================================== */

/* ---- J: focus rings on every interactive control, in both themes ---- */
:focus-visible { outline: 2px solid var(--accent-t); outline-offset: 2px; }
.pill:focus-visible, .hud button:focus-visible, .coach button:focus-visible, .avnav:focus-visible { outline: 2px solid var(--glass-ink); outline-offset: 2px; box-shadow: 0 0 0 4px rgba(10,11,9,.7); }
.st:focus-visible, .seg button:focus-visible, .tabs button:focus-visible, .chip:focus-visible, .btn:focus-visible, .go:focus-visible, .card .th:focus-visible,
.card .acts button:focus-visible, .set:focus-visible, .prop:focus-visible, .tog:focus-visible, .reset:focus-visible, .dl button:focus-visible, .popover button:focus-visible,
.icon:focus-visible, .food:focus-visible, .subj .x:focus-visible, .uptile:focus-visible, .switem:focus-visible, .rclose:focus-visible, .tert button:focus-visible, .pptog:focus-visible { outline: 2px solid var(--accent-t); outline-offset: 2px; }
.composer input[type="text"]:focus-visible, .rside input:focus-visible, .libhead .search:focus-visible, .libhead .fsel:focus-visible, .admin textarea:focus-visible, .admin input:focus-visible { outline: 2px solid var(--accent-t); outline-offset: 1px; }
.camsheet input[type="range"]:focus-visible { outline: 2px solid var(--accent-t); outline-offset: 4px; border-radius: 2px; }
.ba:focus-visible { outline: 3px solid var(--accent-t); outline-offset: -3px; }
.pill[aria-pressed="true"], .chip[aria-pressed="true"] { font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ---- A: coach strip, station tooltip, phone strip fades ---- */
.coach { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); width: max-content; z-index: 4; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  background: rgba(10,11,9,.86); color: var(--glass-ink); border: 1px solid var(--accent); border-radius: 999px; padding: 6px 8px 6px 16px; backdrop-filter: blur(6px); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.coach ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px 18px; flex-wrap: wrap; counter-reset: c; font-size: .86rem; font-weight: 600; }
.coach li { counter-increment: c; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.coach li::before { content: counter(c); width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; font: 700 .76rem var(--body); flex: none; }
.coachx { border: 0; background: transparent; color: var(--glass-ink); width: 30px; height: 30px; border-radius: 50%; font-size: .9rem; flex: none; }
.coachx:hover { background: rgba(255,255,255,.14); }
.app.focus .coach { display: none; }
.icon.on { border-color: var(--accent); color: var(--accent-t); }
.sttip { position: fixed; z-index: 70; pointer-events: none; display: grid; gap: 1px; background: var(--ink); color: var(--panel); border-radius: 10px; padding: 8px 12px; max-width: 240px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.sttip b { font-size: .94rem; } .sttip span { font-size: .88rem; opacity: .95; }
.sttip[hidden] { display: none; }
@media (max-width: 760px) {
  .rail, .app.sf .sfst .stations { -webkit-mask-image: none; mask-image: none; }
  .rail.fade-r, .sfstrip .stations.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
  .rail.fade-l, .sfstrip .stations.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
  .rail.fade-l.fade-r, .sfstrip .stations.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
  .coach { top: 48px; border-radius: 16px; padding: 8px 8px 8px 12px; }
  .coach ol { font-size: .8rem; gap: 4px 12px; }
}

/* ---- B: the crop frame, quiet until there is a subject or text ---- */
.frame.quiet { border-width: 1px; border-color: color-mix(in srgb, var(--glass-ink) 45%, transparent); box-shadow: 0 0 0 4000px rgba(0,0,0,.14); }
.frame.quiet .safe { display: none; }
.frame.quiet .tag { font-size: .66rem; padding: 1px 7px; background: rgba(10,11,9,.62); }
.app.sf.nosubj .frame.quiet { box-shadow: none; }
.hud .has-pop { display: inline-flex; }
.hideframe { border-top: 1px solid var(--line) !important; border-radius: 0 0 8px 8px !important; margin-top: 4px; }
.hideframe[aria-pressed="true"] small { color: var(--accent-t); }

/* ---- C: earlier-shot cards: solid background, a count badge on phones ---- */
.pp-card { background: var(--panel); backdrop-filter: none; }
.pp-badge { position: absolute; left: 0; top: 0; pointer-events: auto; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 999px; border: 2px solid var(--panel); background: var(--accent); color: var(--on-accent); font: 700 .86rem var(--mono); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent), 0 2px 8px rgba(0,0,0,.3); cursor: pointer; display: grid; place-items: center; }
.pp-badge[hidden] { display: none; }
.pp-badge:focus-visible { outline: 2px solid var(--glass-ink); outline-offset: 3px; }
.app.placing .pp-badge, .app:not(.nosubj) .pp-badge { pointer-events: none; }

/* ---- D: the camera sheet ---- */
.camsheet { width: 264px; min-width: 264px; padding: 12px 14px 14px; display: none; }
.camsheet.open { display: grid; gap: 10px; }
.camrow { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; font-weight: 600; }
.camrow output { font: 600 .8rem var(--mono); color: var(--muted-t); }
.camsheet input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; background: var(--line); border-radius: 2px; margin: 8px 0 0; cursor: pointer; }
.camsheet input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--accent-t); }
.camsheet input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }
.camticks { position: relative; height: 18px; margin: -2px 9px 0; }
.camticks span { position: absolute; transform: translateX(-50%); font: 600 .72rem var(--mono); color: var(--muted-t); }
.camticks span::before { content: ""; position: absolute; left: 50%; top: -6px; width: 1px; height: 5px; background: var(--muted-t); }
.camhow b { font-size: .8rem; } .camhow p { margin: 2px 0 0 !important; font-size: .8rem !important; color: var(--muted-t); line-height: 1.4; }
.camsheet .reset { justify-content: center; }
.popover.camsheet button { display: inline-flex; }

/* ---- E: composer chips ---- */
.sugg .chip.more { border-style: dashed; }
.sugg .chip { color: var(--muted-t); }
.sugg .chip.on { color: var(--accent-t); }

/* ---- F: library ---- */
.libhead .chip.tag { font-weight: 500; text-transform: none; }
.setback { display: flex; align-items: center; gap: 10px; padding: 2px 22px 6px; font-weight: 600; font-size: .9rem; }
.setback[hidden] { display: none; }
.card .kept { display: inline-block; margin-top: 3px; font: 600 .68rem var(--body); color: var(--accent2-t); border: 1px solid color-mix(in srgb, var(--accent2) 55%, transparent); border-radius: 999px; padding: 1px 8px; }
.card .acts.sizes { align-items: center; }
.card .acts .asklbl { font-size: .72rem; font-weight: 600; color: var(--muted-t); width: 100%; }
.card .acts.sizes button.on { border-color: var(--accent); color: var(--accent-t); font-weight: 700; }
.card.isset { box-shadow: 4px 4px 0 -1px var(--panel), 4px 4px 0 0 var(--line), 8px 8px 0 -1px var(--panel), 8px 8px 0 0 var(--line); margin: 0 8px 8px 0; }
@media (max-width: 760px) { .setback { padding: 2px 12px 6px; } }

/* ---- G: result overlay hierarchy ---- */
.rhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rclose { border: 1px solid var(--line); background: transparent; color: var(--muted-t); border-radius: 999px; padding: 3px 10px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.rclose small { opacity: .8; font-size: .66rem; margin-left: 3px; }
.rclose:hover { border-color: var(--accent); color: var(--ink); }
.rstatus { font-size: .86rem; font-weight: 600; display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: help; }
.rstatus::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--accent2); }
.rstatus.ok { color: var(--accent2-t); }
.rstatus.flag { color: var(--bad-t); } .rstatus.flag::before { background: var(--bad); }
.rstatus[hidden] { display: none; }
.dlsplit { position: relative; display: flex; gap: 2px; }
.dlsplit .btn.primary:first-child { flex: 1; border-radius: 999px 0 0 999px; padding: 11px 14px; font-size: .9rem; font-weight: 700; }
.dlsplit .dlmore { border-radius: 0 999px 999px 0; padding: 11px 14px; justify-content: center; }
.dlsplit .popover { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); min-width: 230px; }
.dlsplit .popover.open { display: block; }
.dlpop button.on { color: var(--accent-t); font-weight: 700; }
.tert { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .84rem; color: var(--muted-t); }
.tert button { border: 0; background: none; color: var(--ink); font-size: .84rem; font-weight: 600; padding: 4px 6px; border-radius: 6px; text-decoration: underline; text-underline-offset: 3px; }
.tert button:hover { color: var(--accent-t); }
.tert [data-discard] { color: var(--bad-t); }
.result.saved [data-regen] { display: inline-block; }
.rside .foot { justify-content: flex-end; }

/* ---- H: admin tabs ---- */
.apane { display: grid; gap: 14px; }
.admin .lbl { color: var(--muted-t); }

/* ---- I: flash when "Signature look" opens the mood section ---- */
.drawer .flash { animation: flashbox 1.6s ease-out 1; border-radius: 10px; }
@keyframes flashbox { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (max-width: 760px) {
  .rside .tert { justify-content: flex-start; }
  .camsheet { position: fixed; left: 12px; right: 12px; bottom: 150px; width: auto; min-width: 0; }
}
.hud.r:has(.popover.open) { z-index: 9; }
.admin [data-ai] { display: grid; gap: 14px; }
.admin .keys { color: var(--muted-t); }

.propshead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.linkbtn { border: 0; background: none; color: var(--accent); font: 600 .78rem var(--body); cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- account menu (auth.js) and the no-studio page ---- */
.chip.acct { gap: 7px; padding: 3px 11px 3px 3px; max-width: 200px; }
.acctav { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: .72rem; font-weight: 700; flex: none; }
.acctname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acctmenu { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; min-width: 250px; z-index: 60; }
.acctmenu.open { display: grid; gap: 2px; }
.accthead { display: grid; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; min-width: 0; }
.accthead b { font-size: .86rem; } .accthead small { font-family: var(--body); overflow-wrap: anywhere; }
.acctitem { display: flex; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-size: .8rem; text-align: left; color: var(--ink); text-decoration: none; }
.acctitem:hover { background: var(--panel2); } .acctitem.out { color: var(--bad-t); }
.acctpw { display: grid; gap: 6px; padding: 4px 8px 8px; }
.acctpw input { border: 1px solid var(--line); background: var(--plaster); color: var(--ink); border-radius: 8px; padding: 7px 9px; font: .8rem var(--body); min-width: 0; }
.acctpw .btn { justify-self: start; }
.acctmsg { margin: 0; font-size: .74rem; color: var(--muted-t); } .acctmsg.err { color: var(--bad-t); }
.app.nostudio { display: grid; place-items: center; grid-template-columns: 1fr; grid-template-rows: 1fr; padding: 16px; overflow: auto; }
.nscard { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: grid; gap: 12px; }
.nscard h1 { margin: 0; font: 700 1.2rem var(--display); } .nscard p { margin: 0; color: var(--muted-t); font-size: .9rem; }
.nslist, .nsacts { display: flex; flex-wrap: wrap; gap: 8px; } .nscard a.chip { color: var(--ink); text-decoration: none; }
/* the library's "could not be refreshed" banner sits above the grid and stays visible beside cached photos; the shared network banner is one line at the top */
.liberr { border: 1px solid var(--bad); color: var(--bad-t); background: color-mix(in srgb, var(--bad) 10%, transparent); border-radius: 10px; margin: 4px 22px 8px; padding: 7px 11px; font-weight: 600; }
.liberr:not([hidden]) { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.liberr[hidden] { display: none; }
.netbanner { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px); background: var(--panel); color: var(--bad-t); border: 1px solid var(--bad); border-radius: 999px; padding: 6px 14px; font-size: .82rem; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.netbanner[hidden] { display: none; }
