/* ===== Theme tokens — modern, matte, Element/Discord-like ===== */
:root {
  --radius: 14px; --radius-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Default: refined dark (Discord/Linear vibe) */
[data-theme="modern"] {
  --bg-primary:#16171b; --bg-secondary:#1b1c21; --bg-surface:#212329; --bg-elevated:#2a2c33;
  --text-primary:#eceef1; --text-secondary:#b3b7c0; --text-muted:#7d818c;
  --accent:#6470ff; --accent-2:#8b7bff; --accent-contrast:#fff; --danger:#f0596b;
  --border:#2a2c33; --border-soft:#23252b; --bubble-radius:16px;
  --shadow:0 10px 40px rgba(0,0,0,.45); --online:#3fcf8e;
}
/* Clean light (Element vibe) */
[data-theme="light"] {
  --bg-primary:#f5f6f8; --bg-secondary:#ffffff; --bg-surface:#ffffff; --bg-elevated:#eef0f4;
  --text-primary:#15171c; --text-secondary:#4c525e; --text-muted:#878d99;
  --accent:#3a7afe; --accent-2:#6f63ff; --accent-contrast:#fff; --danger:#e23b4e;
  --border:#e5e8ec; --border-soft:#eef0f3; --bubble-radius:16px;
  --shadow:0 10px 36px rgba(30,40,70,.10); --online:#1bb673;
}
/* Deep midnight */
[data-theme="midnight"] {
  --bg-primary:#0d1117; --bg-secondary:#11161d; --bg-surface:#161c25; --bg-elevated:#1d2531;
  --text-primary:#e7ecf3; --text-secondary:#aab3c2; --text-muted:#6b7585;
  --accent:#4c9bff; --accent-2:#7c8cff; --accent-contrast:#04101f; --danger:#ff6b81;
  --border:#202732; --border-soft:#19202a; --bubble-radius:16px;
  --shadow:0 10px 40px rgba(0,0,0,.5); --online:#37d39a;
}
/* Optional retro terminal (kept, not default) */
[data-theme="shadow"] {
  --bg-primary:#05080a; --bg-secondary:#0a0f0c; --bg-surface:#0c1410; --bg-elevated:#10201a;
  --text-primary:#c9ffe0; --text-secondary:#5fd6a0; --text-muted:#3a8f68;
  --accent:#19d089; --accent-2:#16b478; --accent-contrast:#04130c; --danger:#ff5470;
  --border:#143527; --border-soft:#0e2419; --bubble-radius:10px;
  --shadow:0 10px 40px rgba(0,0,0,.5); --online:#19d089;
  --font:'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* stop mobile auto-shrinking text */
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-primary); color: var(--text-primary);
  font-family: var(--font); display: flex; flex-direction: column;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-muted) 40%, transparent); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-muted) 60%, transparent); }

/* ===== Controls ===== */
input, select, textarea, button {
  font-family: inherit; font-size: 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 10px 13px;
  background: var(--bg-elevated); color: var(--text-primary); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s, transform .06s, filter .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { resize: vertical; }
button {
  cursor: pointer; border: none; font-weight: 600; letter-spacing: .1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-contrast);
}
button:hover { filter: brightness(1.07); }
button:active { transform: translateY(1px); }
button.secondary, button.ghost { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
button.secondary:hover, button.ghost:hover { background: color-mix(in srgb, var(--accent) 12%, var(--bg-elevated)); border-color: var(--accent); }
button.full { width: 100%; margin-top: 8px; }
button.icon { background: transparent; color: var(--text-secondary); border: 1px solid transparent; font-size: 18px; padding: 8px 11px; line-height: 1; border-radius: 10px; }
button.icon:hover { background: var(--bg-elevated); color: var(--text-primary); }
/* Secret chat (Double Ratchet) active: lock button lit + a key tint on the header. */
#secretBtn.on { color: var(--accent-contrast); background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.conv-header.secret { box-shadow: inset 0 -2px 0 var(--accent); }
.conv-header.secret #peerName::after { content: ' 🔒'; font-size: 12px; opacity: .8; }
button.danger-btn { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 60%, transparent); }
button.danger-btn:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
button:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Top bar ===== */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.brand { font-weight: 800; color: var(--accent); letter-spacing: .5px; font-size: 17px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.search-wrap { padding: 10px 10px 4px; }
.search-wrap input { width: 100%; box-sizing: border-box; }
/* Controls must never shrink/clip — they hold the gear (Settings → logout). */
.controls { display: flex; gap: 8px; align-items: center; margin-left: auto; flex: 0 0 auto; }
/* Live-connection indicator — shown only while the socket is down/reconnecting */
.conn-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.conn-status .conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: connPulse 1.1s ease-in-out infinite; }
@keyframes connPulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* ===== Auth ===== */
.centered { flex: 1; display: grid; place-items: center; padding: 20px; }
.card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.auth-card { width: min(400px, 94vw); display: flex; flex-direction: column; gap: 14px; }
.auth-brand { font-size: 26px; font-weight: 800; color: var(--accent); text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.field input, .field textarea, .field select { color: var(--text-primary); }
.row { display: flex; gap: 10px; }
.row button { flex: 1; }
.muted { color: var(--text-muted); font-size: 13px; margin: 0; }
.error { color: var(--danger); min-height: 18px; font-size: 13px; margin: 2px 0 0; }

/* ===== Login / auth page (hero + card + animated backdrop) ===== */
.auth-view { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 28px; overflow-x: hidden; overflow-y: auto; }
.auth-footer { position: relative; z-index: 1; width: 100%; max-width: 980px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border-soft); text-align: center; color: var(--text-muted); font-size: 13px; font-style: italic; line-height: 1.5; }
.auth-footer .af-mark { color: var(--accent); font-style: normal; margin-right: 6px; }
/* Soft, slowly-drifting gradient blobs + faint grid so the page isn't empty. */
.auth-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.auth-bg .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; will-change: transform; }
.auth-bg .b1 { width: 460px; height: 460px; left: -120px; top: -120px; background: var(--accent); animation: blobFloat 18s ease-in-out infinite; }
.auth-bg .b2 { width: 520px; height: 520px; right: -160px; top: 10%; background: var(--accent-2); animation: blobFloat 22s ease-in-out infinite reverse; }
.auth-bg .b3 { width: 380px; height: 380px; left: 25%; bottom: -160px; background: color-mix(in srgb, var(--accent) 60%, var(--accent-2)); animation: blobFloat 26s ease-in-out infinite; }
.auth-grid-overlay { position: absolute; inset: 0; background-image: linear-gradient(color-mix(in srgb, var(--text-muted) 8%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--text-muted) 8%, transparent) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); }
@keyframes blobFloat { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(40px,30px) scale(1.08); } 66% { transform: translate(-30px,20px) scale(.95); } }
@media (prefers-reduced-motion: reduce) { .auth-bg .blob { animation: none; } }

.auth-wrap { position: relative; z-index: 1; margin: auto 0; display: grid; grid-template-columns: 1.05fr 400px; grid-template-areas: "hero card" "features card"; column-gap: 54px; row-gap: 18px; align-items: start; width: 100%; max-width: 980px; }
.auth-hero { grid-area: hero; }
.auth-card { grid-area: card; align-self: center; }
.auth-features { grid-area: features; align-self: start; }

