/* Graphite chat: existing screens and actions keep their positions. */
:root {
  --bg-0:#17191d;
  --bg-1:#1b1e23;
  --card:#25292f;
  --card-2:#30353d;
  --border:rgba(255,255,255,.065);
  --border-strong:rgba(255,255,255,.12);
  --fg:#f2f3f5;
  --muted:#939ba8;
  --accent:#6aa8ff;
  --accent-2:#4389ee;
  --green:#7cbaa4;
  --red:#ed727d;
  --error:#ed727d;
}
body {
  background:#17191d;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;
}
#chat-view {
  background:#191c21;
  isolation:isolate;
}
.chat-top {
  flex-shrink:0;
  min-height:76px;
  padding:14px 12px;
  padding-top:max(env(safe-area-inset-top),14px);
  background:#202329;
  border-bottom:1px solid rgba(255,255,255,.045);
  gap:8px;
  backdrop-filter:none;
}
.chat-top .icon-btn {
  background:transparent;
  width:32px;
  height:44px;
  padding:0;
  flex-shrink:0;
  color:#c7ced8;
}
.chat-peer {gap:11px}
.chat-peer .av {
  width:43px;height:43px;
  font-size:21px;font-weight:600;
  border:1px solid rgba(255,255,255,.07);
}
.chat-peer .av .online-dot {border-color:#202329;background:#82bea7;width:10px;height:10px}
.chat-peer .name {font-size:16px;font-weight:600;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-peer .sub {font-size:12px;margin-top:2px;color:#939ba8;display:block}
.chat-peer .sub.online {color:#93aabd}
.chat-actions {gap:1px;flex-shrink:0}
.chat-act-btn {width:36px;height:42px;border-radius:12px}
.chat-act-btn.audio,.chat-act-btn.search {background:transparent;color:#aeb8c6}
.chat-act-btn.video {background:rgba(106,168,255,.10);color:#80b5ff}
.chat-act-btn svg {stroke-width:1.8}
.chat-search {background:#202329;padding:8px 14px 12px;flex-shrink:0}
.chat-search input {background:#2a2e35;border-color:transparent;border-radius:12px}
.chat-messages {padding:12px 0 18px;gap:2px;min-height:0;scrollbar-width:thin;scrollbar-color:#3a414c transparent}
.chat-messages .day-sep {
  background:#252a31;
  border:1px solid rgba(255,255,255,.025);
  color:#a3aab5;font-size:11px;font-weight:500;
  padding:5px 13px;margin:10px 0 18px;
}
.msg-row {padding:0 16px;margin:3px 0}
.msg {
  max-width:83%;
  padding:10px 12px 7px;
  border-radius:17px;
  font-size:15px;line-height:1.45;
  letter-spacing:.005em;
  box-shadow:0 1px 2px rgba(0,0,0,.10);
}
.msg.them {background:#2a2e35;border-bottom-left-radius:5px;color:#edf0f4}
.msg.me {background:#2d5b91;border-bottom-right-radius:5px;color:#f4f8ff}
.msg .time {font-size:10px;letter-spacing:.01em;opacity:1;color:#9ba4b1;gap:5px;margin-top:5px;line-height:1.2}
.msg.me .time {color:#b5cce9}
.msg.me .time .ticks {color:#c3dfff}
.msg .reply-quote {background:rgba(0,0,0,.10);opacity:1;border-left:2px solid #78acf2;padding:6px 9px;border-radius:3px 7px 7px 3px;margin-bottom:8px}
.msg.me .reply-quote {background:rgba(14,34,61,.22);border-left-color:#9dc9ff}
.msg .reply-name {color:#9dc9ff}
.msg .reply-quote .reply-name {font-size:12px;font-weight:600;opacity:1}
.msg .reply-body {color:#c1cddc;font-size:12px}
.msg .reacts {gap:5px;margin-top:9px}
.msg .react-chip {font-size:15px;min-height:26px;padding:3px 8px;background:rgba(0,0,0,.13);border-color:transparent;gap:5px}
.msg .react-chip.mine {background:rgba(106,168,255,.16);border-color:rgba(139,189,255,.35)}
.msg.me .react-chip.mine {background:rgba(196,222,255,.12);border-color:rgba(196,222,255,.25)}
.msg .react-chip .count {font-size:11px;font-weight:500;color:#d7e2f1}
.react-popup,.msg-menu {background:#2b3038;border-color:#424a55;box-shadow:0 12px 48px #0007}
.react-popup {padding:8px 10px}
.msg-menu {border-radius:18px;padding:6px}
.msg-menu button {min-height:44px;border-radius:12px}
.msg-menu-backdrop {background:rgba(10,12,16,.5);backdrop-filter:blur(2px)}
.chat-preview {flex-shrink:0;background:#252b34;border-top-color:#ffffff08;padding:10px 16px}
.chat-preview .title {color:#8cbbfa}
.chat-preview .body {color:#aeb8c7}
.chat-input {
  flex-shrink:0;
  align-items:center;
  padding:12px 12px max(env(safe-area-inset-bottom),16px);
  background:#202329;
  border-top:1px solid rgba(255,255,255,.045);
  gap:9px;
}
#chat-input {
  height:46px;min-width:0;
  border:1px solid rgba(255,255,255,.045);
  background:#2b3037;
  border-radius:24px;
  padding:11px 17px;
  font-size:15px;
  color:#edf0f5;
  box-shadow:none;
}
#chat-input::placeholder {color:#919ba9}
#chat-input:focus {background:#2b3037;border-color:rgba(106,168,255,.4);box-shadow:none}
.send-btn {width:46px;height:46px}
.send-btn.empty,.send-btn:not(.empty) {background:#4d91ef;color:white;box-shadow:none}
.send-btn .send-icon {width:21px;height:21px}
.rec-bar {background:#202329;padding:12px 14px max(env(safe-area-inset-bottom),16px)}
.rec-bar .rec-send {background:#4d91ef}
.msg .voice {min-width:220px;max-width:254px;gap:11px;padding:3px 0 1px}
.msg .voice-play {width:42px;height:42px;background:#4d91ef;color:#fff}
.msg.me .voice-play {background:#a8cfff;color:#244b7b}
.msg .voice-info {gap:7px}
.msg .voice-track,.msg.me .voice-track {height:5px;border-radius:3px;background:rgba(181,201,227,.23)}
.msg .voice-fill {background:#81b9ff}
.msg.me .voice-fill {background:#bcdcff}
.msg .voice-meta {font-size:11px;color:#b6c3d5;opacity:1}
.msg .voice-speed,.msg.me .voice-speed {background:rgba(193,215,246,.12);color:#dce9fa;height:22px;min-width:34px;padding:2px 7px;font-size:10px}
#chat-view button:hover {transform:none;filter:brightness(1.08)}
#chat-view button:active {transform:scale(.95)}
#chat-view button:focus-visible {outline:2px solid #96c2ff;outline-offset:3px}
@media(max-width:350px) {
  .chat-top {gap:5px;padding-left:6px;padding-right:6px}
  .chat-peer {gap:7px}
  .chat-act-btn {width:32px}
  .msg-row {padding:0 12px}
  .msg .voice {min-width:190px}
}
@media(prefers-reduced-motion:reduce) {
  #chat-view,#chat-view *, .react-popup,.msg-menu {animation:none!important;transition:none!important;scroll-behavior:auto!important}
}

/* Quiet, original line-art wallpaper. Never covers the message text. */
.chat-messages{background-color:#191e26;background-image:linear-gradient(155deg,#25374c25,#13171e40),url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22360%22%20height%3D%22400%22%20viewBox%3D%220%200%20360%20400%22%20fill%3D%22none%22%3E%3Cg%20stroke%3D%22%239fbcde%22%20stroke-width%3D%221.25%22%20opacity%3D%22.14%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%0A%3Cg%20transform%3D%22translate%2824%2030%29%20rotate%28-18%2020%2020%29%22%3E%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2236%22%20height%3D%2227%22%20rx%3D%229%22%2F%3E%3Cpath%20d%3D%22M8%2027l-2%208%2012-8M10%209h16M10%2016h9%22%2F%3E%3C%2Fg%3E%0A%3Cg%20transform%3D%22translate%28254%2017%29%20rotate%2818%29%22%3E%3Cpath%20d%3D%22M0%2012L36%200%2025%2033%2016%2021%200%2012zM16%2021L36%200M16%2021l-1%2010%206-6%22%2F%3E%3C%2Fg%3E%0A%3Cpath%20d%3D%22M133%2028c15-20%2040%204%2020%2021l-20%2015-20-15c-20-17%205-41%2020-21z%22%2F%3E%0A%3Cpath%20d%3D%22M57%20104l4%2011%2012%201-9%208%202%2012-10-6-10%206%202-12-9-8%2013-1zM208%20112l5%205m-5%200l5-5M315%2096l6%200m-3-3v6%22%2F%3E%0A%3Cg%20transform%3D%22translate%28142%20135%29%20rotate%2824%29%22%3E%3Cellipse%20rx%3D%2229%22%20ry%3D%2212%22%2F%3E%3Cellipse%20rx%3D%2229%22%20ry%3D%2212%22%20transform%3D%22rotate%2860%29%22%2F%3E%3Cellipse%20rx%3D%2229%22%20ry%3D%2212%22%20transform%3D%22rotate%28120%29%22%2F%3E%3Ccircle%20r%3D%223%22%2F%3E%3C%2Fg%3E%0A%3Cg%20transform%3D%22translate%28278%20158%29%20rotate%28-12%29%22%3E%3Cpath%20d%3D%22M0%200c-8%2016-10%2035%202%2045%2019-9%2021-26%2015-42-9%209-14%2020-15%2042M2%2045l-4%2012%22%2F%3E%3C%2Fg%3E%0A%3Cpath%20d%3D%22M24%20212c16-26%2039-23%2052-9-18%203-37%2017-43%2036M70%20200c9%2016%207%2031-9%2039-13-11-15-20-9-31%22%2F%3E%0A%3Cg%20transform%3D%22translate%28179%20232%29%20rotate%2818%29%22%3E%3Crect%20width%3D%2229%22%20height%3D%2242%22%20rx%3D%228%22%2F%3E%3Cpath%20d%3D%22M10%207h9M11%2035h7%22%2F%3E%3C%2Fg%3E%0A%3Cpath%20d%3D%22M325%20245a18%2018%200%2011-19-26c-10%2012-1%2029%2019%2026zM107%20267l6%200m-3-3v6M249%20276l5%205m-5%200l5-5%22%2F%3E%0A%3Cg%20transform%3D%22translate%2837%20319%29%20rotate%28-12%29%22%3E%3Cpath%20d%3D%22M0%2013c10-18%2032-18%2042%200-10%2018-32%2018-42%200z%22%2F%3E%3Ccircle%20cx%3D%2221%22%20cy%3D%2213%22%20r%3D%227%22%2F%3E%3C%2Fg%3E%0A%3Cpath%20d%3D%22M136%20330c6-10%2018-5%2016%204-2%207-13%2012-19%2019-4-9-13-17-13-24%200-9%2012-11%2016%201zM287%20339l4%2010%2011%201-9%207%203%2011-9-6-10%206%203-11-9-7%2011-1z%22%2F%3E%0A%3Cpath%20d%3D%22M197%20376c8-13%2017-13%2025%200m-30-9c12-18%2028-18%2039%200M87%20389l4-5m7-5l5-5%22%2F%3E%0A%3C%2Fg%3E%3C%2Fsvg%3E");background-size:cover,360px 400px;background-attachment:local;}
.msg{box-shadow:0 1px 3px #0003}
.msg .time .ticks{color:#a9bbd1;opacity:1}
.msg .time .ticks.read{color:#b9dcff}
.msg .time .ticks svg{display:block}
.msg .voice-track,.msg.me .voice-track{height:28px;background:none;border-radius:0;overflow:visible;cursor:pointer;touch-action:pan-y}
.voice-wave{display:block;width:100%;height:28px;fill:#8195ac}
.msg.me .voice-wave{fill:#87a9d0}
.voice-wave rect.played{fill:#cde7ff}
.msg .voice-fill{display:none}
.rec-wave{width:68px;height:26px;flex-shrink:1;overflow:hidden}
.rec-wave .voice-wave{fill:#82b6ff;height:26px}
.rec-hint{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px!important}
#chat-send{touch-action:none;user-select:none;-webkit-touch-callout:none}
.rec-bar{gap:8px;z-index:5}
.rec-bar.is-holding .rec-send{opacity:0;pointer-events:none}
.rec-bar.is-holding .rec-cancel{visibility:hidden}
.rec-lock{position:absolute;right:13px;bottom:88px;width:44px;height:90px;display:flex;flex-direction:column;align-items:center;gap:17px;padding-top:12px;background:#2d3745;border:1px solid #6aa8ff30;border-radius:24px;color:#a5ccff;z-index:7;pointer-events:none;transform:translateY(var(--record-lift,0px));box-shadow:0 8px 30px #0004;}
.rec-lock span{font-size:18px;line-height:1}
#calling-overlay,#incoming-overlay{background:radial-gradient(ellipse at 50% 30%,#2d435450,transparent 65%),#181c23f5;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}
#calling-overlay .call-card,#incoming-overlay .call-card{background:transparent;border:0;box-shadow:none;gap:18px;padding:40px 24px}
.call-card .who{font-size:32px;font-weight:600;letter-spacing:-.035em;line-height:1.2;text-align:center}
.call-card .sub{font-size:15px;color:#b4bfce;font-weight:400;text-align:center;line-height:1.5}
.call-card .call-detail{font-size:12px;color:#808e9f;line-height:1.6;max-width:270px;text-align:center;min-height:40px}
.call-card .call-label{font-size:10px;letter-spacing:.18em;color:#7c8ea4;text-transform:uppercase;margin-bottom:10px}
.call-card .big-avatar{width:116px;height:116px;font-size:50px;box-shadow:0 0 0 14px #6a9fdf07,0 0 0 30px #6a9fdf04;border-color:#ffffff10;margin-bottom:22px}
.big-avatar.pulse::before,.big-avatar.pulse::after{border-color:#79aee73d}
.call-card .btn-cancel{margin-top:44px;width:64px;height:64px;border-radius:50%;padding:0;background:#dc5263;color:#fff;display:grid;place-items:center;border:none}
.call-card .btn-cancel svg{width:28px;height:28px}
@media(max-width:350px){.rec-wave{width:42px}.rec-bar{gap:6px}}

.apple-emoji{display:inline-block;width:1.2em;height:1.2em;vertical-align:-.24em;background-image:url('/emoji-sheet.png?v=1');background-size:6200% 6200%;background-repeat:no-repeat;line-height:1.2;overflow:hidden;color:transparent;white-space:nowrap;user-select:none}
.react-popup .apple-emoji{width:28px;height:28px}
.react-chip .apple-emoji{width:18px;height:18px}
.call-permission-banner{margin:0 0 14px;padding:12px 14px;background:#27313e;border:1px solid #6aa8ff33;border-radius:14px;font-size:12px;color:#cbd7e7;display:flex;gap:10px;align-items:center;line-height:1.5}
.call-permission-banner button{background:#3d79c5;font-size:12px;padding:10px;border-radius:10px;flex-shrink:0}

#loading-view{height:100dvh;min-height:400px;max-width:none;padding:0;background:radial-gradient(ellipse at 50% 38%,#253b573d,transparent 60%),#171b22;display:grid;place-items:center}
.splash-center{text-align:center;display:flex;flex-direction:column;align-items:center;padding:28px}
.splash-mark{width:84px;height:84px;border-radius:25px;background:#4d91ef;display:grid;place-items:center;color:#fff;box-shadow:0 0 0 12px #4d91ef06,0 24px 50px #0003;margin-bottom:24px}
.splash-mark svg{width:58px;height:58px}
.splash-center h1{font-size:38px;letter-spacing:-.045em;font-weight:600;line-height:1.2;margin:0 0 9px}
.splash-tagline{font-size:13px;color:#939faf;margin:0 0 44px}
.splash-activity{display:flex;gap:6px;margin-bottom:16px;height:8px}
.splash-activity i{display:block;width:5px;height:5px;background:#79abef;border-radius:50%;animation:loadingDot 1.3s ease-in-out infinite}
.splash-activity i:nth-child(2){animation-delay:.16s}.splash-activity i:nth-child(3){animation-delay:.32s}
#loading-status{font-size:12px;color:#8d9caf;line-height:1.7;max-width:230px}
#loading-retry{margin-top:20px;background:#357bda;border-radius:12px;font-size:13px;padding:11px 24px}
@keyframes loadingDot{0%,70%,100%{opacity:.28;transform:translateY(0)}35%{opacity:1;transform:translateY(-4px)}}
.call-gesture-hint{font-size:12px;color:#8e9bad;margin-top:38px;margin-bottom:4px}
.call-actions{gap:70px;padding-top:30px}
.call-actions button{touch-action:none;position:relative;user-select:none;-webkit-touch-callout:none;}
.call-actions button::before{content:'↑';position:absolute;left:50%;top:-34px;transform:translateX(-50%);font-size:22px;color:#91a1b5;line-height:1}
@media(min-width:1000px){#app #loading-view{height:min(844px,calc(100dvh - 64px));min-height:0}}

#calling-overlay .who,#incoming-overlay .who{font-size:32px;font-weight:600;letter-spacing:-.035em}
#calling-overlay .big-avatar,#incoming-overlay .big-avatar{width:116px;height:116px;font-size:50px;box-shadow:0 0 0 14px #6a9fdf07,0 0 0 30px #6a9fdf04;border-color:#ffffff10;margin-bottom:22px}
.call-card .big-avatar.pulse::before,.call-card .big-avatar.pulse::after{border-color:#79aee73d}

/* Incoming controls are anchored to opposite screen edges, not the caller card. */
#incoming-overlay .call-card{position:absolute;top:clamp(100px,20vh,210px);left:0;right:0;width:100%;max-width:none;padding:0 24px;animation:none;transform:none;gap:16px}
#incoming-overlay .call-gesture-hint{position:absolute;left:20px;right:20px;bottom:max(200px,calc(env(safe-area-inset-bottom) + 168px));margin:0;text-align:center;font-size:12px;color:#94a1b1}
#incoming-overlay .call-actions{position:absolute;left:28px;right:28px;bottom:max(64px,calc(env(safe-area-inset-bottom) + 32px));display:flex;justify-content:space-between;align-items:center;gap:0;padding:0;margin:0}
#incoming-overlay .call-actions button{width:76px;height:76px;flex-shrink:0;display:grid;place-items:center;box-shadow:none}
#incoming-overlay .btn-decline{background:#e65464}
#incoming-overlay .btn-answer{background:#24b86c}
#incoming-overlay .call-actions button svg{width:34px;height:34px;display:block;pointer-events:none}
#incoming-overlay .call-actions button::before{top:-38px;color:#a1adbc;font-size:22px}
#incoming-overlay .call-actions button::after{position:absolute;left:50%;top:calc(100% + 15px);transform:translateX(-50%);font-size:12px;font-weight:400;line-height:1.3;color:#b9c3d1;white-space:nowrap;pointer-events:none}
#incoming-overlay .btn-decline::after{content:'Отклонить'}
#incoming-overlay .btn-answer::after{content:'Ответить'}
@media(max-height:550px){#incoming-overlay .call-card{top:30px;gap:8px}#incoming-overlay .big-avatar{width:72px;height:72px;font-size:32px;margin-bottom:8px}#incoming-overlay .call-gesture-hint{bottom:152px}#incoming-overlay .call-actions{bottom:42px}#incoming-overlay .call-actions button{width:64px;height:64px}}

/* Motion is limited to opacity/transforms; normal layout never bounces. */
:root{--ease-spring:cubic-bezier(.22,1.3,.35,1)}
.touch-ripple{position:absolute;inset:0;background:#fff;border-radius:inherit;pointer-events:none;opacity:0;z-index:1}
.chat-act-btn,.voice-play,.voice-speed,.react-chip,.thread,.icon-btn,.send-btn{position:relative}
#chat-view{animation:none;overflow:hidden}
#chat-view button:active{transform:none}
#chat-view .msg.motion-arrival,#chat-view .msg.motion-settled{animation:none}
#chat-messages{overscroll-behavior-y:contain}
#chat-messages>*{translate:0 var(--edge-pull,0px);transition:translate .42s cubic-bezier(.22,1.3,.35,1)}
#chat-messages.is-pulling>*{transition:none}
.chat-preview{animation:replyReveal .24s cubic-bezier(.2,.75,.25,1) both}
@keyframes replyReveal{from{opacity:0;translate:0 10px}to{opacity:1;translate:0 0}}
.react-popup,.msg-menu{animation:menuSpring .28s cubic-bezier(.22,1.3,.35,1) both;transform-origin:center bottom}
@keyframes menuSpring{from{opacity:0;scale:.94;translate:0 8px}to{opacity:1;scale:1;translate:0 0}}
.react-popup button{transition:scale .2s cubic-bezier(.22,1.3,.35,1)}
.rec-drag-mic{position:absolute;right:7px;bottom:max(10px,env(safe-area-inset-bottom));width:58px;height:58px;border-radius:50%;background:#4d91ef;display:grid;place-items:center;color:white;z-index:6;pointer-events:none;box-shadow:0 0 0 8px #4d91ef18,0 8px 24px #0003;animation:recordLift .28s cubic-bezier(.22,1.3,.35,1) both}
.rec-drag-mic svg{width:25px;height:25px;display:block;opacity:1}
@keyframes recordLift{from{scale:.7;opacity:0}65%{scale:1.07;opacity:1}to{scale:1;opacity:1}}
.rec-bar:not(.is-holding) .rec-send{animation:recordLift .26s cubic-bezier(.22,1.3,.35,1)}
#incoming-overlay .call-actions button{transition:transform .26s cubic-bezier(.22,1.3,.35,1),box-shadow .2s}
#incoming-overlay .call-actions button:active{transition:box-shadow .2s;box-shadow:0 0 0 10px #ffffff08}
#incoming-overlay .call-actions button::before{animation:callHint 2.2s ease-in-out infinite}
@keyframes callHint{0%,70%,100%{translate:0 0;opacity:.45}35%{translate:0 -5px;opacity:.95}}
@media(prefers-reduced-motion:reduce){
 *,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
 #chat-messages>*{translate:none!important}
}
