/* SUPER Ascii Cam — interface: buttons, start screen, top bar, rail, panels, dock, strip, shutter, recording,
 * viewer, help, hints, toasts. Surfaces are dark glass with a top-lit sheen and a thin border lit in
 * the current lens's accent; everything pressable scales up while pressed (.is-pressed, js/ui.js). */

/* ───────── buttons ───────── */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,0) 62%), var(--glass);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  transition: transform .18s var(--ease-spring), border-color .2s, background-color .2s, box-shadow .25s, color .2s, opacity .3s, visibility 0s;
  box-shadow: 0 8px 26px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.1), inset 0 0 0 1px rgba(0,0,0,.18);
}
@media (hover: hover) {
  .btn:hover { border-color: var(--accent-line); color: #fff; box-shadow: 0 8px 26px rgba(0,0,0,.38), 0 0 24px -6px var(--accent), inset 0 1px 0 rgba(255,255,255,.12); }
}
.btn.is-pressed {
  transform: scale(1.12);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 26px rgba(0,0,0,.38), 0 0 30px -4px var(--accent), inset 0 0 14px -6px var(--accent), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn:focus-visible, .chip:focus-visible, .switch:focus-visible, .shutter:focus-visible, .thumb:focus-visible, .start__alt:focus-visible, .slider:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 4px;
}
.btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn--icon { width: 54px; height: 54px; padding: 0; }
.btn:disabled { opacity: .3; pointer-events: none; }

/* Desktop tooltips (data-tip), shown after a short hover. */
@media (hover: hover) and (pointer: fine) {
  [data-tip]::after {
    content: attr(data-tip);
    position: absolute; left: 50%; top: calc(100% + 12px);
    translate: -50% 0;
    padding: 7px 13px; border-radius: 10px;
    font: 600 15px/1.2 var(--font-ui); letter-spacing: .03em; white-space: nowrap; color: #fff;
    background: var(--glass-strong); border: 1px solid var(--line);
    box-shadow: 0 8px 22px rgba(0,0,0,.45);
    opacity: 0; transform: translateY(-4px) scale(.96);
    transition: opacity .16s, transform .2s var(--ease-out);
    pointer-events: none;
  }
  [data-tip]:hover::after { opacity: 1; transform: none; transition-delay: .45s; }
  .rail [data-tip]::after { top: 50%; left: auto; right: calc(100% + 14px); translate: 0 -50%; transform: translateX(4px) scale(.96); }
  .rail [data-tip]:hover::after { transform: none; }
  .dock [data-tip]::after { top: auto; bottom: calc(100% + 12px); transform: translateY(4px) scale(.96); }
  .dock [data-tip]:hover::after { transform: none; }
  .is-active[data-tip]::after, .is-pressed[data-tip]::after, .no-tip[data-tip]::after { opacity: 0 !important; transition-delay: 0s !important; }
}

/* ───────── hero (start camera) ───────── */
.btn--hero {
  gap: 14px;
  padding: 20px 40px 20px 30px;
  font-size: 26px; font-weight: 700; letter-spacing: .04em;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 20%, rgba(8,10,16,.55)), rgba(8,10,16,.78));
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 0 44px -6px color-mix(in srgb, var(--accent) 70%, transparent), 0 14px 44px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.2);
  animation: heroBreathe 2.8s ease-in-out infinite;
}
.btn--hero.is-pressed { transform: scale(1.08); }
.hero__icon { position: relative; width: 34px; height: 34px; flex: none; }
.hero__icon svg { position: absolute; inset: 0; width: 34px; height: 34px; stroke: var(--accent); stroke-width: 1.8; transition: opacity .25s, transform .35s var(--ease-pop); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 70%, transparent)); }
.hero__iris { opacity: 0; transform: scale(.4) rotate(-90deg); }
.hero__label { position: relative; text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.hero__scan {
  position: absolute; inset: -2px; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.2) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: heroSheen 4.2s ease-in-out 1.2s infinite;
}
@keyframes heroBreathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 0 34px -8px color-mix(in srgb, var(--accent) 60%, transparent), 0 14px 44px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.2); }
  50% { box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 0 60px -4px color-mix(in srgb, var(--accent) 80%, transparent), 0 14px 44px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.24); }
}
@keyframes heroSheen { 0% { transform: translateX(-120%); } 38%, 100% { transform: translateX(120%); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── start screen ───────── */
.start {
  position: absolute; z-index: 1; left: 0; right: 0; top: 61%;
  display: flex; justify-content: center;
  pointer-events: none;
  transition: opacity .35s, visibility 0s;
}
.start__inner { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 16px; text-align: center; }
.start__inner > * { pointer-events: auto; }
/* Until ui.js is ready only an error (e.g. no WebGL 2, written by main.js) may show. */
html:not(.ui-ready) .btn--hero, html:not(.ui-ready) .start__alt { visibility: hidden; }
.start__alt {
  min-height: 46px; padding: 8px 18px;
  background: none; border: 0; border-radius: 12px; cursor: pointer;
  font-size: 18px; font-weight: 600; color: var(--muted);
  text-decoration: underline; text-decoration-color: rgba(255,255,255,.3); text-decoration-style: dotted; text-underline-offset: 6px;
  background: rgba(4,6,10,.42); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 2px 10px rgba(0,0,0,.9);
  transition: color .2s, transform .18s var(--ease-spring), background .2s;
}
.start__alt:hover { color: #fff; text-decoration-color: var(--accent); }
.start__alt.is-pressed { transform: scale(1.08); }
.start__wait {
  margin: 0; padding: 10px 18px; border-radius: 14px;
  font-size: 18px; font-weight: 600; color: #fff;
  background: var(--glass-strong); border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.start__wait::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); vertical-align: 1px; animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* waiting for the camera */
.start[data-state="waiting"] .btn--hero { pointer-events: none; animation: none; }
.start[data-state="waiting"] .hero__cam { opacity: 0; transform: scale(.5) rotate(60deg); }
.start[data-state="waiting"] .hero__iris { opacity: 1; transform: none; animation: spin 1.6s linear infinite; }
.start[data-state="waiting"] .hero__scan { animation: heroSheen 1.3s ease-in-out infinite; }
.start[data-state="waiting"] .start__alt { opacity: .0; pointer-events: none; }
.start[data-state="error"] .btn--hero, .start[data-state="error"] .start__alt { display: none; }
/* The start screen is just the title art and the two ways in. */
html:not(.is-live) .lens-name { opacity: 0; pointer-events: none; }

/* friendly failure card */
.start__error {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px 18px;
  width: min(560px, calc(100vw - 32px)); margin: 0; padding: 22px 24px 22px 22px;
  text-align: left; font-size: 18px; font-weight: 600; color: #ffe3e8;
  background: linear-gradient(180deg, rgba(255,77,106,.16), rgba(255,77,106,0) 70px), rgba(14,6,10,.88);
  border: 1px solid rgba(255,77,106,.6); border-radius: 20px;
  box-shadow: 0 0 50px -10px rgba(255,77,106,.7), 0 24px 70px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.err__icon { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; color: #ff9aac; background: rgba(255,77,106,.16); border: 1px solid rgba(255,77,106,.35); }
.err__icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.err__body { flex: 1; min-width: 200px; }
.err__title { margin: 2px 0 6px; font-size: 24px; font-weight: 700; color: #fff; letter-spacing: .02em; }
.err__msg { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.4; color: #ffd6de; }
.err__actions { flex-basis: 100%; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.btn--pill { padding: 13px 22px; min-height: 52px; font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.btn--primary { color: var(--accent-ink); background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0) 60%), var(--accent); border-color: transparent; box-shadow: 0 0 26px -4px var(--accent), 0 8px 24px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.5); }
@media (hover: hover) { .btn--primary:hover { color: var(--accent-ink); border-color: #fff; } }
.btn--primary.is-pressed { color: var(--accent-ink); }

/* ───────── top bar ───────── */
.topbar {
  position: absolute; top: calc(16px + var(--safe-t)); left: calc(18px + var(--safe-l)); right: calc(18px + var(--safe-r));
  display: flex; gap: 12px; align-items: center; pointer-events: none;
  transition: opacity .3s;
}
.topbar > * { pointer-events: auto; }
.topbar__spacer { flex: 1; pointer-events: none; }
#soundBtn .off { display: none; }
#soundBtn.is-off .on { display: none; }
#soundBtn.is-off .off { display: block; }
#soundBtn.is-off { color: var(--muted); }
#flipBtn svg { transition: transform .5s var(--ease-pop); }
#flipBtn.is-flipping svg { transform: rotateY(180deg); }

/* things that only exist while the picture is live */
html:not(.is-live) .rail, html:not(.is-live) .btn--remix, html:not(.is-live) .btn--gallery,
html:not(.is-live) #stopBtn, html:not(.is-live) #flipBtn, html:not(.is-live) .shutter, html:not(.is-live) .slot {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .3s, visibility 0s .3s;
}
html.is-leaving .rail, html.is-leaving #stopBtn, html.is-leaving #flipBtn, html.is-leaving .btn--gallery, html.is-leaving .btn--remix,
html.is-leaving .shutter, html.is-leaving .slot, html.is-leaving .thumb { opacity: 0 !important; pointer-events: none; transition: opacity .2s; }
html.is-live .start { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s, visibility 0s .3s; }

/* ───────── tool rail + panel ───────── */
.rail {
  position: absolute; right: calc(18px + var(--safe-r)); top: 50%; translate: 0 -54%;
  display: flex; flex-direction: column; gap: 14px;
  pointer-events: none;
  transition: opacity .3s;
}
.rail > * { pointer-events: auto; }
.rail__btn.is-on { color: var(--accent); border-color: var(--accent-line); box-shadow: 0 8px 26px rgba(0,0,0,.38), 0 0 22px -6px var(--accent), inset 0 1px 0 rgba(255,255,255,.1); }
.rail__btn.is-on::before {
  content: ''; position: absolute; top: 5px; right: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent), 0 0 0 2px rgba(0,0,0,.55);
}
.rail__btn.is-active { color: var(--accent-ink); background: var(--accent); border-color: transparent; box-shadow: 0 0 28px -4px var(--accent), 0 8px 26px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.5); }
.rail__btn.is-active::before { display: none; }
.rail__btn.is-disabled { opacity: .45; }

.panel {
  position: absolute; right: calc(92px + var(--safe-r)); top: 120px;
  width: 392px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--dock-h) - 112px - var(--safe-t));
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,0) 60px), var(--glass-strong);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, rgba(255,255,255,.1));
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 26px 70px rgba(0,0,0,.6), 0 0 40px -14px var(--accent), inset 0 1px 0 rgba(255,255,255,.08);
  transform-origin: 100% 50%;
}
.panel::before, .panel::after, .help__card::before, .help__card::after {
  content: ''; position: absolute; width: 18px; height: 18px; pointer-events: none;
  border: 2px solid var(--accent); opacity: .95;
  filter: drop-shadow(0 0 5px var(--accent));
}
.panel::before, .help__card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 22px; }
.panel::after, .help__card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 22px; }
.panel__grab { display: none; }
.panel__head { display: flex; align-items: center; gap: 12px; padding: 18px 16px 8px 24px; }
.panel__dot { width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.panel__title { flex: 1; min-width: 0; font-size: 25px; font-weight: 700; letter-spacing: .03em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel__close, .panel__reset { width: 46px; height: 46px; flex: none; box-shadow: none; background: rgba(255,255,255,.06); }
.panel__close svg, .panel__reset svg { width: 22px; height: 22px; }
.panel__body { overflow: auto; padding: 4px 24px 24px; mask: linear-gradient(180deg, transparent 0, #000 10px, #000 calc(100% - 26px), transparent); -webkit-mask: linear-gradient(180deg, transparent 0, #000 10px, #000 calc(100% - 26px), transparent); scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; overscroll-behavior: contain; }
.panel__section { margin-top: 18px; }
.panel__label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin-bottom: 10px;
  font: 700 15px/1.2 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
}
.panel__value { display: inline-block; font: 700 18px/1 var(--font-mono); letter-spacing: .02em; color: #fff; text-transform: none; text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent); }
.panel__note { margin: 10px 0 4px; font-size: 18px; line-height: 1.4; color: var(--muted); }
.panel__note.is-loading::before { content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 10px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; vertical-align: -2px; animation: spin .8s linear infinite; }
.panel.is-flash .panel__body { animation: panelFlash .5s ease-out; }
@keyframes panelFlash { from { background: color-mix(in srgb, var(--accent) 14%, transparent); } }
.panel__section.is-changed { animation: changed .7s ease-out; }
@keyframes changed { 0% { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 14px; box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; box-shadow: 0 0 0 8px transparent; } }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 50px; padding: 10px 18px;
  font-size: 18px; font-weight: 600; color: var(--text);
  background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  cursor: pointer;
  transition: transform .18s var(--ease-spring), background .2s, border-color .2s, color .2s, box-shadow .25s;
}
@media (hover: hover) { .chip:hover { border-color: var(--accent-line); background: rgba(255,255,255,.1); } }
.chip.is-pressed { transform: scale(1.1); }
.chip.is-on {
  color: var(--accent-ink); background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,0) 70%), var(--accent); border-color: transparent;
  box-shadow: 0 0 22px -4px var(--accent), inset 0 1px 0 rgba(255,255,255,.45);
}
.chip__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c, #fff); box-shadow: 0 0 8px var(--c, #fff); }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 2px; }
.swatch {
  position: relative; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--sw, #888);
  box-shadow: 0 0 0 2px rgba(255,255,255,.18), 0 4px 12px rgba(0,0,0,.45), inset 0 2px 3px rgba(255,255,255,.35), inset 0 -3px 6px rgba(0,0,0,.25);
  transition: transform .18s var(--ease-spring), box-shadow .25s;
}
@media (hover: hover) { .swatch:hover { box-shadow: 0 0 0 2px rgba(255,255,255,.55), 0 4px 14px rgba(0,0,0,.45), inset 0 2px 3px rgba(255,255,255,.35); } }
.swatch.is-pressed { transform: scale(1.15); }
.swatch.is-on { box-shadow: 0 0 0 3px rgba(8,10,16,.95), 0 0 0 6px #fff, 0 0 22px 2px var(--accent), inset 0 2px 3px rgba(255,255,255,.35); }
.swatch:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }

.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; min-height: 56px; padding: 10px 12px 10px 18px;
  font-size: 18px; font-weight: 600; text-align: left; color: var(--text);
  background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 16px;
  cursor: pointer; transition: transform .18s var(--ease-spring), border-color .2s, background .2s;
}
@media (hover: hover) { .switch:hover { border-color: var(--accent-line); } }
.switch.is-pressed { transform: scale(1.04); }
.switch__track { position: relative; flex: none; width: 58px; height: 34px; border-radius: 17px; background: rgba(255,255,255,.16); box-shadow: inset 0 1px 3px rgba(0,0,0,.5); transition: background .2s, box-shadow .25s; }
.switch__knob { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.45); transition: transform .32s var(--ease-spring), width .16s var(--ease-out); }
.switch[aria-checked="true"] .switch__track { background: var(--accent); box-shadow: 0 0 18px -2px var(--accent), inset 0 1px 0 rgba(255,255,255,.4); }
.switch[aria-checked="true"] .switch__knob { transform: translateX(24px); }
.switch.is-pressed .switch__knob { width: 32px; }
.switch[aria-checked="true"].is-pressed .switch__knob { transform: translateX(18px); }

