@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap;
  src: url("fonts/jetbrains-mono-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap;
  src: url("fonts/jetbrains-mono-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap;
  src: url("fonts/jetbrains-mono-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #0A0A0D;
  --panel: #121217;
  --panel-2: #16161C;
  --line: #2A2A33;
  --text: #E6E3EC;
  --muted: #8E8A9C;
  --blue: #5EC8FF;
  --pink: #FF7AC6;
  --yellow: #FFD84A;
  --grad: linear-gradient(90deg, #5EC8FF, #FF7AC6, #FFD84A);
  --grad-d: linear-gradient(135deg, #5EC8FF, #FF7AC6, #FFD84A);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 14px; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.6; }
.grow { flex: 1 1 auto; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: calc(24px + var(--safe-t)) 20px calc(20px + var(--safe-b)); }

/* ---------- PIN ---------- */
.pin { align-items: center; padding-top: calc(12vh + var(--safe-t)); }
.logo-big { font-size: 40px; letter-spacing: 0.06em; }
.cur { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.grad-bar { width: 48px; height: 3px; margin-top: 14px; background: var(--grad); }
.pin-label { margin: 9vh 0 0; letter-spacing: 0.06em; }
.dots { display: flex; gap: 18px; margin-top: 22px; height: 16px; }
.dots span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #3A3A44; }
.dots span.on { border: 0; background: var(--grad-d); }
.dots.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.keypad { margin-top: 6vh; width: 100%; max-width: 320px; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 6px; }
.keypad button { height: 64px; background: transparent; border: 0; border-radius: 32px; font-size: 24px; }
.keypad button:active { background: var(--panel-2); }
.keypad .key-del { color: var(--muted); display: flex; align-items: center; justify-content: center; }
.pin-hint { margin-top: auto; text-align: center; }

/* ---------- основной экран ---------- */
.app { gap: 14px; }
.top { display: flex; align-items: center; justify-content: space-between; }
.logo { background: none; border: 0; padding: 6px 0; font-size: 20px; letter-spacing: 0.06em; }
.presence { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.pdot { width: 7px; height: 7px; border-radius: 50%; background: #3A3A44; }
.presence.on .pdot { background: var(--blue); animation: pulse 1.8s infinite; }
.presence.on { color: var(--text); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(94,200,255,.5); } 100% { box-shadow: 0 0 0 8px rgba(94,200,255,0); } }

.banner { font-size: 12px; color: var(--yellow); background: var(--panel); border-radius: 12px; padding: 10px 14px; line-height: 1.5; }
.banner-action { color: var(--text); }
.banner-action button { margin-top: 8px; background: var(--grad); color: var(--bg); border: 0;
  border-radius: 18px; padding: 8px 16px; font-weight: 700; }

.tabs { display: flex; gap: 28px; }
.tab { background: none; border: 0; padding: 10px 0; color: var(--muted); position: relative; font-size: 13px; }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--grad); }
.badge { display: inline-block; margin-left: 6px; min-width: 18px; padding: 1px 5px; border-radius: 9px;
  background: var(--pink); color: var(--bg); font-size: 10px; font-weight: 700; text-align: center; }

.view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; }

/* доска */
.board-wrap { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.zoom-ctl { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px;
  background: rgba(10,10,13,.72); border-radius: 20px; padding: 2px; }
.zoom-ctl button { width: 36px; height: 36px; border: 0; border-radius: 18px; background: transparent; color: var(--text);
  display: flex; align-items: center; justify-content: center; padding: 0; font-size: 10px; }
.zoom-ctl .zoom-level { width: 42px; }
.zoom-ctl button:disabled { color: #4A4A55; }
.zoom-ctl button.active { background: var(--grad-d); color: var(--bg); }
#board.panning { cursor: grab; }
#board { display: block; background: var(--panel); border-radius: 20px; touch-action: none; }
.tools { display: flex; align-items: center; gap: 6px; }
.swatch, .icon-btn { width: 44px; height: 44px; background: transparent; border: 0; padding: 0;
  display: flex; align-items: center; justify-content: center; color: var(--muted); }
.swatch span { width: 22px; height: 22px; border-radius: 50%; display: block; }
.swatch.active span { outline: 2px solid var(--text); outline-offset: 3px; }
.c-blue { background: var(--blue); } .c-pink { background: var(--pink); }
.c-yellow { background: var(--yellow); } .c-light { background: var(--text); }

.call-btn { width: 100%; height: 60px; border: 0; border-radius: 30px; background: var(--grad);
  color: var(--bg); font-size: 15px; font-weight: 700; letter-spacing: 0.2em; flex: none; }
.call-btn:active { transform: scale(0.98); }
.call-status { text-align: center; font-size: 12px; color: var(--muted); }
.call-status.ok { color: var(--blue); }
.call-status.wait { color: var(--yellow); }

/* чат */
.messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
  gap: 16px; padding-bottom: 4px; line-height: 1.5; -webkit-overflow-scrolling: touch; }
.messages::before { content: ""; margin-top: auto; }
.msg { max-width: 80%; display: flex; flex-direction: column; gap: 5px; }
.msg .bubble { padding: 11px 15px; border-radius: 18px; white-space: pre-wrap; word-break: break-word; }
.msg.theirs { align-self: flex-start; }
.msg.theirs .bubble { background: var(--panel-2); border-bottom-left-radius: 4px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.mine .bubble { background: var(--text); color: var(--bg); border-bottom-right-radius: 4px; }
.msg.mine.queued .bubble { background: transparent; color: var(--text); border: 1px dashed #4A4A55; }
.msg .meta { font-size: 10px; color: var(--muted); padding: 0 4px; }
.meta .sent { color: var(--muted); } .meta .delivered { color: var(--pink); }
.meta .read { color: var(--blue); } .meta .queued { color: var(--yellow); }
.sys { align-self: center; font-size: 11px; color: var(--muted); }
.empty { margin: auto; text-align: center; color: var(--muted); font-size: 12px; }

.composer { display: flex; gap: 10px; align-items: center; flex: none; }
.composer input { flex: 1 1 auto; min-width: 0; height: 52px; background: var(--panel-2); border: 0;
  border-radius: 26px; color: var(--text); font: inherit; font-size: 16px; padding: 0 20px; outline: none; }
.composer input::placeholder { color: var(--muted); }
.round { width: 52px; height: 52px; flex: none; border-radius: 50%; background: var(--panel-2); border: 0;
  display: flex; align-items: center; justify-content: center; padding: 0; }
.round-grad { background: var(--grad-d); color: var(--bg); }

/* входящий вызов */
.incoming { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column;
  align-items: center; padding: calc(14vh + var(--safe-t)) 28px calc(40px + var(--safe-b)); }
.rings { width: 220px; height: 220px; position: relative; display: flex; align-items: center; justify-content: center; }
.ring { position: absolute; width: 180px; height: 180px; border-radius: 50%; animation: ring 2.4s ease-out infinite; }
.r1 { border: 1.5px solid var(--pink); } .r2 { border: 1.5px solid var(--blue); animation-delay: 1.2s; }
@keyframes ring { 0% { transform: scale(.7); opacity: .8; } 100% { transform: scale(1.4); opacity: 0; } }
.orb { width: 120px; height: 120px; border-radius: 50%; background: var(--grad-d); position: relative; }
.in-name { margin-top: 44px; font-size: 32px; letter-spacing: 0.06em; }
#in-time { margin-top: 10px; font-size: 12px; }
.in-late { margin-top: 6px; font-size: 11px; color: var(--yellow); text-align: center; }
.in-row { margin-top: 12px; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.text-btn { height: 48px; background: none; border: 0; color: var(--muted); font-size: 13px; }

/* вспышка вместо звука */
.flash { position: fixed; inset: 0; z-index: 30; pointer-events: none; background: var(--grad-d); opacity: 0; }
.flash.go { animation: flash 1.2s ease-out 3; }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }

/* настройки */
.sheet { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; }
.sheet-card { width: 100%; background: var(--panel); border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.sheet-title { font-size: 20px; letter-spacing: 0.06em; display: flex; gap: 12px; align-items: baseline; }
.sheet-title .muted { font-size: 12px; }
.help summary { cursor: pointer; color: var(--text); }
.help p { color: var(--muted); }
.help b { color: var(--text); font-weight: 500; }
.sheet-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
