[hidden] { display: none !important; }
:root {
  --bg: #0b0b0d;
  --surface: #141417;
  --surface-2: #1c1c20;
  --surface-3: #26262b;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #f3f1ec;
  --muted: #8e8b85;
  --accent: #eaa95e;
  --accent-2: #f5c98a;
  --accent-ink: #1d1306;
  --accent-soft: rgba(234, 169, 94, 0.14);
  --danger: #ef6f5e;
  --r-lg: 22px;
  --r: 16px;
  --r-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Arabic", "Segoe UI", "Noto Sans Arabic", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --composer-h: 150px;
  --tabbar-h: 0px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100dvh;
  background: radial-gradient(1200px 500px at 50% -200px, rgba(234, 169, 94, 0.07), transparent 70%), var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
svg { flex: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 600; font-size: 15px;
  transition: transform 0.15s var(--ease), opacity 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 6px 20px -8px rgba(234, 169, 94, 0.6); }
.btn.ghost { background: var(--surface-3); color: var(--text); }
.btn.text { background: none; color: var(--accent); padding: 6px 4px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--surface-3); color: var(--text); flex: none;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.plain { background: none; color: var(--muted); }
.icon-btn.small { width: 30px; height: 30px; }
.icon-btn.glass { background: rgba(255, 255, 255, 0.12); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ---------- app bar & tabs ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.02em; direction: ltr; }
.brand .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-inline-start: 4px; box-shadow: 0 0 12px var(--accent); }
.top-tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 999px; }
.top-tabs .tab { border: 0; background: none; padding: 6px 16px; border-radius: 999px; color: var(--muted); font-size: 14px; font-weight: 500; }
.top-tabs .tab.active { background: var(--surface-3); color: var(--text); }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  display: none; justify-content: space-around;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid var(--line);
}
.tabbar .tab { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 500; padding: 4px 0; transition: color 0.2s; }
.tabbar .tab.active { color: var(--accent); }

.banner { margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--r); background: #2e2213; color: #f3d3a5; font-size: 14px; }

/* ---------- views ---------- */
.view { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--composer-h) + var(--tabbar-h) + 24px); }
body[data-view="gallery"] .composer { display: none; }
#gallery.view { padding-bottom: calc(var(--tabbar-h) + 32px); }

.log { display: flex; flex-direction: column; gap: 14px; }

.empty { min-height: 52dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 8px; animation: rise 0.5s var(--ease); }
.empty-art { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); margin-bottom: 16px; }
.empty h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.empty p { margin: 0 0 20px; color: var(--muted); max-width: 340px; }
.ideas { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 440px; }
.idea { text-align: left; direction: ltr; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--r); padding: 12px 14px; font-size: 14px; transition: background 0.2s, transform 0.15s var(--ease); }
.idea:active { transform: scale(0.98); }
.idea:hover { background: var(--surface-2); }

