:root {
  --bg: #0F1013;
  --surface: #191B20;
  --surface-2: #23262D;
  --line: #1F2127;
  --text: #ECEDEF;
  --text-2: #C3C6CD;
  --muted: #9A9DA6;
  --accent: #3A66CC;
  --accent-text: #7FA6FF;
  --warn: #F2A33A;
  --danger: #C62E33;
  --ok: #4CC38A;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #050506; color: var(--text); font-family: var(--font); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }

#stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#phone {
  position: relative; width: 390px; height: 844px; flex: none;
  border-radius: 46px; overflow: hidden; background: #000;
  box-shadow: 0 0 0 10px #16171a, 0 0 0 11px #2a2c31, 0 30px 80px rgba(0,0,0,.7);
  transform-origin: center center;
  user-select: none; -webkit-user-select: none;
}
#phone.full { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; transform: none !important; }
#screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }

/* ---------- status bar ---------- */
.sb { align-self: stretch; height: 44px; flex: none; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; position: relative; z-index: 2; }
.sb-right { display: flex; align-items: center; gap: 6px; }
.sb .low { color: var(--warn); }

/* ---------- boot ---------- */
.boot { flex: 1; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; cursor: pointer; }
.boot .pct { font-size: 15px; color: var(--muted); }
.boot .hint { position: absolute; bottom: 60px; font-size: 13px; color: #55585F; }
.boot-logo { width: 14px; height: 14px; border-radius: 7px; background: var(--text); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.8); opacity: .3; } }

