@font-face { font-family: Inter; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/inter-latin.woff2) format("woff2"); }
:root {
  --bg: #f7f7f8; --surface: #ffffff; --surface2: #f0f0f2; --hover: #ebebee; --line: #e6e6ea;
  --fg: #16171a; --muted: #71737a; --faint: #a3a5ac;
  --accent: #5b5bd6; --accent-fg: #fff; --accent-soft: #ededfc;
  --rec: #e5484d; --ok: #30a46c; --warn: #d97706;
  --bubble: #ffffff; --bubble-fg: var(--fg); --chatbg: #f3f3f5;
  --shadow: 0 1px 2px rgba(16,17,20,.04), 0 4px 16px rgba(16,17,20,.05);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1012; --surface: #17181b; --surface2: #1f2024; --hover: #26272c; --line: #26272b;
    --fg: #ececee; --muted: #8e9099; --faint: #5d5f66;
    --accent: #8b8cf6; --accent-fg: #0f1012; --accent-soft: #23243d;
    --rec: #f2555a; --ok: #4cc38a; --warn: #f1a10d;
    --bubble: #1d1e22; --chatbg: #121315;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 15.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.err { color: var(--rec); font-size: 14px; min-height: 1em; margin: 0; }

/* Icons */
.i { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i.sm { width: 15px; height: 15px; }
.i.xs { width: 13px; height: 13px; stroke-width: 2; }

/* Buttons */
button { font: inherit; color: inherit; background: var(--surface2); border: 0; border-radius: 12px; padding: 9px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s, color .15s, transform .1s, opacity .15s; }
button:hover { background: var(--hover); }
button:active { transform: scale(.96); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-fg); font-weight: 600; padding: 9px 16px 9px 18px; }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.primary .i { stroke-width: 2.2; width: 18px; height: 18px; }
button.round { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
button.icon { background: transparent; color: var(--muted); width: 40px; height: 40px; padding: 0; border-radius: 12px; }
button.icon:hover { background: var(--surface2); color: var(--fg); }
button.soft { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); font-weight: 500; font-size: 14px; padding: 8px 14px; }
button.soft .i { width: 18px; height: 18px; color: var(--muted); }
button.glass { background: rgba(255,255,255,.14); color: #fff; width: 48px; height: 48px; border-radius: 50%; padding: 0; backdrop-filter: blur(10px); }
button.glass:hover { background: rgba(255,255,255,.24); }
button.recording { background: var(--rec) !important; color: #fff !important; width: auto !important; padding: 0 14px 0 12px !important; border-radius: 99px !important; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
button.recording .ico { animation: pulse 1.2s infinite; display: inline-flex; }
@keyframes pulse { 50% { opacity: .35; } }
.lbl:empty { display: none; }
.ico { display: inline-flex; }

/* Logo */
.logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #a26ef5); display: flex; align-items: center; justify-content: center; color: #fff; }
.logo .i { width: 18px; height: 18px; stroke-width: 2.6; }
.logo.lg { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 6px; }
.logo.lg .i { width: 30px; height: 30px; }

/* Main screen */
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 64px; padding-top: max(16px, env(safe-area-inset-top)); }
.appHead { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; }
h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 13px; color: var(--muted); margin: 32px 4px 10px; font-weight: 600; letter-spacing: 0; }

.composer { background: var(--surface); border-radius: 20px; padding: 16px 16px 10px; box-shadow: var(--shadow); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within, .composer.dragging { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
.editor { width: 100%; min-height: 120px; max-height: 50vh; overflow-y: auto; outline: 0; color: var(--fg); font-size: 16.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.editor:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.editor img { display: none; }
.toolbar { display: flex; gap: 2px; align-items: center; padding-top: 8px; margin: 0 -6px; }
.toolbar .spacer { flex: 1; }

.attachments { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.attachments:empty { display: none; }
.att { position: relative; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; background: var(--surface2); display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-align: center; padding: 4px; }
.att img, .att video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.att .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px); }
.att .x .i { width: 13px; height: 13px; stroke-width: 2.4; }
.att .kind { position: absolute; left: 6px; bottom: 6px; color: #fff; display: flex; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.att.wide { width: auto; min-width: 76px; padding: 6px 34px 6px 8px; }
.att audio { height: 36px; }

/* Feed */
.feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.feed > .sub { color: var(--muted); text-align: center; padding: 28px 0; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; transition: border-color .15s, transform .15s; }
.item.clickable { cursor: pointer; }
.item.clickable:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.item.pending { border-style: dashed; }
.item .top { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.item .title { font-weight: 600; overflow-wrap: anywhere; letter-spacing: -.005em; }
.item .sub { color: var(--muted); font-size: 14px; margin-top: 3px; overflow-wrap: anywhere; }
.item .sub:empty { display: none; }
.item .sub .i { margin: -2px 4px 0 0; }
.item .thumbs { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.item .thumbs img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; }
.item .thumbs span { font-size: 13px; color: var(--muted); background: var(--surface2); border-radius: 8px; padding: 4px 9px; display: inline-flex; align-items: center; gap: 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
.item .time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.item .actions { display: flex; gap: 6px; }
.item .actions button { font-size: 13px; padding: 5px 10px; border-radius: 9px; }

.status { font-size: 12px; font-weight: 500; padding: 2px 9px 2px 8px; border-radius: 99px; background: var(--surface2); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.processing, .status.queued { color: var(--warn); }
.status.processing::before, .status.uploading::before { animation: pulse 1.2s infinite; }
.status.uploading { color: var(--accent); }
.status.done { color: var(--ok); }
.status.error, .status.failed { color: var(--rec); }

/* Login */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 320px; text-align: center; }
.login h1 { font-size: 24px; }
.login .muted { margin: -4px 0 14px; font-size: 14px; }
.login input, .login button { width: 100%; }
.login input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); outline: 0; transition: border-color .15s, box-shadow .15s; }
.login input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.login button { padding: 12px; }

/* Camera */
.overlay { position: fixed; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column; }
.overlay video { flex: 1; width: 100%; min-height: 0; object-fit: contain; background: #000; }
.camBar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: center; padding: 24px 20px max(24px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.shoot { width: 72px; height: 72px; border-radius: 50%; background: #fff; border: 4px solid rgba(255,255,255,.35); background-clip: padding-box; padding: 0; }
.shoot:hover { background: #fff; }
.shoot.video { background: var(--rec); }
.shoot.rec { border-radius: 18px; transform: scale(.78); }
.camTimer { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--rec); color: #fff; padding: 4px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Viewer (tree / notes) */
.panel { background: var(--bg); }
.panelHead { display: flex; align-items: center; gap: 6px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--surface); }
.panelHead span { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panelBody { flex: 1; overflow: auto; padding: 16px; max-width: 820px; width: 100%; margin: 0 auto; }
.tree { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.tree li { padding: 10px 12px; border-radius: 10px; cursor: pointer; overflow-wrap: anywhere; display: flex; align-items: center; gap: 12px; }
.tree li:hover { background: var(--surface2); }
.tree li .i { color: var(--muted); }
.tree li[data-dir="true"] .i { color: var(--accent); }
.md { line-height: 1.65; }
.md img, .md video { max-width: 100%; border-radius: 12px; }
.md pre { background: var(--surface2); padding: 12px; border-radius: 10px; overflow: auto; }
.md table { border-collapse: collapse; } .md td, .md th { border: 1px solid var(--line); padding: 6px 10px; }
.md .fm { color: var(--muted); font-size: 13px; background: var(--surface2); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; }

.drop { position: fixed; inset: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 24px; }
.drop > div { border: 2px dashed var(--accent); color: var(--accent); border-radius: 24px; padding: 40px 48px; font-size: 18px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--surface); }
.drop .i { width: 32px; height: 32px; }
.toast { position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 99px; z-index: 40; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100vw - 32px); text-align: center; animation: toastIn .2s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Archive ---------- */
body.noscroll { overflow: hidden; }
.archive { position: fixed; inset: 0; z-index: 15; display: flex; background: var(--bg); }
.chats { width: 340px; flex-shrink: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.chatsHead { display: flex; align-items: center; gap: 4px; padding: 8px; padding-top: max(8px, env(safe-area-inset-top)); }
.chatsHead b { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: -.02em; padding-left: 2px; }
.search { margin: 2px 12px 10px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; background: var(--surface2); color: var(--muted); }
.search .i { width: 17px; height: 17px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font: inherit; padding: 9px 0; }
.chatList { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chatList li { display: flex; gap: 12px; padding: 10px; border-radius: 12px; cursor: pointer; align-items: center; }
.chatList li:hover { background: var(--surface2); }
.chatList li.on { background: var(--accent-soft); }
.chatList li.hint { color: var(--muted); font-size: 14px; cursor: default; display: block; text-align: center; padding: 20px 12px; }
.chatList li.hint:hover { background: none; }
.chatList .ci { flex: 1; min-width: 0; }
.chatList .r1, .chatList .r2 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chatList .r1 b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatList .r2 span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatList .r2 i { font-style: normal; color: var(--faint); }
.chatList .r2 em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface2); border-radius: 99px; padding: 1px 7px; }
.chatList li.on .r2 em { background: var(--surface); }
.chatList .time { font-size: 12px; color: var(--faint); white-space: nowrap; }
.avatar { width: 44px; height: 44px; border-radius: 14px; overflow: hidden; flex-shrink: 0; background: var(--surface2); }
.avatar img, .avatar span { width: 100%; height: 100%; object-fit: cover; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 17px; }
.avatar span { background: var(--accent); }
.avatar span .i { width: 22px; height: 22px; }
.chatHead .avatar { width: 36px; height: 36px; border-radius: 11px; }
.chatHead .avatar span { font-size: 15px; }

.pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chatbg); }
.paneEmpty { margin: auto; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.paneEmpty .i { width: 40px; height: 40px; stroke-width: 1.25; color: var(--faint); }
.chatView { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chatHead { display: flex; align-items: center; gap: 10px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--surface); }
.chatHead .ct { flex: 1; min-width: 0; }
.chatHead .t1 { font-weight: 600; }
.chatHead .t2 { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatHead .back { display: none; }
.tabs { display: flex; gap: 4px; padding: 4px 12px 10px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border-radius: 99px; padding: 5px 14px; font-size: 13.5px; font-weight: 500; background: transparent; color: var(--muted); }
.tabs button:hover { background: var(--surface2); color: var(--fg); }
.tabs button.on { background: var(--fg); color: var(--bg); }

.msgs { flex: 1; overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.day { text-align: center; margin: 14px 0 4px; }
.day span { color: var(--muted); font-size: 12px; font-weight: 500; background: var(--surface); padding: 3px 12px; border-radius: 99px; border: 1px solid var(--line); }
.msg { display: flex; justify-content: flex-end; }
.msg.flash .bubble { animation: flash 1.8s; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } }
.bubble { background: var(--bubble); color: var(--bubble-fg); border: 1px solid var(--line); border-radius: 18px 18px 6px 18px; padding: 8px 10px 6px; max-width: min(560px, 88%); min-width: 130px; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.bubble .mt { font-size: 13px; font-weight: 600; color: var(--accent); margin: 0 2px 5px; }
.bubble .text { white-space: pre-wrap; padding: 0 2px; }
.bubble .imgs { display: grid; gap: 3px; border-radius: 12px; overflow: hidden; margin-bottom: 6px; }
.bubble .imgs.n2, .bubble .imgs.n4 { grid-template-columns: 1fr 1fr; }
.bubble .imgs.n3 { grid-template-columns: 1fr 1fr 1fr; }
.bubble .imgs img { width: 100%; max-height: 360px; object-fit: cover; display: block; cursor: zoom-in; }
.bubble .imgs:not(.n1) img { aspect-ratio: 1; }
.bubble video { width: 100%; max-height: 380px; border-radius: 12px; background: #000; margin-bottom: 6px; display: block; }
.bubble audio { width: 100%; min-width: 240px; margin-bottom: 4px; }
.bubble .tr, .fileList .tr { font-size: 13px; color: var(--muted); margin: 0 2px 6px; white-space: pre-wrap; display: flex; gap: 6px; }
.bubble .tr .i { margin-top: 3px; }
.bubble .doc { display: flex; gap: 10px; align-items: center; background: var(--surface2); border-radius: 12px; padding: 9px 12px; margin-bottom: 6px; color: inherit; }
.bubble .doc > .i { width: 24px; height: 24px; color: var(--accent); }
.bubble .doc b { font-weight: 500; }
.bubble .doc small { display: block; color: var(--muted); font-size: 12px; }
.bubble .meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.bubble .meta .time { font-size: 11px; color: var(--faint); }
.chip { font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 99px; background: var(--surface2); color: var(--muted); gap: 5px; }
.chip:hover { background: var(--hover); color: var(--fg); }
.none { margin: auto; color: var(--muted); }

.mediaGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; }
.mediaGrid img, .mediaGrid .vid { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; display: block; border-radius: 8px; overflow: hidden; }
.mediaGrid .vid { position: relative; background: #000; }
.mediaGrid .vid video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.mediaGrid .vid span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.mediaGrid .vid span .i { width: 36px; height: 36px; padding: 9px 7px 9px 11px; border-radius: 50%; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); }
.linkList, .fileList { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.linkList li, .fileList li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.linkList .fi, .fileList .fi { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.linkList .fi .i, .fileList .fi .i { width: 18px; height: 18px; }
.linkList div, .fileList div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.linkList a, .fileList a { font-weight: 600; overflow-wrap: anywhere; }
.linkList span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.linkList small, .fileList small { font-size: 12px; color: var(--faint); }
.fileList audio { width: 100%; margin-top: 6px; }

.chatComposer { background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.chatComposer .row { display: flex; gap: 2px; align-items: flex-end; }
.chatComposer .editor { flex: 1; min-height: 40px; max-height: 160px; background: var(--surface2); border-radius: 20px; padding: 8px 16px; font-size: 15.5px; margin: 0 4px; }
.chatComposer .editor:empty::before { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatComposer button { flex-shrink: 0; }
.chatComposer .attachments { margin: 0 0 8px; }

.lightbox { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.92); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img, .lightbox video { max-width: 96vw; max-height: 94vh; object-fit: contain; border-radius: 6px; }
#viewer { z-index: 22; }

@media (max-width: 799px) {
  .chats { width: 100%; border-right: 0; }
  .pane { display: none; }
  .archive.inChat .chats { display: none; }
  .archive.inChat .pane { display: flex; }
  .chatHead .back { display: inline-flex; }
}
@media (max-width: 400px) {
  .toolbar button.icon { width: 38px; }
  .chatComposer button.icon { width: 34px; }
}

/* ---------- Ask ---------- */
button.primary.ask { background: var(--ok); border-color: var(--ok); color: #06210f; }
.answers { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.answer { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.answer .q { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.answer .q b { color: var(--fg); font-weight: 600; flex: 1; overflow-wrap: anywhere; }
.answer .q button { font-size: 12px; padding: 2px 8px; }
.answer .st { font-size: 13px; color: var(--muted); margin-top: 6px; }
.answer .st.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; animation: pulse 1s infinite; }
.answer .md { margin-top: 6px; overflow-wrap: anywhere; }
.answer .md p { margin: 6px 0; }
.answer .md strong { background: color-mix(in srgb, var(--ok) 18%, transparent); padding: 0 4px; border-radius: 4px; cursor: copy; }
.answer .err { margin-top: 6px; }
.answer .foot { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.answer .foot .time { font-size: 12px; color: var(--muted); margin-left: auto; }
.answer .foot button { font-size: 12px; padding: 3px 10px; }
.answer .older { opacity: .85; }
.hit { margin: 8px 0; }
.hit img { max-width: 100%; max-height: 420px; border-radius: 10px; display: block; cursor: zoom-in; }
.hit video { max-width: 100%; max-height: 420px; border-radius: 10px; display: block; }
.hit audio { width: 100%; }
.hit a.card { display: flex; gap: 10px; align-items: center; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: inherit; text-decoration: none; }
.hit a.card span { font-size: 24px; }
.hit a.card b { overflow-wrap: anywhere; font-weight: 600; }
.hit a.card small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.hit iframe { width: 100%; height: 480px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; background: #fff; }
.moreAsks { align-self: center; font-size: 13px; }
.answer .q svg.i { width: 14px; height: 14px; flex-shrink: 0; align-self: center; }

/* ---------- Two fields: Merken / Fragen ---------- */
.composer.ask { --accent: var(--ask); --accent-soft: var(--ask-soft); border-color: var(--line); }
.composer.ask:focus-within { border-color: color-mix(in srgb, var(--ask) 45%, var(--line)); box-shadow: var(--shadow), 0 0 0 4px var(--ask-soft); }
button.primary.ask { background: var(--ask); color: #fff; }
:root { --ask: #12a594; --ask-soft: #e0f6f2; }
@media (prefers-color-scheme: dark) { :root { --ask: #2ebfa8; --ask-soft: #10302b; } button.primary.ask { color: #0f1012; } }
.answers { margin-top: 12px; }
.answer { box-shadow: var(--shadow); }
.answer .q span { display: inline-flex; gap: 4px; color: var(--muted); }
.answer .foot button.chip { font-size: 12px; padding: 3px 10px; }
.answer .md strong { background: color-mix(in srgb, var(--ask) 18%, transparent); }
.hit a.card span { display: flex; color: var(--accent); }
.hit a.card span .i { width: 22px; height: 22px; }

/* ---------- Answer actions, file cards, preview, share sheet ---------- */
.answer .foot { flex-wrap: wrap; }
.answer .foot .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.answer .foot .acts[hidden] { display: none; }
.answer .foot .chip { font-size: 12.5px; padding: 5px 11px; }
.answer .foot .del { width: 32px; height: 32px; margin-left: -4px; }
.hit { margin: 10px 0; }
.hit > img { cursor: zoom-in; margin-bottom: 6px; }
.hit > video, .hit > audio { margin-bottom: 6px; }
.hit .card { display: flex; align-items: center; gap: 2px; background: var(--surface2); border: 0; border-radius: 12px; padding: 4px 4px 4px 4px; }
.hit .card .cardMain { flex: 1; min-width: 0; justify-content: flex-start; background: transparent; padding: 6px 8px; gap: 10px; text-align: left; }
.hit .card .cardMain:active { transform: none; }
.hit .card .fi { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hit .card .fi .i { width: 18px; height: 18px; }
.hit .card .cn { min-width: 0; display: flex; flex-direction: column; }
.hit .card .cn b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit .card .cn small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit .card button.icon { width: 36px; height: 36px; }
.hit .card button.icon:hover { background: var(--hover); }
@media (max-width: 480px) { .hit .card button.icon[data-prev] { display: none; } }

#sov { z-index: 24; }
.sovFrame { flex: 1; width: 100%; border: 0; background: var(--bg); }

.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .15s; }
.sheetCard { width: 100%; max-width: 420px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 14px 12px max(12px, env(safe-area-inset-bottom)); box-shadow: 0 -8px 40px rgba(0,0,0,.25); animation: slideUp .2s ease-out; }
@media (min-width: 600px) { .sheet { align-items: center; } .sheetCard { border-radius: 22px; } }
.sheetTitle { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; padding: 2px 12px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheetItems { display: flex; flex-direction: column; gap: 2px; }
.sheetItems button { justify-content: flex-start; background: transparent; padding: 10px 12px; gap: 14px; font-weight: 500; border-radius: 12px; }
.sheetItems button:hover { background: var(--surface2); }
.sheetItems .si { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.sheetItems .si .i { width: 19px; height: 19px; }
.sheetCancel { width: 100%; margin-top: 8px; padding: 12px; font-weight: 600; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
.answer .body .md { cursor: copy; white-space: normal; }
.answer .body .md > p:only-child, .answer .body .md > p:first-child:last-child { font-size: 17px; font-weight: 500; letter-spacing: -.005em; }
.answer .body .md.ctx { cursor: auto; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.45; }
.answer .body .md.ctx > .i { float: left; margin: 2px 6px 0 0; color: var(--faint); }
.answer .body .md.ctx p { margin: 0; font-size: 13px; font-weight: 400; }
.answer .body .md.ctx .hit { margin: 8px 0 0; }

/* Hinweis im Android-Browser: App installieren */
.apkBanner { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px 6px 8px 10px; margin-bottom: 14px; box-shadow: var(--shadow); }
.apkBanner .fi { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.apkBanner .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.apkBanner .txt b { font-size: 14px; font-weight: 600; }
.apkBanner .txt small { font-size: 12px; color: var(--muted); }
.apkBanner .dl { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 11px; flex-shrink: 0; }
.apkBanner .dl .i { width: 17px; height: 17px; stroke-width: 2.2; }
.apkBanner button.icon { width: 32px; height: 32px; }
.apkBanner button.icon .i { width: 17px; height: 17px; }

/* ---------- Verlauf: seitlich wischbar ---------- */
.history { margin-top: 14px; }
.histHead { display: flex; align-items: center; gap: 8px; padding: 0 2px 6px 4px; }
.histHead .ht { font-size: 13px; font-weight: 600; color: var(--muted); }
.histHead .hp { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.histHead .spacer { flex: 1; }
.histHead button.icon { width: 32px; height: 32px; }
.histHead button.icon .i { width: 18px; height: 18px; }
.histHead button:disabled { opacity: .3; }
.i.flip { transform: scaleX(-1); }
.answers { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; margin-top: 0; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 2px 2px 10px; }
.answers::-webkit-scrollbar { display: none; }
.answers > .answer { flex: 0 0 min(88%, 540px); scroll-snap-align: start; box-shadow: none; }
.answers { touch-action: pan-x pan-y; }
.answers > .answer:only-child { flex-basis: 100%; }
@media (pointer: coarse) { .histHead button.icon { display: none; } }

/* ---------- Folgefragen ---------- */
.answer .turns:empty { display: none; }
.answer .turn { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.answer .turn .q .i { color: var(--ask); }
.answer .follow { display: flex; align-items: flex-end; gap: 6px; margin-top: 12px; background: var(--surface2); border-radius: 20px; padding: 4px 4px 4px 14px; }
.answer .follow[hidden] { display: none; }
.answer .follow .fEd { flex: 1; min-height: 0; max-height: 140px; font-size: 15px; padding: 7px 0; }
.answer .follow .fSend { width: 34px; height: 34px; flex-shrink: 0; }
.answer .follow .fSend .i { width: 17px; height: 17px; }
.answer.live .follow { opacity: .5; pointer-events: none; }


/* ---------- Startscreen: Umschalter Merken | Fragen, immer nur ein Feld ---------- */
.appHead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; }
.appHead .navBtns { justify-self: end; }
.modeSeg { display: flex; width: 280px; padding: 3px; gap: 2px; background: var(--surface2); border-radius: 12px; }
.modeSeg button { flex: 1; height: 34px; padding: 0 10px; gap: 7px; border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.modeSeg button:hover { background: transparent; color: var(--fg); }
.modeSeg button:active { transform: none; }
.modeSeg button .i { width: 16px; height: 16px; stroke-width: 2; }
.modeSeg kbd { font: 600 11px/1 Inter, system-ui, sans-serif; color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 2px 4px; margin-left: 1px; }
main[data-mode="mem"] .modeSeg [data-m="mem"], main[data-mode="ask"] .modeSeg [data-m="ask"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
main[data-mode="mem"] .modeSeg [data-m="mem"] .i { color: var(--accent); }
main[data-mode="ask"] .modeSeg [data-m="ask"] .i { color: var(--ask); }
@media (prefers-color-scheme: dark) { main[data-mode="mem"] .modeSeg [data-m="mem"], main[data-mode="ask"] .modeSeg [data-m="ask"] { background: var(--hover); } }
@media (pointer: coarse) { .modeSeg kbd { display: none; } }
main[data-mode="ask"] #composer, main[data-mode="mem"] #askBox, main[data-mode="mem"] #answersWrap { display: none; }
.composer .editor { min-height: 200px; }
.composer.ask .editor { min-height: 96px; }
.history { margin-top: 20px; }
@media (min-width: 800px) { main { padding-top: max(40px, env(safe-area-inset-top)); } .appHead { margin-bottom: 22px; } }

/* ---------- Handy: eigene, kompaktere Skala ---------- */
/* Schrift 15 / 13 / 11.5 px · Abstände 6 / 10 / 12 px · Tippflächen 36 px · Radien 10 / 14 px */
@media (max-width: 599px) {
  html, body { font-size: 15px; line-height: 1.45; }
  .i { width: 19px; height: 19px; }
  button { border-radius: 10px; padding: 7px 12px; }
  button.icon { width: 36px; height: 36px; border-radius: 10px; }
  button.round { width: 36px; height: 36px; }
  button.primary { padding: 7px 12px 7px 14px; font-size: 14.5px; }
  button.primary .i { width: 17px; height: 17px; }
  .chip { font-size: 12px; padding: 3px 8px; }
  .status { font-size: 11.5px; }

  /* Startscreen: Kopfzeile mit Umschalter, immer nur ein Feld */
  main { padding: 8px 12px 32px; padding-top: max(8px, env(safe-area-inset-top)); }
  .logo { width: 28px; height: 28px; border-radius: 8px; }
  .logo .i { width: 16px; height: 16px; }
  .appHead { grid-template-columns: auto 1fr auto; gap: 8px; margin: 0 0 10px; }
  .appHead h1 { display: none; }
  .modeSeg { width: 100%; max-width: 260px; justify-self: center; border-radius: 11px; }
  .modeSeg button { height: 32px; padding: 0 8px; gap: 6px; border-radius: 8px; }
  .modeSeg button .i { width: 15px; height: 15px; }
  .navBtns button { width: 34px; height: 36px; padding: 0; background: transparent; box-shadow: none; }
  .navBtns button span { display: none; }
  .navBtns button .i { width: 20px; height: 20px; color: var(--muted); }
  .appHead .navBtns { gap: 0; }
  .composer .editor { min-height: 180px; font-size: 16px; }
  .composer.ask .editor { min-height: 72px; }

  .composer { border-radius: 14px; padding: 12px 12px 6px; }
  .toolbar { margin: 0 -6px; padding-top: 4px; gap: 0; }
  .attachments { gap: 6px; margin: 4px 0 8px; }
  .att { width: 64px; height: 64px; border-radius: 10px; }
  .att.wide { min-width: 64px; }
  .apkBanner { border-radius: 14px; margin-bottom: 10px; }

  /* Verlauf der Antworten */
  .history { margin-top: 14px; }
  .histHead { padding: 0 2px 6px; }
  .histHead .ht { font-size: 12.5px; }
  .answers { gap: 8px; }
  .answers > .answer { flex-basis: 90%; }
  .answer { border-radius: 14px; padding: 12px; }
  .answer .q { font-size: 12.5px; }
  .answer .body .md > p:only-child, .answer .body .md > p:first-child:last-child { font-size: 16px; }
  .answer .follow { margin-top: 10px; padding: 3px 3px 3px 12px; }
  .answer .follow .fEd { font-size: 15px; padding: 6px 0; }
  .answer .follow .fSend { width: 32px; height: 32px; }
  .answer .foot { margin-top: 6px; }
  .answer .foot .chip { font-size: 12px; padding: 4px 9px; }
  .hit img, .hit video { max-height: 280px; }
  .hit .card .fi { width: 32px; height: 32px; }
  .hit .card .cn b { font-size: 13.5px; }
  .hit .card button.icon { width: 34px; height: 34px; }
  .hit iframe { height: 360px; }

  /* Archiv: Ordnerliste */
  .chatsHead { padding: 6px; padding-top: max(6px, env(safe-area-inset-top)); }
  .chatsHead b { font-size: 17px; }
  .search { margin: 0 12px 8px; border-radius: 10px; padding: 0 10px; }
  .search input { padding: 8px 0; }
  .chatList { padding: 0 6px 12px; gap: 0; }
  .chatList li { padding: 8px 8px; gap: 12px; }
  .avatar { width: 42px; height: 42px; border-radius: 13px; }
  .avatar img, .avatar span { font-size: 16px; }
  .avatar span .i { width: 20px; height: 20px; }
  .chatList .r1 b { font-size: 15px; }
  .chatList .r2 span { font-size: 13px; }
  .chatList .time { font-size: 11.5px; }

  /* Archiv: Chat */
  .chatHead { gap: 8px; padding: 6px; padding-top: max(6px, env(safe-area-inset-top)); }
  .chatHead .avatar { width: 34px; height: 34px; border-radius: 10px; }
  .chatHead .avatar span { font-size: 14px; }
  .chatHead .t1 { font-size: 15px; line-height: 1.3; }
  .chatHead .t2 { font-size: 11.5px; }
  .tabs { padding: 2px 10px 8px; }
  .tabs button { padding: 4px 12px; font-size: 13px; }
  .msgs { padding: 8px 10px 16px; gap: 6px; }
  .day { margin: 10px 0 2px; }
  .day span { font-size: 11.5px; padding: 2px 10px; }
  .bubble { border-radius: 16px 16px 5px 16px; padding: 7px 9px 5px; max-width: 86%; min-width: 120px; }
  .bubble .mt { font-size: 12.5px; margin-bottom: 3px; }
  .bubble .imgs { border-radius: 10px; margin-bottom: 5px; }
  .bubble .imgs img { max-height: 240px; }
  .bubble video { max-height: 280px; border-radius: 10px; }
  .bubble .doc { padding: 8px 10px; border-radius: 10px; }
  .bubble .doc > .i { width: 22px; height: 22px; }
  .bubble .tr, .fileList .tr { font-size: 12.5px; }
  .bubble .meta { margin-top: 3px; gap: 4px; }
  .mediaGrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 3px; }
  .linkList li, .fileList li { padding: 10px; gap: 10px; border-radius: 12px; }
  .linkList .fi, .fileList .fi { width: 32px; height: 32px; border-radius: 9px; }
  .chatComposer { padding: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .chatComposer .editor { min-height: 36px; padding: 7px 14px; font-size: 16px; border-radius: 18px; }

  /* Ordneransicht / Notizen */
  .panelHead { padding: 6px; padding-top: max(6px, env(safe-area-inset-top)); }
  .panelBody { padding: 12px; }
  .tree li { padding: 8px 10px; gap: 10px; }

  .sheetItems button { padding: 8px 10px; }
  .sheetItems .si { width: 34px; height: 34px; }
  .toast { font-size: 13.5px; padding: 8px 16px; }
}

/* Code-Scanner */
.scan video { object-fit: cover; }
.scanFrame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.scanFrame i { width: min(72vw, 72vh, 340px); aspect-ratio: 1; border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.85); position: relative; overflow: hidden; }
.scanFrame i::after { content: ""; position: absolute; left: 8%; right: 8%; height: 2px; top: 10%; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: scanLine 2.2s ease-in-out infinite alternate; }
@keyframes scanLine { to { top: 88%; } }
@media (prefers-reduced-motion: reduce) { .scanFrame i::after { animation: none; top: 50%; } }
.scanHint { position: absolute; top: max(22px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; padding: 6px 14px; border-radius: 99px; font-size: 14px; font-weight: 500; backdrop-filter: blur(10px); white-space: nowrap; }
.scanRes { position: absolute; left: 12px; right: 12px; bottom: calc(110px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; max-height: calc(100% - 180px); overflow: auto; background: var(--surface); color: var(--fg); border-radius: 20px; padding: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 12px; animation: scanIn .2s ease-out; }
@keyframes scanIn { from { opacity: 0; transform: translateY(10px); } }
.scanRes .code + .code { border-top: 1px solid var(--line); padding-top: 12px; }
.scanRes .fmt { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.scanRes .val { font: 15px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 40vh; overflow: auto; margin: 4px 0 10px; user-select: text; }
.scanRes .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.scanRes .acts button { font-size: 14px; padding: 8px 13px; }
.scanRes .again { background: transparent; color: var(--muted); font-size: 14px; align-self: center; }
#scanTorch.on { background: #fff; color: #000; }

/* ---------- Kamera (capture.js) ---------- */
.cam { touch-action: none; user-select: none; -webkit-user-select: none; }
.camStage { position: absolute; inset: 0; overflow: hidden; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam video.mirror { transform: scaleX(-1); }
.camGrid { position: absolute; inset: 0; pointer-events: none; }
.camGrid::before, .camGrid::after, .camGrid i { content: ""; position: absolute; background: rgba(255,255,255,.35); }
.camGrid::before { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.camGrid::after { left: 66.66%; top: 0; bottom: 0; width: 1px; }
.camGrid i:first-child { top: 33.33%; left: 0; right: 0; height: 1px; }
.camGrid i:last-child { top: 66.66%; left: 0; right: 0; height: 1px; }
.camFocus { position: absolute; width: 72px; height: 72px; margin: -36px 0 0 -36px; border: 2px solid #ffd60a; border-radius: 14px; pointer-events: none; }
.camFocus.go { animation: camFocus .35s ease-out; }
@keyframes camFocus { from { transform: scale(1.5); opacity: 0; } }
.camZoomLbl { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.5); color: #fff; padding: 6px 14px; border-radius: 99px; font-weight: 600; font-variant-numeric: tabular-nums; }
.camCount { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; font-size: 120px; font-weight: 700; text-shadow: 0 4px 24px rgba(0,0,0,.5); font-variant-numeric: tabular-nums; pointer-events: none; }
.camFx { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.camFx.go { animation: camFx .25s ease-out; }
@keyframes camFx { 0% { opacity: .85; } 100% { opacity: 0; } }
.camTop { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: max(14px, env(safe-area-inset-top)) 14px 24px; background: linear-gradient(rgba(0,0,0,.5), transparent); }
.camTop .spacer { flex: 1; }
.cam button.glass { width: 44px; height: 44px; position: relative; }
.cam button.glass small { position: absolute; right: 5px; bottom: 4px; font-size: 10px; font-weight: 700; line-height: 1; }
.cam button.glass.on { background: #ffd60a; color: #000; }
.cam button.glass.sm { width: 38px; height: 38px; }
.cam .camTimer { position: static; transform: none; }
.camBottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 30px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.camZoom { display: flex; gap: 6px; background: rgba(0,0,0,.35); border-radius: 99px; padding: 4px; }
.camZoom:empty { display: none; }
.camZoom button { min-width: 38px; height: 34px; padding: 0 8px; border-radius: 99px; background: transparent; color: #fff; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.camZoom button.on { background: rgba(255,255,255,.2); color: #ffd60a; }
.camModes { display: flex; gap: 4px; }
.camModes button { background: transparent; color: rgba(255,255,255,.7); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 6px 12px; border-radius: 99px; }
.camModes button.on { color: #ffd60a; background: rgba(0,0,0,.3); }
.cam .camBar { position: relative; width: 100%; max-width: 520px; background: none; justify-content: space-between; padding: 6px 28px max(26px, env(safe-area-inset-bottom)); }
.camThumb { width: 52px; height: 52px; border-radius: 12px; padding: 0; overflow: hidden; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.6); }
.camThumb:empty { visibility: hidden; }
.camThumb img { width: 100%; height: 100%; object-fit: cover; }
.camBadge { position: absolute; left: 66px; top: 0; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.camBadge:empty { display: none; }
.camSide { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 52px; }
.cam .shoot { width: 76px; height: 76px; transition: transform .15s, border-radius .15s, background .15s; }
.cam .shoot.rec { border-radius: 16px; transform: scale(.62); }
.cam.recording .camTop { background: none; }
@media (orientation: landscape) and (max-height: 520px) {
  .camBottom { left: auto; top: 0; width: auto; flex-direction: row-reverse; padding: 0 max(14px, env(safe-area-inset-right)) 0 30px; background: linear-gradient(90deg, transparent, rgba(0,0,0,.6)); }
  .cam .camBar { flex-direction: column-reverse; height: 100%; padding: 16px 0; width: auto; }
  .camModes, .camZoom { flex-direction: column; }
  .camBadge { left: auto; right: 0; top: auto; bottom: 8px; }
}

/* ---------- Rekorder (capture.js) ---------- */
.recorder { background: radial-gradient(120% 80% at 50% 30%, #2a1416, #0c0c0e 70%); color: #fff; }
.recTop { display: flex; align-items: center; padding: max(14px, env(safe-area-inset-top)) 14px 0; }
.recTop .spacer { flex: 1; }
.recChip { background: rgba(255,255,255,.12); color: #fff; border-radius: 99px; font-size: 13px; font-weight: 600; padding: 8px 14px; }
.recMain { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 0; padding: 0 16px; }
.recDot { width: 14px; height: 14px; border-radius: 50%; background: var(--rec); animation: pulse 1.4s infinite; margin-bottom: 8px; box-shadow: 0 0 24px var(--rec); }
.recorder.paused .recDot { animation: none; background: #777; box-shadow: none; }
.recTime { font-size: clamp(56px, 18vw, 96px); font-weight: 300; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.recState { color: rgba(255,255,255,.65); font-size: 15px; min-height: 1.5em; }
.recWave { width: 100%; max-width: 640px; height: 140px; margin-top: 28px; color: var(--rec); }
.recBar { display: flex; align-items: center; justify-content: space-evenly; padding: 24px 20px max(34px, env(safe-area-inset-bottom)); }
.recorder button.glass { width: 56px; height: 56px; }
.recorder button.glass.ok { background: #fff; color: #000; }
.recBtn { width: 84px; height: 84px; border-radius: 50%; padding: 0; background: var(--rec); color: #fff; box-shadow: 0 0 0 6px rgba(242,85,90,.25); }
.recBtn:hover { background: var(--rec); filter: brightness(1.08); }
.recBtn .i { width: 32px; height: 32px; }
.recorder.paused .recBtn { background: #fff; color: var(--rec); box-shadow: 0 0 0 6px rgba(255,255,255,.15); }
@media (prefers-reduced-motion: reduce) { .recDot, .camFx.go, .camFocus.go { animation: none; } }
.cam.sharp[data-mode="photo"] .shoot { border-color: #30d158; box-shadow: 0 0 0 3px rgba(48,209,88,.35); }
.camHint { position: absolute; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 58px); transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; padding: 6px 14px; border-radius: 99px; font-size: 14px; font-weight: 500; backdrop-filter: blur(10px); white-space: nowrap; pointer-events: none; }
.cam.sharp .camHint { background: rgba(48,209,88,.85); color: #000; }
.camScreenFlash { position: absolute; inset: 0; background: #fff; z-index: 2; }
.camScreen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 32px 200px; text-align: center; color: #fff; background: radial-gradient(100% 70% at 50% 35%, #1e1f3a, #000 75%); }
.camScreen > .i { width: 56px; height: 56px; stroke-width: 1.4; color: var(--accent); }
.camScreen b { font-size: 20px; }
.camScreen p { margin: 0; max-width: 340px; color: rgba(255,255,255,.7); font-size: 14.5px; }
.camScreen .recChip { margin-top: 8px; }
.camScreen .recChip.on { background: #fff; color: #000; }
.cam[data-mode="screen"] .camGrid, .cam[data-mode="screen"] video { display: none; }
.scrBar { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 8px; background: var(--rec); color: #fff; padding: 5px 6px 5px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.scrBar .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
.scrBar button { background: rgba(255,255,255,.22); color: #fff; padding: 4px 12px; border-radius: 99px; font-size: 13px; }

/* Navigation: Chats · Galerie · Archiv */
.navBtns { display: flex; gap: 6px; align-items: center; }

/* Vollbild-Ansichten (Chats, Galerie) */
.view { position: fixed; inset: 0; z-index: 16; background: var(--bg); display: flex; flex-direction: column; }
.viewHead { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.viewHead .vt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.viewHead .vt b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewHead .vt small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewHead .spacer { width: 40px; }
.viewBody { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 10px 0 max(24px, env(safe-area-inset-bottom)); }
.viewBody > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
#chatsView .viewBody > * { max-width: 760px; }
.convList { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.convList li { display: flex; gap: 12px; padding: 10px; border-radius: 12px; cursor: pointer; align-items: center; }
.convList li:hover { background: var(--surface2); }
.convList li.hint { color: var(--muted); font-size: 14px; cursor: default; display: block; text-align: center; padding: 28px 12px; }
.convList li.hint:hover { background: none; }
.convList .avatar span { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: #fff; }
.convList .ci { flex: 1; min-width: 0; }
.convList .r1, .convList .r2 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.convList .r1 b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convList .r1 .time { color: var(--faint); font-size: 12px; flex-shrink: 0; }
.convList .r2 span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 4px; align-items: center; }
.convList .r2 em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface2); border-radius: 99px; padding: 1px 7px; }
.convo { padding: 0 12px; }

/* Galerie */
.gTools { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; }
.gKinds { display: flex; gap: 2px; padding: 3px; background: var(--surface2); border-radius: 12px; align-self: flex-start; max-width: 100%; overflow-x: auto; }
.gKinds button { background: transparent; padding: 6px 12px; font-size: 14px; font-weight: 500; color: var(--muted); border-radius: 9px; gap: 6px; white-space: nowrap; }
.gKinds button.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.gSortRow { display: flex; gap: 8px; align-items: center; }
.gSortRow .search { flex: 1; margin: 0; }
.gSortRow select { font: inherit; font-size: 14px; color: var(--fg); background: var(--surface2); border: 0; border-radius: 12px; padding: 9px 10px; max-width: 46%; }
.gTags { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.gTags::-webkit-scrollbar { display: none; }
.gTags:empty { display: none; }
.gTags .chip, .gvTags .chip { white-space: nowrap; flex-shrink: 0; font-size: 13px; padding: 5px 11px; }
.chip.on { background: var(--accent); color: var(--accent-fg); }
.chip.place .i { color: inherit; }
.gGrid { padding: 0 12px; }
.gDay { font-size: 14px; font-weight: 600; margin: 18px 2px 8px; color: var(--fg); }
.gTiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 4px; margin-top: 10px; }
.gDay + .gTiles { margin-top: 0; }
@media (min-width: 700px) { .gTiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; } }
.gTile { position: relative; aspect-ratio: 1; padding: 0; border-radius: 8px; overflow: hidden; background: var(--surface2); display: block; }
.gTile:active { transform: scale(.97); }
.gTile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gTile .gNo { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: var(--faint); }
.gTile .gBadge { position: absolute; left: 6px; bottom: 6px; display: inline-flex; gap: 3px; align-items: center; background: rgba(0,0,0,.55); color: #fff; font-size: 11.5px; font-weight: 600; padding: 2px 7px 2px 5px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.gTile .gGeo, .gTile .gPend { position: absolute; top: 6px; display: inline-flex; background: rgba(0,0,0,.45); color: #fff; padding: 3px; border-radius: 99px; }
.gTile .gGeo { right: 6px; }
.gTile .gPend { left: 6px; background: var(--accent); }
.gTile.audio { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 2px; padding: 12px; text-align: left; background: linear-gradient(160deg, var(--accent-soft), var(--surface2)); color: var(--fg); }
.gTile.audio > .i { width: 26px; height: 26px; color: var(--accent); margin-bottom: auto; }
.gTile.audio b { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gTile.audio small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gTile.audio .gPend { top: 10px; right: 10px; left: auto; }
.gEmpty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 14px; }

/* Galerie: Einzelansicht */
.gview { position: fixed; inset: 0; z-index: 30; background: #000; color: #fff; display: flex; }
.gvTop { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: max(12px, env(safe-area-inset-top)) 12px 24px; background: linear-gradient(rgba(0,0,0,.55), transparent); }
.gvTop .spacer { flex: 1; }
.gvTop button.glass { width: 42px; height: 42px; }
.gvTop button.glass.on { background: #fff; color: #000; }
.gvPos { font-size: 14px; font-weight: 500; opacity: .85; font-variant-numeric: tabular-nums; }
.gvStage { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom; }
.gvMedia { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
video.gvMedia { width: 100%; height: 100%; }
.gvAudio { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; max-width: 560px; width: 100%; text-align: center; }
.gvAudio > .i { width: 64px; height: 64px; color: var(--accent); }
.gvAudio audio { width: 100%; }
.gvAudio p { font-size: 14px; line-height: 1.5; opacity: .8; max-height: 30vh; overflow: auto; margin: 0; text-align: left; }
.gvNav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.gvNav.prev { left: 12px; }
.gvNav.next { right: 12px; }
.gvNav:disabled { opacity: 0; pointer-events: none; }
.gvInfo { width: 340px; flex-shrink: 0; background: var(--surface); color: var(--fg); overflow-y: auto; padding: max(70px, calc(env(safe-area-inset-top) + 60px)) 18px 24px; display: flex; flex-direction: column; gap: 14px; }
.gview:has(.gvInfo:not([hidden])) .gvNav.next { right: 352px; }
.gvInfo h2 { font-size: 17px; margin: 0; line-height: 1.35; }
.gvInfo .cap { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.gvRow { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.gvRow > .i { color: var(--muted); margin-top: 1px; }
.gvRow > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gvRow b { font-weight: 600; }
.gvRow small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.gvRow .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.gvTags { flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; }
.linkBtn { background: none; padding: 0; color: var(--accent); font-weight: 500; justify-content: flex-start; text-align: left; }
.linkBtn:hover { background: none; text-decoration: underline; }
@media (max-width: 899px) {
  .gview { flex-direction: column; }
  .gvInfo { width: auto; max-height: 46vh; padding: 16px 16px max(18px, env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
  .gview:has(.gvInfo:not([hidden])) .gvNav.next { right: 12px; }
  .gvNav { display: none; }
  @media (pointer: fine) { .gvNav { display: inline-flex; } }
}
.gSortRow .search { min-width: 0; }
.gSortRow select { flex: 0 1 auto; min-width: 0; }
.gTile:has(img) { background: linear-gradient(110deg, var(--surface2) 30%, var(--hover) 50%, var(--surface2) 70%) 0 0 / 300% 100%; animation: gShimmer 1.4s linear infinite; }
.gTile:has(img.ok) { animation: none; background: var(--surface2); }
@keyframes gShimmer { to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) { .gTile:has(img) { animation: none; } }
@media (min-width: 900px) { .gview:has(.gvInfo:not([hidden])) .gvTop { right: 340px; } }
.gvInfo h2 { color: var(--fg); font-weight: 650; }
pre.diag { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface2); padding: 12px; border-radius: 12px; }
pre.diag.raw { font-size: 11px; color: var(--muted); max-height: 50vh; overflow: auto; }

/* Native Kamera (APK): das Kamerabild liegt HINTER dem WebView – Seite durchsichtig, nur die Bedienung bleibt */
html.nativecam, html.nativecam body { background: transparent !important; }
html.nativecam body > :not(#cam):not(#sheet):not(#lightbox):not(.toast):not(svg) { visibility: hidden !important; }
html.nativecam #cam { background: transparent; }
html.nativecam #camVideo { display: none; }
.gTile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.gTile .gPend.up { background: var(--ok); }
.gTile .gPend.up .i { animation: pulse 1.2s infinite; }
.gTile .gPend.fail { background: var(--warn); }
.gTile.fresh { animation: gIn .35s ease-out; }
@keyframes gIn { from { opacity: 0; transform: scale(.9); } }
@media (prefers-reduced-motion: reduce) { .gTile.fresh, .gTile .gPend.up .i { animation: none; } }
@media (max-width: 599px) { #gCam span { display: none; } #gCam { width: 40px; height: 40px; padding: 0; } }

/* Kontextmenü (Galerie) */
.ctxMenu { position: fixed; z-index: 35; min-width: 180px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); display: flex; flex-direction: column; animation: ctxIn .12s ease-out; }
@keyframes ctxIn { from { opacity: 0; transform: scale(.96); } }
.ctxMenu button { justify-content: flex-start; background: transparent; padding: 8px 10px; border-radius: 8px; font-size: 14px; gap: 10px; }
.ctxMenu button:hover:not(:disabled) { background: var(--hover); }
.ctxMenu button:active { transform: none; }
.ctxMenu button .i { color: var(--muted); }
.ctxMenu button.danger, .ctxMenu button.danger .i { color: var(--rec); }
.ctxMenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.gTile.ctx { outline: 2px solid var(--accent); outline-offset: 2px; }