/* ---------- messages ---------- */
.msg { max-width: 82%; padding: 10px 14px; border-radius: 20px; white-space: pre-wrap; word-break: break-word; animation: rise 0.35s var(--ease); }
.msg.user { align-self: flex-start; background: linear-gradient(180deg, #2c2a27, #24221f); border-end-start-radius: 6px; }
.msg.user .tag { display: block; font-size: 12px; color: var(--accent); margin-bottom: 2px; }
.msg.agent { align-self: flex-end; background: var(--surface); border: 1px solid var(--line); color: var(--muted); border-end-end-radius: 6px; font-size: 14px; }
.msg img.thumb, .msg video.thumb { display: block; max-width: 140px; border-radius: 12px; margin-top: 8px; }
.msg.error { align-self: stretch; max-width: none; display: flex; gap: 10px; align-items: flex-start; border: 1px solid rgba(239, 111, 94, 0.25); background: rgba(239, 111, 94, 0.08); color: #f6b9ae; font-size: 13px; border-radius: var(--r); }
.msg.error .err-text { direction: ltr; text-align: left; flex: 1; }
.msg.note { align-self: stretch; max-width: none; border: 1px dashed var(--line-2); color: var(--muted); font-size: 13px; border-radius: var(--r); }
.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }

/* ---------- plan card ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; animation: rise 0.4s var(--ease); }
.plan-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text); font-size: 12px; font-weight: 500; }
.pill.accent { background: var(--accent-soft); color: var(--accent-2); }
.fl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.fl small { opacity: 0.75; }
.fl textarea, .fl input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; color: var(--text); font-family: var(--mono); font-size: 14px; line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.fl textarea { resize: vertical; min-height: 64px; }
.fl textarea:focus, .fl input:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan:not([data-firstframe]) .only-firstframe { display: none; }
.adv { border-top: 1px solid var(--line); padding-top: 10px; }
.adv summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before { content: ""; width: 7px; height: 7px; border-inline-end: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 0.2s; margin-top: -3px; }
html[dir="rtl"] .adv summary::before { transform: rotate(135deg); }
.adv[open] summary::before { transform: rotate(45deg) !important; margin-top: -4px; }
.adv[open] { display: flex; flex-direction: column; gap: 12px; }
.plan-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status { font-size: 13px; color: var(--muted); }
.plan.locked .fl textarea, .plan.locked .fl input { opacity: 0.6; pointer-events: none; }

/* ---------- results ---------- */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.results:empty { display: none; }
.result { position: relative; border-radius: var(--r); overflow: hidden; background: var(--surface-2); animation: pop 0.45s var(--ease); }
.result img, .result video { display: block; width: 100%; height: auto; cursor: zoom-in; }
.result .mini {
  position: absolute; inset-inline: 0; bottom: 0; display: flex; gap: 6px; justify-content: flex-end; padding: 24px 8px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); pointer-events: none;
}
.result .mini > * { pointer-events: auto; }
.result .mini button, .result .mini a {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 0; color: #fff; text-decoration: none;
}
.result video { cursor: default; }
.result .badge { position: absolute; top: 8px; inset-inline-start: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, 0.5); color: #fff; backdrop-filter: blur(8px); pointer-events: none; }

.result.skeleton { display: grid; place-items: center; min-height: 160px; cursor: default; overflow: hidden; }
.result.skeleton::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 40%, transparent 60%);
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
.sk-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; text-align: center; }
.sk-spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.sk-label { font-size: 13px; color: var(--text); }
.sk-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- composer ---------- */
.composer {
  position: fixed; inset-inline: 0; bottom: var(--tabbar-h); z-index: 25;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 22%);
}
.composer > * { max-width: 736px; margin-inline: auto; }
.composer-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.composer-top::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 6px; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  transition: background 0.2s, transform 0.15s var(--ease);
}
.chip:active { transform: scale(0.95); }
.chip.icon { padding: 7px 9px; color: var(--muted); }
.chip.locked { border-style: dashed; color: var(--accent-2); }

.inputbar {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 26px; padding: 5px;
  box-shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.8);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.inputbar:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 0 0 4px var(--accent-soft), 0 10px 40px -12px rgba(0, 0, 0, 0.8); }
.inputbar textarea { flex: 1; resize: none; border: 0; background: none; padding: 9px 6px; max-height: 160px; color: var(--text); font-size: 16px; line-height: 1.4; }
.inputbar textarea:focus { outline: none; }
.inputbar textarea::placeholder { color: #6d6a65; }
.send-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; flex: none; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink);
  transition: transform 0.15s var(--ease), opacity 0.2s;
}
.send-btn:active { transform: scale(0.9); }
.send-btn:disabled { opacity: 0.4; }

.attach { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px; margin-bottom: 8px; animation: rise 0.3s var(--ease); }
.attach-media img, .attach-media video { display: block; height: 52px; width: auto; max-width: 90px; object-fit: cover; border-radius: 10px; }
.attach-note { flex: 1; font-size: 13px; color: var(--muted); }

/* ---------- segmented controls ---------- */
.seg { display: inline-flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 999px; border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: background 0.25s var(--ease), color 0.2s;
}
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.seg button:disabled { opacity: 0.35; }
.mode-seg { flex: none; }
.mode-seg button.on { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); }
.seg.compact { margin-bottom: 14px; }
.seg.wrap { flex-wrap: wrap; border-radius: var(--r); }