/* Hero / pitch column */
.auth-hero { display: flex; flex-direction: column; gap: 14px; }
.auth-logo { width: 64px; height: 64px; display: grid; place-items: center; font-size: 34px; color: var(--accent-contrast); border-radius: 18px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 36px color-mix(in srgb, var(--accent) 45%, transparent); }
.auth-title { margin: 6px 0 0; font-size: 40px; font-weight: 800; letter-spacing: -.5px; line-height: 1.05; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-tagline { margin: 0; color: var(--text-secondary); font-size: 16px; max-width: 42ch; }
.auth-features { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-features li { display: flex; gap: 12px; align-items: flex-start; }
.auth-features .afi { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; font-size: 19px; border-radius: 11px; background: var(--bg-elevated); border: 1px solid var(--border); }
.auth-features .aft { display: flex; flex-direction: column; gap: 1px; }
.auth-features .aft b { font-size: 14.5px; color: var(--text-primary); }
.auth-features .aft span { font-size: 13px; color: var(--text-muted); }

/* Card refinements for the login page */
.auth-card-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; text-align: center; }
.auth-brand-mark { display: none; }
.auth-trust { margin-top: 6px; text-align: center; font-size: 11.5px; color: var(--text-muted); letter-spacing: .2px; border-top: 1px dashed var(--border); padding-top: 12px; }
.auth-pw-note { margin: 4px 0 0; padding: 8px 12px; font-size: 12px; line-height: 1.45; color: var(--warning, #f5b340); background: color-mix(in srgb, var(--warning, #f5b340) 12%, transparent); border-left: 3px solid var(--warning, #f5b340); border-radius: 8px; }
.win-dl { display: block; text-align: center; margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-decoration: none; border: 1px solid var(--border); transition: border-color .15s, color .15s, background .15s; }
.win-dl:hover { color: var(--text-primary); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.linux-steps { text-align: left; line-height: 1.7; padding-left: 22px; margin: 4px 0 10px; color: var(--text-secondary); font-size: 14px; }
.linux-steps li { margin-bottom: 8px; }

@media (max-width: 860px) {
  /* Single column, and crucially the FORM comes right after the compact hero —
     above the feature cards — so it's visible without scrolling. */
  .auth-view { place-items: start center; }
  .auth-wrap { grid-template-columns: 1fr; grid-template-areas: "hero" "card" "features"; gap: 16px; max-width: 460px; justify-items: stretch; }
  .auth-card { align-self: start; width: 100%; }
  .auth-hero { align-items: center; text-align: center; gap: 6px; }
  .auth-logo { width: 52px; height: 52px; font-size: 28px; border-radius: 15px; }
  .auth-title { font-size: 27px; }
  .auth-tagline { font-size: 14px; max-width: 36ch; margin: 0 auto; }
  /* Features become compact 2x2 cards below the form (fills space, stays tidy). */
  .auth-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; width: 100%; }
  .auth-features li { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; background: color-mix(in srgb, var(--bg-surface) 80%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
  .auth-features .afi { width: 34px; height: 34px; font-size: 17px; }
  .auth-features .aft b { font-size: 13.5px; }
  .auth-features .aft span { display: none; } /* drop long descriptions on small screens */
}
@media (max-width: 420px) {
  .auth-view { padding: 16px 12px; }
  .auth-title { font-size: 25px; }
  .auth-features .aft b { font-size: 12.5px; }
}
/* The auth view fills the remaining flex space (.auth-view{flex:1;min-height:0;
   overflow-y:auto}) and is the SINGLE scroll container. We deliberately do NOT
   force min-height:100dvh here: on desktop that ADDS a full viewport height on
   top of the .topbar, pushing <body> past the viewport so a document scrollbar
   appears next to the auth view's own inner scrollbar — two scrollbars, plainly
   visible in the desktop app / on Windows where scrollbars aren't overlaid.
   The mobile URL-bar clipping case is handled by the max-width:860px block
   below, which switches the auth page to natural document scroll. */

/* ROOT mobile fix: on the auth page (no .chat-mode) let the WHOLE document scroll
   naturally instead of trapping scroll inside .auth-view. A trapped inner scroll
   tied to height:100% doesn't track the mobile URL bar, so the bottom (feature
   cards / register button) gets clipped and feels unreachable. Natural document
   scroll has correct momentum and always reaches every element. The chat shell
   keeps its fixed-height layout via body.chat-mode. */
@media (max-width: 860px) {
  body:not(.chat-mode) { height: auto; min-height: 100%; }
  body:not(.chat-mode) .auth-view {
    flex: none; overflow: visible; min-height: 0;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }
}

/* ===== Chat layout ===== */
.chat { flex: 1; display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 0; }
.sidebar { background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }

.me-bar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.me-info { display: flex; flex-direction: column; min-width: 0; }
.me-info strong { font-size: 15px; }
.me-status { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Avatars */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: inline-grid; place-items: center; font-weight: 700; color: var(--accent);
  background-size: cover; background-position: center; overflow: hidden; text-transform: uppercase;
}
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.lg { width: 84px; height: 84px; font-size: 30px; }

/* Tabs */
.tabs { display: flex; padding: 8px 8px 0; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; background: transparent; border: none; color: var(--text-muted);
  border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 4px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }

.panel { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }
.panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); padding: 6px 8px; }
.empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 24px 16px; line-height: 1.5; }

/* People lists (chats, friends, search, requests) */
.people { list-style: none; margin: 0; padding: 0; }
.people li {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: var(--radius-sm); cursor: pointer;
}
.people li:hover { background: var(--bg-elevated); }
.people li.active { background: var(--bg-elevated); }
.person-main { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.person-name { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.pn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.person-sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-actions { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; max-width: 56%; }
.person-actions button { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.mute-tag { font-size: 11px; opacity: .65; }
/* Kebab (⋮) on chat rows → opens the chat context menu */
.row-menu-btn { flex: 0 0 auto; background: transparent; border: none; color: var(--text-muted); font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 8px; opacity: 0; transition: opacity .12s; }
.people li:hover .row-menu-btn { opacity: 1; }
.row-menu-btn:hover { background: var(--bg-surface); color: var(--text-primary); }
@media (hover: none) { .row-menu-btn { opacity: .6; } } /* always visible on touch devices */
/* Archived section header in the chat list */
.archive-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; color: var(--text-secondary); font-weight: 600; font-size: 13px; border-radius: var(--radius-sm); }
.archive-header:hover { background: var(--bg-elevated); }
/* The chat context menu reuses .msg-menu; give its buttons room + left-align */
#chatMenu button { text-align: left; padding: 9px 12px; font-size: 14px; background: transparent; color: var(--text-primary); border: none; border-radius: 8px; }
#chatMenu button:hover { background: var(--bg-elevated); }
#chatMenu button.danger-btn { color: var(--danger); }

/* ===== Conversation ===== */
.conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg-primary); }
.conv-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
/* peer-id must be allowed to shrink (min-width:0) so its long name truncates
   instead of pushing the call buttons off the right edge on narrow screens. */
.peer-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; background: transparent; border: none; color: var(--text-primary); font-size: 15px; padding: 4px; }
.peer-id:hover { color: var(--accent); }
.call-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.conv-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); gap: 10px; }
.conv-empty-art { font-size: 56px; color: var(--border); }

