:root {
  --bg: #0b0b10; --surface: #15151c; --surface2: #1d1d26; --surface3: #262631; --line: rgba(255,255,255,.08);
  --text: #f5f5f8; --muted: #8d8d9b; --brand: #7b61ff; --brand2: #c04dff; --grad: linear-gradient(135deg, #7b61ff 0%, #c04dff 100%);
  --accent: #ffd400; --ok: #3ddc84; --warn: #ff8a65; --r: 20px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);   /* JS sets them if iOS gives 0 */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* html = the colour of the tab bar: iOS 26 home-screen apps get a page shorter than the screen and show this colour below it */
html { background: #121219; }
body { background: var(--bg); }
html, body { margin: 0; height: 100%; color: var(--text); overscroll-behavior: none;
  font: 16px/1.42 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: #a99bff; }
.hidden { display: none !important; }
/* the whole screen, notch to home bar: fixed + inset works in an iPhone home-screen app, where 100vh/100dvh leaves a black strip */
.screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; background: var(--bg); }
body.typing .screen { bottom: auto; height: var(--vvh, 100%); }   /* keyboard open: exactly the visible part */
::-webkit-scrollbar { width: 0; height: 0; }

/* boot */
#boot { align-items: center; justify-content: center; }
.boot { text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 18px; }
.boot .logo { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 12px 40px #7b61ff55; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #ffffff1a; border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* login */
#login { align-items: center; justify-content: center; padding: calc(24px + var(--sat)) 24px calc(24px + var(--sab)); overflow-y: auto;
  background: radial-gradient(120% 60% at 50% -10%, #7b61ff40 0%, transparent 60%), radial-gradient(80% 40% at 100% 100%, #c04dff26 0%, transparent 70%), var(--bg); }
.login-box { width: 100%; max-width: 380px; text-align: center; animation: rise .5s ease both; }
.logo-wrap { width: 96px; height: 96px; margin: 0 auto; border-radius: 28px; padding: 3px; background: var(--grad); box-shadow: 0 18px 50px #7b61ff66; }
.logo-wrap .logo { width: 100%; height: 100%; border-radius: 25px; display: block; }
h1 { margin: 20px 0 8px; font-size: 30px; letter-spacing: -.5px; }
.sub { color: var(--muted); margin: 0 0 22px; font-size: 15.5px; }
.steps { list-style: none; padding: 14px 16px; margin: 0 0 22px; background: #ffffff08; border: 1px solid var(--line); border-radius: var(--r);
  display: flex; flex-direction: column; gap: 10px; text-align: left; }
.steps li { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.steps i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; width: 100%; padding: 16px; margin: 10px 0; border: 0;
  border-radius: 16px; font-size: 17px; font-weight: 650; cursor: pointer; transition: transform .12s, opacity .12s; }
.btn:active, .pbtn:active, .fbtn:active, .tab:active, .kb button:active, .dl:active { transform: scale(.97); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 10px 30px #7b61ff4d; }
.btn.ghost { background: #ffffff0a; color: var(--text); border: 1px solid var(--line); }
input { width: 100%; padding: 15px 16px; margin: 6px 0; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font-size: 17px; outline: none; }
input:focus { border-color: var(--brand); }
.hint { color: var(--muted); font-size: 13.5px; }
.err { color: #ff6b6b; min-height: 1.2em; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* header */
header { position: relative; z-index: 3; display: flex; align-items: center; gap: 11px; padding: calc(8px + var(--sat)) 16px 10px;
  background: rgba(11,11,16,.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.hlogo { width: 38px; height: 38px; border-radius: 12px; }
.htitle { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.htitle b { font-size: 17px; letter-spacing: -.2px; }
.htitle span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbtn { width: 38px; height: 38px; border-radius: 50%; background: var(--surface2); border: 0; color: var(--text); display: grid; place-items: center; cursor: pointer; }
.hbtn svg { width: 19px; height: 19px; }
#pushBtn { color: var(--accent); animation: ring 2.4s ease-in-out infinite; }
@keyframes ring { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(12deg); } 95% { transform: rotate(-10deg); } }

/* bottom tab bar */
.tabs { display: flex; padding: 6px 8px max(8px, var(--sab)); background: #121219;
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 2px; border: 0; background: none;
  color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; transition: color .15s, transform .12s; }
.tab svg { width: 25px; height: 25px; stroke-width: 1.8; }
.tab.on { color: var(--text); }
.tab.on svg { color: #a48bff; filter: drop-shadow(0 2px 8px #7b61ff88); }
body.typing .tabs { display: none; }

/* chat */
#feed { flex: 1; overflow-y: auto; padding: 14px 12px 18px; display: flex; flex-direction: column; gap: 8px;
  background: radial-gradient(90% 50% at 0% 0%, #7b61ff14 0%, transparent 60%), radial-gradient(80% 40% at 100% 100%, #c04dff12 0%, transparent 60%); }
.msg { max-width: 86%; padding: 10px 13px 7px; border-radius: 20px; white-space: pre-wrap; word-wrap: break-word; font-size: 15.5px; animation: pop .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.msg.bot { align-self: flex-start; background: var(--surface2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 6px 20px #7b61ff33; }
.msg.me a { color: #fff; }
.msg .time { display: block; text-align: right; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.msg.me .time { color: #ffffffb0; }
.msg video { width: 100%; max-height: 70dvh; border-radius: 14px; background: #000; display: block; margin-bottom: 8px; }
.msg audio { width: 100%; margin-bottom: 6px; }
.msg:has(.vbox), .msg:has(video) { width: 86%; }
.kb { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.kb .row { display: flex; gap: 6px; }
.kb button, .kb a { flex: 1; padding: 11px 8px; border-radius: 14px; border: 1px solid #7b61ff40; background: #7b61ff1f; color: #e9e4ff;
  font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; transition: background .15s, transform .12s; }
.kb button:disabled { opacity: .5; }
.dl { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; cursor: pointer; font-size: 15px; margin-top: 4px; padding: 12px 14px;
  border-radius: 14px; background: var(--accent); color: #111; font-weight: 700; text-decoration: none; transition: transform .12s; }
.dl svg { width: 19px; height: 19px; stroke-width: 2.4; }
.dl:disabled { opacity: .85; }
.dlfile { display: block; text-align: center; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.vbox { position: relative; width: 100%; aspect-ratio: 9 / 16; max-height: 60dvh; border-radius: 14px; margin-bottom: 8px; overflow: hidden;
  background: #000 center / cover no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: pointer; }
.vbox::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, #0009); pointer-events: none; }
.vplay { position: relative; z-index: 1; width: 66px; height: 66px; border-radius: 50%; border: 1px solid #ffffff40; color: #fff; display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.18); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 30px #0006; transition: transform .15s; }
.vplay svg { width: 28px; height: 28px; fill: #fff; stroke: none; margin-left: 4px; }
.vbox:active .vplay { transform: scale(.92); }
.vplay:disabled { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.vprog { position: relative; z-index: 1; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: #fff; border-radius: 12px;
  padding: 5px 12px; font-size: 13px; min-width: 190px; text-align: center; font-variant-numeric: tabular-nums; }
.vprog:empty { display: none; }
.vprog2 { color: var(--muted); font-size: 13px; margin: 6px 0; min-height: 1em; font-variant-numeric: tabular-nums; }

/* upload bubbles */
.msg.up { min-width: 66%; }
.prog { height: 6px; background: #ffffff33; border-radius: 3px; margin: 9px 0 5px; overflow: hidden; }
.prog div { height: 100%; width: 0; background: #fff; border-radius: 3px; transition: width .3s; }
.ustat { font-size: 12.5px; color: #ffffffd9; font-variant-numeric: tabular-nums; }
.msg.up.failed { background: #6e2b33; box-shadow: none; }

/* composer */
#attach { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.chip { background: var(--surface3); border-radius: 14px; padding: 6px 6px 6px 11px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chip button { background: #ffffff1f; border: 0; color: var(--text); border-radius: 50%; width: 22px; height: 22px; cursor: pointer; flex: none; }
footer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--line); }

.fbtn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--surface3); color: var(--text);
  display: grid; place-items: center; cursor: pointer; transition: transform .12s; }
.fbtn svg { width: 21px; height: 21px; }
.fbtn.send { background: var(--grad); color: #fff; box-shadow: 0 6px 18px #7b61ff55; }
.fbtn.send svg { stroke-width: 2.6; }
.field { flex: 1; display: flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 22px; transition: border-color .15s; }
.field:focus-within { border-color: #7b61ff80; }
textarea { flex: 1; resize: none; max-height: 140px; padding: 10px 15px; border: 0; background: none; color: var(--text); font: inherit; font-size: 16px; outline: none; }

/* «Мои видео» */
#vids, #prof { flex: 1; overflow-y: auto; padding: 16px 14px 24px; }
.ptitle { font-size: 30px; font-weight: 800; letter-spacing: -.6px; margin: 2px 2px 4px; }
.psub { color: var(--muted); font-size: 13.5px; margin: 0 2px 16px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.vcard { background: var(--surface2); border-radius: 18px; overflow: hidden; cursor: pointer; border: 1px solid var(--line); padding: 0; color: var(--text);
  text-align: left; animation: rise .35s ease both; transition: transform .12s; }
.vcard:active { transform: scale(.97); }
.vcard .th { position: relative; aspect-ratio: 9 / 16; background: #000 center / cover no-repeat; }
.vcard .th::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, #000a); }
.vcard .th.wide { aspect-ratio: 16 / 9; }
.vcard .dur { position: absolute; z-index: 1; right: 8px; bottom: 8px; background: #000a; backdrop-filter: blur(6px); padding: 2px 7px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.vcard .play { position: absolute; z-index: 1; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid #ffffff40; }
.vcard .play svg { width: 20px; height: 20px; fill: #fff; stroke: none; margin-left: 3px; }
.vcard .meta { padding: 9px 11px 11px; font-size: 12.5px; }
.vcard .meta b { display: block; font-size: 14.5px; margin-bottom: 1px; }
.vcard .meta span { color: var(--muted); }
.empty { color: var(--muted); text-align: center; margin-top: 60px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .eicon { width: 76px; height: 76px; border-radius: 24px; background: var(--surface2); display: grid; place-items: center; color: #a48bff; }
.empty .eicon svg { width: 36px; height: 36px; }
.empty b { color: var(--text); font-size: 17px; }

/* profile */
.phead { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 0 20px; }
.avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 32px; font-weight: 800;
  box-shadow: 0 12px 36px #7b61ff55; margin-bottom: 12px; }
.phead h2 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.phead .muted { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.stat small { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.stat b { font-size: 22px; letter-spacing: -.4px; }
.stat b.ok { color: var(--ok); } .stat b.no { color: var(--warn); }
.stat em { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 2px; }
.pcard { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 16px; margin-bottom: 14px; }
.prow { display: flex; justify-content: space-between; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.prow:last-child { border-bottom: 0; }
.prow span { color: var(--muted); }
.pbtn { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 15px; margin: 9px 0; border-radius: 16px; border: 0; font-size: 16px; font-weight: 650;
  text-align: center; text-decoration: none; cursor: pointer; background: var(--grad); color: #fff; box-shadow: 0 8px 24px #7b61ff40; transition: transform .12s; }
.pbtn.wa { background: #25d366; box-shadow: 0 8px 24px #25d36633; }
.pbtn.ghost { background: transparent; border: 1px solid var(--line); color: #ff7b7b; box-shadow: none; }
.pbtn svg { width: 20px; height: 20px; }

/* player */
#player { position: fixed; inset: 0; background: rgba(0,0,0,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: calc(14px + var(--sat)) 14px calc(14px + var(--sab)); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.pbox { width: 100%; max-width: 480px; text-align: center; position: relative; }
#pvideo { width: 100%; max-height: 72dvh; border-radius: 18px; background: #000; }
.pinfo { color: var(--muted); margin: 6px 0 10px; font-size: 13.5px; }
.pclose { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(0,0,0,.5); backdrop-filter: blur(10px); color: #fff; border: 0; border-radius: 50%;
  width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; }
.pclose svg { width: 18px; height: 18px; stroke-width: 2.4; }