.slider {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 44px; margin: 0;
  background: transparent; cursor: pointer; touch-action: pan-y;
  --p: 50%;
}
.slider::-webkit-slider-runnable-track {
  height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent) 0 var(--p), rgba(255,255,255,.14) var(--p) 100%);
  box-shadow: 0 0 16px -4px var(--accent), inset 0 1px 2px rgba(0,0,0,.45);
}
.slider::-moz-range-track { height: 10px; border-radius: 5px; background: rgba(255,255,255,.14); }
.slider::-moz-range-progress { height: 10px; border-radius: 5px; background: var(--accent); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px; height: 32px; margin-top: -11px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff, #e8ecf8);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 20px var(--accent), 0 3px 10px rgba(0,0,0,.5);
  transition: transform .16s var(--ease-spring), box-shadow .2s;
}
.slider::-moz-range-thumb { width: 32px; height: 32px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 20px var(--accent); }
.slider.is-dragging::-webkit-slider-thumb, .slider:active::-webkit-slider-thumb { transform: scale(1.28); box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 28px var(--accent), 0 3px 10px rgba(0,0,0,.5); }
.slider.is-dragging::-moz-range-thumb { transform: scale(1.28); }

/* ───────── dock: slot reels, lens name, gallery, strip + shutter, remix ───────── */
.dock {
  position: absolute; left: 0; right: 0; bottom: calc(12px + var(--safe-b));
  display: grid;
  grid-template-columns: 66px minmax(0, 860px) 66px;
  grid-template-areas: "slot slot slot" ". name ." "gal strip remix";
  justify-content: center; align-items: center;
  column-gap: 20px;
  pointer-events: none;
  transition: opacity .3s, transform .4s var(--ease-out);
}
.dock > * { pointer-events: auto; }
.slot { grid-area: slot; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; min-height: 0; padding: 0 12px 8px; pointer-events: none; }
.slot:empty { padding: 0; }
/* The lens name is also the button that opens the lens browser. */
.lens-name {
  grid-area: name; justify-self: center;
  position: relative;
  height: 50px; max-width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 0 16px 0 20px; border: 1px solid transparent; border-radius: 25px; background: transparent;
  font-family: var(--font-ui); font-size: 33px; font-weight: 700; letter-spacing: .07em; white-space: nowrap;
  color: #fff; cursor: pointer;
  text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 75%, transparent), 0 0 4px color-mix(in srgb, var(--accent) 50%, transparent), 0 2px 12px rgba(0,0,0,.9);
  transition: opacity .25s, transform .18s var(--ease-spring), background .2s, border-color .2s;
}
.lens-name__txt { overflow: hidden; text-overflow: clip; }
.lens-name__icon {
  width: 22px; height: 22px; flex: none; fill: currentColor; opacity: .8;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 80%, transparent)) drop-shadow(0 1px 3px rgba(0,0,0,.8));
  transition: transform .3s var(--ease-spring), opacity .2s;
}
@media (hover: hover) {
  .lens-name:hover { background: rgba(8,10,16,.42); border-color: var(--accent-line); }
  .lens-name:hover .lens-name__icon { opacity: 1; transform: scale(1.15) rotate(45deg); }
}
.lens-name.is-pressed { transform: scale(1.08); background: rgba(8,10,16,.55); border-color: var(--accent); }
.lens-name:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lens-name.is-preview { opacity: .82; }
.lens-name.is-dim { opacity: .18; }
.rec-time {
  grid-area: name; justify-self: center;
  display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 18px 0 14px; border-radius: 23px;
  font: 800 28px/1 var(--font-mono); letter-spacing: .04em; color: #fff;
  background: rgba(20, 4, 8, .55); border: 1px solid rgba(255,45,85,.5);
  box-shadow: 0 0 26px -6px var(--rec);
  text-shadow: 0 0 14px rgba(255,45,85,.6);
}
.rec-time__dot { width: 16px; height: 16px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 14px var(--rec); animation: blink 1s ease-in-out infinite; }
.rec-time.is-ending { color: #ffd6de; border-color: var(--rec); }

.strip { grid-area: strip; position: relative; height: 124px; touch-action: none; cursor: grab; }
.strip:active { cursor: grabbing; }
.thumb {
  position: absolute; left: 0; top: 0; padding: 0;
  border-radius: 50%; background: transparent; cursor: pointer;
  border: 2px solid rgba(255,255,255,.5);
  box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 0 0 1px rgba(0,0,0,.35);
  background-size: cover; background-position: center;
  transition: border-color .2s, box-shadow .25s;
  will-change: transform, opacity;
}
.thumb.is-near { border-color: rgba(255,255,255,.8); }
@media (hover: hover) {
  .thumb:hover { border-color: #fff; box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 26px color-mix(in srgb, var(--accent) 70%, transparent), 0 6px 18px rgba(0,0,0,.5); }
}
.thumb-tip {
  position: fixed; left: 0; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 15px 8px 12px; border-radius: 12px;
  font: 700 17px/1.1 var(--font-ui); letter-spacing: .05em; white-space: nowrap; color: #fff;
  background: var(--glass-strong); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 22px -6px var(--accent), 0 8px 24px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .14s;
}
.thumb-tip::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.thumb-tip.is-on { opacity: 1; }

.shutter {
  position: absolute; left: 50%; top: 50%; width: 100px; height: 100px; margin: -50px 0 0 -50px;
  padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; z-index: 2;
  transition: transform .18s var(--ease-spring), opacity .3s, visibility 0s;
  --prog: 0;
}
.shutter__ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 0 34px color-mix(in srgb, var(--accent) 65%, transparent), 0 0 10px rgba(255,255,255,.35), inset 0 0 0 1px rgba(0,0,0,.35), inset 0 0 24px rgba(0,0,0,.3);
  transition: border-color .25s, box-shadow .3s;
}
.shutter__ring::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.42); transition: opacity .2s; }
.shutter__core { position: absolute; inset: 15px; border-radius: 50%; background: rgba(255,255,255,0); transition: background .18s, transform .28s var(--ease-spring), inset .28s var(--ease-spring), border-radius .28s, box-shadow .25s; }
.shutter.is-pressed { transform: scale(1.12); }
.shutter.is-pressed .shutter__core { background: rgba(255,255,255,.24); transform: scale(.92); }
.shutter.is-snap .shutter__core { animation: snap .38s ease-out; }
@keyframes snap { 0% { background: rgba(255,255,255,.95); } 100% { background: rgba(255,255,255,0); } }
.shutter__prog { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; pointer-events: none; }
.shutter__track { fill: none; stroke: transparent; stroke-width: 6; }
.shutter__bar {
  fill: none; stroke: var(--rec); stroke-width: 6.5; stroke-linecap: round;
  stroke-dasharray: 295.31; stroke-dashoffset: calc(295.31 * (1 - var(--prog)));
  filter: drop-shadow(0 0 5px var(--rec));
  opacity: 0; transition: opacity .2s;
}
.shutter.is-charging .shutter__bar { opacity: 1; animation: charge .38s cubic-bezier(.5,0,.9,.6) forwards; }
.shutter.is-charging .shutter__track { stroke: rgba(255,255,255,.12); transition: stroke .2s .1s; }
@keyframes charge { from { stroke-dashoffset: 295.31; } to { stroke-dashoffset: 0; } }
.shutter.is-recording .shutter__ring { border-color: rgba(255,255,255,.28); box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 0 34px rgba(255,45,85,.55), inset 0 0 24px rgba(0,0,0,.3); }
.shutter.is-recording .shutter__ring::after { opacity: 0; }
.shutter.is-recording .shutter__track { stroke: rgba(255,255,255,.14); }
.shutter.is-recording .shutter__bar { opacity: 1; animation: none; }
.shutter.is-recording .shutter__core { inset: 31px; border-radius: 9px; background: var(--rec); box-shadow: 0 0 26px var(--rec); transform: none; }
.shutter.is-ending .shutter__bar { animation: endPulse .5s ease-in-out infinite; }
@keyframes endPulse { 50% { filter: drop-shadow(0 0 12px var(--rec)) brightness(1.4); } }
.shutter.is-hinted .shutter__ring { animation: hintRing 1.6s ease-out infinite; }
@keyframes hintRing {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 80%, transparent), 0 0 34px color-mix(in srgb, var(--accent) 65%, transparent); }
  100% { box-shadow: 0 0 0 26px color-mix(in srgb, var(--accent) 0%, transparent), 0 0 34px color-mix(in srgb, var(--accent) 65%, transparent); }
}

