/* ==========================================================================
   Leaf API demo kit: shared styles
   ========================================================================== */

:root {
  --bg: #faf8f6;
  --fg: #1a4d2e;
  --fg-soft: rgba(26, 77, 46, 0.72);
  --fg-mute: rgba(26, 77, 46, 0.5);
  --card: #ffffff;
  --primary: #2d7a4f;
  --primary-hover: #256842;
  --primary-fg: #ffffff;
  --secondary: #f0ebe3;
  --muted: #e8ddf5;
  --border: #e0d5ca;
  --input: #ffffff;
  --danger: #c41e3a;
  --dark: #0f2818;
  --dark-2: #1a3a2a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(26, 77, 46, 0.06), 0 1px 3px rgba(26, 77, 46, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 40, 24, 0.12);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--fg);
  background: linear-gradient(180deg, var(--secondary) 0%, var(--bg) 280px);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); }

/* ---------- Shell ---------- */
.leaf-shell { max-width: 1240px; margin: 0 auto; padding: 16px; }
.leaf-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 14px; flex-wrap: wrap; }
.leaf-brand { display: flex; align-items: center; gap: 10px; }
.leaf-logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: var(--primary-fg);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800;
}
.leaf-brand-title { font-weight: 700; font-size: 16px; }
.leaf-brand-sub { font-size: 12px; color: var(--fg-mute); display: flex; align-items: center; gap: 6px; }
.leaf-status { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.status-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--card);
  border-radius: 999px; padding: 5px 10px; color: var(--fg-soft);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.status-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }

.leaf-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.leaf-app {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
  padding: 22px; min-height: 520px; min-width: 0;
}
.leaf-stage { min-width: 0; }
/* The demo's own layouts respond to the space the demo really has (page, tablet or phone), not the window. */
.leaf-screen { container: site / inline-size; }
@media (max-width: 960px) { .leaf-layout { grid-template-columns: minmax(0, 1fr); } }
@container site (max-width: 960px) { .leaf-app { padding: 16px; } }

