/* Grabazo — página del celular: control remoto, guion y cámara */

:root {
  --bg: #000;
  --surface: #111113;
  --surface-2: #1b1b1e;
  --surface-3: #262629;
  --line: rgba(255, 255, 255, .07);
  --text: #f5f5f7;
  --muted: #8e8e93;
  --accent: #ff7a1a;
  --accent-2: #ff5e1a;
  --accent-soft: rgba(255, 122, 26, .16);
  --rec: #ff3b30;
  --ok: #34c759;
  --warn: #ff9f0a;
  --danger: #ff453a;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.42 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  pointer-events: none;
}
svg .fill { fill: currentColor; stroke: none; }

[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 var(--safe-r) 0 var(--safe-l);
  background: radial-gradient(560px 360px at 50% -12%, rgba(255, 122, 26, .16), transparent 70%), var(--bg);
}

@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes enter { from { transform: translateY(8px); opacity: 0; } }
@keyframes pop { 0% { transform: scale(1.25); opacity: .2; } 100% { transform: scale(1); opacity: 1; } }

/* ---------------------------------------------------------- cabecera */

.top {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) 10px 8px 16px;
  background: linear-gradient(rgba(0, 0, 0, .92), rgba(0, 0, 0, .78));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand img { flex: none; margin: -2px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text b { font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.status .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.app[data-conn="connected"] .status .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 199, 89, .22); }
.app[data-conn="connecting"] .status .dot,
.app[data-conn="reconnecting"] .status .dot,
.app[data-conn="waiting"] .status .dot,
.app[data-conn="offline"] .status .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }

.rec-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: 99px;
  background: rgba(255, 59, 48, .16);
  color: #ff8a80;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rec-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--rec); animation: pulse 1.3s ease-in-out infinite; }
.app[data-rec="paused"] .rec-chip { background: rgba(255, 159, 10, .16); color: #ffc46b; }
.app[data-rec="paused"] .rec-chip i { background: var(--warn); animation: none; }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
}
.icon-btn:active { transform: scale(.94); }

/* ---------------------------------------------------------- pestañas */

.tabs {
  position: sticky;
  top: calc(58px + var(--safe-t));
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 2px 14px 0;
  padding: 4px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .8);
}
.tabs button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.tabs button svg { width: 18px; height: 18px; }
.tabs button[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.tabs .badge {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface), 0 0 10px var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}

/* ---------------------------------------------------------- vistas */

