/* =====================================================================
   Yeniçeri Chat — arayüz
   ===================================================================== */
:root {
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --grad: linear-gradient(135deg, #6d5dfc 0%, #b33ec7 48%, #f2597f 78%, #ff8a4c 100%);
  --grad-soft: linear-gradient(135deg, rgba(109,93,252,.18), rgba(242,89,127,.18));
  --ig-ring: conic-gradient(from 210deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
  --accent: #a855f7;
  --accent-2: #ec4899;
  --ok: #22c55e;
  --danger: #ef4444;
  --read: #6ee7ff;
  --r-lg: 20px;
  --r-md: 14px;
  --shadow: 0 20px 60px -20px rgba(0,0,0,.55);
  --ease: cubic-bezier(.2,.8,.2,1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07080d;
  --app: #0d0f17;
  --panel: rgba(20, 23, 34, .82);
  --panel-solid: #141722;
  --panel-2: #1b1f2d;
  --hover: rgba(255,255,255,.06);
  --line: rgba(255,255,255,.08);
  --text: #eef0f7;
  --text-2: #c3c8d6;
  --muted: #858ca3;
  --bubble-in: #1c2030;
  --bubble-in-text: #eef0f7;
  --input: #171a26;
  --pattern: rgba(255,255,255,.025);
  --glass: rgba(13,15,23,.72);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #e9ebf3;
  --app: #f6f7fb;
  --panel: rgba(255,255,255,.86);
  --panel-solid: #ffffff;
  --panel-2: #f0f1f7;
  --hover: rgba(10,14,30,.05);
  --line: rgba(10,14,30,.08);
  --text: #10131d;
  --text-2: #3b4050;
  --muted: #6b7185;
  --bubble-in: #ffffff;
  --bubble-in-text: #10131d;
  --input: #ffffff;
  --pattern: rgba(20,20,60,.035);
  --glass: rgba(246,247,251,.78);
  --read: #b9f3ff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--hover); padding: 1px 5px; border-radius: 5px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
::selection { background: rgba(168,85,247,.35); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(128,128,160,.35) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(128,128,160,.35); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600;
  background: var(--panel-2); color: var(--text); transition: transform .15s var(--ease), filter .2s, opacity .2s;
  position: relative; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; pointer-events: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 10px 30px -12px rgba(200,60,170,.8); }
.btn.danger { background: rgba(239,68,68,.14); color: #ff6b6b; }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.loading > * { opacity: 0; }
.btn.loading::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  color: var(--text-2); transition: background .15s, color .15s, transform .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 21px; height: 21px; }
.icon-btn.danger { color: var(--danger); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- auth */
.auth-body { display: grid; place-items: center; min-height: 100%; overflow: auto; padding: 24px 16px; }
.auth-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.auth-bg span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .45; animation: float 18s ease-in-out infinite alternate; }
.auth-bg span:nth-child(1) { background: #6d5dfc; left: -20vmax; top: -20vmax; }
.auth-bg span:nth-child(2) { background: #e1306c; right: -25vmax; top: 10vmax; animation-delay: -6s; }
.auth-bg span:nth-child(3) { background: #ff8a4c; left: 10vmax; bottom: -35vmax; animation-delay: -12s; opacity: .3; }
@keyframes float { to { transform: translate(8vmax, 6vmax) scale(1.1); } }
.auth-card {
  position: relative; z-index: 1; width: min(400px, 100%);
  background: var(--panel); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--line); border-radius: 28px; padding: 36px 28px 26px; text-align: center; box-shadow: var(--shadow);
  animation: rise .5s var(--ease);
}
.auth-card.install { width: min(520px, 100%); text-align: left; }
.auth-card.install h1, .auth-card.install .auth-logo { text-align: center; }
.auth-card h1 { margin: 14px 0 6px; font-size: 24px; letter-spacing: -.02em; }
.auth-card p { margin: 0 0 22px; }
.auth-logo img { width: 72px; height: 72px; border-radius: 22px; box-shadow: 0 16px 40px -12px rgba(225,48,108,.7); }
.auth-logo { display: flex; justify-content: center; }
.auth-foot { margin: 18px 0 0 !important; font-size: 12px; color: var(--muted); }
.auth-leave .auth-card { transform: scale(.96); opacity: 0; transition: .25s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.pw-field { position: relative; margin-bottom: 14px; }
.pw-field input, .field, .form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--input);
  padding: 0 16px; outline: none; transition: border-color .2s, box-shadow .2s; font-size: 16px;
}
.pw-field input { padding-right: 50px; text-align: center; letter-spacing: .1em; }
.pw-field input::placeholder { letter-spacing: normal; }
.pw-field input:focus, .field:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: rgba(168,85,247,.7); box-shadow: 0 0 0 4px rgba(168,85,247,.15);
}
.pw-eye { position: absolute; right: 6px; top: 6px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.pw-eye:hover { background: var(--hover); }
.alert { padding: 11px 14px; border-radius: 12px; font-size: 14px; margin: 0 0 14px; text-align: left; }
.alert.err { background: rgba(239,68,68,.12); color: #ff7b7b; border: 1px solid rgba(239,68,68,.25); }
.alert.ok { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.checks { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 6px; font-size: 14px; }
.checks li { padding: 8px 12px 8px 36px; border-radius: 10px; background: var(--hover); position: relative; }
.checks li::before { position: absolute; left: 12px; font-weight: 700; }
.checks .ok::before { content: "✓"; color: var(--ok); }
.checks .bad::before { content: "✕"; color: var(--danger); }
.checks .warn::before { content: "!"; color: #f59e0b; }
.form-grid { display: grid; gap: 14px; }
.form-grid fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; }
.form-grid legend { padding: 0 6px; font-weight: 600; }
.form-grid label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form-grid input, .form-grid select { height: 44px; font-size: 15px; color: var(--text); }
.form-grid textarea { height: auto; min-height: 70px; padding: 10px 14px; resize: vertical; }

/* ---------------------------------------------------------- app shell */
.app-bg { position: fixed; inset: 0; background:
  radial-gradient(60vmax 60vmax at 0% 0%, rgba(109,93,252,.22), transparent 60%),
  radial-gradient(60vmax 60vmax at 100% 100%, rgba(242,89,127,.18), transparent 60%), var(--bg); }
.app {
  position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--app);
  overflow: hidden; isolation: isolate;
}
@media (min-width: 900px) {
  .app { inset: 18px 0; margin: 0 auto; width: min(1000px, calc(100vw - 36px));
    border-radius: 26px; border: 1px solid var(--line); box-shadow: var(--shadow); }
}
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 22px; background: var(--bg); transition: opacity .35s, visibility .35s; }
.splash.hide { opacity: 0; visibility: hidden; }

/* top bar */
.topbar {
  position: relative; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) 10px 10px 12px; background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.peer { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; padding: 4px 8px 4px 4px; border-radius: 14px; }
.peer:hover { background: var(--hover); }
.peer-info { display: flex; flex-direction: column; min-width: 0; }
.peer-info strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.status { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s; }
.status.on { color: var(--ok); }
.status.typing { color: var(--accent-2); font-weight: 500; }
.status .dots i { display: inline-block; width: 4px; height: 4px; margin-left: 2px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; vertical-align: middle; }
.status .dots i:nth-child(2) { animation-delay: .2s; }
.status .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.top-actions { display: flex; gap: 2px; }
.searchbar { position: absolute; inset: 0; display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 10px 8px; background: var(--panel-solid); animation: fade .2s; }
.searchbar input { flex: 1; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--input); padding: 0 14px; outline: none; }
.searchbar .muted { font-size: 13px; min-width: 44px; text-align: center; }
@keyframes fade { from { opacity: 0; } }

/* avatar */
.avatar {
  --s: 44px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: calc(var(--s) * .4);
  background: var(--grad); background-size: cover; background-position: center;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.ring { padding: 2.5px; background: var(--line); }
.avatar.ring.on { background: var(--ig-ring); }
.avatar.ring > .av-in { width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--app); overflow: hidden; display: grid; place-items: center; background: var(--grad); }
.avatar.ring > .av-in img { width: 100%; height: 100%; object-fit: cover; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--ok); border: 2.5px solid var(--app); transform: scale(0); transition: transform .25s var(--ease); }
.avatar.on .dot { transform: scale(1); }

.conn { position: relative; z-index: 4; text-align: center; font-size: 12.5px; padding: 6px; background: rgba(245,158,11,.15); color: #f8b84e; animation: fade .2s; }

/* ---------------------------------------------------------- chat area */
.chat {
  flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; padding: 8px 0 14px;
  overscroll-behavior: contain; scroll-behavior: auto;
  background-color: var(--app);
  background-image:
    radial-gradient(var(--pattern) 1.2px, transparent 1.3px),
    radial-gradient(var(--pattern) 1.2px, transparent 1.3px);
  background-size: 26px 26px; background-position: 0 0, 13px 13px;
}
.older { display: flex; justify-content: center; padding: 14px 0 6px; min-height: 40px; }
.older.done { visibility: hidden; min-height: 8px; padding: 0; }
.list { display: flex; flex-direction: column; }
.empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--text-2); pointer-events: none; }
.empty-ic { font-size: 52px; margin-bottom: 8px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
/* Mesaj kutusunun üstünde sabit duran sohbet başlığı */
.story-bar { text-align: center; font-style: italic; font-weight: 500; font-size: 13px; letter-spacing: .015em; line-height: 1.4; color: var(--text-2); opacity: .9; padding: 9px 18px 5px; }
@media (max-width: 420px) { .story-bar { font-size: 12px; padding: 7px 14px 4px; } }

/* ---- PIN girişi ---- */
.pin-card { width: min(360px, 100%); }
.pin-dots { display: flex; gap: 13px; justify-content: center; align-items: center; min-height: 18px; margin: 4px 0 20px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; background: transparent; border: 2px solid var(--line); transition: transform .15s, background .15s, border-color .15s; }
.pin-dots i.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; transform: scale(1.12); box-shadow: 0 4px 14px rgba(168,85,247,.5); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 4px auto 0; }
.pin-pad.busy { opacity: .5; pointer-events: none; }
.pin-pad button { height: 66px; border: none; border-radius: 18px; background: var(--panel-2); color: var(--text); font-size: 25px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; transition: transform .07s ease, background .15s; }
.pin-pad button:active { transform: scale(.92); background: var(--line); }
.pin-pad button svg { width: 27px; height: 27px; fill: currentColor; }
.pin-pad .pin-del { color: var(--text-2); }
.pin-pad .pin-ok { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 22px rgba(168,85,247,.4); }
.pin-pad .pin-ok:active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
@media (max-width: 380px) { .pin-pad button { height: 58px; font-size: 22px; } .pin-pad, .pin-dots { gap: 10px; } }

.day { align-self: center; position: sticky; top: 8px; z-index: 2; margin: 14px 0 8px; padding: 5px 12px; border-radius: 10px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); }

.msg { display: flex; align-items: flex-end; gap: 6px; padding: 1px 14px; position: relative; }
.msg.first { margin-top: 8px; }
.msg.out { flex-direction: row-reverse; }
.msg.has-rx { margin-bottom: 16px; }
.msg.new { animation: pop .28s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.msg.flash .bubble { animation: flash 1.2s; }
@keyframes flash { 0%, 100% { filter: none; } 30% { filter: brightness(1.5) drop-shadow(0 0 12px rgba(236,72,153,.7)); } }
.msg .swipe-ic { position: absolute; left: 4px; top: 50%; transform: translate(-30px, -50%) scale(.5); opacity: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); transition: none; }

.bubble {
  position: relative; max-width: min(76%, 540px); padding: 7px 10px 7px 12px; border-radius: 20px;
  background: var(--bubble-in); color: var(--bubble-in-text); word-wrap: break-word; overflow-wrap: anywhere;
  box-shadow: 0 1px 1px rgba(0,0,0,.08); transition: transform .2s var(--ease);
}
.msg.in:not(.first) .bubble { border-top-left-radius: 6px; }
.msg.in:not(.last) .bubble { border-bottom-left-radius: 6px; }
.msg.out .bubble { background: var(--grad); background-attachment: fixed; color: #fff; }
@supports (-webkit-touch-callout: none) { .msg.out .bubble { background-attachment: scroll; } }
.msg.out:not(.first) .bubble { border-top-right-radius: 6px; }
.msg.out:not(.last) .bubble { border-bottom-right-radius: 6px; }
.msg.out .bubble.media-bubble { background: linear-gradient(135deg, #7a4fe6, #d84a96); background-attachment: scroll; }
.msg.out.pending .bubble { opacity: .85; }
.msg.failed .bubble { outline: 2px solid var(--danger); }
.msg .text { white-space: pre-wrap; font-size: 15px; line-height: 1.38; }
.msg .text a { text-decoration: underline; text-underline-offset: 2px; }
.msg.in .text a { color: #8ab4ff; }
.msg .text pre { margin: 4px 0; padding: 8px 10px; background: rgba(0,0,0,.22); border-radius: 10px; overflow-x: auto; font-size: 13px; white-space: pre; }
.msg .text mark { background: #fde047; color: #111; border-radius: 3px; padding: 0 1px; }
.meta-sp { display: inline-block; width: 46px; height: 1px; }
.msg.out .meta-sp { width: 62px; }
.msg.edited .meta-sp { width: 118px; }
.msg.out.edited .meta-sp { width: 132px; }
.meta { position: absolute; right: 10px; bottom: 5px; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1; opacity: .72; white-space: nowrap; user-select: none; }
.msg.out .meta { opacity: .9; }
.meta .ed { font-style: italic; margin-right: 2px; }
.tick { width: 17px; height: 17px; }
.tick.read { color: var(--read); }
.tick.clock { width: 13px; height: 13px; animation: spin 2s linear infinite; }

/* big emoji */
.msg.jumbo .bubble { background: none !important; box-shadow: none; padding: 0 4px 16px; }
.msg.jumbo .text { font-size: 44px; line-height: 1.15; }
.msg.jumbo .meta { color: var(--text-2); bottom: 0; right: 4px; }
.msg.jumbo .meta-sp { display: none; }

/* reply quote */
.rq { display: block; width: 100%; text-align: left; margin: 0 0 6px; padding: 6px 10px; border-radius: 12px; background: rgba(0,0,0,.16); border-left: 3px solid var(--accent-2); font-size: 13px; overflow: hidden; }
.msg.in .rq { background: var(--hover); }
.msg.out .rq { border-left-color: rgba(255,255,255,.85); background: rgba(0,0,0,.18); }
.rq b { display: block; font-size: 12.5px; color: var(--accent-2); margin-bottom: 1px; }
.msg.out .rq b { color: #fff; }
.rq span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }
.media-bubble .rq { margin: 4px 4px 4px; width: calc(100% - 8px); }

/* reactions */
.rx { position: absolute; bottom: -15px; display: flex; gap: 1px; padding: 2px 6px; border-radius: 14px; background: var(--panel-solid); border: 2px solid var(--app); font-size: 14px; line-height: 1.3; box-shadow: 0 2px 6px rgba(0,0,0,.2); cursor: pointer; animation: pop .25s var(--ease); z-index: 1; }
.msg.out .rx { right: 10px; }
.msg.in .rx { left: 10px; }
.heart-burst { position: absolute; left: 50%; top: 50%; font-size: 56px; transform: translate(-50%, -50%) scale(0); pointer-events: none; animation: burst .8s var(--ease) forwards; z-index: 3; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
@keyframes burst { 30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 60% { transform: translate(-50%, -50%) scale(.95); } 100% { transform: translate(-50%, -60%) scale(1); opacity: 0; } }

/* message hover action */
.more-btn { align-self: center; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); opacity: 0; transition: opacity .15s, background .15s; }
.more-btn svg { width: 18px; height: 18px; }
.more-btn:hover { background: var(--hover); color: var(--text); }
@media (hover: hover) { .msg:hover .more-btn { opacity: 1; } }
@media (hover: none) { .more-btn { display: none; } }

/* media */
.media-bubble { padding: 3px; }
.media-bubble .text { padding: 4px 8px 2px; }
.mbox { position: relative; display: block; width: min(var(--w, 300px), 68vw); aspect-ratio: var(--ar, 4/3); max-height: 420px; border-radius: 17px; overflow: hidden; background: rgba(127,127,160,.15); cursor: zoom-in; }
.msg.in:not(.first) .mbox { border-top-left-radius: 5px; }
.msg.out:not(.first) .mbox { border-top-right-radius: 5px; }
.mbox img, .mbox video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mbox img { opacity: 0; transition: opacity .3s; }
.mbox img.ld { opacity: 1; }
.mbox .play { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); color: #fff; }
.mbox .play svg { width: 30px; height: 30px; margin-left: 3px; }
.mbox .vdur { position: absolute; left: 8px; bottom: 8px; font-size: 11.5px; color: #fff; background: rgba(0,0,0,.5); padding: 2px 7px; border-radius: 8px; }
.media-bubble.no-cap .meta { background: rgba(0,0,0,.45); color: #fff; padding: 4px 7px; border-radius: 10px; right: 10px; bottom: 10px; opacity: 1; }
.media-bubble.no-cap .meta-sp { display: none; }
.prog { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); color: #fff; }
.ring-prog { width: 54px; height: 54px; position: relative; display: grid; place-items: center; }
.ring-prog svg { position: absolute; inset: 0; width: 54px; height: 54px; transform: rotate(-90deg); }
.ring-prog circle { fill: none; stroke-width: 3.5; }
.ring-prog .bg { stroke: rgba(255,255,255,.25); }
.ring-prog .fg { stroke: #fff; stroke-linecap: round; stroke-dasharray: 145; stroke-dashoffset: 145; transition: stroke-dashoffset .25s; }
.ring-prog button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.ring-prog button svg { position: static; width: 18px; height: 18px; transform: none; }

/* file card */
.fcard { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; min-width: 230px; max-width: 320px; border-radius: 14px; background: rgba(0,0,0,.14); text-decoration: none; color: inherit; }
.msg.in .fcard { background: var(--hover); }
.fic { position: relative; width: 44px; height: 50px; flex: none; border-radius: 8px; background: var(--fc, #64748b); display: grid; place-items: end center; padding-bottom: 6px; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .03em; box-shadow: inset 0 -2px rgba(0,0,0,.15); clip-path: polygon(0 0, 70% 0, 100% 22%, 100% 100%, 0 100%); }
.fic::before { content: ""; position: absolute; right: 0; top: 0; width: 30%; height: 22%; background: rgba(255,255,255,.35); clip-path: polygon(0 0, 100% 100%, 0 100%); }
.finfo { flex: 1; min-width: 0; }
.finfo b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finfo small { opacity: .75; font-size: 12px; }
.fdl { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); flex: none; }
.msg.in .fdl { background: var(--hover); }
.fdl svg { width: 20px; height: 20px; }
.file-bubble { padding: 4px 4px 6px; }
.file-bubble .text { padding: 4px 6px 0; min-height: 14px; }
.tick.read { filter: drop-shadow(0 0 1px rgba(0,0,0,.35)); }
.msg.out .ap-av { margin-left: 2px; }

/* audio player */
.ap { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 320px; padding: 4px 2px 14px 0; }
.ap-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; background: rgba(255,255,255,.2); color: #fff; transition: transform .15s; }
.msg.in .ap-btn { background: var(--grad); }
.ap-btn:active { transform: scale(.9); }
.ap-btn svg { width: 22px; height: 22px; }
.ap-btn .ic-pause { display: none; }
.ap.playing .ic-play { display: none; }
.ap.playing .ic-pause { display: block; }
.ap.loading .ap-btn svg { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.ap-body { flex: 1; min-width: 0; position: relative; }
.ap-wave { display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; touch-action: none; }
.ap-wave i { flex: 1; min-width: 2px; max-width: 4px; border-radius: 3px; background: currentColor; opacity: .35; height: var(--h); transition: opacity .1s; }
.ap-wave i.p { opacity: 1; }
.ap-time { position: absolute; left: 0; bottom: -15px; font-size: 11px; opacity: .75; }
.ap-speed { font-size: 11.5px; font-weight: 700; padding: 3px 7px; border-radius: 10px; background: rgba(255,255,255,.18); flex: none; min-width: 34px; }
.msg.in .ap-speed { background: var(--hover); }
.ap-av { position: relative; flex: none; }
.ap-av .avatar { --s: 42px; }
.ap-av .mic-badge { position: absolute; right: -3px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--app); color: var(--accent-2); }
.ap-av .mic-badge svg { width: 12px; height: 12px; }
.audio-bubble .meta { bottom: 6px; }

/* typing bubble */
.typing-row { display: flex; padding: 8px 14px 0; animation: pop .25s var(--ease); }
.bubble.typing { display: flex; gap: 4px; padding: 13px 15px; border-radius: 20px; border-bottom-left-radius: 6px; }
.bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.3s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: .15s; }
.bubble.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
.typing-row.audio .bubble.typing::before { content: "🎙️"; margin-right: 4px; font-size: 13px; animation: pulse 1s infinite; }

/* fab */
.fab-down { position: absolute; right: 18px; bottom: calc(88px + var(--safe-b)); z-index: 6; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-solid); color: var(--text); border: 1px solid var(--line); box-shadow: 0 8px 24px -8px rgba(0,0,0,.5); animation: pop .2s var(--ease); }
.fab-down .badge { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------------------------------------------------------- composer */
.composer { position: relative; z-index: 5; padding: 8px 10px calc(10px + var(--safe-b)); background: var(--glass); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); border-top: 1px solid var(--line); }
.compose-row, .rec-row { display: flex; align-items: flex-end; gap: 8px; }
.input-wrap { flex: 1; display: flex; align-items: flex-end; gap: 2px; min-height: 48px; padding: 6px 6px; background: var(--input); border: 1px solid var(--line); border-radius: 24px; transition: border-color .2s, box-shadow .2s; }
.input-wrap:focus-within { border-color: rgba(168,85,247,.5); box-shadow: 0 0 0 3px rgba(168,85,247,.1); }
#input { flex: 1; resize: none; border: 0; outline: none; background: transparent; padding: 7px 4px; max-height: 160px; line-height: 1.38; font-size: 16px; min-width: 0; }
#input::placeholder { color: var(--muted); }
.input-wrap .icon-btn.sm { color: var(--muted); }
.input-wrap .icon-btn.sm:hover { color: var(--text); }
.composer.has-text #cameraBtn { display: none; }
.send-btn { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--grad); color: #fff; box-shadow: 0 8px 22px -8px rgba(200,60,170,.8); transition: transform .18s var(--ease); position: relative; }
.send-btn:active { transform: scale(.9); }
.send-btn svg { position: absolute; transition: transform .22s var(--ease), opacity .18s; }
.send-btn .ic-send, .send-btn .ic-check { opacity: 0; transform: scale(.4) rotate(-45deg); }
.composer.has-text .send-btn .ic-mic, .composer.editing .send-btn .ic-mic { opacity: 0; transform: scale(.4); }
.composer.has-text:not(.editing) .send-btn .ic-send { opacity: 1; transform: none; }
.composer.editing .send-btn .ic-check { opacity: 1; transform: none; }
.composer.editing .send-btn .ic-send { opacity: 0 !important; }
.rec-row .send-btn .ic-send { opacity: 1; transform: none; }
.rec-row { align-items: center; min-height: 48px; animation: fade .2s; }
.rec-info { flex: 1; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; background: var(--input); border: 1px solid var(--line); border-radius: 24px; min-width: 0; font-variant-numeric: tabular-nums; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; flex: none; }
.rec-row.paused .rec-dot { animation: none; opacity: .4; }
.rec-wave { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 2px; height: 28px; overflow: hidden; }
.rec-wave i { width: 3px; flex: none; border-radius: 2px; background: var(--accent-2); height: var(--h); }
.ctx-bar { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px 6px; animation: slideup .2s var(--ease); }
@keyframes slideup { from { opacity: 0; transform: translateY(8px); } }
.ctx-line { width: 3px; align-self: stretch; border-radius: 3px; background: var(--grad); }
.ctx-body { flex: 1; min-width: 0; font-size: 13px; }
.ctx-body strong { display: block; color: var(--accent-2); font-size: 13px; }
.ctx-body span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }

.drop-zone { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(13,15,23,.7); backdrop-filter: blur(6px); }
.drop-zone > div { border: 2.5px dashed rgba(255,255,255,.4); border-radius: 26px; padding: 40px 60px; text-align: center; color: #fff; }
.drop-zone svg { width: 48px; height: 48px; }

/* ---------------------------------------------------------- popovers & menus */
.pop { position: fixed; z-index: 60; min-width: 200px; padding: 6px; border-radius: 16px; background: var(--panel); backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%); border: 1px solid var(--line); box-shadow: var(--shadow); animation: popin .16s var(--ease); transform-origin: var(--ox, 50%) var(--oy, 0); }
@keyframes popin { from { opacity: 0; transform: scale(.92); } }
.pop .mi { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; text-align: left; }
.pop .mi:hover { background: var(--hover); }
.pop .mi svg { width: 20px; height: 20px; color: var(--text-2); }
.pop .mi.danger, .pop .mi.danger svg { color: #ff6b6b; }
.pop .sep { height: 1px; background: var(--line); margin: 5px 6px; }
.pop .rx-row { display: flex; gap: 2px; padding: 4px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop .rx-row button { width: 40px; height: 40px; border-radius: 50%; font-size: 24px; display: grid; place-items: center; transition: transform .15s var(--ease), background .15s; }
.pop .rx-row button:hover { transform: scale(1.22); background: var(--hover); }
.pop .rx-row button.on { background: rgba(236,72,153,.2); }
.attach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; min-width: 270px; }
.attach-grid button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px; border-radius: 14px; font-size: 12.5px; }
.attach-grid button:hover { background: var(--hover); }
.attach-grid .ai { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.attach-grid .ai svg { width: 24px; height: 24px; }

.emoji-pop { width: min(360px, calc(100vw - 20px)); padding: 0; overflow: hidden; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.emoji-tabs button { width: 36px; height: 34px; border-radius: 10px; font-size: 19px; flex: none; opacity: .6; }
.emoji-tabs button.on, .emoji-tabs button:hover { opacity: 1; background: var(--hover); }
.emoji-grid { height: 280px; overflow-y: auto; padding: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); align-content: start; }
.emoji-grid h6 { grid-column: 1 / -1; margin: 6px 4px 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.emoji-grid button { height: 40px; font-size: 25px; border-radius: 10px; }
.emoji-grid button:hover { background: var(--hover); transform: scale(1.1); }

/* ---------------------------------------------------------- modal */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(3,4,8,.55); backdrop-filter: blur(4px); animation: fade .2s; }
.modal-wrap.closing { animation: fade .18s reverse forwards; }
.modal { width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); animation: rise .25s var(--ease); display: flex; flex-direction: column; }
.modal.wide { width: min(920px, 100%); height: calc(100dvh - 32px); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-solid); z-index: 2; }
.modal-h h3 { margin: 0; flex: 1; font-size: 18px; letter-spacing: -.01em; }
.modal-b { padding: 18px 20px; flex: 1; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 18px; flex-wrap: wrap; }
.modal-f .btn { flex: 1; min-width: 120px; }
.confirm-ic { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 12px; font-size: 28px; background: var(--grad-soft); }
.confirm-t { text-align: center; }
.confirm-t h3 { margin: 0 0 6px; font-size: 19px; }
.confirm-t p { margin: 0; color: var(--text-2); }
.choice-list { display: grid; gap: 8px; padding: 0 20px 20px; }
.choice-list .btn { height: 48px; }
@media (max-width: 600px) {
  .modal-wrap.sheet { place-items: end stretch; padding: 0; }
  .modal-wrap.sheet .modal { width: 100%; border-radius: 24px 24px 0 0; max-height: 92dvh; animation: sheet .3s var(--ease); padding-bottom: var(--safe-b); }
  .modal.wide { height: 100dvh; max-height: 100dvh !important; border-radius: 0 !important; }
  .modal-wrap:has(.modal.wide) { padding: 0; }
}
@keyframes sheet { from { transform: translateY(100%); } }

/* profile/settings */
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0 16px; }
.profile-head .avatar { --s: 104px; font-size: 40px; cursor: pointer; }
.profile-head .avatar .cam { position: absolute; right: 2px; bottom: 2px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--text); border: 3px solid var(--panel-solid); }
.profile-head .avatar .cam svg { width: 16px; height: 16px; }
.profile-head h2 { margin: 0; font-size: 21px; }
.section-t { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 0 8px; font-weight: 700; }
.row-opt { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.row-opt:last-child { border-bottom: 0; }
.row-opt .ro-t { flex: 1; }
.row-opt .ro-t small { display: block; color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .22s var(--ease); box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--grad); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(18px); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { padding: 12px; border-radius: 14px; background: var(--panel-2); }
.stat b { display: block; font-size: 20px; letter-spacing: -.02em; }
.stat small { color: var(--muted); font-size: 12px; }
.log-list { font-size: 12.5px; display: grid; gap: 4px; }
.log-list div { display: flex; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); }
.log-list .bad { color: #ff7b7b; }
.log-list span:last-child { margin-left: auto; color: var(--muted); }

/* ---------------------------------------------------------- send preview */
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pv-item { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; text-align: center; font-size: 12px; padding: 0; }
.pv-item img, .pv-item video { width: 100%; height: 100%; object-fit: cover; }
.pv-item .fic { margin: 0 auto 6px; }
.pv-item .pv-name { padding: 0 8px; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pv-item .pv-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.pv-item .pv-x svg { width: 16px; height: 16px; }
.pv-item .pv-size { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: rgba(0,0,0,.55); color: #fff; padding: 1px 6px; border-radius: 6px; }
.pv-opts { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; color: var(--text-2); }
.pv-cap { margin-top: 14px; }
.pv-cap textarea { width: 100%; border-radius: 14px; border: 1px solid var(--line); background: var(--input); padding: 12px 14px; outline: none; resize: none; min-height: 48px; font-size: 15px; }

/* ---------------------------------------------------------- lightbox */
.lb { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.94); display: flex; flex-direction: column; animation: fade .2s; touch-action: pan-y; }
.lb-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 12px 10px 16px; color: #fff; z-index: 2; }
.lb-top .lb-t { flex: 1; min-width: 0; }
.lb-top .lb-t b { display: block; font-size: 15px; }
.lb-top .lb-t small { opacity: .7; font-size: 12.5px; }
.lb .icon-btn { color: #fff; }
.lb .icon-btn:hover { background: rgba(255,255,255,.12); }
.lb-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; padding: 0 0 calc(12px + var(--safe-b)); }
.lb-stage img, .lb-stage video { max-width: 100vw; max-height: calc(100dvh - 90px - var(--safe-t) - var(--safe-b)); object-fit: contain; user-select: none; animation: zoomin .25s var(--ease); }
.lb-stage img { cursor: zoom-in; transition: transform .25s var(--ease); }
.lb-stage img.zoomed { transform: scale(2.2); cursor: zoom-out; }
@keyframes zoomin { from { opacity: 0; transform: scale(.94); } }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.1) !important; z-index: 2; }
.lb-nav.prev { left: 14px; }
.lb-nav.next { right: 14px; }
.lb-cap { position: absolute; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); text-align: center; color: #fff; padding: 0 20px; pointer-events: none; text-shadow: 0 1px 4px #000; }

/* ---------------------------------------------------------- archive */
.arch-tools { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.arch-tools input, .arch-tools select { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--input); padding: 0 10px; outline: none; color: var(--text); font-size: 14px; }
.arch-tools input[type=search] { flex: 1 1 200px; }
.arch-tools .arch-count { align-self: center; font-size: 13px; color: var(--muted); margin-left: auto; }
.arch-list { padding: 8px 12px 20px; overflow-y: auto; flex: 1; }
.arch-item { display: flex; gap: 12px; padding: 12px; border-radius: 14px; transition: background .15s; }
.arch-item:hover { background: var(--hover); }
.arch-item .avatar { --s: 38px; }
.arch-main { flex: 1; min-width: 0; }
.arch-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.arch-head b { font-size: 14px; }
.arch-head time { color: var(--muted); font-size: 12px; }
.arch-text { margin-top: 3px; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.arch-media { margin-top: 6px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--panel-2); font-size: 13px; text-decoration: none; }
.arch-media img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.arch-edits { margin-top: 6px; font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 10px; }
.arch-edits div { margin: 2px 0; }
.arch-edits s { opacity: .8; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.tag.red { background: rgba(239,68,68,.15); color: #ff7b7b; }
.tag.amber { background: rgba(245,158,11,.15); color: #f8b84e; }
.tag.blue { background: rgba(59,130,246,.15); color: #7fb0ff; }
.tag.gray { background: var(--hover); color: var(--text-2); }
.arch-act { display: flex; align-items: flex-start; }
.arch-more { display: flex; justify-content: center; padding: 14px; }
.arch-empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ---------------------------------------------------------- toasts */
.toasts { position: fixed; left: 50%; top: calc(16px + var(--safe-t)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { pointer-events: auto; padding: 11px 16px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px; animation: toastin .3s var(--ease); display: flex; gap: 8px; align-items: center; }
.toast.err { border-color: rgba(239,68,68,.4); }
.toast.out { animation: toastin .25s reverse forwards; }
@keyframes toastin { from { opacity: 0; transform: translateY(-12px) scale(.96); } }

.ap-name { font-weight: 600; }
@media (hover: none) { .msg .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.rx small { font-size: 11px; margin-left: 2px; opacity: .8; align-self: center; }

/* search highlight */
.msg.hit .bubble { box-shadow: 0 0 0 2px #fde047; }

/* ---------------------------------------------------------- live location & mandatory gate */
.loc-top-btn { position: relative; }
.loc-dot { position: absolute; right: 7px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); border: 2px solid var(--app); pointer-events: none; }
.loc-dot.live { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 1.4s infinite; }
.loc-dot.denied { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.loc-dot.last { background: #38bdf8; }

.loc-gate { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 20px; background: rgba(7,8,13,.86); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%); animation: fade .22s; }
.loc-gate-card { width: min(420px, 100%); background: var(--panel-solid); border: 1px solid var(--line); border-radius: 26px; padding: 28px 24px 24px; text-align: center; box-shadow: var(--shadow); animation: rise .3s var(--ease); }
.loc-gate-ic { width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: var(--grad-soft); color: var(--accent-2); position: relative; }
.loc-gate-ic svg { width: 34px; height: 34px; }
.loc-gate-ic::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px dashed rgba(236,72,153,.35); animation: spin 14s linear infinite; }
.loc-gate-card h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.01em; }
.loc-gate-card p { margin: 0 0 16px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.loc-gate-steps { text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 0 0 16px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.loc-gate-steps b { color: var(--text); }
.loc-gate-steps ol { margin: 6px 0 0; padding-left: 18px; }
.loc-gate-steps li { margin: 4px 0; }

.loc-status-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 11px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 12px; }
.loc-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.loc-badge i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.loc-badge.live { color: #22c55e; background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.3); }
.loc-badge.live i { background: #22c55e; box-shadow: 0 0 8px #22c55e; animation: pulse 1.3s infinite; }
.loc-badge.denied { color: #ff7b7b; background: rgba(239,68,68,.14); border: 1px solid rgba(239,68,68,.3); }
.loc-badge.denied i { background: #ef4444; }
.loc-badge.last { color: #38bdf8; background: rgba(56,189,248,.14); border: 1px solid rgba(56,189,248,.3); }
.loc-badge.last i { background: #38bdf8; }

.loc-addr-card { padding: 14px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); margin-top: 10px; }
.loc-addr-main { font-size: 15px; font-weight: 700; line-height: 1.45; margin: 6px 0 10px; word-break: break-word; }
.loc-addr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 10px; }
.loc-addr-grid div small { display: block; color: var(--muted); font-size: 11.5px; }
.loc-addr-grid div b { font-weight: 600; color: var(--text); }

.loc-coord-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); margin-top: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
.loc-map-wrap { margin-top: 12px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); height: 230px; position: relative; }
.loc-map-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.loc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.loc-actions .btn { flex: 1; min-width: 140px; }
.loc-hist-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; }
.loc-hist-item b { display: block; font-size: 13px; margin-bottom: 2px; }
.loc-hist-item code { font-size: 11.5px; color: var(--accent-2); }

/* misc */
.ld-dots::after { content: "…"; }
@media (max-width: 600px) {
  .bubble { max-width: 82%; }
  .msg { padding: 1px 8px; }
  .topbar { padding-left: 6px; }
  .avatar { --s: 40px; }
  #searchBtn { display: none; }
  .lb-nav { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