.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.bubble {
  max-width: 68%; padding: 9px 13px; border-radius: var(--bubble-radius);
  background: var(--bg-elevated); border: 1px solid var(--border); word-wrap: break-word; line-height: 1.4;
  animation: pop .12s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-contrast); border: none; }
.bubble .meta { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }

.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: var(--bg-secondary); align-items: center; }
.composer #msgInput { flex: 1; min-width: 0; }

.emoji-panel { display: flex; flex-direction: column; padding: 0; background: var(--bg-elevated); border-top: 1px solid var(--border); max-height: 230px; }
.ep-tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--border); }
.ep-tab { background: transparent; border: none; color: var(--text-secondary); font-size: 16px; font-weight: 700; padding: 6px 12px; border-radius: 8px 8px 0 0; cursor: pointer; }
.ep-tab.active { color: var(--text-primary); background: var(--bg-surface); }
.ep-body { display: flex; flex-wrap: wrap; gap: 2px; padding: 10px; overflow-y: auto; max-height: 180px; }
.ep-body span { cursor: pointer; padding: 4px; border-radius: 6px; }
.ep-body.emoji-grid span { font-size: 22px; }
.ep-body.sticker-grid span { font-size: 34px; padding: 6px; }
.ep-body span:hover { background: var(--bg-surface); }
.ep-body.gif-tab { flex-direction: column; align-items: flex-start; gap: 10px; }
.ep-body.gif-tab .muted { margin: 0; }
/* Stickers render large, with no chat-bubble background. */
.bubble.sticker-bubble { background: transparent !important; box-shadow: none !important; padding: 2px 0; }
.sticker-glyph { font-size: 60px; line-height: 1; display: block; }