.views { flex: 1; display: flex; flex-direction: column; padding: 14px 14px calc(24px + var(--safe-b)); }
.view { display: flex; flex-direction: column; gap: 16px; animation: enter .25s ease; }
.label { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.block { display: flex; flex-direction: column; gap: 10px; }

/* ---------- tarjeta principal: tiempo y botón de grabar */

.stage-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px 14px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: inset 0 0 0 1px var(--line);
}
.stage-top { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border-radius: 99px;
  background: var(--surface-3);
  font-size: 13px;
  font-weight: 600;
}
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.app[data-rec="recording"] .chip { background: rgba(255, 59, 48, .16); color: #ff8a80; }
.app[data-rec="recording"] .chip i { background: var(--rec); animation: pulse 1.3s ease-in-out infinite; }
.app[data-rec="paused"] .chip { background: rgba(255, 159, 10, .16); color: #ffc46b; }
.app[data-rec="paused"] .chip i { background: var(--warn); }
.app[data-rec="countdown"] .chip i,
.app[data-rec="placing"] .chip i,
.app[data-rec="saving"] .chip i { background: var(--accent); animation: pulse 1s ease-in-out infinite; }

.big-time {
  margin-top: 12px;
  font-size: 58px;
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.app[data-rec="idle"] .big-time,
.app[data-rec="placing"] .big-time { color: var(--surface-3); }
.app[data-rec="paused"] .big-time { color: #ffc46b; }
.app.ending .big-time { color: #ff6961; animation: pulse 1s ease-in-out infinite; }
.limit { min-height: 18px; margin-top: 4px; }

.transport {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  width: 100%;
  margin-top: 12px;
}
.round {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.round svg {
  width: 54px;
  height: 54px;
  padding: 16px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
}
.round:active svg { transform: scale(.93); }
.round:disabled { opacity: .3; }
.round .i-play { display: none; fill: currentColor; stroke: none; }
.round[aria-pressed="true"] .i-pause { display: none; }
.round[aria-pressed="true"] .i-play { display: block; }

.rec-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .9);
  transition: transform .1s ease;
}
.rec-button:active { transform: scale(.95); }
.rec-core {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6a3d, var(--rec));
  transition: width .25s cubic-bezier(.3, .7, .4, 1), height .25s cubic-bezier(.3, .7, .4, 1), border-radius .25s ease;
}
.app[data-rec="recording"] .rec-core,
.app[data-rec="paused"] .rec-core { width: 34px; height: 34px; border-radius: 9px; }
.app[data-rec="countdown"] .rec-core,
.app[data-rec="saving"] .rec-core,
.app[data-rec="starting"] .rec-core { opacity: .45; }

.transport-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 22px;
  margin-top: 12px;
}
.link-btn { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.link-btn.danger { color: var(--danger); }

/* ---------- pulsar para hablar */

.talk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 64px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 16px;
  font-weight: 650;
  transition: background .12s ease, transform .1s ease;
}
.talk svg { width: 24px; height: 24px; }
.talk.on { background: rgba(52, 199, 89, .22); color: #4cd964; box-shadow: inset 0 0 0 2px rgba(52, 199, 89, .6); transform: scale(.99); }

/* ---------- herramientas */

.tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tools button, .toggles button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}
.tools button svg, .toggles button svg { width: 22px; height: 22px; }
.tools button[aria-pressed="true"], .toggles button[aria-pressed="true"] { background: var(--accent-soft); color: #ffa45c; box-shadow: inset 0 0 0 1.5px rgba(255, 122, 26, .55); }
.tools button:active, .toggles button:active { transform: scale(.96); }
.toggles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.toggles button.action { color: var(--muted); }
.toggles button.off { color: #ff6961; }

.cam-place { display: flex; gap: 10px; align-items: stretch; }
.cam-place .corners { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; flex: none; width: 132px; }
.cam-place .corners button {
  display: grid;
  place-items: center;
  height: 44px;
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
}
.cam-place .corners svg { width: 26px; height: 26px; }
.cam-place .corners button[aria-pressed="true"] { background: var(--accent-soft); color: #ffa45c; box-shadow: inset 0 0 0 1.5px rgba(255, 122, 26, .55); }
.cam-place .corners button:active { transform: scale(.96); }
.cam-opts { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cam-opts .seg button { display: grid; place-items: center; height: 38px; }
.cam-opts .seg svg { width: 20px; height: 20px; }

.colors { display: flex; justify-content: space-between; gap: 6px; padding: 4px 2px; }
.colors button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2);
}
.colors button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px #fff; }

.draw-row { display: flex; align-items: center; gap: 8px; }
.draw-row .seg { flex: 1; }
.draw-row .seg i { display: block; margin: auto; border-radius: 50%; background: currentColor; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 14px;
  border-radius: 13px;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 550;
}
.pill-btn svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------- teleprompter */

.prompter-view { flex: 1; gap: 10px; min-height: calc(100dvh - 150px - var(--safe-t) - var(--safe-b)); }
.prompter {
  position: relative;
  flex: 1;
  min-height: 300px;
  border-radius: 20px;
  background: #000;
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.prompter-text {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 38% 22px 70%;
  font-size: var(--p-size, 34px);
  font-weight: 650;
  line-height: 1.36;
  letter-spacing: -.01em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.prompter-text::-webkit-scrollbar { display: none; }
.prompter.mirror .prompter-text { transform: scaleX(-1); }
.prompter .guide {
  position: absolute;
  left: 0;
  right: 0;
  top: 33%;
  height: calc(var(--p-size, 34px) * 1.5);
  transform: translateY(-15%);
  border-top: 1px solid rgba(255, 122, 26, .35);
  border-bottom: 1px solid rgba(255, 122, 26, .35);
  background: linear-gradient(90deg, rgba(255, 122, 26, .12), rgba(255, 122, 26, .03) 30%, rgba(255, 122, 26, .03) 70%, rgba(255, 122, 26, .12));
  pointer-events: none;
}
.prompter::before, .prompter::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  height: 18%;
  pointer-events: none;
}
.prompter::before { top: 0; background: linear-gradient(#000, transparent); }
.prompter::after { bottom: 0; background: linear-gradient(transparent, #000); }
.prompter-count {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .55);
  font-size: 120px;
  font-weight: 800;
  animation: pop .4s ease;
}
.prompter-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  text-align: center;
  color: var(--muted);
}
.prompter-empty svg { width: 44px; height: 44px; color: var(--accent); }
.prompter-empty b { color: var(--text); font-size: 17px; }

.prompter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 20px;
  background: var(--surface);
}
.round-sm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.round-sm svg { width: 44px; height: 44px; padding: 12px; border-radius: 50%; background: var(--surface-3); color: var(--text); }
.round-sm.danger svg { color: var(--danger); }
.play {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb347, var(--accent-2));
  color: #fff;
}
.play svg { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.play .i-pause { display: none; fill: none; stroke: currentColor; stroke-width: 2.4; }
.play[aria-pressed="true"] .i-play { display: none; }
.play[aria-pressed="true"] .i-pause { display: block; }
.speed { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }

input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---------------------------------------------------------- cámara del celular */

.cam-card { display: flex; flex-direction: column; gap: 12px; }
.cam-preview {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: 56vh;
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface);
}
.cam-preview video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.cam-preview.back video { transform: none; }
.cam-off {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  text-align: center;
  color: var(--muted);
  background: radial-gradient(circle at 50% 40%, rgba(255, 122, 26, .18), transparent 65%), var(--surface);
}
.cam-off svg { width: 44px; height: 44px; color: var(--accent); }
.cam-off b { color: var(--text); font-size: 17px; }
.live-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .6);
  font-size: 12px;
  font-weight: 650;
}
.live-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.want {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: #ffc08f;
  font-size: 14px;
}
.cam-controls { display: flex; justify-content: space-around; }

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
}
.setting > span { display: flex; flex-direction: column; gap: 2px; }
.setting b { font-weight: 600; }

/* ---------------------------------------------------------- pantallas completas */

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-t)) 28px calc(24px + var(--safe-b));
  text-align: center;
  background: radial-gradient(500px 340px at 50% 30%, rgba(255, 122, 26, .2), transparent 70%), #000;
}
.app.ready .gate { display: none; }
.screen-inner { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 340px; }
.screen-logo { margin-bottom: 22px; filter: drop-shadow(0 16px 30px rgba(255, 122, 26, .3)); }
.screen h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.screen p { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.screen .spinner { margin-top: 26px; }
.screen .btn { margin-top: 22px; }
.credit { position: absolute; bottom: calc(18px + var(--safe-b)); margin: 0; font-size: 12px; color: #48484a; }

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .14);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 24px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--text); color: #000; }
.btn.big { height: 56px; width: 100%; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn.accent { background: linear-gradient(135deg, #ffb347, var(--accent-2)); color: #fff; }

/* ---------------------------------------------------------- selector segmentado */

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 13px;
  background: var(--surface);
}
.seg button {
  height: 36px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.seg button[aria-checked="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }

/* ---------------------------------------------------------- hojas */

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 10px 20px calc(20px + var(--safe-b));
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  color: var(--text);
}
.sheet[open] { animation: rise .28s cubic-bezier(.2, .8, .2, 1); }
.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet form { display: flex; flex-direction: column; }
.sheet-handle { flex: none; width: 38px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--surface-3); }
.sheet h2 { margin: 0 0 8px; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.sheet .btn { flex: none; width: 100%; margin-top: 12px; }
.sheet .btn.danger { margin-top: 18px; background: var(--surface-2); }
.sheet.tall { height: 88dvh; }
.sheet.tall form { height: 100%; }
.field { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.field-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; }
.field-label { font-size: 14px; }
.block-line { display: block; margin-top: 2px; }
.script-input {
  flex: 1;
  min-height: 200px;
  margin-top: 6px;
  padding: 14px;
  border: 0;
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  resize: none;
}
.script-input:focus { outline: 2px solid var(--accent); }
.credit-in { margin: 16px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.credit-in a { color: inherit; }

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 99px;
  background: var(--surface-3);
  cursor: pointer;
  transition: background .2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  transition: transform .2s cubic-bezier(.3, .7, .4, 1);
}
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }

/* ---------------------------------------------------------- cuenta regresiva y aviso */

.countdown {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .7);
  pointer-events: none;
}
.countdown span {
  display: grid;
  place-items: center;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--accent);
  font-size: 96px;
  font-weight: 800;
  animation: pop .4s ease;
}
.app[data-view="script"] .countdown { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  z-index: 30;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(38, 38, 41, .97);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: rgba(80, 24, 22, .97); }