/* ---------- bottom sheet ---------- */
dialog { color: var(--text); }
.sheet {
  margin: auto auto 0; width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  border: 1px solid var(--line-2); border-bottom: 0; border-radius: 26px 26px 0 0;
  background: var(--surface); padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
}
.sheet[open] { animation: sheetUp 0.35s var(--ease); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 2px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.field { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.field .lbl { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; }
.field .lbl output { color: var(--accent-2); font-weight: 600; }
.field .seg { align-self: stretch; }
.field .seg button { flex: 1; }
.sheet[data-mode="image"] .only-video, .sheet[data-mode="video"] .only-image { display: none; }
.shape { display: inline-block; border: 1.6px solid currentColor; border-radius: 3px; }
.shape.portrait { width: 10px; height: 14px; }
.shape.square { width: 12px; height: 12px; }
.shape.landscape { width: 15px; height: 10px; }

.option-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-cards button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start;
  border: 1.5px solid var(--line-2); background: var(--surface-2); border-radius: var(--r); padding: 12px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease);
}
.option-cards button:active { transform: scale(0.97); }
.option-cards button b { font-size: 15px; direction: ltr; }
.option-cards button small { color: var(--muted); font-size: 12px; }
.option-cards .oc-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); margin-bottom: 6px; color: var(--muted); }
.option-cards button.on { border-color: var(--accent); background: var(--accent-soft); }
.option-cards button.on .oc-icon { background: var(--accent); color: var(--accent-ink); }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; direction: ltr; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--pct, 50%), var(--surface-3) var(--pct, 50%)); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--surface-3); }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; margin-top: -9px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.range::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.range-scale { display: flex; justify-content: space-between; direction: ltr; font-size: 11px; color: var(--muted); margin-top: -4px; padding: 0 6px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 4px; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; }
.switch-row b { font-weight: 500; font-size: 15px; }
.switch-row small { color: var(--muted); font-size: 12px; }
.switch { -webkit-appearance: none; appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--surface-3); position: relative; flex: none; cursor: pointer; transition: background 0.25s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: inset-inline-start 0.25s var(--ease); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.switch:checked { background: #3ec46d; }
.switch:checked::after { inset-inline-start: 23px; }

/* ---------- notifications ---------- */
.push-row { display: flex; align-items: center; gap: 12px; }
.push-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--surface-3); color: var(--muted); flex: none; }
.push-icon.ok { background: rgba(62, 196, 109, 0.16); color: #5fd68a; }
.push-icon.warn { background: var(--accent-soft); color: var(--accent-2); }
.push-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.push-text b { font-weight: 500; font-size: 15px; }
.push-text small { color: var(--muted); font-size: 12px; }
.compact-btn { padding: 8px 14px; font-size: 14px; }
#pushTest { align-self: flex-start; font-size: 14px; }
.tip { align-self: stretch; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-2); animation: rise 0.35s var(--ease); }
.tip p { margin: 0; flex: 1; font-size: 13px; color: var(--muted); }
.tip p b { display: block; color: var(--text); font-size: 14px; font-weight: 600; }

/* ---------- gallery ---------- */
.gallery-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 12px; }
.gallery-head h1 { margin: 0; font-size: 26px; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.grid .result { border-radius: 12px; }
.grid .result img, .grid .result video { aspect-ratio: 3 / 4; object-fit: cover; cursor: pointer; }
.grid .result .mini { display: none; }
.grid-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- viewer ---------- */
.viewer {
  margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; padding: 0;
  background: #000; display: none; flex-direction: column;
}
.viewer[open] { display: flex; animation: fade 0.25s ease; }
.viewer::backdrop { background: #000; }
.viewer-top { position: absolute; top: 0; inset-inline: 0; display: flex; justify-content: flex-end; padding: calc(12px + env(safe-area-inset-top)) 14px 12px; z-index: 2; }
.viewer-media { flex: 1; display: grid; place-items: center; min-height: 0; padding: 60px 0 0; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.viewer-bottom { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.9)); }
.viewer-prompt { font-size: 12px; color: #a9a59e; max-height: 4.5em; overflow: auto; text-align: left; margin: 0 auto 12px; max-width: 700px; font-family: var(--mono); }
.viewer-actions { display: flex; justify-content: center; gap: 28px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; color: #fff; font-size: 12px; text-decoration: none; min-width: 56px; }
.action svg { width: 46px; height: 46px; padding: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.action.danger { color: var(--danger); }

/* ---------- login ---------- */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 340px); display: flex; flex-direction: column; align-items: stretch; gap: 12px; text-align: center; animation: rise 0.5s var(--ease); }
.logo-mark { width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 20px; display: grid; place-items: center; color: var(--accent-ink); background: linear-gradient(160deg, var(--accent-2), var(--accent)); box-shadow: 0 14px 40px -12px rgba(234, 169, 94, 0.7); }
.login-title { margin: 0; font-size: 28px; direction: ltr; }
.login-sub { margin: -6px 0 10px; color: var(--muted); }
.login-card input { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 14px 16px; font-size: 16px; text-align: center; }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.error { color: var(--danger); min-height: 1em; margin: 0; font-size: 13px; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- phone layout: bottom tab bar ---------- */
@media (max-width: 700px) {
  :root { --tabbar-h: calc(58px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; }
  .top-tabs { display: none; }
  .composer { padding-bottom: 8px; }
  .view { padding-inline: 12px; }
  .msg { max-width: 90%; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; }
  .grid .result { border-radius: 6px; }
  .gallery-head h1 { font-size: 30px; }
}
@media (min-width: 701px) {
  .sheet { margin: auto; border-radius: 26px; border-bottom: 1px solid var(--line-2); }
  .grabber { display: none; }
}
