@font-face {
  font-family: 'Andika';
  src: url('/fonts/andika-uk-v1-400.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Andika';
  src: url('/fonts/andika-uk-v1-700.woff2') format('woff2');
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f1eeec;
  --page: #e9e4e1;
  --surface: #ffffff;
  --surface-2: #ede8e5;
  --chip: #e6e0dc;
  --line: #e2dbd7;
  --text: #241f26;
  --muted: #655c69;
  --accent: #5b3b63;
  --on-accent: #ffffff;
  --on-accent-muted: rgba(255, 255, 255, 0.78);
  --accent-ink: #5b3b63;
  --accent-soft: #eee3f0;
  --quote-mine: rgba(255, 255, 255, 0.16);
  --quote-theirs: #f3edf4;
  --track-off: #948a93;
  --danger: #a3372b;
  --danger-soft: #f6e3e0;
  --scrim: rgba(28, 20, 30, 0.42);
  --shadow: 0 10px 30px rgba(36, 31, 38, 0.14);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #171317;
    --page: #110e11;
    --surface: #231e24;
    --surface-2: #2f2930;
    --chip: #2a2429;
    --line: #3a333b;
    --text: #f2ecf1;
    --muted: #b0a5af;
    --accent: #6e4a76;
    --on-accent: #ffffff;
    --on-accent-muted: rgba(255, 255, 255, 0.78);
    --accent-ink: #d9bcdd;
    --accent-soft: #3b2d3f;
    --quote-mine: rgba(255, 255, 255, 0.14);
    --quote-theirs: #30283a;
    --track-off: #756b75;
    --danger: #f29a8d;
    --danger-soft: #3d2423;
    --scrim: rgba(0, 0, 0, 0.55);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #171317;
  --page: #110e11;
  --surface: #231e24;
  --surface-2: #2f2930;
  --chip: #2a2429;
  --line: #3a333b;
  --text: #f2ecf1;
  --muted: #b0a5af;
  --accent: #6e4a76;
  --on-accent: #ffffff;
  --on-accent-muted: rgba(255, 255, 255, 0.78);
  --accent-ink: #d9bcdd;
  --accent-soft: #3b2d3f;
  --quote-mine: rgba(255, 255, 255, 0.14);
  --quote-theirs: #30283a;
  --track-off: #756b75;
  --danger: #f29a8d;
  --danger-soft: #3d2423;
  --scrim: rgba(0, 0, 0, 0.55);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--text);
  font-family: 'Andika', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.center-col { width: 100%; max-width: 760px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; background: var(--bg); position: relative; overflow: hidden; }
@media (min-width: 800px) { .center-col { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* Mygtukai ir laukai */
.btn { height: 52px; padding: 0 20px; border: 0; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--accent-ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.small { height: 44px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
.icon-btn { flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.round { border-radius: 50%; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > .label { font-size: 14px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; }
.field > .label .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.input { height: 52px; width: 100%; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; line-height: 1.4; }
.pw { position: relative; display: flex; }
.pw .input { padding-right: 52px; }
.pw .icon-btn { position: absolute; top: 4px; right: 4px; }
.error { color: var(--danger); font-size: 15px; margin: 0; }
.note { color: var(--muted); font-size: 14px; margin: 0; }
.ok-text { color: var(--accent-ink); font-size: 15px; margin: 0; }

/* Pradiniai ekranai */
.screen { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: max(40px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); width: 100%; max-width: 480px; margin: 0 auto; background: var(--bg); }
.screen-wrap { flex: 1 1 auto; min-height: 0; display: flex; background: var(--bg); }
.who { display: flex; align-items: center; gap: 12px; }
.who .name { font-weight: 700; font-size: 17px; line-height: 1.25; }
.who .sub { font-size: 14px; color: var(--muted); }
.screen h1 { margin: 32px 0 6px; font-size: 34px; line-height: 1.1; letter-spacing: -0.01em; }
.screen .lead { margin: 0 0 26px; font-size: 17px; color: var(--muted); }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--chip); }
.seg button { flex: 1 1 0; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--text); }
.form { display: flex; flex-direction: column; gap: 16px; }
.trust { margin-top: auto; padding-top: 24px; display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.trust svg { flex: 0 0 auto; margin-top: 1px; }
.recovery-key { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 20px; letter-spacing: 0.04em; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--accent); text-align: center; word-break: break-all; }

/* Avataras */
.avatar { flex: 0 0 auto; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); }

/* Pokalbio antraštė */
.bar { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); min-height: 64px; }
.bar .titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.bar .title { font-weight: 700; font-size: 17px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .subtitle { font-size: 13px; line-height: 1.3; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .subtitle.typing { color: var(--accent-ink); }
.bar .back { margin-left: -10px; margin-right: -6px; color: var(--text); }
.chip-timer { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.offline { flex: 0 0 auto; padding: 6px 16px; background: var(--danger-soft); color: var(--danger); font-size: 14px; text-align: center; }

/* Žinutės */
.messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-anchor: none; display: flex; flex-direction: column-reverse; background: var(--bg); }
.messages-inner { display: flex; flex-direction: column; padding: 12px 12px 14px; }
@media (min-width: 900px) { .messages-inner { padding: 16px 24px 18px; } }
.system { align-self: center; margin: 6px 0 4px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-align: center; max-width: 320px; }
.daychip { align-self: center; margin: 14px 0 6px; padding: 3px 12px; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: 13px; }
.load-older { align-self: center; margin: 4px 0 8px; }
.row { display: flex; flex-direction: column; }
.row.mine { align-items: flex-end; }
.row.theirs { align-items: flex-start; }
.bubble { max-width: min(80%, 520px); display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 7px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-align: left; position: relative; }
.row.mine .bubble { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.row.mine .bubble.cont { border-top-right-radius: 6px; }
.row.mine .bubble { border-bottom-right-radius: 6px; }
.row.theirs .bubble.cont { border-top-left-radius: 6px; }
.row.theirs .bubble { border-bottom-left-radius: 6px; }
.bubble.photo { padding: 4px; }
.bubble.selected { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.bubble.auto { background: var(--surface); }
button.bubble { cursor: pointer; font: inherit; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.photo .text { padding: 4px 8px 0; }
.text.gone { font-style: italic; opacity: 0.8; }
.meta { align-self: flex-end; font-size: 12px; line-height: 1.2; color: var(--muted); }
.row.mine .meta { color: var(--on-accent-muted); }
.bubble.photo .meta { padding: 0 8px 2px; }
.quote { display: flex; flex-direction: column; padding: 6px 10px; border-radius: 12px; background: var(--quote-theirs); font-size: 14px; line-height: 1.3; min-width: 0; }
.row.mine .quote { background: var(--quote-mine); }
.quote b { color: var(--accent-ink); }
.row.mine .quote b { color: var(--on-accent); }
.quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
.reaction-pill { position: relative; margin: -8px 10px 0; padding: 1px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; line-height: 1.5; display: flex; gap: 2px; }
.receipt { align-self: flex-end; margin: 4px 6px 0; font-size: 12px; color: var(--muted); }
.receipt.failed { color: var(--danger); display: flex; gap: 8px; align-items: center; }
.typing-bubble { align-self: flex-start; margin-top: 10px; display: flex; align-items: center; gap: 5px; padding: 14px 16px; border-radius: 18px 18px 18px 6px; background: var(--surface); border: 1px solid var(--line); }
.typing-bubble span { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite ease-in-out; }
.typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing-bubble span { animation: none; } }

.photo-box { position: relative; display: block; border-radius: 14px; overflow: hidden; background: var(--surface-2); max-width: 100%; }
.photo-box img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-box.hidden img { filter: blur(18px); transform: scale(1.1); }
.photo-box .veil { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border: 0; padding: 0; background: transparent; }
.photo-box .veil span { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(20, 14, 22, 0.6); color: #fff; font-size: 14px; }
.photo-box .loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }

/* Rašymo laukas */
.replybar { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 6px 0 16px; background: var(--surface); border-top: 1px solid var(--line); }
.replybar .what { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.replybar b { font-size: 13px; color: var(--accent-ink); }
.replybar span { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 2px; padding: 8px 6px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.replybar + .composer { border-top: 0; }
.composer textarea { flex: 1 1 auto; min-width: 0; min-height: 44px; max-height: 140px; resize: none; border: 0; outline: none; border-radius: 22px; padding: 11px 16px; background: var(--surface-2); color: var(--text); line-height: 1.35; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.composer .send.ready { background: var(--accent); color: var(--on-accent); }
.blocked-note { flex: 0 0 auto; padding: 14px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); text-align: center; }

.emoji-panel { flex: 0 0 auto; height: 296px; display: flex; flex-direction: column; background: var(--surface); border-top: 1px solid var(--line); }
.emoji-cats { flex: 0 0 auto; display: flex; gap: 2px; padding: 2px 8px; overflow-x: auto; }
.emoji-cats button { flex: 0 0 auto; height: 44px; padding: 0 14px; border: 0; border-radius: 22px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; }
.emoji-cats button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-ink); }
.emoji-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); align-content: start; padding: 2px 6px 10px; }
.emoji-grid button { height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; font-size: 26px; line-height: 1; }
.emoji-grid button:hover { background: var(--surface-2); }

/* Apatiniai lapai */
.sheet-wrap { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-wrap.fixed { position: fixed; }
.scrim { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: var(--scrim); cursor: default; }
.sheet { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 10px 20px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); background: var(--surface); border-radius: 22px 22px 0 0; max-height: 92%; overflow-y: auto; width: 100%; max-width: 760px; margin: 0 auto; }
.sheet .handle { display: block; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line); flex: 0 0 auto; }
.sheet h2 { margin: 4px 0 0; font-size: 20px; line-height: 1.25; }
.sheet .head { display: flex; align-items: center; justify-content: space-between; }
.sheet .head h2 { margin: 0; font-size: 18px; }
.reactions { display: flex; justify-content: space-between; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.reactions button { width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-2); font-size: 26px; line-height: 1; }
.reactions button[aria-pressed='true'] { background: var(--accent-soft); }
.action { display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 8px; border: 0; border-radius: 12px; background: transparent; color: var(--text); text-align: left; }
.action:hover { background: var(--surface-2); }
.action.danger { color: var(--danger); }
.preview-line { margin: 0 4px; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 16px; }
.facts li { display: flex; gap: 14px; align-items: flex-start; }
.facts .ic { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-ink); }
.facts li > span:last-child { padding-top: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; }
.photo-preview { border-radius: 16px; overflow: hidden; background: var(--surface-2); max-height: 46vh; display: flex; justify-content: center; }
.photo-preview img { display: block; max-width: 100%; max-height: 46vh; object-fit: contain; }
.photo-preview.hidden img { filter: blur(18px); }
.inline-row { display: flex; align-items: center; gap: 8px; }
.inline-row .input { height: 44px; border-radius: 22px; background: var(--surface-2); border: 0; }

/* Jungiklis */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 2px; border: 0; background: transparent; color: var(--text); text-align: left; width: 100%; }
.switch { flex: 0 0 auto; position: relative; width: 48px; height: 28px; border-radius: 14px; background: var(--track-off); transition: background 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
[aria-checked='true'] > .switch { background: var(--accent); }
[aria-checked='true'] > .switch::after { transform: translateX(20px); }

/* Nustatymai */
.settings { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 4px 16px max(28px, env(safe-area-inset-bottom)); background: var(--bg); }
.settings .profile { display: flex; align-items: center; gap: 14px; padding: 0 4px; }
.settings .profile .name { font-size: 22px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.settings .profile .sub { font-size: 14px; color: var(--muted); }
.group-label { padding: 0 4px; font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: -12px; }
.group { display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; overflow: hidden; }
.group > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 14px 8px 16px; border: 0; background: transparent; color: var(--text); text-align: left; width: 100%; text-decoration: none; }
button.item:hover, a.item:hover { background: var(--surface-2); }
.item .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .val { flex: 0 0 auto; font-size: 15px; color: var(--muted); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .val.accent { color: var(--accent-ink); font-weight: 700; }
.item .small { font-size: 13px; color: var(--muted); }
.item.danger { color: var(--danger); }
.item svg.lead-ic { flex: 0 0 auto; }
.item .switch { margin-left: auto; }
.panel { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.status-ok { color: var(--accent-ink); }
.status-bad { color: var(--danger); font-weight: 700; }
.status-line { font-size: 14px; color: var(--muted); }

/* PIN */
.lock { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; padding: max(80px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); background: var(--bg); }
.lock h1 { margin: 22px 0 0; font-size: 22px; }
.dots { display: flex; gap: 18px; margin: 24px 0 36px; }
.dots span { display: block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.dots span.on { background: var(--accent); }
.dots.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 28px; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--surface); color: var(--text); font-size: 28px; display: flex; align-items: center; justify-content: center; }
.keypad button.plain { background: transparent; }
.keypad .spacer { visibility: hidden; }

/* Savininko vaizdas */
.owner { flex: 1 1 auto; min-height: 0; display: flex; background: var(--bg); }
.owner .list-pane { flex: 0 0 auto; width: 100%; display: flex; flex-direction: column; background: var(--surface); min-width: 0; }
.owner .thread-pane { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; background: var(--bg); }
.owner .info-pane { flex: 0 0 auto; width: 320px; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); min-height: 0; }
.owner.mobile .thread-pane, .owner.mobile .info-pane { width: 100%; border-left: 0; }
@media (min-width: 900px) {
  .owner .list-pane { width: 340px; border-right: 1px solid var(--line); }
}
.list-head { display: flex; align-items: center; gap: 10px; padding: 14px 8px 10px 16px; padding-top: max(14px, env(safe-area-inset-top)); }
.list-tools { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 8px; }
.search { position: relative; display: flex; }
.search svg { position: absolute; left: 15px; top: 13px; color: var(--muted); }
.search input { flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 14px 0 42px; border: 0; outline: none; border-radius: 22px; background: var(--surface-2); color: var(--text); }
.filters { display: flex; gap: 6px; overflow-x: auto; }
.filters button { flex: 0 0 auto; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.filters button span { font-weight: 400; }
.filters button[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.conv-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 6px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.conv { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; border-radius: 14px; background: transparent; color: var(--text); text-align: left; text-decoration: none; }
.conv:hover { background: var(--surface-2); }
.conv[aria-current='true'] { background: var(--surface-2); }
.conv .lines { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv .l1, .conv .l2 { display: flex; align-items: center; gap: 6px; }
.conv .nick { flex: 1 1 auto; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .time { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.conv .prev { flex: 1 1 auto; min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .prev { color: var(--text); }
.conv.unread .time { color: var(--accent-ink); font-weight: 700; }
.badge { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.empty { margin: 32px 16px; color: var(--muted); text-align: center; }
.info-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; padding: 24px 22px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.info-top { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.info-top .name { margin-top: 6px; font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.info-top .sub { font-size: 14px; color: var(--muted); }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.timers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.timers button { height: 44px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.timers button[aria-pressed='true'] { background: var(--surface); color: var(--text); }
.owner-empty { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; color: var(--muted); padding: 24px; text-align: center; }
.inline-banner { margin: 0 12px 10px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 8px; }
.inline-banner b { font-size: 13px; color: var(--accent-ink); }

/* Peržiūra per visą ekraną */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(10, 8, 11, 0.94); display: flex; align-items: center; justify-content: center; border: 0; padding: 0; width: 100%; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 15px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; background: var(--bg); }

/* Avatarų spalvos pagal žmogų */
.av0 { background: #e9dded; color: #4e3355; }
.av1 { background: #dde7df; color: #2f4a37; }
.av2 { background: #f3e0d5; color: #6a3b24; }
.av3 { background: #dce4ef; color: #2d4260; }
.av4 { background: #efe7d2; color: #5a4a1f; }
.av5 { background: #f1dce0; color: #6b2f3b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .av0 { background: #3b2d3f; color: #e3cbe8; }
  :root:not([data-theme='light']) .av1 { background: #26362b; color: #bfd9c6; }
  :root:not([data-theme='light']) .av2 { background: #3d2c22; color: #f0cdb8; }
  :root:not([data-theme='light']) .av3 { background: #243246; color: #c4d3ea; }
  :root:not([data-theme='light']) .av4 { background: #3a3220; color: #e6d6a8; }
  :root:not([data-theme='light']) .av5 { background: #3e2329; color: #f0c4cd; }
}
:root[data-theme='dark'] .av0 { background: #3b2d3f; color: #e3cbe8; }
:root[data-theme='dark'] .av1 { background: #26362b; color: #bfd9c6; }
:root[data-theme='dark'] .av2 { background: #3d2c22; color: #f0cdb8; }
:root[data-theme='dark'] .av3 { background: #243246; color: #c4d3ea; }
:root[data-theme='dark'] .av4 { background: #3a3220; color: #e6d6a8; }
:root[data-theme='dark'] .av5 { background: #3e2329; color: #f0c4cd; }

/* Slenkančiame flex stulpelyje vaikai neturi trauktis: kitaip grupė su overflow:hidden
   susispaudžia iki ekrano aukščio ir apkerpa savo eilutes, užuot slinkusi. */
.settings > *, .info-scroll > *, .screen > *, .sheet > *, .form > *, .messages-inner > * { flex-shrink: 0; }

/* Balso žinutės */
.voice-bubble { cursor: default; }
.voice { display: flex; align-items: center; gap: 10px; width: min(300px, 64vw); padding: 2px 0 0; }
.voice-play { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.row.mine .voice-play { background: var(--on-accent); color: var(--accent); }
.voice-wave { flex: 1 1 auto; min-width: 0; height: 34px; display: flex; align-items: center; gap: 2px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.voice-wave i { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: var(--track-off); }
.voice-wave i.on { background: var(--accent-ink); }
.row.mine .voice-wave i { background: rgba(255, 255, 255, 0.42); }
.row.mine .voice-wave i.on { background: var(--on-accent); }
.voice-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.voice-time { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.row.mine .voice-time { color: var(--on-accent-muted); }
.voice-speed { border: 0; border-radius: 999px; padding: 2px 7px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text); cursor: pointer; }
.row.mine .voice-speed { background: rgba(255, 255, 255, 0.18); color: var(--on-accent); }
.voice-more { border: 0; background: transparent; color: inherit; padding: 0 6px 0 0; margin: -6px 0; height: 24px; display: inline-flex; align-items: center; cursor: pointer; opacity: 0.8; }
.meta { display: inline-flex; align-items: center; gap: 4px; }
.rec-bar { align-items: center; gap: 6px; }
.rec-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #d64545; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.rec-time { flex: 0 0 auto; min-width: 40px; font-variant-numeric: tabular-nums; }
.rec-levels { flex: 1 1 auto; min-width: 0; height: 34px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec-levels i { flex: 0 0 3px; border-radius: 2px; background: var(--accent-ink); }
.rec-preview { flex: 1 1 auto; min-width: 0; display: flex; }
.rec-preview .voice { width: 100%; }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