/* ---------- wallpaper ---------- */
.wall { position: absolute; inset: 0; pointer-events: none; }
.wall-photo { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.wall-dim { background: linear-gradient(to bottom, rgba(0,0,0,.35), rgba(0,0,0,.55) 35%, rgba(0,0,0,.7)); }

/* ---------- lock ---------- */
.lock, .home, .pattern, .boot { min-height: 0; }
.notifs { -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent); mask-image: linear-gradient(to bottom, #000 88%, transparent); }
.lock { flex: 1; position: relative; display: flex; flex-direction: column; background: #0B0C0F; }
.lock-clock { text-align: center; padding-top: 18px; position: relative; }
.lock-clock .big { font-size: 86px; font-weight: 300; letter-spacing: -3px; line-height: 1; }
.lock-clock .date { margin-top: 10px; font-size: 16px; color: var(--text-2); }
.lock-clock .chg { margin-top: 6px; font-size: 13px; color: var(--muted); }
.notifs { margin-top: 24px; padding: 0 12px; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; flex: 1; min-height: 0; }
.notif { background: rgba(28,30,36,.92); border-radius: 18px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; animation: drop .35s ease-out both; }
@keyframes drop { from { opacity: 0; transform: translateY(-14px) scale(.98); } }
.notif .ic { width: 32px; height: 32px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; }
.notif .body { flex: 1; min-width: 0; }
.notif .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.notif .ttl { font-size: 15px; font-weight: 600; margin-top: 2px; }
.notif .txt { font-size: 14px; color: #D4D6DB; margin-top: 1px; line-height: 1.35; }
.more-pill { align-self: center; padding: 8px 16px; border-radius: 999px; background: rgba(28,30,36,.92); font-size: 13px; color: var(--text-2); animation: drop .35s ease-out both; }
.unlock-hint { padding: 12px 0 26px; display: flex; justify-content: center; position: relative; }
.unlock-hint button { min-height: 52px; padding: 0 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }

/* ---------- pattern ---------- */
.pattern { flex: 1; display: flex; flex-direction: column; align-items: center; background: #0B0C0F; position: relative; }
.pattern h2 { margin: 14px 0 0; font-size: 20px; font-weight: 500; }
.pattern .sub { margin-top: 8px; font-size: 14px; color: var(--muted); min-height: 20px; }
.pattern .sub.err { color: #F07A7A; }
.pad { margin-top: 56px; width: 264px; height: 264px; position: relative; touch-action: none; }
.pad svg { position: absolute; inset: 0; }
.pad.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.pattern-foot { margin-top: auto; padding: 0 28px 30px; width: 100%; display: flex; justify-content: space-between; }
.pattern-foot button { min-height: 44px; padding: 0 8px; font-size: 14px; color: var(--text-2); }

/* ---------- home ---------- */
.home { flex: 1; display: flex; flex-direction: column; position: relative; background: #0D0E11; }
.home-clock { padding: 22px 24px 0; position: relative; }
.home-clock .big { font-size: 54px; font-weight: 300; letter-spacing: -2px; line-height: 1; }
.home-clock .date { margin-top: 8px; font-size: 15px; color: var(--text-2); }
.grid { margin-top: 30px; padding: 0 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 22px; position: relative; }
.app { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; }
.tile { position: relative; width: 60px; height: 60px; border-radius: 17px; display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.app:active .tile { transform: scale(.92); }
.badge { position: absolute; top: -5px; right: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.widget { grid-column: span 2; grid-row: span 2; padding: 0 6px; }
.widget .ph { height: 186px; border-radius: 24px; overflow: hidden; position: relative; background: #2B2622; }
.widget .ph svg, .cam-btn svg[role="img"] { width: 100%; height: 100%; display: block; }
.ph-img { width: 100%; height: 100%; object-fit: cover; display: block; background: #1A1C21; }
.photo-full { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.photo-full .ph-img { height: auto; max-height: 100%; object-fit: contain; }
.widget .cap { text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.widget .cap { position: absolute; left: 14px; bottom: 12px; font-size: 13px; font-weight: 600; }
.dots { margin-top: auto; display: flex; justify-content: center; gap: 6px; padding-bottom: 14px; position: relative; }
.dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--text); }
.dots span + span { opacity: .35; }
.dock { margin: 0 12px 10px; padding: 12px 10px; border-radius: 30px; background: rgba(255,255,255,.08); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: relative; }
.dock .app { gap: 0; }

/* ---------- system nav (home bar) ---------- */
.homebar { height: 22px; flex: none; display: flex; align-items: center; justify-content: center; position: relative; z-index: 2; }
.homebar button { width: 160px; height: 22px; display: flex; align-items: center; justify-content: center; }
.homebar button::before { content: ''; width: 120px; height: 5px; border-radius: 3px; background: rgba(236,237,239,.55); }

/* ---------- app chrome ---------- */
.app-screen { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.hdr { min-height: 64px; flex: none; padding: 0 12px 0 4px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.hdr .back { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; flex: none; }
.hdr .ttl { font-size: 20px; font-weight: 600; }
.hdr .sub { font-size: 13px; color: var(--muted); }
.hdr .sub.typing { color: var(--accent-text); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: 0; }
.sec { padding: 18px 16px 6px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 16px; min-height: 56px; width: 100%; text-align: left; }
button.row:active, .row.tap:active { background: #16181c; }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .side { font-size: 12px; color: var(--muted); text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row .cnt { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ava { width: 48px; height: 48px; border-radius: 24px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 600; color: #fff; }
.ava.sm { width: 40px; height: 40px; font-size: 17px; }
.share { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 22px; }
.share:active { background: #23262d; }
.empty { padding: 60px 32px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ---------- chat ---------- */
.msgs { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.daychip { align-self: center; margin: 10px 0 6px; padding: 4px 12px; border-radius: 999px; background: #1C1E24; font-size: 12px; color: #A4A7AF; }
.bub { max-width: 80%; padding: 8px 12px; font-size: 15px; line-height: 1.38; word-wrap: break-word; text-align: left; animation: pop .2s ease-out both; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.bub.in { align-self: flex-start; background: var(--surface-2); border-radius: 18px 18px 18px 6px; }
.bub.out { align-self: flex-end; background: var(--accent); color: #fff; border-radius: 18px 18px 6px 18px; }
.bub .tm { font-size: 11px; color: var(--muted); margin-left: 8px; white-space: nowrap; float: right; margin-top: 5px; }
.bub.out .tm { color: #DCE5FA; }
.bub.ev { padding: 8px; }
.evcard { display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,.18); border-radius: 12px; padding: 8px 10px; }
.bub.in .evcard { background: rgba(255,255,255,.05); }
.evcard .t1 { font-size: 14px; font-weight: 500; line-height: 1.3; }
.evcard .t2 { font-size: 12px; opacity: .75; margin-top: 2px; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.voice .play { width: 38px; height: 38px; border-radius: 19px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.bub.out .voice .play { background: rgba(255,255,255,.22); }
.voice .wave { position: relative; flex: 1; height: 22px; background: repeating-linear-gradient(90deg, #6b6f79 0 2px, transparent 2px 5px); border-radius: 2px; overflow: hidden; }
.voice .wave i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: repeating-linear-gradient(90deg, #ECEDEF 0 2px, transparent 2px 5px); }
.bub.out .voice .wave { background: repeating-linear-gradient(90deg, rgba(255,255,255,.45) 0 2px, transparent 2px 5px); }
.bub.out .voice .wave i { background: repeating-linear-gradient(90deg, #fff 0 2px, transparent 2px 5px); }
.voice .vdur { font-size: 13px; color: var(--muted); min-width: 30px; }
.bub.out .voice .vdur { color: #DCE5FA; }
.voice .vtx { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); background: rgba(255,255,255,.06); flex: none; }
.voice .vtx[aria-pressed="true"] { background: rgba(255,255,255,.16); color: #fff; }
.transcript { margin-top: 8px; font-size: 14px; color: var(--text-2); font-style: italic; }
.typing-bub { align-self: flex-start; background: var(--surface-2); border-radius: 18px 18px 18px 6px; padding: 12px 14px; display: flex; gap: 5px; }
.typing-bub span { width: 7px; height: 7px; border-radius: 4px; background: var(--muted); animation: blink 1.2s infinite; }
.typing-bub span:nth-child(2) { animation-delay: .2s; } .typing-bub span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .3; } }
.composer { flex: none; padding: 8px 10px 8px; display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); }
.composer input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid #2A2D35; background: var(--surface); color: var(--text); font-size: 15px; outline: none; user-select: text; -webkit-user-select: text; }
.composer input::placeholder { color: #8E919A; }
.chips { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 10px 12px 2px; border-top: 1px solid var(--line); }
.chip { min-height: 40px; padding: 8px 14px; border-radius: 20px; border: 1px solid #3A66CC; background: #15203A; color: #D6E2FF; font-size: 14px; line-height: 1.3; text-align: left; animation: pop .25s ease-out both; }
.chip:active { background: #22335C; }
.fakeinput { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid #2A2D35; background: var(--surface); color: #5E616A; font-size: 15px; display: flex; align-items: center; }
.composer .send.dim { opacity: .35; }
.composer .send { width: 44px; height: 44px; border-radius: 22px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.channel-post { margin: 8px 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); font-size: 15px; line-height: 1.45; text-align: left; width: calc(100% - 24px); display: block; }
.channel-post .meta { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- gallery / camera ---------- */
.gal { padding: 4px 4px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.gal button { aspect-ratio: 1; overflow: hidden; border-radius: 4px; display: block; }
.gal svg, .photo svg { width: 100%; height: 100%; display: block; }
.photo { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; background: #000; }
.photo .info { padding: 16px; font-size: 13px; color: var(--muted); text-align: center; }
.cam { flex: 1; min-height: 0; position: relative; background: #000; }
.cam svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cam-bar { flex: none; height: 120px; background: #000; display: flex; align-items: center; justify-content: space-around; }
.shutter { width: 70px; height: 70px; border-radius: 35px; border: 4px solid #fff; background: rgba(255,255,255,.15); }
.cam-btn { width: 48px; height: 48px; border-radius: 24px; background: #1d1f24; display: flex; align-items: center; justify-content: center; }
.flash { position: absolute; inset: 0; background: #fff; animation: flash .25s ease-out forwards; pointer-events: none; }
@keyframes flash { to { opacity: 0; } }

/* ---------- misc app bits ---------- */
.card { margin: 12px 16px; padding: 16px; border-radius: 18px; background: var(--surface); }
.bal { font-size: 32px; font-weight: 600; margin-top: 4px; }
.toggle { width: 52px; height: 32px; border-radius: 16px; background: #3A3D45; position: relative; flex: none; transition: background .15s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; transition: left .15s; }
.toggle[aria-checked="true"] { background: var(--ok); }
.toggle[aria-checked="true"]::after { left: 23px; }
.battery-big { font-size: 56px; font-weight: 300; }
.note-body { padding: 16px; font-size: 16px; line-height: 1.55; white-space: pre-wrap; }
.pw { padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.pw input { width: 100%; height: 48px; border-radius: 12px; border: 1px solid #2A2D35; background: var(--surface); color: var(--text); padding: 0 14px; font-size: 16px; outline: none; user-select: text; -webkit-user-select: text; }
.btn { height: 48px; padding: 0 20px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; }
.btn.ghost { background: #1E2026; color: var(--text); }
.live { margin: 8px 16px 0; position: relative; height: 200px; border-radius: 18px; overflow: hidden; background: #15171B; }
.live svg { width: 100%; height: 100%; display: block; }
.live .chip { position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.6); display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.live .chip i { width: 8px; height: 8px; border-radius: 4px; background: #E5484D; display: block; }
.thumb { width: 88px; height: 66px; flex: none; border-radius: 10px; overflow: hidden; }
.thumb svg { width: 100%; height: 100%; display: block; }
.clockapp { padding: 40px 16px; text-align: center; }
.clockapp .big { font-size: 72px; font-weight: 300; letter-spacing: -2px; }

/* ---------- ПИН-код приложения ---------- */
.pinbox { flex: 1; display: flex; flex-direction: column; align-items: center; padding-top: 48px; }
.pdots { display: flex; gap: 18px; margin-top: 26px; }
.pdots.shake { animation: shake .4s; }
.pdot { width: 14px; height: 14px; border-radius: 7px; border: 2px solid #9A9DA6; }
.pdot.on { background: var(--text); border-color: var(--text); }
.perr { min-height: 20px; margin-top: 16px; font-size: 14px; color: var(--text-2); text-align: center; padding: 0 24px; }
.perr .bad { color: #F07A7A; }
.pkeys { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 26px; }
.pkey { width: 76px; height: 76px; border-radius: 38px; background: #1C1E24; font-size: 28px; font-weight: 300; display: flex; align-items: center; justify-content: center; }
.pkey:active { background: #2A2D35; }
.pkey.sm { background: none; font-size: 14px; font-weight: 500; color: var(--text-2); }

/* ---------- overlays ---------- */
#banner-layer { position: absolute; left: 0; right: 0; top: 0; z-index: 20; pointer-events: none; padding: 8px 8px 0; }
.banner { pointer-events: auto; margin-top: 36px; background: rgba(36,38,45,.97); border-radius: 18px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: slide .3s ease-out both; width: 100%; text-align: left; }
.banner.out { animation: slideout .3s ease-in forwards; }
@keyframes slide { from { transform: translateY(-120%); } }
@keyframes slideout { to { transform: translateY(-140%); } }
#sheet-layer { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
#sheet-layer.on { pointer-events: auto; background: rgba(0,0,0,.5); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: #1A1C21; border-radius: 22px 22px 0 0; padding: 10px 0 18px; animation: up .25s ease-out both; }
@keyframes up { from { transform: translateY(100%); } }
.sheet h3 { margin: 6px 20px 2px; font-size: 16px; font-weight: 600; }
.sheet .what { margin: 0 20px 10px; font-size: 13px; color: var(--muted); }
.sheet .cancel { margin: 8px 16px 0; width: calc(100% - 32px); height: 48px; border-radius: 12px; background: #23262D; font-weight: 500; }
.toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); background: rgba(50,52,60,.96); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 40; animation: pop .2s ease-out both; white-space: nowrap; }
#dead-layer { position: absolute; inset: 0; z-index: 50; background: #000; opacity: 0; pointer-events: none; transition: opacity 2.5s; }
#dead-layer.on { opacity: 1; pointer-events: auto; }
.powersave #screen { filter: brightness(.8) saturate(.7); }