/* @mentions */
.mention { color: var(--accent); font-weight: 600; }
.bubble.mine .mention { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.mention.me { background: color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 5px; padding: 0 3px; }
.bubble.mention-hit { box-shadow: inset 3px 0 0 var(--accent); } /* a message that @-mentions me */
/* Mention autocomplete popup above the composer */
.mention-box { list-style: none; margin: 0; padding: 6px; max-height: 220px; overflow-y: auto;
  background: var(--bg-surface); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.mention-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.mention-item.active, .mention-item:hover { background: var(--bg-elevated); }
.mention-name { font-weight: 600; }

.file-msg { display: flex; align-items: center; gap: 10px; }
.file-msg .file-icon { font-size: 26px; }
.file-msg .file-meta { display: flex; flex-direction: column; }
.file-msg .file-name { font-weight: 600; word-break: break-all; }
.file-msg .file-size { font-size: 11px; opacity: .7; }
.file-msg button { font-size: 12px; padding: 4px 9px; }

/* Message extras: reply quote, reactions, status, edited/deleted */
.bubble { position: relative; cursor: default; }
.bubble.deleted { opacity: .6; font-style: italic; }
.reply-quote { display: block; border-left: 3px solid currentColor; padding: 2px 8px; margin-bottom: 5px; font-size: 12px; opacity: .8; border-radius: 4px; background: rgba(127,127,127,.12); }
.reply-quote .rq-name { font-weight: 700; }
.edited-tag { font-size: 10px; opacity: .6; margin-left: 6px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reaction { background: rgba(127,127,127,.18); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: 12px; cursor: pointer; line-height: 1.7; }
.reaction.mine-react { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
/* Ticks (✓ sent / ✓✓ read / ✗ failed / … sending). Slightly larger + weighted
   so they stay readable on every theme (not the previous faint 11px). */
.msg-status { font-size: 12px; margin-left: 6px; font-weight: 600; line-height: 1; }
.msg-status.read { color: var(--accent); }
.msg-status.failed { color: var(--danger); font-weight: 700; } /* ✗ — not delivered (e.g. not friends yet) */

/* Own bubbles sit on the .bubble.mine accent gradient with white text. The
   .meta wrapper has opacity:.7 (line ~281) which dimmed the read receipt
   nearly into invisibility. Tinting alone doesn't fix the lighter accents
   (midnight blue, shadow green) — white text on them sits below WCAG 3:1.
   The reliable cross-theme fix is a small semi-transparent dark backdrop
   (pill) behind the tick + "Görüldü" text, so the white glyphs pop on ANY
   accent colour. The pill is subtle (.28 alpha) — visible but not loud. */
.bubble.mine .meta { opacity: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bubble.mine .msg-status,
.bubble.mine .seen-at {
  background: rgba(0,0,0,.42);   /* .42 lifts ✓✓/Görüldü above WCAG AA (4.5:1) even on the brightest accent (shadow theme green) */
  padding: 1px 8px;
  border-radius: 10px;
  color: #fff;
  margin-left: 0;                /* gap on .meta handles spacing */
}
.bubble.mine .msg-status { font-weight: 700; }
.bubble.mine .msg-status.read { text-shadow: 0 0 4px rgba(255,255,255,.45); } /* glow distinguishes ✓✓ from plain ✓ */
.bubble.mine .msg-status.failed { color: #ffd9de; background: rgba(0,0,0,.48); }

/* Voice message player */
.voice-msg { display: flex; align-items: center; gap: 8px; min-width: 180px; }
.voice-msg button.vplay { width: 34px; height: 34px; border-radius: 50%; font-size: 14px; padding: 0; }
.voice-msg .vbar { flex: 1; height: 4px; background: rgba(127,127,127,.3); border-radius: 4px; overflow: hidden; }
.voice-msg .vbar i { display: block; height: 100%; width: 0; background: currentColor; }
.voice-msg .vdur { font-size: 11px; opacity: .8; }

/* Reply bar (composer) */
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-elevated); border-top: 1px solid var(--border); font-size: 13px; }
.reply-bar .reply-preview { flex: 1; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-icon { color: var(--accent); }

/* In-chat search bar */
.chat-search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-elevated); border-bottom: 1px solid var(--border); }
.chat-search-bar input { flex: 1; min-width: 0; background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.chat-search-bar .chat-search-count { font-size: 12px; color: var(--text-muted); min-width: 38px; text-align: center; }
.bubble.search-hit { box-shadow: inset 0 0 0 1px var(--accent); }
.bubble.search-current { box-shadow: 0 0 0 2px var(--accent); }

/* Pinned message bar */
.pinned-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.pinned-bar .reply-preview { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fwd-tag { display: block; font-size: 11px; opacity: .7; font-style: italic; margin-bottom: 3px; }
.bubble.flash { animation: flash 1s ease-out; }
@keyframes flash { 0% { background: var(--accent); } 100% {} }

/* Typing indicator */
.peer-id-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.peer-id-text #peerName { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing-ind { font-size: 11px; color: var(--accent); }

/* Recording state */
.composer.recording #voiceBtn { background: var(--danger); color: #fff; border-color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* Message context menu */
.msg-menu { position: fixed; z-index: 60; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; min-width: 150px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100dvh - 16px); overflow-y: auto; }
.msg-menu button { background: transparent; color: var(--text-primary); border: none; text-align: left; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.msg-menu button:hover { background: var(--bg-elevated); }
.msg-menu .quick-react { display: flex; gap: 4px; padding: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.msg-menu .quick-react span { cursor: pointer; font-size: 20px; padding: 3px; border-radius: 6px; }
.msg-menu .quick-react span:hover { background: var(--bg-elevated); }

/* ===== Page/screen open–close transitions (Telegram-like) ===== */
.overlay { animation: overlayIn .18s ease-out; }
.overlay .card, .call-card { animation: cardIn .22s cubic-bezier(.2,.8,.3,1); }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.conversation:not(.conv-empty-only) { animation: convIn .18s ease-out; }
@keyframes convIn { from { opacity: .5; } to { opacity: 1; } }

/* ===== Overlays / modals ===== */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.7); backdrop-filter: blur(3px); padding: 16px; }
.modal .card { width: min(420px, 94vw); position: relative; max-height: 90vh; overflow-y: auto; }
.close { position: absolute; top: 12px; right: 12px; background: transparent; border: none; color: var(--text-muted); font-size: 16px; padding: 4px 8px; }
.profile-card { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.profile-card h2 { margin: 6px 0 0; }
.profile-status { color: var(--text-secondary); margin: 0; }
.profile-bio { color: var(--text-muted); margin: 4px 0 0; }
.profile-actions { margin-top: 14px; width: 100%; flex-wrap: wrap; }

/* Key verification (safety number) */
.verify-card { width: min(440px, 94vw); display: flex; flex-direction: column; gap: 12px; }
.safety-number {
  font-family: var(--font-mono, ui-monospace, 'JetBrains Mono', monospace);
  font-size: 19px; letter-spacing: 2px; line-height: 1.8; text-align: center;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--text-primary);
}
#verifyBtn.verified { color: var(--online); }
.settings-card { display: flex; flex-direction: column; gap: 12px; }
.settings-card h2, .settings-card h3 { margin: 0; }
.settings-card h3 { font-size: 13px; color: var(--text-secondary); border-top: 1px solid var(--border); padding-top: 12px; }
.row-field { flex-direction: row; align-items: center; justify-content: space-between; }
.row-field select { width: 50%; }
.avatar-edit { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* Avatar cropper */
.crop-card { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.crop-card h2 { margin: 0; align-self: flex-start; }
.crop-viewport { position: relative; width: 300px; height: 300px; max-width: 80vw; max-height: 80vw; border-radius: 12px; overflow: hidden; background: #000; cursor: grab; touch-action: none; }
.crop-viewport:active { cursor: grabbing; }
.crop-viewport canvas { display: block; width: 100%; height: 100%; }
/* circular guide: a centred circle whose huge outer shadow dims everything
   outside it, so the user sees exactly what will land in the round avatar */
.crop-ring { position: absolute; inset: 0; pointer-events: none; }
.crop-ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.85); }
.crop-zoom { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--text-secondary); }
.crop-zoom input[type=range] { flex: 1; accent-color: var(--accent); }
.crop-actions { display: flex; gap: 10px; width: 100%; }
.crop-actions button { flex: 1; }

/* Group settings: photo picker, permissions, invite link */
.group-photo-pick { position: relative; width: 120px; height: 120px; margin: 4px auto 8px; }
.group-photo-pick .avatar { width: 120px; height: 120px; font-size: 44px; }
.photo-fab { position: absolute; right: -2px; bottom: -2px; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px; border: 3px solid var(--bg-secondary);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-contrast); }
.perm-list { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 10px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.perm-row:last-child { border-bottom: none; }
.perm-row span { color: var(--text-primary); font-size: 14px; }
.perm-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: 0 0 auto; }
.invite-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.invite-link { flex: 1 1 100%; font-size: 12px; color: var(--text-secondary); }
#groupInfoMeta { font-size: 12px; margin: 2px 0 8px; }

/* Call screen — full-bleed (override the modal centering/padding of .overlay) */
#callScreen { padding: 0; display: block; }
.call-card { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; min-width: 280px; }

/* ===== Gelen çağrı ekranı (yenilenmiş tasarım) =====
   Üst label → pulse halkalı büyük avatar → arayan adı → arama tipi →
   yuvarlak yeşil/kırmızı aksiyon butonları (whatsapp/iphone tarzı). */
.incoming-frame {
  position: relative;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 30px 28px 28px;
  width: min(360px, 94vw);
  text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04) inset;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  animation: cardIn .28s cubic-bezier(.2,.8,.3,1);
}
.incoming-label {
  font-size: 11.5px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700;
}
.incoming-avatar-wrap {
  position: relative; width: 132px; height: 132px;
  display: grid; place-items: center; margin: 6px 0 4px;
}
.incoming-avatar {
  position: relative; width: 116px; height: 116px; border-radius: 50%;
  font-size: 44px; z-index: 2;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 4px var(--bg-surface);
}
.incoming-pulse {
  position: absolute; left: 50%; top: 50%;
  width: 116px; height: 116px; margin: -58px 0 0 -58px;
  border-radius: 50%; border: 2px solid var(--accent);
  animation: incomingPulse 1.9s ease-out infinite;
  opacity: 0; pointer-events: none;
}
.incoming-pulse.delay-1 { animation-delay: .63s; }
.incoming-pulse.delay-2 { animation-delay: 1.26s; }
@keyframes incomingPulse {
  0%   { transform: scale(.92); opacity: 0; }
  20%  { opacity: .55; }
  100% { transform: scale(1.7);  opacity: 0; }
}
.incoming-name {
  font-size: 23px; font-weight: 700; color: var(--text-primary);
  max-width: 100%; padding: 0 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -.01em;
}
.incoming-kind {
  font-size: 13.5px; color: var(--text-secondary); margin-top: -2px;
  display: inline-flex; align-items: center; gap: 6px;
}
.incoming-actions { display: flex; gap: 56px; margin-top: 16px; }
.incoming-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 0;
  cursor: pointer; color: #fff; font-size: 26px; line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 12px 28px rgba(0,0,0,.4);
  transition: transform .12s ease, filter .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.incoming-btn:hover  { filter: brightness(1.1); }
.incoming-btn:active { transform: translateY(2px) scale(.95); }
.incoming-ico { display: block; font-weight: 700; }
.incoming-reject { background: linear-gradient(135deg, #f0596b, #c93b50); animation: incomingShake 1.6s ease-in-out infinite; }
.incoming-accept { background: linear-gradient(135deg, #3fcf8e, #1bb673); animation: incomingPulseBtn 1.4s ease-in-out infinite; }
.incoming-reject .incoming-ico { transform: scale(1.05); }
.incoming-accept .incoming-ico { transform: rotate(8deg); animation: phoneShake 1.4s ease-in-out infinite; }

@keyframes incomingShake {
  0%, 100% { transform: rotate(0); }
  10%, 30%, 50% { transform: rotate(-10deg); }
  20%, 40%      { transform: rotate(10deg); }
  60% { transform: rotate(0); }
}
@keyframes incomingPulseBtn {
  0%, 100% { box-shadow: 0 12px 28px rgba(0,0,0,.4), 0 0 0 0 rgba(63,207,142,.55); }
  60%      { box-shadow: 0 12px 28px rgba(0,0,0,.4), 0 0 0 16px rgba(63,207,142,0); }
}
@keyframes phoneShake {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-14deg); }
  40%, 80% { transform: rotate(14deg); }
}

@media (max-width: 480px) {
  .incoming-frame { padding: 26px 22px 24px; gap: 10px; }
  .incoming-avatar-wrap { width: 116px; height: 116px; }
  .incoming-avatar { width: 100px; height: 100px; font-size: 38px; }
  .incoming-pulse { width: 100px; height: 100px; margin: -50px 0 0 -50px; }
  .incoming-name { font-size: 21px; }
  .incoming-actions { gap: 48px; margin-top: 14px; }
  .incoming-btn { width: 58px; height: 58px; font-size: 24px; }
}
.call-stage { position: relative; width: 100%; height: 100%; overflow: hidden; }
#remoteVideo { width: 100%; height: 100%; object-fit: cover; background: #000; }
#localVideo { position: absolute; right: 16px; top: 16px; width: 132px; max-width: 30vw; aspect-ratio: 3/4; border-radius: 16px; border: 2px solid rgba(255,255,255,.5); box-shadow: 0 8px 28px rgba(0,0,0,.5); object-fit: cover; background: #111; z-index: 3; }
#localVideo.mirror { transform: scaleX(-1); } /* selfie view, like every messenger */
/* Remote-side poster: soft gradient + avatar while the peer's frames aren't up */
.call-remote-poster { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--accent) 22%, #0b0d12), #0b0d12 72%); color: #fff; }
.call-remote-poster strong { font-size: 20px; }
.call-remote-poster .muted { color: rgba(255,255,255,.6); }
.call-info { position: absolute; top: 16px; left: 16px; color: #fff; background: rgba(0,0,0,.5); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
/* Control bar: wraps so no button (incl. hangup) can ever overflow off-screen
   when the camera turns on and a 5th button appears; tinted so it stays legible
   over video. */
.call-controls { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; z-index: 5;
  max-width: 94vw; padding: 10px 16px; border-radius: 999px;
  background: rgba(0,0,0,.34); backdrop-filter: blur(8px); }
.call-info, .call-participants { z-index: 4; }
.call-controls .icon { width: 56px; height: 56px; border-radius: 50%; font-size: 22px; background: rgba(255,255,255,.12); color: #fff; flex: 0 0 auto; }
.call-controls .icon:hover { background: rgba(255,255,255,.22); }
.call-controls .icon.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.call-controls .icon.off { opacity: .5; }
.call-controls .icon.active { background: var(--accent); color: var(--accent-contrast); }

/* Digital call visualizer (sound waves) — shown for voice calls */
.call-viz { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background:
  radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--accent) 10%, #000), #000 70%); }
.call-stage.has-video .call-viz { display: none; }
.call-participants { position: absolute; top: 60px; left: 0; right: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.call-chip { display: flex; align-items: center; gap: 7px; background: rgba(0,0,0,.55); color: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.call-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.call-chip .dot.live { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* Invite picker reuses .people */
#inviteList { max-height: 50vh; overflow-y: auto; }

/* Call avatar (round) shown while connecting / for voice calls */
.avatar.xl { width: 120px; height: 120px; font-size: 44px; box-shadow: 0 0 44px color-mix(in srgb, var(--accent) 45%, transparent); }
.call-avatar-wrap { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.call-stage.has-video .call-avatar-wrap { display: none; }

/* In-app dialog (confirm/alert/prompt replacement) */
.ui-dialog { width: min(380px, 92vw); display: flex; flex-direction: column; gap: 14px; }
.ui-dialog h2 { margin: 0; font-size: 18px; }
.ui-dialog-msg { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.ui-dialog-input { width: 100%; }
.ui-dialog-actions { justify-content: flex-end; }
.ui-dialog-actions button { flex: 0 0 auto; min-width: 96px; }

/* Registration success modal — clear confirmation + bold save-password warning */
.reg-done { width: min(400px, 92vw); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.reg-done-icon { font-size: 44px; line-height: 1; }
.reg-done h2 { margin: 0; }
.reg-warn { width: 100%; text-align: left; background: color-mix(in srgb, var(--danger) 12%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; }
.reg-warn b { color: var(--danger); font-size: 14px; }
.reg-warn span { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* Centered system note in a conversation (call log entries, etc.) */
.system-note { align-self: center; max-width: 80%; text-align: center; margin: 6px auto; padding: 4px 12px;
  font-size: 12px; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: 999px; }

/* View-once photo card + lit composer button */
#viewOnceBtn.on { color: var(--accent-contrast); background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.view-once { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-elevated)); border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); color: var(--text-primary); font-size: 14px; }
.view-once:hover { background: color-mix(in srgb, var(--accent) 26%, var(--bg-elevated)); }
.view-once.done { cursor: default; opacity: .6; border-style: solid; background: var(--bg-elevated); }
/* Full-screen view-once viewer */
.vo-viewer { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
#viewOnceImg { max-width: 94vw; max-height: 82vh; border-radius: 10px; box-shadow: 0 12px 50px rgba(0,0,0,.6); }
.vo-hint { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.8); background: rgba(0,0,0,.45); padding: 6px 14px; border-radius: 999px; font-size: 13px; }

/* Inline image messages */
.img-msg img { max-width: min(260px, 60vw); max-height: 320px; border-radius: 10px; display: block; cursor: pointer; background: rgba(127,127,127,.15); }

/* Mobile back button (in conversation header) */
.back-btn { display: none; background: transparent; border: none; color: var(--text-primary); font-size: 20px; padding: 4px 8px; }

/* ===== Mobile / responsive ===== */
html, body { overscroll-behavior: none; }
.messages, .panel, .modal .card, #inviteList { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.topbar { padding-top: max(10px, env(safe-area-inset-top)); }
.composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }

@media (max-width: 720px) {
  /* Lock to viewport ONLY in the chat shell. The auth/login page must scroll
     freely on small screens, or its lower half (features + footer) gets clipped. */
  body.chat-mode { overflow: hidden; height: 100vh; height: 100dvh; }
  /* 16px inputs prevent iOS from auto-zooming (the "screen shift" on focus). */
  input, select, textarea, #msgInput { font-size: 16px; }
  .brand { font-size: 15px; }
  .controls select { max-width: 104px; font-size: 13px; }

  .chat { grid-template-columns: minmax(0, 1fr); }
  .sidebar { width: 100%; }
  .conversation { display: none; }
  .chat.in-convo .sidebar { display: none; }
  .chat.in-convo .conversation { display: flex; animation: slideIn .22s ease-out; }
  @keyframes slideIn { from { transform: translateX(16%); opacity: .5; } to { transform: none; opacity: 1; } }
  .back-btn { display: inline-flex; }

  .bubble { max-width: 84%; }
  .call-controls .icon { width: 52px; height: 52px; }
  /* Touch targets */
  button, .people li, .tab { min-height: 40px; }
}

@media (max-width: 720px) {
  .chat { grid-template-columns: minmax(0, 1fr); }
  .conversation.show { position: fixed; inset: 49px 0 0; z-index: 30; }
}

/* ============================================================ */
/* ===== Modern polish layer (Element/Discord-like) ========== */
/* ============================================================ */
.topbar { backdrop-filter: blur(8px); background: color-mix(in srgb, var(--bg-secondary) 88%, transparent); }
.brand { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search-wrap input { background: var(--bg-elevated); border-radius: 999px; padding-left: 16px; }

.sidebar { background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary)); }
.me-bar { gap: 12px; }

/* Gradient initials avatars; image overrides the gradient when set.
   Use the background-image longhand (NOT the `background` shorthand) so it does
   not reset background-size:cover / background-position:center from .avatar —
   otherwise an uploaded photo renders at natural size in the top-left corner. */
.avatar { background-image: linear-gradient(135deg, var(--accent), var(--accent-2)); background-color: var(--bg-elevated); background-size: cover; background-position: center; color: #fff; border: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.avatar.xl { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent), 0 10px 40px rgba(0,0,0,.4); }

/* Tabs */
.tab { font-size: 14px; }
.tab.active { color: var(--text-primary); }
.tab.active::after { content: ''; }

/* People rows — softer, roomier */
.people li { padding: 11px 12px; border-radius: 12px; gap: 12px; }
.people li:hover { background: var(--bg-elevated); }
.people li.active { background: color-mix(in srgb, var(--accent) 16%, var(--bg-elevated)); }
.person-name { font-size: 15px; font-weight: 600; }

/* Conversation + bubbles */
.conv-header { backdrop-filter: blur(6px); background: color-mix(in srgb, var(--bg-secondary) 90%, transparent); }
.messages { padding: 20px; gap: 6px; }
.bubble { box-shadow: 0 1px 2px rgba(0,0,0,.18); font-size: 15px; padding: 9px 14px; }
.bubble:not(.mine) { background: var(--bg-surface); border-color: var(--border-soft); }
.bubble.mine { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.bubble .meta { font-size: 11px; }

/* Composer */
.composer { padding: 14px; gap: 10px; }
.composer #msgInput { border-radius: 999px; background: var(--bg-elevated); padding: 11px 16px; }
.composer #sendBtn { border-radius: 999px; padding: 10px 20px; }

/* Cards / modals — soft elevated */
.card { border-radius: 18px; border-color: var(--border-soft); }
.auth-brand { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Context menu — readable */
.msg-menu { min-width: 184px; border-radius: 14px; padding: 8px; }
.msg-menu button { font-size: 15px; padding: 10px 12px; }
.msg-menu .quick-react span { font-size: 22px; padding: 5px; }

/* Reactions */
.reaction { padding: 1px 9px; line-height: 1.8; font-size: 13px; }

/* ===== Mobile readability ===== */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .brand { font-size: 16px; }
  /* Shrink the brand to just the mark so the controls (incl. the ⚙️ gear that
     opens Settings → Logout) always fit and are never pushed off-screen. */
  .brand-word { display: none; }
  /* Logout lives in Settings on mobile — frees crowded topbar space. */
  #logoutBtn { display: none; }
  .controls { gap: 4px; }
  .controls select { font-size: 13px; padding: 7px 6px; max-width: 104px; }
  .controls .icon { padding: 8px 8px; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .messages { padding: 14px; }
  .bubble { max-width: 86%; font-size: 15px; }
  .msg-menu { min-width: 60vw; }
  .msg-menu button { padding: 13px 14px; font-size: 16px; }
  .modal .card { width: 94vw; border-radius: 16px; }
  .people li { padding: 13px 12px; }
  .tab { padding: 12px 4px; font-size: 14px; }
  .call-controls .icon { width: 56px; height: 56px; }

  /* Composer: give the text box the room. Compact the icons and move the two
     niche actions (self-destruct, steganography) out of the bar so the input
     isn't squeezed to a sliver on a phone. */
  .composer { gap: 2px; padding: 8px 6px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .composer .icon { padding: 6px 5px; font-size: 19px; min-height: 40px; }
  .composer #ttlBtn, .composer #stegoBtn { display: none; }
  /* min-width:0 (not 120px) so the input yields and the Send button is never
     pushed off the right edge; flex-basis keeps it as wide as possible. */
  .composer #msgInput { flex: 1 1 0; min-width: 0; padding: 12px 14px; }
  .composer #sendBtn { flex: 0 0 auto; padding: 11px 14px; }
  /* conversation header: tighter call icons so all of them fit on a phone */
  .call-actions { gap: 2px; }
  .call-actions .icon { padding: 7px 7px; }
}

/* Admin panel stats */
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 4px; }
.admin-stat { background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: 14px; padding: 14px; text-align: center; }
.admin-stat b { display: block; font-size: 24px; color: var(--accent); }
.admin-stat span { font-size: 12px; color: var(--text-muted); }

/* Admin abuse-reports list */
.admin-reports { display: flex; flex-direction: column; gap: 10px; padding: 0; list-style: none; }
.report-row { background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.report-row.open { border-color: color-mix(in srgb, var(--danger) 60%, var(--border-soft)); }
.report-row.resolved { opacity: 0.72; }
.report-head { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; align-items: center; }
.report-kind { background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 11px; }
.report-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-secondary); }
.report-status.open { background: color-mix(in srgb, var(--danger) 24%, transparent); color: var(--danger); font-weight: 600; }
.report-ts { font-size: 11px; }
.report-reason { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.report-snippet { font-size: 13px; line-height: 1.5; padding: 8px 12px; background: var(--bg-secondary); border-radius: 10px; border-left: 3px solid var(--accent); white-space: pre-wrap; word-break: break-word; }
.report-actions { display: flex; gap: 8px; }
.report-actions button { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* Burner chat (ephemeral) */
.burner-box { width: min(560px, 96vw); height: min(80vh, 760px); background: var(--bg-surface); border: 1px solid var(--border); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.burner-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, color-mix(in srgb, var(--danger) 22%, var(--bg-secondary)), var(--bg-secondary)); }
.burner-peers { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.burner-share { padding: 10px 14px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.burner-share input { flex: 1; font-size: 12px; }
.burner-box .messages { flex: 1; }

/* =====================================================================
   POLISH LAYER 3 — fuller, classier shell (empty states, depth, chrome).
   Appended at EOF so it overrides cleanly without touching earlier rules.
   ===================================================================== */

/* --- Conversation pane: depth instead of flat black --- */
.conversation {
  background:
    radial-gradient(1100px 560px at 72% -12%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 60%),
    radial-gradient(820px 460px at 105% 112%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 55%),
    var(--bg-primary);
}

/* --- Empty conversation: a real welcome hero --- */
.conv-empty { gap: 14px; padding: 24px; position: relative; }
.conv-empty::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--text-muted) 9%, transparent) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 70%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 70%);
}
.conv-empty > * { position: relative; }
.conv-empty-art {
  width: 96px; height: 96px; display: grid; place-items: center; font-size: 44px;
  color: var(--accent-contrast); border-radius: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 20px 56px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .conv-empty-art { animation: none; } }
.conv-empty-title { margin: 6px 0 0; font-size: 23px; font-weight: 800; color: var(--text-primary); letter-spacing: -.3px; }
.conv-empty p { color: var(--text-muted); margin: 0; max-width: 44ch; }
.empty-tips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; max-width: 460px; }
.empty-tips .tip {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--bg-surface) 80%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); white-space: nowrap;
}

/* --- Sidebar list empty states: icon + breathing room (fills the void) --- */
.empty { padding: clamp(36px, 16vh, 150px) 22px 0; max-width: 30ch; margin: 0 auto; font-size: 14px; }
.empty::before { content: '💬'; display: block; font-size: 42px; margin: 0 auto 14px; opacity: .55; line-height: 1; }
#friendsEmpty::before { content: '👋'; }
#reqEmpty::before { content: '📭'; }

/* --- Sidebar / me-bar / search polish --- */
.me-bar { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--bg-secondary)), var(--bg-secondary)); }
.search-wrap input { background: var(--bg-elevated); border-radius: 999px; }
.search-wrap input:focus { background: var(--bg-surface); }
.people li { transition: background .12s ease, transform .06s ease; }
.people li:active { transform: scale(.99); }
.tab { position: relative; transition: color .12s ease; }

/* --- Top bar: balanced + subtle brand glow --- */
.topbar { backdrop-filter: blur(10px); background: color-mix(in srgb, var(--bg-secondary) 86%, transparent); }
.brand { text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 40%, transparent); }
.topbar .controls select, .topbar .controls .icon { transition: filter .12s, background .12s, color .12s; }

/* --- Composer: a touch more finished --- */
.composer { background: color-mix(in srgb, var(--bg-secondary) 92%, transparent); backdrop-filter: blur(8px); }
#msgInput { background: var(--bg-elevated); border-radius: 999px; }
#msgInput:focus { background: var(--bg-surface); }
#sendBtn { border-radius: 999px; padding-inline: 18px; }

/* --- Message bubbles: softer, with depth --- */
.bubble { box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.bubble.sticker-bubble { box-shadow: none !important; }

/* Mobile: keep the welcome hero compact and the tips tidy */
@media (max-width: 600px) {
  .conv-empty-art { width: 84px; height: 84px; font-size: 38px; border-radius: 24px; }
  .conv-empty-title { font-size: 20px; }
  .empty-tips { gap: 8px; }
  .empty-tips .tip { padding: 8px 12px; font-size: 12.5px; }
}

/* ===== read-receipt "Görüldü HH:MM" =====
   Always appears inside .bubble.mine (only own messages can be "seen"). The
   default rule is a sane fallback for any non-accent background; the
   .bubble.mine pill styling lives next to the .msg-status rules above. */
.seen-at { font-size: 11.5px; color: var(--text-secondary); margin-left: 6px; white-space: nowrap; font-weight: 600; }

/* ===== profile handle (@username under display name) ===== */
.profile-handle { margin: 2px 0 6px; color: var(--text-muted); font-size: 14px; text-align: center; }

/* ===== profile wall (public posts) ===== */
.wall { width: 100%; align-self: stretch; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; text-align: left; }
.wall-title { margin: 0 0 10px; font-size: 15px; color: var(--text-secondary); }
.wall-compose { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 14px; }
.wall-compose textarea { width: 100%; resize: vertical; box-sizing: border-box; }
.wall-compose-actions { margin-top: 8px; gap: 8px; }
.wall-img-preview { position: relative; margin-top: 8px; display: inline-block; }
.wall-img-preview img { max-width: 100%; max-height: 220px; border-radius: var(--radius-sm); display: block; }
.wall-img-rm { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 26px; height: 26px; cursor: pointer; padding: 0; }
.wall-list { display: flex; flex-direction: column; gap: 12px; }
.post-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-meta { flex: 1; min-width: 0; }
.post-author { font-weight: 600; }
.post-time { font-size: 12px; color: var(--text-muted); }
.post-del { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; }
.post-del:hover { color: var(--danger); }
.post-text { margin: 10px 0 0; white-space: pre-wrap; word-break: break-word; }
.post-img { margin-top: 10px; max-width: 100%; border-radius: var(--radius-sm); display: block; }
.post-acts { margin-top: 10px; display: flex; gap: 12px; }
.post-like { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); border-radius: 20px; padding: 4px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.post-like.liked { color: var(--danger); border-color: var(--danger); }
.post-comments { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.post-comment { font-size: 14px; background: var(--bg-elevated); padding: 6px 10px; border-radius: var(--radius-sm); word-break: break-word; }
.post-comment-add { margin-top: 8px; display: flex; gap: 8px; }
.post-comment-add input { flex: 1; }
.post-comment-add button { white-space: nowrap; }

/* =====================================================================
   LOGIN ANIMATED MOTIFS — brand diamonds drifting, an aurora glow and
   thin rings, so the auth page greets you with subtle living movement.
   CSS-only (GPU transforms), behind the content, reduced-motion aware.
   ===================================================================== */
.auth-bg .aurora {
  position: absolute; left: 50%; top: 45%; width: 150vmax; height: 150vmax;
  transform: translate(-50%, -50%); border-radius: 45%;
  background: conic-gradient(from 0deg,
    color-mix(in srgb, var(--accent) 22%, transparent), transparent 25%,
    color-mix(in srgb, var(--accent-2) 22%, transparent) 50%, transparent 72%,
    color-mix(in srgb, var(--accent) 22%, transparent));
  filter: blur(90px); opacity: .32; animation: auroraSpin 42s linear infinite;
}
@keyframes auroraSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.auth-bg .motif {
  position: absolute; color: var(--accent); opacity: .16; font-weight: 700; line-height: 1;
  text-shadow: 0 0 34px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: motifDrift linear infinite; will-change: transform; user-select: none;
}
.auth-bg .m1 { left: 8%;  top: 18%; font-size: 64px; animation-duration: 26s; }
.auth-bg .m2 { left: 82%; top: 22%; font-size: 40px; opacity: .14; animation-duration: 32s; animation-direction: reverse; }
.auth-bg .m3 { left: 70%; top: 66%; font-size: 90px; opacity: .12; animation-duration: 38s; }
.auth-bg .m4 { left: 15%; top: 74%; font-size: 52px; opacity: .15; animation-duration: 30s; animation-direction: reverse; }
.auth-bg .m5 { left: 47%; top: 10%; font-size: 30px; opacity: .16; animation-duration: 22s; }
.auth-bg .m6 { left: 90%; top: 56%; font-size: 34px; opacity: .13; animation-duration: 34s; }
.auth-bg .m7 { left: 33%; top: 84%; font-size: 44px; opacity: .14; animation-duration: 28s; animation-direction: reverse; }
@keyframes motifDrift {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(0, -36px) rotate(180deg); }
  100% { transform: translate(0, 0) rotate(360deg); }
}

.auth-bg .ring {
  position: absolute; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  opacity: .45; animation: ringFloat ease-in-out infinite; will-change: transform;
}
.auth-bg .rg1 { width: 260px; height: 260px; left: 11%; top: 42%; animation-duration: 24s; }
.auth-bg .rg2 { width: 180px; height: 180px; right: 13%; top: 30%; animation-duration: 30s; animation-direction: reverse; }
@keyframes ringFloat { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(22px,-26px) scale(1.12); } }

@media (prefers-reduced-motion: reduce) { .auth-bg .aurora, .auth-bg .motif, .auth-bg .ring { animation: none; } }
@media (max-width: 600px) {
  .auth-bg .m3, .auth-bg .m6, .auth-bg .rg2 { display: none; }
  .auth-bg .motif { opacity: .07; }
  .auth-bg .aurora { opacity: .26; }
}

/* --- Presence dot on friend avatars (green=online, red=offline) --- */
.av-wrap { position: relative; flex: 0 0 auto; display: inline-flex; }
.av-wrap .presence { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg-secondary); box-sizing: border-box; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.av-wrap .presence.on { background: var(--online); }
.av-wrap .presence.off { background: var(--danger); }

/* --- Login/Register segmented toggle: the tabs set the mode, the display-name
   field shows only in Register, and the active mode's button is the primary
   action while the other is a slim secondary. Both buttons stay visible &
   clickable (so nothing that targets them breaks). --- */
.auth-tabs { display: flex; gap: 6px; background: var(--bg-elevated); padding: 4px; border-radius: 12px; }
.auth-tab { flex: 1; background: transparent; color: var(--text-secondary); border: none; padding: 9px 10px; border-radius: 9px; font-weight: 700; font-size: 14px; cursor: pointer; }
.auth-tab:hover { color: var(--text-primary); }
.auth-tab.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,.22); }
.auth-card.mode-login #authDisplayField { display: none; }
/* Primary = active mode's action (full width, gradient); secondary = a slim ghost. */
.auth-card.mode-login #loginBtn, .auth-card.mode-register #registerBtn { flex: 1 1 auto; order: 1; }
.auth-card.mode-login #registerBtn, .auth-card.mode-register #loginBtn {
  flex: 0 0 auto; order: 2; background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); font-weight: 600;
}
.auth-card.mode-login #registerBtn:hover, .auth-card.mode-register #loginBtn:hover { color: var(--text-primary); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* --- Minimized call: shrink the full call overlay to a floating mini-bar so
   the rest of the app stays usable; click the bar to restore. --- */
#callScreen.min { position: fixed; inset: auto; right: 16px; bottom: 16px; width: min(300px, 86vw); height: auto; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 0; backdrop-filter: none; display: block; overflow: hidden; cursor: pointer; animation: none; }
#callScreen.min .call-stage { position: static; width: auto; height: auto; padding: 10px 12px; display: flex; align-items: center; gap: 10px; overflow: visible; }
#callScreen.min #remoteVideo, #callScreen.min #callViz, #callScreen.min .call-avatar-wrap,
#callScreen.min #remotePoster, #callScreen.min #localVideo, #callScreen.min .call-participants { display: none !important; }
#callScreen.min .call-info { position: static; top: auto; left: auto; background: transparent; color: var(--text-primary); padding: 0; font-size: 13px; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#callScreen.min .call-controls { position: static; transform: none; bottom: auto; left: auto; padding: 0; gap: 6px; flex: 0 0 auto; box-shadow: none; background: transparent; }
#callScreen.min .call-controls .icon { width: 38px; height: 38px; font-size: 16px; }
/* In the mini bar keep only mic + hang up; clicking the bar restores. */
#callScreen.min #toggleCamBtn, #callScreen.min #flipCamBtn, #callScreen.min #screenShareBtn,
#callScreen.min #inviteCallBtn, #callScreen.min #minCallBtn { display: none; }
.call-controls #minCallBtn { font-weight: 800; }

/* --- Instant styled tooltips (replaces the slow native title popup) --- */
.tip-pop {
  position: fixed; z-index: 9999; pointer-events: none;
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px;
  font-size: 12px; font-weight: 500; line-height: 1.35; max-width: 240px;
  white-space: normal; box-shadow: var(--shadow); animation: tipIn .1s ease-out;
}
@keyframes tipIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ===== Shadow Arena (first-person AK47 duel) ===== */
.arena { position: relative; width: 100%; height: 100%; min-height: 60vh; overflow: hidden; background: #05070a; border-radius: var(--radius-sm); touch-action: none; user-select: none; }
.arena-cv { display: block; width: 100%; height: 100%; cursor: crosshair; }
.arena-hud { position: absolute; inset: 0; pointer-events: none; font-weight: 700; }
.ar-top { position: absolute; top: 10px; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 14px; color: #fff; text-shadow: 0 1px 4px #000; }
.ar-score b { font-size: 18px; } .ar-score b#arEn { color: var(--danger, #f0596b); }
.ar-tag { background: rgba(0,0,0,.45); padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.ar-cross { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); color: rgba(255,255,255,.8); font-size: 22px; text-shadow: 0 0 4px #000; }
.ar-bottom { position: absolute; left: 14px; right: 14px; bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ar-hp { flex: 0 0 200px; max-width: 45%; height: 14px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; overflow: hidden; }
.ar-hp i { display: block; height: 100%; width: 100%; background: var(--online,#3fcf8e); transition: width .12s, background .2s; }
.ar-ammo { color: #fff; text-shadow: 0 1px 4px #000; background: rgba(0,0,0,.45); padding: 4px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.ar-hint { position: absolute; left: 0; right: 0; bottom: 40px; text-align: center; color: rgba(255,255,255,.7); font-size: 12px; text-shadow: 0 1px 3px #000; font-weight: 500; }
.ar-hint.flash { color: #ffd34d; font-size: 15px; font-weight: 800; }
.ar-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%); font-size: clamp(28px, 7vw, 56px); font-weight: 900; letter-spacing: 1px; padding: 14px 28px; border-radius: 16px; background: rgba(0,0,0,.6); }
.ar-banner.win { color: #ffd34d; box-shadow: 0 0 60px rgba(255,211,77,.4); }
.ar-banner.lose { color: var(--danger,#f0596b); }
/* touch controls */
.ar-touch { pointer-events: none; }
.ar-stick { pointer-events: auto; position: absolute; left: 18px; bottom: 70px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); }
.ar-stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,.35); }
.ar-fire { pointer-events: auto; position: absolute; right: 22px; bottom: 96px; width: 84px; height: 84px; border-radius: 50%; font-size: 30px; background: rgba(240,89,107,.85); color: #fff; border: 2px solid rgba(255,255,255,.4); }
.ar-reload { pointer-events: auto; position: absolute; right: 120px; bottom: 70px; width: 56px; height: 56px; border-radius: 50%; font-size: 22px; background: rgba(0,0,0,.5); color: #fff; border: 2px solid rgba(255,255,255,.3); }