.leaf-boot { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--fg-mute); font-size: 14px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--secondary); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- API call log ---------- */
.leaf-log {
  background: var(--dark); color: #f0ebe3; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column;
  height: 640px; position: sticky; top: 16px;
}
@media (max-width: 960px) { .leaf-log { position: static; height: 360px; } }
.log-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); font-size: 14px; font-weight: 600; }
.log-head .count { color: rgba(255, 255, 255, 0.5); font-weight: 500; font-size: 12px; }
.log-head .spacer { flex: 1; }
.log-head button { background: none; border: 0; color: rgba(255, 255, 255, 0.55); padding: 4px; display: inline-flex; }
.log-head button:hover { color: #fff; }
.pulse { position: relative; width: 8px; height: 8px; }
.pulse::before, .pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #4ade80; }
.pulse::before { animation: ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite; opacity: 0.6; }
@keyframes ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }
.log-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.log-empty { text-align: center; color: rgba(255, 255, 255, 0.5); font-size: 13px; padding: 40px 16px; line-height: 1.5; }
.log-item { background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 10px; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.log-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.log-copy {
  margin-left: auto; flex-shrink: 0; width: 24px; height: 24px; border: 0; border-radius: 6px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.75); opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.log-copy svg { width: 13px; height: 13px; }
.log-item:hover .log-copy, .log-copy:focus-visible, .log-copy.done { opacity: 1; }
.log-copy:hover { background: #22c55e; color: #052e16; }
.log-copy.done { background: #22c55e; color: #052e16; }
@media (hover: none) { .log-copy { opacity: 1; } }
.log-path { font-family: var(--mono); font-size: 11.5px; color: rgba(255, 255, 255, 0.92); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-body pre { margin: 8px 0 0; max-height: 110px; overflow: auto; background: rgba(0, 0, 0, 0.3); border-radius: 6px; padding: 8px; font-family: var(--mono); font-size: 11px; line-height: 1.5; color: rgba(255, 255, 255, 0.72); }
.log-result { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11px; }
.log-result.ok { color: #86efac; }
.log-result.err { color: #fca5a5; }
.log-result .ms { margin-left: auto; color: rgba(255, 255, 255, 0.4); }
.log-result svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ---------- Methods ---------- */
.method { flex-shrink: 0; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 2px 6px; letter-spacing: 0.02em; }
.m-GET { background: #dbeafe; color: #1e40af; }
.m-POST { background: #dcfce7; color: #166534; }
.m-PATCH { background: #f3e8ff; color: #6b21a8; }
.m-PUT { background: #fef9c3; color: #854d0e; }
.m-DELETE { background: #fee2e2; color: #991b1b; }

/* ---------- Primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 9px; border: 1px solid transparent;
  padding: 8px 14px; font-size: 14px; font-weight: 600; background: var(--primary); color: var(--primary-fg); white-space: nowrap; text-decoration: none;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.btn:hover:not(:disabled) { background: var(--primary-hover); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-outline { background: var(--card); color: var(--fg); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--secondary); border-color: rgba(45, 122, 79, 0.35); }
.btn-ghost { background: transparent; color: var(--fg-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--secondary); color: var(--fg); }
.btn-danger, .btn.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a3182f; border-color: #a3182f; color: #fff; }
.btn-warn, .btn.btn-warn { background: #f59e0b; border-color: #f59e0b; color: #422006; }
.btn-warn:hover:not(:disabled) { background: #d97706; border-color: #d97706; color: #422006; }
/* Armed "click again to confirm" state for destructive buttons. */
.btn.armed { background: var(--danger); border-color: var(--danger); color: #fff; animation: armPulse 1s ease-in-out infinite; }
.btn.armed:hover:not(:disabled) { background: #a3182f; border-color: #a3182f; color: #fff; }
@keyframes armPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(196, 30, 58, 0.35); } 50% { box-shadow: 0 0 0 5px rgba(196, 30, 58, 0); } }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; padding: 4px; color: var(--fg-mute); display: inline-flex; border-radius: 6px; }
.icon-btn { transition: color .15s, background .15s; }
.icon-btn:hover { color: var(--fg); background: var(--secondary); }
.icon-btn.danger:hover { color: var(--danger); background: #fee2e2; }
.icon-btn.armed, .icon-btn.armed:hover { background: var(--danger); color: #fff; padding: 4px 8px; font-size: 12px; font-weight: 600; gap: 4px; align-items: center; }
.icon-btn svg { width: 15px; height: 15px; }

.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border); background: var(--input); border-radius: 9px; padding: 8px 11px; font-size: 14px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45, 122, 79, 0.15); }
.textarea { resize: vertical; min-height: 90px; }

.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.badge-low { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge-medium { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge-hard { background: #ffe4e6; color: #9f1239; border-color: #fecdd3; }
.badge-expert { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.badge-mobile { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.chip { border: 0; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 500; background: var(--secondary); color: var(--fg-soft); transition: background .15s, color .15s; }
.chip:hover:not(.active) { background: #e7dfd3; color: var(--fg); }
.chip.active { background: var(--primary); color: var(--primary-fg); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--fg-mute); }
.soft { color: var(--fg-soft); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 8px; }
.grid { display: grid; gap: 12px; }
.title { font-size: 20px; font-weight: 700; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-mute); }
.skeleton { background: var(--secondary); border-radius: 10px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.error-banner { margin-bottom: 14px; border: 1px solid rgba(196, 30, 58, 0.3); background: rgba(196, 30, 58, 0.08); color: var(--danger); padding: 9px 12px; border-radius: 10px; font-size: 13px; }
.hide-sm { }
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* ---------- Modal ---------- */
.leaf-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 40, 24, 0.45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.leaf-modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card); border-radius: 20px;
  box-shadow: 0 25px 60px rgba(15, 40, 24, 0.3); animation: popIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
.modal-hero { padding: 22px 22px 0; display: flex; gap: 14px; align-items: flex-start; }
.modal-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #dcfce7; color: var(--primary); }
.modal-icon.warn { background: #fef3c7; color: #b45309; }
.modal-icon.err { background: #ffe4e6; color: #be123c; }
.modal-icon svg { width: 22px; height: 22px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-sub { font-size: 13.5px; color: var(--fg-soft); margin-top: 4px; line-height: 1.5; }
.modal-body { padding: 18px 22px 22px; }
.modal-close { margin-left: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-soft); margin-bottom: 6px; }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 8px; }
.key-input { font-family: var(--mono); letter-spacing: 0.02em; }
.hint { font-size: 12px; color: var(--fg-mute); margin-top: 8px; line-height: 1.5; }
.account-note { display: flex; align-items: center; gap: 6px; color: var(--primary); }
.account-note svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-google { width: 100%; gap: 10px; padding: 10px 14px; color: var(--primary); border-color: var(--primary); }
.btn-google svg { width: 18px; height: 18px; }
.or-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 14px; font-size: 12px; color: var(--fg-mute); }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--secondary); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 19px; }
.stat span { font-size: 11px; color: var(--fg-soft); }
.meter { height: 6px; background: var(--secondary); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.5s ease; }
.meter.warn > i { background: #f59e0b; }
.meter.full > i { background: var(--danger); }
.res-list { display: flex; flex-direction: column; gap: 6px; }
.res-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 11px; padding: 9px 10px; }
.res-item.current { border-color: var(--primary); background: rgba(45, 122, 79, 0.05); }
.res-item .grow { flex: 1; min-width: 0; }
.res-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-meta { font-size: 11.5px; color: var(--fg-mute); }
.tag { font-size: 10px; font-weight: 700; border-radius: 4px; padding: 1px 5px; background: var(--secondary); color: var(--fg-soft); }
.tag.green { background: #dcfce7; color: #166534; }
.tag.red { background: #ffe4e6; color: #9f1239; }
.need-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border: 1px dashed #c4b5fd; background: #f5f3ff; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.need-box p { flex-basis: 100%; margin: 0; }
.need-facts { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--fg-soft); }
.need-facts b { color: #6d28d9; }
.need-count { display: flex; align-items: baseline; gap: 6px; }
.need-count b { font-size: 30px; font-weight: 800; color: #6d28d9; line-height: 1; transition: transform .2s; }
.need-count span { font-size: 12px; color: var(--fg-soft); }
.need-slots { display: flex; gap: 5px; }
.need-slots i { width: 22px; height: 22px; border-radius: 6px; background: #ddd6fe; border: 2px solid #c4b5fd; }
.need-slots i.used { background: #7c3aed; border-color: #7c3aed; }
.need-slots i.just-freed { animation: popIn .35s ease; background: #dcfce7; border-color: #22c55e; }
.res-item.freed { opacity: .55; border-style: dashed; }
/* Project choice rows: info on the left, the two choices (each with an optional Recommended badge) on the right. */
.res-item.res-choice { flex-wrap: wrap; row-gap: 10px; }
.res-choice-info { display: flex; align-items: center; gap: 10px; flex: 1 1 220px; min-width: 0; }
.res-choice-actions { display: flex; align-items: flex-end; gap: 8px; margin-left: auto; }
.choice { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.choice.recommended .btn-warn { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3); }
.choice.recommended .btn-danger { box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.22); }
.rec-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; border-radius: 999px; padding: 2px 7px; white-space: nowrap; }
.rec-badge svg { width: 10px; height: 10px; fill: currentColor; }
.rec-badge.use { background: #fef3c7; color: #92400e; }
.rec-badge.delete { background: #ffe4e6; color: #9f1239; }
.res-meta.fit-ok { color: #166534; }
.res-meta.fit-short { color: #9f1239; }
.res-meta.fit-tight { color: #92400e; }
.res-item.suggested { border-color: rgba(196, 30, 58, 0.45); background: rgba(196, 30, 58, 0.04); }
.ok-box { border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.warn-box { border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.progress-line { height: 4px; background: var(--secondary); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress-line > i { display: block; height: 100%; background: var(--primary); transition: width 0.25s; }

/* ---------- Toast ---------- */
.leaf-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; background: var(--dark); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: popIn 0.25s ease;
}

/* ==========================================================================
   Device preview (website / tablet / mobile): only the demo goes in the frame
   ========================================================================== */
.leaf-statusbar, .leaf-homebar { display: none; }
.leaf-device { position: relative; }
html:not([data-device="desktop"]) .leaf-layout { align-items: stretch; }
html:not([data-device="desktop"]) .leaf-stage {
  display: flex; justify-content: center; align-items: flex-start; padding: 18px 12px; border-radius: 18px; border: 1px solid var(--border);
  background: radial-gradient(circle at 30% 20%, rgba(45,122,79,.12), transparent 50%), radial-gradient(circle at 80% 80%, rgba(139,92,246,.10), transparent 45%), #ece7df;
}
html:not([data-device="desktop"]) .leaf-device {
  display: flex; flex-direction: column; overflow: hidden; background: var(--card); flex-shrink: 0;
  border: 12px solid #121212; box-shadow: 0 0 0 2px #3a3a3a, 0 30px 70px rgba(0,0,0,.28);
}
/* Real device proportions (390×844 phone, 820×1180 tablet). leaf-api.js zooms the whole frame down to fit the
   window instead of squashing its height, so the preview always has the shape of a real device. */
html[data-device="mobile"] .leaf-device { width: 390px; height: 844px; border-radius: 56px; --leaf-screen-r: 44px; }
html[data-device="tablet"] .leaf-device { width: 820px; height: 1180px; border-radius: 38px; border-width: 16px; --leaf-screen-r: 22px; }
html:not([data-device="desktop"]) .leaf-screen { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
/* Chrome (GPU compositing) ignores the frame's rounded overflow clip for backdrop-filter, so a blurred bottom nav or
   sheet backdrop paints square corners over the frame. A solid mask forces a real mask layer that clips to the
   element's own rounded corners (radius = frame radius - border). clip-path: inset() is not enough for sticky navs. */
html:not([data-device="desktop"]) .leaf-screen,
html:not([data-device="desktop"]) .leaf-device > .in-device { -webkit-mask-image: linear-gradient(#000, #000); mask-image: linear-gradient(#000, #000); }
html:not([data-device="desktop"]) .leaf-screen { border-radius: 0 0 var(--leaf-screen-r) var(--leaf-screen-r); }
html:not([data-device="desktop"]) .leaf-device > .in-device { border-radius: var(--leaf-screen-r); overflow: hidden; }
html:not([data-device="desktop"]) .leaf-screen::-webkit-scrollbar { width: 0; }
html:not([data-device="desktop"]) .leaf-app { border: 0; border-radius: 0; box-shadow: none; min-height: 100%; padding: 16px 16px 28px; }
/* Apps drawn edge to edge (chat, full-screen tools): a root with .leaf-bleed fills the whole device screen with no
   white gutter around it, the way a native app does. */
html:not([data-device="desktop"]) .leaf-app:has(> .leaf-bleed) { padding: 0; display: flex; flex-direction: column; }
html:not([data-device="desktop"]) .leaf-app > .leaf-bleed { flex: 1; min-height: 0; border: 0; border-radius: 0; }
/* The API calls panel stays beside the device and matches its height. */
html:not([data-device="desktop"]) .leaf-log { height: auto; contain: size; position: static; }
@media (max-width: 960px) { html:not([data-device="desktop"]) .leaf-log { contain: none; height: 360px; } }
html:not([data-device="desktop"]) .leaf-statusbar {
  display: flex; align-items: center; justify-content: space-between; position: relative; flex-shrink: 0;
  padding: 0 26px; height: 48px; font-size: 15px; font-weight: 600; color: #111; background: var(--card);
}
html[data-device="tablet"] .leaf-statusbar { height: 30px; font-size: 12px; padding: 0 20px; }
.sb-island { position: absolute; left: 50%; top: 11px; width: 122px; height: 34px; transform: translateX(-50%); background: #000; border-radius: 999px; }
html[data-device="tablet"] .sb-island { width: 8px; height: 8px; top: 11px; background: #2a2a2a; }
.sb-icons { display: inline-flex; align-items: center; gap: 6px; }
.sb-icons svg { fill: #111; }
.sb-battery { position: relative; width: 25px; height: 12px; border: 1.5px solid rgba(0,0,0,.45); border-radius: 4px; padding: 1.5px; }
.sb-battery::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; background: rgba(0,0,0,.45); border-radius: 0 2px 2px 0; }
.sb-level { display: block; height: 100%; width: 100%; background: #111; border-radius: 1.5px; }
.sb-level.low { background: #ef4444; }
html:not([data-device="desktop"]) .leaf-homebar {
  display: block; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); width: 134px; height: 5px; border-radius: 999px; background: #111; opacity: .85; z-index: 5; pointer-events: none;
}
html[data-device="tablet"] .leaf-homebar { width: 180px; }
/* The demo's own toasts appear on the device screen. */
.leaf-device > .leaf-toast { position: absolute; }

/* ---------- Top bar controls: preview size + settings ---------- */
.tb-seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); background: var(--card); border-radius: 999px; }
.tb-seg-btn, .tb-btn {
  width: 30px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--fg-mute);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: background .15s, color .15s;
}
.tb-seg-btn svg, .tb-btn svg { width: 16px; height: 16px; }
.tb-seg-btn:hover, .tb-btn:hover { color: var(--fg); background: var(--secondary); }
.tb-seg-btn.on { background: var(--primary); color: var(--primary-fg); }
.tb-btn { width: 36px; height: 36px; border: 1px solid var(--border); background: var(--card); }
.tb-btn:hover svg { animation: spin 2s linear infinite; }
@media (max-width: 600px) { .tb-seg { display: none; } }

/* ---------- Narrow demo widths (mobile preview, small screens) ---------- */
@media (max-width: 480px) {
  .leaf-shell { padding: 12px; }
  .leaf-status .status-chip { font-size: 11px; }
  .stat-grid { gap: 6px; }
}
@container site (max-width: 480px) {
  .leaf-app { padding: 14px; border-radius: 14px; min-height: 0; }
  .title { font-size: 18px; }
}

/* ---------- Snap Stories ----------
   Bold, playful disappearing-photo messenger. Electric yellow + violet on ink, chunky outlines with an offset
   "pop" shadow on primary actions. Phone: bottom nav with a big center camera button, edge to edge (leaf-bleed).
   Wide (>= 640px): side rail with nav + stories, the list panel, and a stage that holds the camera, chat thread
   and both viewers side by side. */
.leaf-app:has(> .ss) { display: flex; flex-direction: column; }
html:not([data-device="desktop"]) .leaf-app:has(> .ss) { height: 100%; }

.ss, .ss-sheet-host {
  --ss-yellow: #ffe14d;
  --ss-yellow-d: #f5c400;
  --ss-violet: #6d28ff;
  --ss-violet-d: #5414e6;
  --ss-violet-soft: #f0e9ff;
  --ss-pink: #ff3d8b;
  --ss-pink-soft: #ffe6f0;
  --ss-ink: #15101f;
  --ss-ink-2: #2b2340;
  --ss-mute: #756d88;
  --ss-faint: #a59db6;
  --ss-line: #ece7f3;
  --ss-soft: #f6f3fa;
  --ss-card: #ffffff;
  --ss-r-xs: 10px;
  --ss-r-sm: 14px;
  --ss-r: 18px;
  --ss-r-lg: 24px;
  --ss-ease: cubic-bezier(.2, .8, .2, 1);
  --ss-pop: 0 3px 0 var(--ss-ink);
  --ss-ring: conic-gradient(from 200deg, #ffe14d, #ff3d8b, #6d28ff, #ffe14d);
  --ring-gap: #fff;
  font-family: var(--font);
  color: var(--ss-ink);
}
.ss *, .ss-sheet-host * { -webkit-tap-highlight-color: transparent; }
.ss button, .ss-sheet-host button {
  cursor: pointer;
  transition: transform .16s var(--ss-ease), background-color .18s, border-color .18s, box-shadow .18s, color .18s, opacity .18s;
}
.ss button:active:not(:disabled), .ss-sheet-host button:active:not(:disabled) { transform: scale(.97); }
.ss button:focus-visible, .ss-sheet-host button:focus-visible, .ss input:focus-visible, .ss-sheet-host input:focus-visible { outline: 3px solid var(--ss-violet); outline-offset: 2px; }
.ss button:disabled, .ss-sheet-host button:disabled { cursor: not-allowed; opacity: .45; }

/* ---------- Shell: phone first ---------- */
.ss {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "main" "nav";
  height: 760px; border-radius: 26px; border: 1px solid var(--ss-line); background: var(--ss-card);
}
html:not([data-device="desktop"]) .ss { height: auto; }
.ss-rail { display: none; }
.ss-panel { grid-area: main; min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--ss-card); }
.ss-stage { grid-area: 1 / 1 / 3 / 2; min-height: 0; min-width: 0; position: relative; display: none; background: #0d0915; }
.ss[data-show="camera"] .ss-panel, .ss[data-show="thread"] .ss-panel { display: none; }
.ss[data-show="camera"] .ss-stage, .ss[data-show="thread"] .ss-stage { display: block; }
.ss[data-show="thread"] .ss-nav { display: none; }
.ss[data-show="camera"][data-review="true"] .ss-nav { display: none; }
.ss-stage .ss-thread { display: none; }
.ss[data-stage="thread"] .ss-thread { display: flex; }
.ss[data-stage="thread"] .ss-cam { display: none; }

/* ---------- Header ---------- */
.ss-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; min-height: 64px; flex-shrink: 0; }
.ss-head-av { border: 0; background: none; padding: 0; border-radius: 50%; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.ss-title { font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.ss-icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; background: var(--ss-soft); color: var(--ss-ink);
}
.ss-icon-btn svg { width: 20px; height: 20px; }
.ss-icon-btn.dark { background: rgba(15, 10, 25, .42); color: #fff; backdrop-filter: blur(10px); }
@media (hover: hover) {
  .ss-icon-btn:hover:not(:disabled) { background: var(--ss-yellow); }
  .ss-icon-btn.dark:hover:not(:disabled) { background: rgba(15, 10, 25, .7); }
}
.ss-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 24px; scrollbar-width: thin; }
.ss-kicker { font-size: 13px; color: var(--ss-mute); font-weight: 600; margin: 2px 2px 10px; }
.ss-h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; margin: 22px 2px 10px; }
.ss-count { font-size: 11px; font-weight: 700; background: var(--ss-soft); color: var(--ss-mute); border-radius: 999px; padding: 2px 8px; letter-spacing: 0; }

/* ---------- Buttons ---------- */
.ss-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border: 2px solid var(--ss-ink); border-radius: 999px; background: var(--ss-yellow); color: var(--ss-ink);
  font-weight: 800; font-size: 15px; box-shadow: var(--ss-pop); white-space: nowrap;
}
.ss-btn svg { width: 18px; height: 18px; }
.ss-btn:active:not(:disabled) { box-shadow: 0 1px 0 var(--ss-ink); transform: translateY(2px) scale(.98); }
.ss-btn.block { width: 100%; margin-top: 8px; }
.ss-btn.ghost { background: var(--ss-card); }
.ss-btn.ghost.dark { background: rgba(15, 10, 25, .45); color: #fff; border-color: rgba(255, 255, 255, .8); box-shadow: none; backdrop-filter: blur(10px); }
@media (hover: hover) {
  .ss-btn:hover:not(:disabled) { background: #ffd51f; transform: translateY(-1px); box-shadow: 0 4px 0 var(--ss-ink); }
  .ss-btn.ghost:hover:not(:disabled) { background: var(--ss-violet-soft); }
  .ss-btn.ghost.dark:hover:not(:disabled) { background: rgba(15, 10, 25, .7); box-shadow: none; }
}
.ss-pill-btn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 14px; flex-shrink: 0;
  border-radius: 999px; border: 0; background: var(--ss-violet); color: #fff; font-weight: 700; font-size: 13px;
}
.ss-pill-btn svg { width: 15px; height: 15px; }
@media (hover: hover) { .ss-pill-btn:hover { background: var(--ss-violet-d); } }

/* ---------- Avatars and story rings ---------- */
.ss-av {
  --s: 48px; width: var(--s); height: var(--s); flex-shrink: 0; position: relative; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; background: var(--c, var(--ss-yellow));
  font-size: calc(var(--s) * .55); line-height: 1; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .08);
}
.ss .ss-av > span, .ss-sheet-host .ss-av > span { font-size: calc(var(--s) * .55); line-height: 1; transform: translateY(1px); }
.ss-av.xs { --s: 26px; }
.ss-av.sm { --s: 38px; }
.ss-av.lg { --s: 62px; }
.ss-av.xl { --s: 116px; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .08); }
.ss-ringwrap { display: inline-flex; flex-shrink: 0; padding: 5px; border-radius: 50%; background: var(--ss-ring); position: relative; }
.ss-ringwrap .ss-av { box-shadow: 0 0 0 2.5px var(--ring-gap), inset 0 -4px 0 rgba(0, 0, 0, .08); }
.ss-ringwrap.ring-seen { background: #d9d3e3; }
.ss-ringwrap.ring-add { background: none; outline: 2px dashed #cfc7dc; outline-offset: -3px; }
.ss-ringwrap.ring-add::after {
  content: "+"; position: absolute; right: -1px; bottom: -1px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ss-violet); color: #fff; font-weight: 800; font-size: 17px; line-height: 21px; text-align: center; border: 2.5px solid var(--ring-gap);
}

/* ---------- Bottom nav (phone) ---------- */
.ss-nav {
  grid-area: nav; position: relative; z-index: 5; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
  padding: 6px 6px 22px; background: rgba(255, 255, 255, .94); border-top: 1px solid var(--ss-line); backdrop-filter: blur(16px);
  transition: background-color .25s, border-color .25s;
}
.ss-nav-btn {
  position: relative; min-height: 54px; border: 0; background: none; border-radius: var(--ss-r-sm); padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 700; color: var(--ss-faint);
}
.ss-nav-ico { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 30px; border-radius: 999px; transition: background-color .2s var(--ss-ease); }
.ss-nav-ico svg { width: 22px; height: 22px; }
.ss-nav-btn.on { color: var(--ss-ink); }
.ss-nav-btn.on .ss-nav-ico { background: var(--ss-yellow); }
.ss-nav-btn .ss-av.xs { box-shadow: 0 0 0 2px #fff; }
.ss-nav-btn.on .ss-av.xs { box-shadow: 0 0 0 2px var(--ss-ink); }
@media (hover: hover) { .ss-nav-btn:hover { color: var(--ss-ink); } }
.ss-badge {
  position: absolute; top: -3px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--ss-pink); color: #fff; font-size: 10.5px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; animation: ss-pop .35s var(--ss-ease);
}
.ss-dot { position: absolute; top: 1px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--ss-violet); border: 2px solid #fff; }
.ss-nav-cam {
  justify-self: center; width: 66px; height: 66px; margin-top: -26px; border-radius: 50%; padding: 0;
  border: 3px solid var(--ss-ink); background: var(--ss-yellow); box-shadow: var(--ss-pop), 0 10px 24px rgba(109, 40, 255, .25);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ss-ink);
}
.ss-nav-cam span { display: inline-flex; }
.ss-nav-cam svg { width: 28px; height: 28px; }
@media (hover: hover) { .ss-nav-cam:hover { transform: translateY(-2px) rotate(-4deg); } }
/* On the camera page the nav floats over the picture and the center button becomes the shutter. */
.ss[data-show="camera"] .ss-nav { background: transparent; border-color: transparent; backdrop-filter: none; }
.ss[data-show="camera"] .ss-nav-btn { color: rgba(255, 255, 255, .82); text-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.ss[data-show="camera"] .ss-nav-btn .ss-nav-ico { filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .35)); }
.ss[data-show="camera"] .ss-badge, .ss[data-show="camera"] .ss-dot { border-color: transparent; }
.ss[data-show="camera"] .ss-nav-cam {
  width: 78px; height: 78px; margin-top: -40px; background: rgba(255, 255, 255, .14); border: 5px solid #fff; box-shadow: 0 4px 22px rgba(0, 0, 0, .3);
}
.ss[data-show="camera"] .ss-nav-cam span { display: none; }
@media (hover: hover) { .ss[data-show="camera"] .ss-nav-cam:hover { transform: scale(1.05); background: rgba(255, 255, 255, .3); } }

/* ---------- Chat rows ---------- */
.ss-list { display: flex; flex-direction: column; gap: 2px; }
.ss-row { position: relative; display: flex; align-items: center; gap: 4px; border-radius: var(--ss-r); transition: background-color .18s; }
.ss-row-hit {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 70px; padding: 9px 8px;
  border: 0; background: none; text-align: left; border-radius: var(--ss-r);
}
.ss-row-hit.static { cursor: default; }
.ss-row-hit.static:active { transform: none; }
.ss-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ss-name { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-status { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12.5px; color: var(--ss-mute); white-space: nowrap; overflow: hidden; }
.ss-status > span { flex-shrink: 0; }
.ss-status > .ss-status-label, .ss-status.mute > span:first-child { flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }
.ss-shape { width: 14px; height: 14px; flex-shrink: 0; }
.ss-status.snap .ss-shape { color: var(--ss-pink); }
.ss-status.chat .ss-shape { color: var(--ss-violet); }
.ss-status.mute .ss-shape { color: var(--ss-faint); }
.ss-row.unread .ss-status-label { font-weight: 800; }
.ss-row.unread .ss-status.snap .ss-status-label { color: var(--ss-pink); }
.ss-row.unread .ss-status.chat .ss-status-label { color: var(--ss-violet); }
.ss-row.unread .ss-name { font-weight: 800; }
.ss-sep { color: var(--ss-faint); }
.ss-streak { font-weight: 800; color: var(--ss-ink); font-variant-numeric: tabular-nums; }
.ss-streak em { font-style: normal; margin-left: 1px; }
.ss-streak.big { font-size: 15px; }
.ss-row-cam {
  width: 44px; height: 44px; flex-shrink: 0; margin-right: 4px; border-radius: 50%; border: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--ss-faint);
}
.ss-row-cam svg { width: 21px; height: 21px; }
.ss-row.on { background: var(--ss-violet-soft); }
@media (hover: hover) {
  .ss-row:hover { background: var(--ss-soft); }
  .ss-row.on:hover { background: var(--ss-violet-soft); }
  .ss-row-cam:hover { background: var(--ss-yellow); color: var(--ss-ink); }
}
.ss-remove {
  flex-shrink: 0; min-width: 44px; height: 44px; margin-right: 4px; border-radius: 999px; border: 0; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--ss-faint); font-size: 13px; font-weight: 800;
}
.ss-remove svg { width: 18px; height: 18px; }
.ss-remove.armed { background: var(--danger); color: #fff; animation: armPulse 1s ease-in-out infinite; }
@media (hover: hover) { .ss-remove:not(.armed):hover { background: #ffe4e8; color: var(--danger); } }

/* ---------- Stories ---------- */
.ss-rings { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.ss-rings::-webkit-scrollbar { display: none; }
.ss-ring {
  flex-shrink: 0; width: 78px; border: 0; background: none; padding: 4px 0; border-radius: var(--ss-r);
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
}
.ss-ring > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .ss-ring:hover .ss-ringwrap { transform: rotate(-6deg) scale(1.04); } }
.ss-ring .ss-ringwrap { transition: transform .25s var(--ss-ease); }
.ss-discover { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ss-card {
  position: relative; aspect-ratio: 3 / 4.4; border: 0; padding: 0; border-radius: var(--ss-r); overflow: hidden; text-align: left; color: #fff;
  box-shadow: 0 6px 18px rgba(21, 16, 31, .12);
}
.ss-card .ss-art { transition: transform .4s var(--ss-ease); }
.ss-card-shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 38%, rgba(10, 6, 20, .82)); }
.ss-card-text { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.ss-card-text small { font-size: 11px; font-weight: 700; opacity: .88; letter-spacing: .02em; }
.ss-card-text b { font-size: 15px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ss-card-new { position: absolute; top: 10px; left: 10px; font-style: normal; font-size: 10.5px; font-weight: 800; background: var(--ss-yellow); color: var(--ss-ink); border-radius: 999px; padding: 3px 9px; border: 2px solid var(--ss-ink); }
.ss-card.seen { opacity: .82; }
@media (hover: hover) { .ss-card:hover .ss-art { transform: scale(1.06); } .ss-card:hover { box-shadow: 0 10px 26px rgba(21, 16, 31, .2); } }

/* ---------- Friends ---------- */
.ss-search { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border-radius: 999px; background: var(--ss-soft); border: 2px solid transparent; transition: border-color .18s, background-color .18s; }
.ss-search svg { width: 18px; height: 18px; color: var(--ss-mute); flex-shrink: 0; }
.ss-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; min-height: 42px; }
.ss-search:focus-within { border-color: var(--ss-violet); background: #fff; }
.ss .ss-search input:focus-visible { outline: none; }
.ss-best { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ss-best-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 6px 12px; min-width: 0;
  border: 2px solid var(--ss-ink); border-radius: var(--ss-r); background: #fffbe0; box-shadow: var(--ss-pop);
}
.ss-best-card:nth-child(2) { background: var(--ss-violet-soft); }
.ss-best-card:nth-child(3) { background: var(--ss-pink-soft); }
.ss-best-card b { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-medal { position: absolute; top: 6px; right: 8px; font-size: 18px; }
@media (hover: hover) { .ss-best-card:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 5px 0 var(--ss-ink); } }

/* ---------- Profile ---------- */
.ss-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 24px 16px 16px; border-radius: var(--ss-r-lg); border: 2px solid var(--ss-ink); box-shadow: var(--ss-pop);
  background: radial-gradient(circle at 15% 10%, rgba(255, 255, 255, .55), transparent 40%), linear-gradient(150deg, #ffe14d 0%, #ffd0e4 55%, #d9c8ff 100%);
}
.ss-hero-av { margin-bottom: 10px; }
.ss-hero-av .ss-ringwrap { --ring-gap: #ffe9a6; }
.ss-hero-name { font-size: 24px; font-weight: 800; letter-spacing: -.035em; overflow-wrap: anywhere; }
.ss-hero-user { font-size: 13px; color: var(--ss-ink-2); font-weight: 600; opacity: .8; margin-top: 2px; }
.ss-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; margin-top: 16px; }
.ss-stats div { background: rgba(255, 255, 255, .7); border-radius: var(--ss-r-sm); padding: 10px 4px; }
.ss-stats b { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ss-stats span { font-size: 11px; color: var(--ss-ink-2); font-weight: 600; }
.ss-picker { padding: 12px; border-radius: var(--ss-r); background: var(--ss-soft); display: flex; flex-direction: column; gap: 12px; }
.ss-emoji-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.ss-emoji-grid button { aspect-ratio: 1; min-height: 44px; border-radius: var(--ss-r-sm); border: 2px solid transparent; background: #fff; font-size: 24px; padding: 0; }
.ss-emoji-grid button.on { border-color: var(--ss-ink); background: var(--ss-yellow); box-shadow: 0 2px 0 var(--ss-ink); }
@media (hover: hover) { .ss-emoji-grid button:hover:not(.on) { transform: translateY(-2px) rotate(-6deg); } }
.ss-emoji-grid.sm button { font-size: 22px; background: var(--ss-soft); }
.ss-swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-items: center; gap: 8px; }
@media (min-width: 700px) { .ss-sheet-host:not(.in-device) .ss-swatches { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.ss-swatches button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; background: var(--c); padding: 0; box-shadow: 0 0 0 1px var(--ss-line); }
.ss-swatches button.on { box-shadow: 0 0 0 3px var(--ss-ink); }
@media (hover: hover) { .ss-swatches button:hover:not(.on) { transform: scale(1.08); } }
.ss-mine { display: flex; flex-direction: column; gap: 8px; }
.ss-mine .ss-btn { align-self: flex-start; margin-top: 6px; }
.ss-mine-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--ss-r); background: var(--ss-soft); }
.ss-mine-thumb { position: relative; width: 52px; height: 76px; flex-shrink: 0; border: 0; padding: 0; border-radius: 12px; overflow: hidden; }
@media (hover: hover) { .ss-mine-thumb:hover { transform: scale(1.04); } }
.ss-mine-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--ss-mute); }
.ss-mine-meta b { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--ss-ink); }
.ss-mine-meta svg { width: 17px; height: 17px; }

/* ---------- Empty + skeleton ---------- */
.ss-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 20px; }
.ss-empty-art {
  width: 92px; height: 92px; border-radius: 30px; display: inline-flex; align-items: center; justify-content: center; font-size: 46px; margin-bottom: 8px;
  background: var(--ss-yellow); border: 2px solid var(--ss-ink); box-shadow: var(--ss-pop); transform: rotate(-6deg);
}
.ss-empty b { font-size: 17px; font-weight: 800; }
.ss-empty p { font-size: 14px; color: var(--ss-mute); max-width: 260px; margin-bottom: 10px; }
.ss-skel-row { display: flex; align-items: center; gap: 12px; padding: 11px 8px; }
.ss-skel-av { width: 48px; height: 48px; border-radius: 50% !important; flex-shrink: 0; }
.ss-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ss-skel-lines span { height: 12px; width: 55%; }
.ss-skel-lines span + span { width: 35%; }
.ss-skel-ring { width: 70px; height: 70px; border-radius: 50% !important; flex-shrink: 0; }
.ss-skel-card { aspect-ratio: 3 / 4.4; border-radius: var(--ss-r) !important; }

/* ---------- Snap art (shared by camera, viewers and thumbnails) ---------- */
.ss-art { position: absolute; inset: 0; overflow: hidden; container-type: size; user-select: none; -webkit-user-select: none; }
.ss-art-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ss-art-media::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, .35), transparent 32%), radial-gradient(circle at 85% 80%, rgba(255, 255, 255, .18), transparent 30%);
}
.ss-art-media img, .ss-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ss-video { transform: scaleX(-1); background: #000; }
.ss-art-emoji { position: relative; font-size: min(46cqw, 34cqh); line-height: 1; filter: drop-shadow(0 6cqw 8cqw rgba(0, 0, 0, .28)); }
.ss-art-tint { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light; }
.ss-sticker { position: absolute; transform: translate(-50%, -50%); font-size: max(14px, 15cqw); line-height: 1; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); touch-action: none; }
.ss-caption {
  position: absolute; left: 0; right: 0; transform: translateY(-50%); padding: .55em 4cqw; text-align: center;
  background: rgba(12, 7, 22, .58); backdrop-filter: blur(6px); color: #fff; font-weight: 700; font-size: max(8px, 4.7cqw);
  line-height: 1.25; overflow-wrap: anywhere; touch-action: none;
}
@container (max-width: 90px) { .ss-caption { font-size: 0; padding: 4cqw; } .ss-sticker { font-size: 15cqw; } }
.ss-cam-surface .ss-caption { cursor: ns-resize; font-size: max(15px, 4.7cqw); }
.ss-cam-surface .ss-sticker { cursor: grab; }
.ss-caption.editing { z-index: 3; padding: 4px 16px; }
.ss-caption.editing input { width: 100%; min-height: 40px; border: 0; background: none; outline: none; color: #fff; text-align: center; font: inherit; font-weight: 700; font-size: 17px; }
.ss-caption.editing input::placeholder { color: rgba(255, 255, 255, .6); }
.ss .ss-caption.editing input:focus-visible { outline: none; }

/* ---------- Camera ---------- */
.ss-cam { position: absolute; inset: 0; overflow: hidden; }
.ss-cam-surface { position: absolute; inset: 0; overflow: hidden; color: #fff; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; }
.ss-cam-wait { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; }
.ss-cam-wait .spinner { border-color: rgba(255, 255, 255, .3); border-top-color: #fff; }
.ss-cam-top { position: absolute; z-index: 4; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; gap: 8px; padding: 14px 12px 40px; background: linear-gradient(rgba(0, 0, 0, .35), transparent); pointer-events: none; }
.ss-cam-top > * { pointer-events: auto; }
.ss-cam-mode, .ss-cam-target {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px;
  background: rgba(15, 10, 25, .45); backdrop-filter: blur(10px); font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.ss-cam-mode svg { width: 15px; height: 15px; }
.ss-cam-mode i { width: 8px; height: 8px; border-radius: 50%; background: #ff4757; box-shadow: 0 0 0 3px rgba(255, 71, 87, .3); animation: ss-blink 1.4s ease-in-out infinite; }
.ss-cam-target { background: var(--ss-yellow); color: var(--ss-ink); }
.ss-tools { display: flex; flex-direction: column; gap: 8px; }
.ss-tool {
  width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(15, 10, 25, .42); color: #fff; backdrop-filter: blur(10px);
}
.ss-tool svg { width: 21px; height: 21px; }
.ss-tool.on { background: var(--ss-yellow); color: var(--ss-ink); }
.ss-tool-time svg { width: 15px; height: 15px; }
.ss-tool-time b { font-size: 10px; line-height: 1; margin-top: 1px; }
@media (hover: hover) { .ss-tool:hover:not(.on) { background: rgba(15, 10, 25, .7); transform: scale(1.06); } }
.ss-filter-name {
  position: absolute; z-index: 3; left: 50%; top: 42%; transform: translate(-50%, -50%); pointer-events: none; opacity: 0;
  font-size: 30px; font-weight: 800; letter-spacing: -.03em; text-shadow: 0 2px 16px rgba(0, 0, 0, .45);
}
.ss-filter-name.show { animation: ss-filter 1.1s var(--ss-ease); }
.ss-tray {
  position: absolute; z-index: 5; left: 12px; right: 64px; top: 64px; padding: 12px; border-radius: var(--ss-r);
  background: rgba(15, 10, 25, .72); backdrop-filter: blur(16px); animation: ss-rise .25s var(--ss-ease);
}
.ss-tray p { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin: 0 2px 8px; }
.ss-tray p + div + p { margin-top: 12px; }
.ss-tray-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.ss-tray-grid button { min-height: 44px; border: 0; border-radius: 12px; background: transparent; font-size: 26px; padding: 0; }
.ss-tray-grid button.on { background: rgba(255, 255, 255, .22); }
@media (hover: hover) { .ss-tray-grid button:hover { background: rgba(255, 255, 255, .14); transform: scale(1.12); } }
.ss-tray-bgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.ss-tray-bgs button { aspect-ratio: 1; min-height: 40px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
.ss-tray-bgs button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--ss-violet); }
.ss-trash {
  position: absolute; z-index: 4; left: 50%; bottom: 210px; width: 56px; height: 56px; margin-left: -28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: rgba(15, 10, 25, .5); border: 2px solid rgba(255, 255, 255, .7);
  opacity: 0; transform: scale(.6); pointer-events: none; transition: opacity .2s, transform .2s var(--ss-ease), background-color .2s;
}
.ss-trash svg { width: 24px; height: 24px; }
.ss-cam-surface.dragging .ss-trash { opacity: 1; transform: none; }
.ss-trash.hot { background: var(--danger); transform: scale(1.18) !important; }
.ss-cam-bottom { position: absolute; z-index: 4; left: 0; right: 0; bottom: 126px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 16px; pointer-events: none; }
.ss-cam-bottom > * { pointer-events: auto; }
.ss-cam-surface.review .ss-cam-bottom { bottom: 0; padding: 40px 16px 26px; background: linear-gradient(transparent, rgba(0, 0, 0, .45)); }
.ss-filter-dots { display: flex; gap: 2px; }
.ss-filter-dots button { width: 22px; height: 28px; border: 0; padding: 0; background: none; position: relative; }
.ss-filter-dots button::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: rgba(255, 255, 255, .5); transition: transform .2s var(--ss-ease), background-color .2s; }
.ss-filter-dots button.on::after { background: #fff; transform: scale(1.45); }
.ss-cam-hint { font-size: 12px; font-weight: 600; opacity: .85; text-shadow: 0 1px 6px rgba(0, 0, 0, .5); text-align: center; }
.ss-shutter { display: none; width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, .12); padding: 0; box-shadow: 0 4px 22px rgba(0, 0, 0, .3); }
.ss-shutter i { display: block; width: 100%; height: 100%; border-radius: 50%; transition: background-color .2s; }
@media (hover: hover) { .ss-shutter:hover { transform: scale(1.05); } .ss-shutter:hover i { background: rgba(255, 255, 255, .22); } }
.ss-cam-on {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .92); color: var(--ss-ink); font-size: 13px; font-weight: 800;
}
.ss-cam-on svg { width: 16px; height: 16px; }
@media (hover: hover) { .ss-cam-on:hover { background: var(--ss-yellow); } }
.ss-review-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; max-width: 420px; }
.ss-review-bar .ss-btn:last-child { flex: 1; max-width: 220px; }
.ss-flash { position: absolute; inset: 0; z-index: 6; background: #fff; opacity: 0; pointer-events: none; }
.ss-cam-surface.flashing .ss-flash { animation: ss-flash .35s ease-out; }

/* ---------- Chat thread ---------- */
.ss-thread { position: absolute; inset: 0; flex-direction: column; background: var(--ss-card); }
.ss-thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--ss-line); flex-shrink: 0; }
.ss-thread-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ss-thread-who b { font-size: 16px; font-weight: 800; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-thread-who span { font-size: 12px; color: var(--ss-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-thread-msgs { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.ss-thread-intro { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 8px 12px 18px; }
.ss-thread-intro b { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.ss-thread-intro > span { font-size: 12.5px; color: var(--ss-mute); }
.ss-day { align-self: center; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ss-faint); margin: 12px 0 6px; }
.ss-msg { display: flex; flex-direction: column; padding: 1px 0 1px 12px; border-left: 3px solid var(--ss-violet); margin-top: 2px; animation: ss-in .25s var(--ss-ease); }
.ss-msg.out { border-left-color: var(--ss-pink); }
.ss-msg-who { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ss-violet); margin: 8px 0 2px; }
.ss-msg.out .ss-msg-who { color: var(--ss-pink); }
.ss-msg p { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.ss-msg.pending p { opacity: .55; }
.ss-thread-empty { text-align: center; color: var(--ss-mute); font-size: 14px; padding: 10px; }
.ss-typing { display: flex; align-items: center; gap: 4px; padding: 10px 0 4px 12px; font-size: 12px; color: var(--ss-mute); font-weight: 600; }
.ss-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ss-violet); animation: ss-bounce 1s ease-in-out infinite; }
.ss-typing i:nth-child(2) { animation-delay: .15s; }
.ss-typing i:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
.ss-pending {
  align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 14px; padding: 0 18px;
  border-radius: 999px; border: 2px solid var(--ss-pink); background: var(--ss-pink-soft); color: var(--ss-pink); font-weight: 800; font-size: 13.5px;
}
@media (hover: hover) { .ss-pending:hover { background: var(--ss-pink); color: #fff; } }
.ss-composer { display: flex; align-items: center; gap: 8px; padding: 10px 12px 24px; border-top: 1px solid var(--ss-line); flex-shrink: 0; background: var(--ss-card); }
.ss-composer-cam, .ss-composer-send {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center;
}
.ss-composer-cam { background: var(--ss-soft); }
.ss-composer-send { background: var(--ss-violet); color: #fff; }
.ss-composer-cam svg, .ss-composer-send svg { width: 20px; height: 20px; }
@media (hover: hover) { .ss-composer-cam:hover { background: var(--ss-yellow); } .ss-composer-send:hover { background: var(--ss-violet-d); } }
.ss-composer-input { flex: 1; min-width: 0; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid transparent; background: var(--ss-soft); outline: none; font-size: 15px; transition: border-color .18s, background-color .18s; }
.ss-composer-input:focus { border-color: var(--ss-violet); background: #fff; }
.ss .ss-composer-input:focus-visible { outline: none; }

/* ---------- Layer: snap viewer + story viewer ---------- */
.ss-layer { position: absolute; inset: 0; z-index: 40; display: none; background: #000; overflow: hidden; }
.ss-layer.on { display: block; animation: ss-zoom .3s var(--ss-ease); }
.ss-viewer, .ss-story { position: absolute; inset: 0; color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; outline: none; }
.ss-viewer { cursor: pointer; }
.ss-viewer-art, .ss-story-art { position: absolute; inset: 0; }
.ss-viewer .ss-art { filter: blur(26px) brightness(.62) saturate(1.2); transform: scale(1.12); transition: filter .28s var(--ss-ease), transform .28s var(--ss-ease); }
.ss-viewer.playing .ss-art { filter: none; transform: none; }
.ss-viewer-top, .ss-story-top { position: absolute; z-index: 3; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px; padding: 14px 12px 36px; background: linear-gradient(rgba(0, 0, 0, .5), transparent); }
.ss-story-top { top: 12px; padding-top: 10px; background: none; }
.ss-viewer-who { flex: 1; min-width: 0; display: flex; flex-direction: column; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.ss-viewer-who b { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-viewer-who span { font-size: 12px; opacity: .85; }
.ss-timer { position: relative; width: 42px; height: 42px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.ss-timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ss-timer circle { fill: none; stroke-width: 3.2; }
.ss-timer .track { stroke: rgba(255, 255, 255, .28); }
.ss-timer .bar { stroke: var(--ss-yellow); stroke-dasharray: 100; stroke-dashoffset: 0; stroke-linecap: round; }
.ss-timer b { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ss-hold { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; pointer-events: none; transition: opacity .22s var(--ss-ease), transform .22s var(--ss-ease); }
.ss-hold b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.ss-hold small { font-size: 12.5px; opacity: .8; }
.ss-hold-ring { width: 88px; height: 88px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .9); display: flex; align-items: center; justify-content: center; font-size: 36px; margin-bottom: 8px; animation: ss-pulse 1.6s ease-in-out infinite; }
.ss-viewer.playing .ss-hold { opacity: 0; transform: scale(.92); }
.ss-story { transition: transform .25s var(--ss-ease), opacity .25s; }
.ss-story.dragging { transition: none; border-radius: 24px; overflow: hidden; }
.ss-story-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(0, 0, 0, .38), transparent 22%, transparent 62%, rgba(0, 0, 0, .55)); }
.ss-bars { position: absolute; z-index: 3; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; }
.ss-bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.ss-bars i { display: block; height: 100%; background: #fff; border-radius: inherit; }
.ss-story-headline { position: absolute; z-index: 2; left: 18px; right: 18px; bottom: 56px; text-shadow: 0 2px 12px rgba(0, 0, 0, .4); }
.ss-story-headline small { display: inline-block; font-size: 12px; font-weight: 800; background: var(--ss-yellow); color: var(--ss-ink); padding: 4px 10px; border-radius: 999px; text-shadow: none; margin-bottom: 10px; }
.ss-story-headline h2 { font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -.035em; }
.ss-story-foot, .ss-story-reply { position: absolute; z-index: 3; left: 12px; right: 12px; bottom: 26px; display: flex; align-items: center; gap: 8px; }
.ss-views { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; background: rgba(15, 10, 25, .5); backdrop-filter: blur(10px); font-size: 13.5px; font-weight: 700; }
.ss-views svg { width: 17px; height: 17px; }
.ss-story-del { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: rgba(15, 10, 25, .5); color: #fff; font-weight: 700; font-size: 13.5px; backdrop-filter: blur(10px); }
.ss-story-del svg { width: 17px; height: 17px; }
.ss-story-del.armed { background: var(--danger); animation: armPulse 1s ease-in-out infinite; }
@media (hover: hover) { .ss-story-del:not(.armed):hover { background: rgba(196, 30, 58, .85); } }
.ss-story-reply input { flex: 1; min-width: 0; min-height: 46px; padding: 0 18px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, .7); background: rgba(15, 10, 25, .35); color: #fff; font-size: 15px; outline: none; backdrop-filter: blur(10px); transition: border-color .18s, background-color .18s; }
.ss-story-reply input::placeholder { color: rgba(255, 255, 255, .75); }
.ss-story-reply input:focus { border-color: #fff; background: rgba(15, 10, 25, .6); }
.ss-story-reply button { width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; border: 0; padding: 0; background: var(--ss-yellow); color: var(--ss-ink); display: inline-flex; align-items: center; justify-content: center; }
.ss-story-reply button svg { width: 20px; height: 20px; }
.ss-paused { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.9); padding: 8px 14px; border-radius: 999px; background: rgba(15, 10, 25, .55); font-size: 13px; font-weight: 800; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s var(--ss-ease); }
.ss-story.paused .ss-paused { opacity: 1; transform: translate(-50%, -50%); }
.ss-story-hint { position: absolute; z-index: 2; left: 50%; top: 72px; transform: translateX(-50%); white-space: nowrap; padding: 6px 12px; border-radius: 999px; background: rgba(15, 10, 25, .45); font-size: 11px; font-weight: 600; pointer-events: none; opacity: 0; animation: ss-hint 3.2s ease .3s both; }
@keyframes ss-hint { 0% { opacity: 0; transform: translate(-50%, -4px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ---------- Bottom sheet (send to / add friend) ---------- */
.ss-sheet-host { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.ss-sheet-host.in-device { position: absolute; border-radius: inherit; overflow: hidden; }
.ss-backdrop { position: absolute; inset: 0; background: rgba(15, 10, 25, .5); opacity: 0; transition: opacity .28s; }
.ss-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 88%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--ss-card); border-radius: 28px 28px 0 0; padding: 0 16px 20px; transform: translateY(100%);
  transition: transform .34s var(--ss-ease); box-shadow: 0 -12px 40px rgba(15, 10, 25, .25);
}
.ss-sheet-host.in-device .ss-sheet { padding-bottom: 30px; }
.ss-sheet-host.open { pointer-events: auto; }
.ss-sheet-host.open .ss-backdrop { opacity: 1; }
.ss-sheet-host.open .ss-sheet { transform: none; }
.ss-grab { display: flex; justify-content: center; padding: 10px 0 6px; }
.ss-grab i { width: 42px; height: 5px; border-radius: 999px; background: var(--ss-line); }
.ss-sheet-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.ss-sheet-title { font-size: 22px; font-weight: 800; letter-spacing: -.035em; }
.ss-sheet-sub { font-size: 12.5px; color: var(--ss-mute); margin-top: 2px; }
.ss-send-thumb { position: relative; width: 46px; height: 66px; flex-shrink: 0; border-radius: 12px; overflow: hidden; border: 2px solid var(--ss-ink); box-shadow: 0 2px 0 var(--ss-ink); }
.ss-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ss-mute); margin: 16px 4px 6px; }
.ss-picks { display: flex; flex-direction: column; gap: 2px; }
.ss-pick { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 10px; border: 0; border-radius: var(--ss-r-sm); background: none; text-align: left; }
.ss-pick.story { background: var(--ss-soft); --ring-gap: var(--ss-soft); }
.ss-pick.story .ss-ringwrap { padding: 4px; }
.ss-pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ss-pick-main b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-pick-main small { font-size: 12px; color: var(--ss-mute); }
.ss-check { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; border: 2px solid #d4cde0; display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: background-color .18s, border-color .18s, transform .2s var(--ss-ease); }
.ss-check svg { width: 16px; height: 16px; stroke-width: 3; }
.ss-pick.on .ss-check { background: var(--ss-violet); border-color: var(--ss-violet); color: #fff; transform: scale(1.08); }
.ss-pick.on { background: var(--ss-violet-soft); }
@media (hover: hover) { .ss-pick:hover:not(.on) { background: var(--ss-soft); } }
.ss-send-bar {
  position: sticky; bottom: -20px; z-index: 2; display: flex; align-items: center; gap: 12px; margin: 14px -16px -20px; padding: 12px 16px 20px;
  background: var(--ss-violet); color: #fff;
}
.ss-sheet-host.in-device .ss-send-bar { bottom: -30px; margin-bottom: -30px; padding-bottom: 30px; }
.ss-send-names { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-send-go { width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--ss-ink); background: var(--ss-yellow); color: var(--ss-ink); padding: 0; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--ss-pop); }
.ss-send-go svg { width: 22px; height: 22px; }
@media (hover: hover) { .ss-send-go:hover:not(:disabled) { transform: translateX(2px) rotate(-8deg); } }
.ss-form { display: flex; flex-direction: column; gap: 10px; }
.ss-add-preview { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--ss-r); background: var(--ss-soft); }
.ss-add-preview > div { min-width: 0; display: flex; flex-direction: column; }
.ss-add-preview b { font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-add-preview > div > span { font-size: 13px; color: var(--ss-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 800; color: var(--ss-mute); }
.ss-field .input { color: var(--ss-ink); font-weight: 500; min-height: 46px; border-radius: var(--ss-r-sm); font-size: 15px; border-width: 2px; }
.ss-field .input:focus { border-color: var(--ss-violet); box-shadow: 0 0 0 3px rgba(109, 40, 255, .15); }
.ss-form .ss-label { margin-top: 6px; margin-bottom: 0; }
@media (min-width: 700px) {
  .ss-sheet-host:not(.in-device) .ss-sheet { top: 50%; bottom: auto; left: 50%; right: auto; width: 480px; max-height: 86vh; border-radius: 28px; transform: translate(-50%, -44%) scale(.97); opacity: 0; transition: transform .28s var(--ss-ease), opacity .2s; }
  .ss-sheet-host.open:not(.in-device) .ss-sheet { transform: translate(-50%, -50%); opacity: 1; }
  .ss-sheet-host:not(.in-device) .ss-grab { visibility: hidden; padding: 4px 0; }
}

/* ---------- Wide: rail + list + stage ---------- */
@container site (min-width: 640px) {
  .ss { grid-template-columns: 88px minmax(0, 1fr) minmax(300px, 1.05fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "rail panel stage"; }
  .ss-nav { display: none; }
  .ss-rail {
    grid-area: rail; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 0; padding: 14px 6px;
    background: var(--ss-ink); color: #fff; --ring-gap: var(--ss-ink);
  }
  .ss-panel, .ss[data-show] .ss-panel { grid-area: panel; display: flex; border-right: 1px solid var(--ss-line); }
  .ss-stage, .ss[data-show] .ss-stage { grid-area: stage; display: block; background: radial-gradient(circle at 30% 0%, #2a1660, #0d0915 65%); }
  .ss-cam, .ss-thread, .ss-layer { inset: 12px; border-radius: 22px; overflow: hidden; }
  .ss-layer { grid-area: stage; }
  .ss-head-av { display: none; }
  .ss-head { padding-top: 18px; }
  .ss-shutter { display: block; }
  .ss-cam-bottom { bottom: 22px; }
  .ss-cam-surface.review .ss-cam-bottom { padding-bottom: 20px; }
  .ss-trash { bottom: 190px; }
  .ss-composer { padding-bottom: 12px; }
  .ss-thread .ss-back { display: none; }
}
.ss-rail-logo { width: 46px; height: 46px; margin-bottom: 6px; }
.ss-logo { width: 100%; height: 100%; display: block; transition: transform .3s var(--ss-ease); }
@media (hover: hover) { .ss-rail-logo:hover .ss-logo { transform: rotate(-10deg) scale(1.06); } }
.ss-rail-cam {
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid #fff; background: var(--ss-yellow); color: var(--ss-ink); padding: 0;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 #000; margin-bottom: 8px;
}
.ss-rail-cam svg { width: 25px; height: 25px; }
.ss-rail-cam.on { box-shadow: 0 0 0 4px rgba(255, 225, 77, .3), 0 3px 0 #000; }
@media (hover: hover) { .ss-rail-cam:hover { transform: rotate(-6deg) scale(1.05); } }
.ss-rail-nav { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.ss-rail-btn {
  width: 100%; min-height: 58px; border: 0; background: none; border-radius: var(--ss-r-sm); padding: 4px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .6);
}
.ss-rail-btn .ss-nav-ico { width: 40px; height: 30px; }
.ss-rail-btn .ss-badge, .ss-rail-btn .ss-dot { border-color: var(--ss-ink); }
.ss-rail-btn.on { color: #fff; }
.ss-rail-btn.on .ss-nav-ico { background: var(--ss-violet); }
.ss-rail-btn .ss-av.xs { box-shadow: 0 0 0 2px var(--ss-ink); }
.ss-rail-btn.on .ss-av.xs { box-shadow: 0 0 0 2px var(--ss-yellow); }
@media (hover: hover) { .ss-rail-btn:hover { color: #fff; background: rgba(255, 255, 255, .07); } }
.ss-rail-label { margin-top: 10px; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .45); }
.ss-rail-stories { -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent); padding-bottom: 24px !important; flex: 1; min-height: 0; width: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; scrollbar-width: none; }
.ss-rail-stories::-webkit-scrollbar { display: none; }
.ss-rail-story { width: 100%; border: 0; background: none; padding: 4px 2px; border-radius: var(--ss-r-sm); display: flex; flex-direction: column; align-items: center; gap: 3px; color: rgba(255, 255, 255, .85); font-size: 10.5px; font-weight: 700; }
.ss-rail-story > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-rail-story .ss-ringwrap { padding: 3.5px; }
.ss-rail-story .ss-ringwrap.ring-seen { background: #4a4160; }
@media (hover: hover) { .ss-rail-story:hover { background: rgba(255, 255, 255, .07); } }
.ss-rail-none { font-size: 10.5px; color: rgba(255, 255, 255, .4); text-align: center; }

@container site (min-width: 900px) {
  .ss { grid-template-columns: 92px minmax(0, 1fr) minmax(380px, 1fr); }
  .ss-discover { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Motion ---------- */
@keyframes ss-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes ss-fade { from { opacity: 0; } }
@keyframes ss-slide { from { opacity: 0; transform: translateX(18px); } }
@keyframes ss-rise { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes ss-zoom { from { opacity: 0; transform: scale(.94); } }
@keyframes ss-pop { 0% { transform: scale(.4); } 60% { transform: scale(1.2); } }
@keyframes ss-blink { 50% { opacity: .35; } }
@keyframes ss-bounce { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-4px); opacity: 1; } }
@keyframes ss-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, .45); } 50% { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(255, 255, 255, 0); } }
@keyframes ss-flash { from { opacity: .85; } to { opacity: 0; } }
@keyframes ss-filter { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.9); } 20%, 70% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -55%); } }
@keyframes ss-float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-3%) rotate(3deg); } }
.ss-anim .ss-item { animation: ss-in .42s var(--ss-ease) both; animation-delay: calc(min(var(--i, 0), 12) * 38ms); }
.ss-cam-surface .ss-art-emoji { animation: ss-float 5s ease-in-out infinite; }
@container site (max-width: 639px) {
  .ss-panel { animation: ss-fade .25s var(--ss-ease); }
  .ss-thread { animation: ss-slide .28s var(--ss-ease); }
}
@media (prefers-reduced-motion: reduce) {
  .ss *, .ss *::before, .ss *::after, .ss-sheet-host * { animation: none !important; transition-duration: .01ms !important; }
}

/* Keep the shared toast above the bottom tab bar inside the phone frame, and let taps pass through it. */
html[data-device="mobile"] .leaf-device:has(.ss) > .leaf-toast { bottom: 108px; }
.leaf-device:has(.ss) > .leaf-toast, body:has(.ss) > .leaf-toast { pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