.rec-lock {
  position: absolute; top: 50%; left: calc(50% + 66px); z-index: 1;
  display: flex; align-items: center; gap: 8px;
  height: 58px; margin-top: -29px; padding: 0 6px 0 16px; border-radius: 29px;
  background: rgba(8,10,16,.72); border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  pointer-events: none;
}
.rec-lock__arrows { display: flex; gap: 2px; }
.rec-lock__arrows i { width: 10px; height: 10px; border-right: 3px solid #fff; border-top: 3px solid #fff; transform: rotate(45deg); opacity: .25; animation: chev 1.1s ease-in-out infinite; }
.rec-lock__arrows i:nth-child(2) { animation-delay: .15s; }
.rec-lock__arrows i:nth-child(3) { animation-delay: .3s; }
@keyframes chev { 30% { opacity: 1; } 60%, 100% { opacity: .25; } }
.rec-lock__icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.14); transition: background .2s, transform .25s var(--ease-spring); }
.rec-lock__icon svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.rec-lock__shackle { transition: transform .3s var(--ease-spring); transform: translateY(-2.5px) translateX(3px); transform-box: fill-box; }
.rec-lock.is-near .rec-lock__icon { background: rgba(255,255,255,.3); transform: scale(1.12); }
.rec-lock.is-locked .rec-lock__icon { background: #fff; transform: scale(1.1); }
.rec-lock.is-locked .rec-lock__icon svg { stroke: #111; }
.rec-lock.is-locked .rec-lock__shackle { transform: none; }
.rec-lock.is-locked .rec-lock__arrows { opacity: 0; }

.btn--gallery { grid-area: gal; justify-self: start; width: 66px; height: 66px; border-radius: 19px; padding: 0; }
.gallery__img { position: absolute; inset: 3px; border-radius: 15px; background-size: cover; background-position: center; opacity: 0; transition: opacity .2s; }
.gallery__empty { width: 30px; height: 30px; opacity: .85; }
.btn--gallery.has-items { border: 2px solid rgba(255,255,255,.9); background: #000; }
.btn--gallery.has-items .gallery__img { opacity: 1; }
.btn--gallery.has-items .gallery__empty { display: none; }
.gallery__count {
  position: absolute; right: -10px; top: -10px; z-index: 1;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px;
  font: 800 16px/30px var(--font-mono); text-align: center;
  color: var(--accent-ink); background: var(--accent);
  box-shadow: 0 0 16px -2px var(--accent), 0 2px 8px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.5);
}
.gallery__count:empty { display: none; }
.btn--remix { grid-area: remix; justify-self: end; width: 66px; height: 66px; }
.btn--remix .die { width: 34px; height: 34px; overflow: visible; }
.die__pips circle { fill: currentColor; stroke: none; }

/* slot-machine reels (remix result) */
.reel {
  display: inline-flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 16px 0 12px; border-radius: 13px;
  font: 700 16px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: #fff;
  background: var(--glass-strong); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 20px -6px var(--accent), 0 8px 22px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}
.reel__dot { width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.reel__txt { display: inline-block; white-space: nowrap; }
.reel.is-spinning .reel__txt { filter: blur(1px); opacity: .85; }
.reel.is-landed { border-color: var(--accent); }

/* While the lens browser is up it owns the screen; while a chosen lens flies home the dock comes back
 * (minus the name, which arrives with the lens). */
html.grid-open .topbar, html.grid-open .rail, html.grid-open .dock, html.grid-open .hint, html.grid-open .thumb-tip,
html.grid-picking .topbar, html.grid-picking .rail, html.grid-picking .hint, html.grid-picking .lens-name, html.grid-picking .slot,
html.grid-picking .btn--gallery, html.grid-picking .btn--remix {
  opacity: 0 !important; pointer-events: none !important;
}
.topbar, .rail, .dock { transition: opacity .3s, transform .4s var(--ease-out); }

/* While recording only the shutter (and the timer) stays. */
html.is-recording .rail, html.is-recording .topbar, html.is-recording .btn--gallery, html.is-recording .btn--remix,
html.is-recording .thumb, html.is-recording .lens-name, html.is-recording .slot, html.is-recording .thumb-tip {
  opacity: 0 !important; pointer-events: none !important; transition: opacity .25s;
}
.rec-frame { position: fixed; inset: 0; z-index: 1; opacity: 0; transition: opacity .35s; box-shadow: inset 0 0 0 3px rgba(255,45,85,.85), inset 0 0 70px rgba(255,45,85,.3); }
html.is-recording .rec-frame { opacity: 1; animation: recFrame 2.4s ease-in-out infinite; }
@keyframes recFrame { 50% { box-shadow: inset 0 0 0 3px rgba(255,45,85,.55), inset 0 0 40px rgba(255,45,85,.18); } }

/* ───────── viewer ───────── */
.viewer { position: fixed; inset: 0; z-index: 5; }
.viewer__scrim {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 42%, rgba(12,14,22,.82), rgba(2,3,6,.95));
  backdrop-filter: blur(18px) saturate(120%); -webkit-backdrop-filter: blur(18px) saturate(120%);
}
.viewer__stage { position: absolute; inset: 0; touch-action: none; }
.viewer__media {
  position: absolute; left: 0; top: 0; display: block;
  border-radius: 16px; background: #000; object-fit: contain;
  box-shadow: 0 30px 90px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.14), 0 0 60px -20px color-mix(in srgb, var(--item-accent, #fff) 60%, transparent);
  transform-origin: 0 0; will-change: transform;
  -webkit-user-drag: none;
}
.viewer__play { position: absolute; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.8); opacity: 0; transition: opacity .2s; pointer-events: none; }
.viewer__play svg { width: 34px; height: 34px; fill: #fff; margin-left: 5px; }
.viewer.is-paused .viewer__play { opacity: 1; }
.viewer__top { position: absolute; top: calc(16px + var(--safe-t)); left: calc(16px + var(--safe-l)); right: calc(16px + var(--safe-r)); display: flex; align-items: center; gap: 12px; pointer-events: none; }
.viewer__top > * { pointer-events: auto; }
.viewer__count, .viewer__lens {
  display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border-radius: 23px;
  background: var(--glass-strong); border: 1px solid var(--line);
  font-size: 17px; font-weight: 600; color: #fff;
}
.viewer__count { font: 700 17px/1 var(--font-mono); letter-spacing: .04em; }
.viewer__lens::before { content: ''; width: 11px; height: 11px; border-radius: 50%; background: var(--item-accent, #fff); box-shadow: 0 0 10px var(--item-accent, #fff); }
.viewer__dur { font: 600 16px/1 var(--font-mono); color: var(--muted); }
.viewer__close { margin-left: auto; }
.viewer__nav { position: absolute; top: 50%; width: 60px; height: 60px; margin-top: -30px; }
.viewer__nav--prev { left: calc(18px + var(--safe-l)); }
.viewer__nav--next { right: calc(18px + var(--safe-r)); }
.viewer__actions { position: absolute; left: 0; right: 0; bottom: calc(26px + var(--safe-b)); display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 0 16px; pointer-events: none; }
.viewer__actions > * { pointer-events: auto; }
.act { gap: 10px; min-height: 56px; padding: 0 24px 0 20px; font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.act svg { width: 24px; height: 24px; }
.act .act__done { display: none; }
.act.is-done .act__icon { display: none; }
.act.is-done .act__done { display: block; color: var(--accent); }
.act--danger { color: #ffd2da; border-color: rgba(255,77,106,.45); }
.act--danger.is-armed { color: #fff; background: var(--danger); border-color: transparent; box-shadow: 0 0 30px -4px var(--danger), 0 8px 24px rgba(0,0,0,.4); }
.act__arm { position: absolute; left: 14px; right: 14px; bottom: 6px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.85); transform-origin: left; transform: scaleX(0); }
.act--danger.is-armed .act__arm { animation: arm 3s linear forwards; }
@keyframes arm { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ───────── keyboard help ───────── */
.help { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px; }
.help__scrim { position: absolute; inset: 0; background: rgba(2,3,6,.62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.help__card {
  position: relative; width: min(820px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  padding: 26px 32px 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,0) 70px), var(--glass-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 36%, rgba(255,255,255,.1)); border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 30px 90px rgba(0,0,0,.65), 0 0 50px -16px var(--accent), inset 0 1px 0 rgba(255,255,255,.08);
}
.help__head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.help__close { width: 48px; height: 48px; }
.help__title { flex: 1; margin: 0; font-size: 30px; font-weight: 700; letter-spacing: .03em; }
.help__cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 6px 44px; }
.help__group { margin: 14px 0 6px; font: 700 15px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.help__row { display: flex; align-items: center; gap: 16px; min-height: 48px; font-size: 18px; color: var(--text); }
.help__keys { display: flex; align-items: center; gap: 6px; min-width: 124px; color: var(--faint); font-size: 15px; }
.help__keys .mouse { display: inline-grid; place-items: center; height: 34px; padding: 0 10px; border-radius: 8px; font: 700 15px/1 var(--font-mono); color: #fff; border: 1px dashed rgba(255,255,255,.35); }

/* ───────── first-run hints ───────── */
.hint { position: fixed; inset: 0; z-index: 3; }
.hint__pill {
  position: absolute; left: 50%; bottom: calc(var(--dock-h) + 26px + var(--safe-b)); translate: -50% 0;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px 12px 12px; border-radius: 20px;
  font-size: 19px; font-weight: 600; white-space: nowrap; color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0) 60%), var(--glass-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 30px -8px var(--accent), 0 14px 36px rgba(0,0,0,.5);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.hint__pill kbd { margin: 0 2px; }
.hint__icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 14px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.hint__icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.hint__finger {
  position: absolute; left: 50%; top: 52%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95) 0 26%, rgba(255,255,255,.28) 28% 58%, rgba(255,255,255,0) 60%);
  box-shadow: 0 0 34px rgba(255,255,255,.45);
  animation: ghostSwipe 2.6s cubic-bezier(.5,0,.3,1) infinite;
}
.hint__finger::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 180px; height: 18px; margin-top: -9px; border-radius: 9px;
  background: linear-gradient(90deg, rgba(255,255,255,.45), rgba(255,255,255,0));
  opacity: 0; animation: ghostTrail 2.6s cubic-bezier(.5,0,.3,1) infinite;
}
@keyframes ghostSwipe {
  0% { transform: translateX(130px) scale(1.25); opacity: 0; }
  14% { transform: translateX(130px) scale(1.25); opacity: 1; }
  24% { transform: translateX(130px) scale(.9); opacity: 1; }
  62% { transform: translateX(-130px) scale(.9); opacity: 1; }
  76%, 100% { transform: translateX(-150px) scale(1.15); opacity: 0; }
}
@keyframes ghostTrail { 0%, 24% { opacity: 0; } 40%, 58% { opacity: 1; } 72%, 100% { opacity: 0; } }

/* ───────── lens browser ─────────
 * The live pictures are GL thumbnails drawn on the canvas under this layer (positions from
 * AC.strip.visible()), so everything here stays transparent where a ring is: no backgrounds or
 * backdrop blur over the tiles, only rings, names and headings. */
.lb { position: fixed; inset: 0; z-index: 4; }
.lb__panel { position: absolute; inset: 0; display: flex; flex-direction: column; will-change: transform; }
.lb__head {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: calc(16px + var(--safe-t)) calc(18px + var(--safe-r)) 6px calc(30px + var(--safe-l));
}
.lb__title {
  flex: 1; margin: 0; font-size: 30px; font-weight: 700; letter-spacing: .05em; color: #fff;
  text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 60%, transparent), 0 2px 10px rgba(0,0,0,.9);
}
.lb__close { flex: none; }
.lb__head { transition: opacity .2s; animation: lbHead .35s ease-out; }
.lb.is-leaving .lb__head { opacity: 0; pointer-events: none; }
@keyframes lbHead { from { opacity: 0; } }
.lb__scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  padding: 10px calc(30px + var(--safe-r)) calc(26px + var(--safe-b)) calc(30px + var(--safe-l));
  scrollbar-width: none; touch-action: pan-y;
  -webkit-mask: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent);
  mask: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent);
}
.lb__scroll::-webkit-scrollbar { display: none; }
.lb__groups { margin: auto 0; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 26px 46px; }
.lb__group { display: flex; flex-direction: column; gap: 10px; max-width: 100%; }
.lb__fam {
  margin: 0 0 0 13px;
  font: 700 15px/1 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: rgba(226,232,255,.72);
  text-shadow: 0 1px 6px rgba(0,0,0,.95), 0 0 2px rgba(0,0,0,.9);
}
.lb__items { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.lb__item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: calc(var(--cell, 120px) + 26px); padding: 0; margin: 0;
  background: none; border: 0; color: var(--text); cursor: pointer; font: inherit;
  -webkit-tap-highlight-color: transparent;
}
.lb__item:focus-visible { outline: none; }
.lb__ring {
  display: block; width: var(--cell, 120px); height: var(--cell, 120px); border-radius: 50%;
  border: 2px solid rgba(255,255,255,.55);
  box-shadow: 0 10px 30px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.35);
  transition: border-color .2s, box-shadow .25s;
  will-change: transform, opacity;
}
.lb__name {
  max-width: 100%; min-height: 20px;
  font-size: 17px; font-weight: 600; line-height: 1.15; letter-spacing: .03em; text-align: center;
  color: rgba(242,245,255,.9); text-shadow: 0 2px 8px rgba(0,0,0,.95), 0 0 2px rgba(0,0,0,.9);
  transition: color .2s;
}
@media (hover: hover) {
  .lb__item:hover .lb__ring { border-color: #fff; box-shadow: 0 0 0 2px var(--a), 0 0 34px color-mix(in srgb, var(--a) 75%, transparent), 0 10px 30px rgba(0,0,0,.6); }
  .lb__item:hover .lb__name { color: #fff; }
}
.lb__item:focus-visible .lb__ring { border-color: #fff; box-shadow: 0 0 0 3px var(--accent), 0 0 30px var(--accent); }
.lb__item:focus-visible .lb__name { color: #fff; }
.lb__item.is-current .lb__ring { border: 3px solid #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--a) 85%, transparent), 0 0 30px color-mix(in srgb, var(--a) 70%, transparent), 0 10px 30px rgba(0,0,0,.6); }
.lb__item.is-current .lb__name { color: #fff; }
.lb__item.is-current .lb__name::before {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; vertical-align: 2px;
  background: var(--a); box-shadow: 0 0 8px var(--a);
}
.lb__fly {
  position: absolute; left: 0; top: 0; width: 0; height: 0; border-radius: 50%; opacity: 0; pointer-events: none;
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 0 34px color-mix(in srgb, var(--a, #fff) 80%, transparent), 0 18px 50px rgba(0,0,0,.55);
}

/* ───────── toasts ───────── */
.toasts { position: absolute; z-index: 8; left: 0; right: 0; bottom: calc(var(--dock-h) + 22px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 16px; }
.toast {
  display: flex; align-items: center; gap: 12px; max-width: 100%;
  padding: 11px 22px 11px 12px; border-radius: 18px;
  font-size: 18px; font-weight: 600; color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0) 60%), var(--glass-strong);
  border: 1px solid var(--accent-line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 26px -8px var(--accent), 0 12px 32px rgba(0,0,0,.45);
}
.toast__icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.toast__icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.toast--warn { border-color: rgba(255,77,106,.6); box-shadow: 0 0 26px -8px var(--danger), 0 12px 32px rgba(0,0,0,.45); }
.toast--warn .toast__icon { background: var(--danger); color: #fff; }
.toast--info .toast__icon { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.toast--info .toast__icon svg { stroke-width: 2.2; width: 22px; height: 22px; }
.dialog-focus:focus { outline: none; }

/* Detail readout (created by main.js while you scroll / pinch). */
.detail-readout {
  position: absolute; left: 50%; top: calc(20px + var(--safe-t));
  min-width: 210px; padding: 12px 22px 20px; border-radius: 16px; text-align: center;
  font: 700 21px/1 var(--font-mono); letter-spacing: .04em; color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0) 60%), var(--glass-strong);
  border: 1px solid var(--accent-line);
  box-shadow: 0 0 26px -8px var(--accent), 0 12px 30px rgba(0,0,0,.45);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transform: translateX(-50%) scale(.9); opacity: 0;
  transition: opacity .2s, transform .25s var(--ease-pop); pointer-events: none;
}
.detail-readout::after {
  content: ''; position: absolute; left: 20px; right: 20px; bottom: 9px; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) 0 var(--p, 50%), rgba(255,255,255,.16) var(--p, 50%) 100%);
  box-shadow: 0 0 10px -2px var(--accent);
}
.detail-readout.is-on { opacity: 1; transform: translateX(-50%) scale(1); }

/* Drop a file anywhere. */
html.is-dropping #ui::after {
  content: 'Drop it to use it'; position: fixed; inset: 18px; display: grid; place-items: center;
  font-size: 36px; font-weight: 700; letter-spacing: .04em; color: #fff;
  text-shadow: 0 0 24px var(--accent);
  border: 3px dashed var(--accent); border-radius: 28px; background: rgba(2,3,6,.55);
  box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 35%, transparent) inset;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: dropPulse 1.2s ease-in-out infinite;
}
@keyframes dropPulse { 50% { box-shadow: 0 0 90px color-mix(in srgb, var(--accent) 50%, transparent) inset; } }

/* ───────── phones ───────── */
@media (max-width: 600px) {
  body { font-size: 17px; }
  .btn--icon { width: 50px; height: 50px; }
  .btn svg { width: 25px; height: 25px; }
  .topbar { top: calc(12px + var(--safe-t)); left: calc(14px + var(--safe-l)); right: calc(14px + var(--safe-r)); gap: 10px; }
  .rail { top: calc(80px + var(--safe-t)); right: calc(14px + var(--safe-r)); translate: none; gap: 10px; }

  .dock {
    bottom: calc(8px + var(--safe-b));
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    grid-template-areas: "slot slot slot" "gal name remix" "strip strip strip";
    column-gap: 8px; row-gap: 4px;
    padding: 0 calc(14px + var(--safe-l)) 0 calc(14px + var(--safe-r));
  }
  .lens-name { font-size: 25px; letter-spacing: .05em; height: 54px; gap: 9px; padding: 0 12px 0 14px; }
  .lens-name__icon { width: 18px; height: 18px; }
  .lb__head { padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 2px calc(22px + var(--safe-l)); }
  .lb__title { font-size: 26px; }
  .lb__scroll { padding: 8px calc(16px + var(--safe-r)) calc(28px + var(--safe-b)) calc(16px + var(--safe-l)); }
  /* Phones: one continuous grid in family order (family groups of 4 would leave lone tiles on rows of 3). */
  .lb__groups { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 18px 8px; margin: 0; }
  .lb__group, .lb__items { display: contents; }
  .lb__fam { display: none; }
  .lb__item { width: auto; gap: 8px; }
  .lb__name { font-size: 15px; }
  .rec-time { font-size: 24px; height: 44px; }
  .strip { height: 104px; margin: 0 calc(-14px - var(--safe-l)) 0 calc(-14px - var(--safe-r)); }
  .shutter { width: 86px; height: 86px; margin: -43px 0 0 -43px; }
  .shutter__core { inset: 13px; }
  .shutter.is-recording .shutter__core { inset: 27px; }
  .rec-lock { left: calc(50% + 56px); height: 54px; margin-top: -27px; }
  .btn--gallery { width: 58px; height: 58px; border-radius: 17px; }
  .gallery__img { border-radius: 13px; }
  .btn--remix { width: 58px; height: 58px; }
  .btn--remix .die { width: 30px; height: 30px; }
  .slot { padding-bottom: 4px; gap: 8px; }
  .reel { height: 38px; font-size: 15px; padding: 0 12px 0 10px; }
  .swatches { gap: 6px; }
  .swatch { width: 44px; height: 44px; }

  .panel {
    left: 0; right: 0; bottom: 0; top: auto !important;
    width: auto; max-height: min(58vh, 560px);
    border-radius: 26px 26px 0 0; border-bottom: 0;
    padding-bottom: var(--safe-b);
    transform-origin: 50% 100%;
  }
  .panel::before, .panel::after { display: none; }
  .panel__grab { display: block; width: 46px; height: 5px; margin: 10px auto -4px; border-radius: 3px; background: rgba(255,255,255,.35); }
  .panel__head { padding: 12px 14px 4px 22px; touch-action: none; }
  .panel__body { padding: 0 20px 22px; }
  html.sheet-open .dock { opacity: 0; transform: translateY(30px); pointer-events: none; }
  html.sheet-open .dock > * { pointer-events: none; }

  .viewer__count, .viewer__lens { height: 44px; font-size: 16px; padding: 0 14px; }
  .viewer__nav { display: none; }
  .viewer__actions { gap: 8px; bottom: calc(18px + var(--safe-b)); flex-wrap: nowrap; }
  .act { flex-direction: column; gap: 5px; min-width: 76px; min-height: 70px; padding: 8px 10px; border-radius: 20px; font-size: 15px; }
  .act__arm { bottom: 5px; }

  .start { top: 57%; }
  .btn--hero { font-size: 23px; padding: 18px 32px 18px 24px; }
  .start__error { padding: 18px; }
  .err__title { font-size: 22px; }
  .hint__pill { font-size: 17px; padding: 10px 18px 10px 10px; white-space: normal; width: max-content; max-width: calc(100vw - 28px); }
  .detail-readout { top: calc(78px + var(--safe-t)); }
  .help__cols { grid-template-columns: 1fr; }
}

/* ───────── reduced motion: no loops, no wobble ───────── */
html[data-reduced-motion="on"] .btn--hero, html[data-reduced-motion="on"] .hero__scan,
html[data-reduced-motion="on"] .shutter.is-hinted .shutter__ring, html[data-reduced-motion="on"] .rec-frame,
html[data-reduced-motion="on"] .rec-lock__arrows i, html[data-reduced-motion="on"] .shutter.is-ending .shutter__bar,
html[data-reduced-motion="on"] .rec-time__dot, html[data-reduced-motion="on"].is-dropping #ui::after { animation: none !important; }
html[data-reduced-motion="on"] .hint__finger { animation: none; opacity: 0; }
html[data-reduced-motion="on"] .start[data-state="waiting"] .hero__iris { animation-duration: 4s; }
