:root {
  /* default = theme "Полночь"; theme tokens are set from the inline script in index.html (before the first paint) */
  --bg: #0f1420; --card: #171f30; --ink: #e6eaf2; --muted: #7f8aa3; --line: #26304a; --chip: #1c2438;
  --accent: #6aa8ff; --accent-dark: #4f8fe6; --on-accent: #0b1830; --accent-text: #6aa8ff;
  --red: #e5484d; --warn: #e0a243;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: 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(--ink);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#app { height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: max(12px, var(--safe-top)) 16px max(20px, var(--safe-bottom)); }
#app.nav .screen { padding-bottom: 8px; } /* the tab bar carries the safe area */
.hidden { display: none !important; }
.center { margin: auto; text-align: center; max-width: 360px; }
.logo { color: var(--accent); } .logo .ic { width: 56px; height: 56px; margin: 0 auto; }
h1 { margin: 8px 0; font-size: 28px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.err { color: var(--red); min-height: 1.4em; }
button { font: inherit; border: 0; cursor: pointer; color: var(--ink); }
.ic { width: 24px; height: 24px; flex: none; display: block; }
button:disabled { opacity: .4; cursor: default; }
.big { padding: 16px 28px; border-radius: 999px; font-size: 19px; font-weight: 600; min-width: 150px; min-height: 56px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primary { background: var(--accent); color: var(--on-accent); }
.primary:active { background: var(--accent-dark); }
.red { background: var(--red); color: #fff; }
.round { width: 56px; height: 56px; border-radius: 50%; background: var(--card); color: var(--ink); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.round .ic-off { display: none; }
.round.off { border-color: var(--red); color: var(--red); }
.round.off .ic-on { display: none; } .round.off .ic-off { display: block; }
#btnCam:not([data-on="1"]) .ic-on { display: none; } #btnCam:not([data-on="1"]) .ic-off { display: block; }
#btnCam[data-on="1"] { border-color: var(--accent); color: var(--accent); }
.round.on { border-color: var(--accent); color: var(--accent); }
.round.red { background: var(--red); border-color: var(--red); color: #fff; }
.top { display: flex; align-items: center; gap: 8px; min-height: 44px; padding-bottom: 6px; }
.ttl { margin: 0; font-size: 26px; font-weight: 700; }
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--accent); } .dot.bad { background: var(--red); } .dot.warn { background: var(--warn); }
#main:not(.lobby) .ttl { display: none; } #main:not(.lobby) .spacer { display: none; }
.stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 22px; margin: 8px 0 12px; background: var(--card); border: 1px solid var(--line); }
#remoteVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; border-radius: 22px; }
/* when the other side's picture has a different shape (phone upright on a wide laptop screen), show it whole on a blurred copy of itself */
#remoteVideo.fit { object-fit: contain; background: transparent; }
#remoteBg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(28px) brightness(.55); background: #000; pointer-events: none; }
#localVideo { position: absolute; right: 10px; bottom: 10px; width: 28%; max-width: 160px; border-radius: 12px; z-index: 2; background: #000; transform: scaleX(-1); }
.peer { text-align: center; z-index: 1; }
.stage.video { background: #000; border-color: transparent; }
/* over the picture: dark plate and light text in every theme */
.stage.video .peer { position: absolute; top: 12px; left: 12px; text-align: left; background: rgba(0,0,0,.45); color: #fff; padding: 8px 12px; border-radius: 12px; }
.stage.video .peer .status, .stage.video .peer .timer { color: rgba(255,255,255,.82); }
.stage.video .avatar { display: none; }
.avatar { width: 120px; height: 120px; border-radius: 50%; background: var(--chip); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 52px; margin: 0 auto 14px; }
.avatar.ring { animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 28px color-mix(in srgb, var(--accent) 0%, transparent); } }
.peerName { font-size: 26px; font-weight: 600; }
.status { color: var(--muted); }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); }
.verify { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 12px; }
.words { font-size: 22px; font-weight: 600; letter-spacing: .3px; margin-top: 4px; }
.controls { display: flex; gap: 16px; justify-content: center; align-items: center; min-height: 64px; }
.pushinfo { text-align: center; margin-top: 10px; min-height: 1.2em; }
button.link { background: none; color: var(--accent-text); min-height: 44px; padding: 0 6px; text-decoration: underline; font-size: inherit; }

/* chat */
.badge { position: absolute; top: -5px; left: calc(50% + 4px); background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; }
.chathead { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.back { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 50%; width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; }
.chattitle { font-weight: 600; font-size: 19px; min-width: 0; overflow-wrap: anywhere; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 6px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--chip); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--card)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.msg .meta { font-size: 12px; color: var(--muted); margin-top: 2px; text-align: right; }
.msg.locked { color: var(--muted); font-style: italic; }
.msg.failed { border-color: var(--red); }
.day { align-self: center; font-size: 12px; color: var(--muted); margin: 8px 0 2px; }
.chatform { display: flex; gap: 8px; align-items: flex-end; padding-top: 8px; border-top: 1px solid var(--line); }
.chatform textarea:focus, .chatform input:focus, .gform input:focus, .keyrow input:focus, .photoprev input:focus { outline: none; border-color: var(--accent); }
.chatform textarea { flex: 1; min-width: 0; resize: none; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px; max-height: 140px; }
.sendbtn { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--on-accent); flex: none; display: flex; align-items: center; justify-content: center; }
.nokey { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 8px 0; font-size: 15px; }
.nokey p { margin: 0 0 8px; }
.nokey summary { color: var(--accent-text); text-decoration: underline; cursor: pointer; font-size: 15px; min-height: 44px; display: flex; align-items: center; }
.nokey details[open] summary { margin-bottom: 8px; }
.keyrow input { min-width: 0; }
.nokey .err { min-height: 0; margin-top: 6px; }
.keyrow { display: flex; gap: 8px; }
.keyrow input { flex: 1; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.small-btn { border-radius: 10px; padding: 8px 14px; min-height: 44px; }

/* guest links */
.top .spacer { flex: 1; }
.gform { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.gform input, .gform select { flex: 1 1 180px; min-height: 44px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.gbtn { border-radius: 10px; padding: 9px 12px; min-height: 44px; background: var(--chip); color: var(--ink); border: 1px solid var(--line); font-size: 15px; }
.gbtn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.gbtn.red { background: none; border-color: var(--red); color: var(--red); }
.glist { flex: 1; overflow-y: auto; padding: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.gitem { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.gname { font-weight: 600; }
.glink { font: 13px ui-monospace, monospace; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; width: 100%; min-height: 44px; }
.grow { display: flex; flex-wrap: wrap; gap: 6px; }

/* recording */
.recbanner { display: flex; align-items: center; justify-content: center; gap: 8px; background: color-mix(in srgb, var(--red) 14%, var(--card)); border: 1px solid var(--red); color: var(--ink); border-radius: 12px; padding: 8px; margin-bottom: 10px; font-weight: 600; }
.recbanner .ic { color: var(--red); }
.round.rec { background: var(--red); border-color: var(--red); color: #fff; animation: recpulse 1.4s infinite; }
@keyframes recpulse { 50% { opacity: .6; } }

/* contact list: one card per person (avatar, name, state, round call button) */
.stage.lobby { flex: 0 1 auto; align-items: flex-start; justify-content: stretch; overflow-y: auto; -webkit-overflow-scrolling: touch; background: none; border: 0; border-radius: 0; margin: 4px 0 0; }
.contacts { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.contact { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 14px; min-width: 0; }
.cavatar { width: 52px; height: 52px; flex: none; border-radius: 50%; background: var(--chip); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; }
.cinfo { min-width: 0; flex: 1; }
.cname { font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.cstatus { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.contact.online .cstatus { color: var(--accent-text); }
.callbtn { width: 52px; height: 52px; flex: none; padding: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.callbtn:disabled { background: var(--chip); color: var(--muted); opacity: 1; }
.contact #ctlIdle { display: block; min-height: 0; flex: none; }
.note { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 4px 0 6px; font-size: 18px; font-weight: 600; }

/* chat list and group chat */
.msg .who { font-size: 13px; font-weight: 600; color: var(--accent-text); margin-bottom: 1px; }
.earlier { align-self: center; background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); padding: 0 16px; min-height: 44px; font-size: 15px; flex: none; }
.crow { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--ink); flex: none; }
.crow .cinfo { flex: 1; min-width: 0; }
.crow .cname { font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cprev { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmeta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 40px; }
.ctime { color: var(--muted); font-size: 13px; }
.cbadge { background: var(--accent); color: var(--on-accent); border-radius: 999px; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; line-height: 22px; text-align: center; padding: 0 6px; }

/* install */
.big.ghost { margin: 14px auto 0; background: none; border: 1px solid var(--line); color: var(--ink); font-size: 17px; font-weight: 500; }
.modal { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modalbox { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px 20px; max-width: 360px; width: 100%; max-height: 100%; overflow-y: auto; text-align: center; }
.modalbox h2 { margin: 0 0 12px; font-size: 24px; }
.gmsg { color: var(--accent-text); font-weight: 600; }
.gpersist { text-align: center; padding-top: 6px; }

/* call buttons: stay round when six of them do not fit the phone width */
#ctlCall { gap: 10px; }
@media (max-width: 440px) { #ctlCall { gap: 6px; } }
#ctlCall .round { flex: 0 1 56px; width: auto; min-width: 0; height: auto; aspect-ratio: 1 / 1; padding: 0; }
/* own video: drag it to any corner (the corner is remembered) */
#localVideo { touch-action: none; cursor: grab; }
#localVideo.dragging { cursor: grabbing; opacity: .85; }
.stage.pip-tl #localVideo { left: 10px; top: 10px; right: auto; bottom: auto; }
.stage.pip-tr #localVideo { right: 10px; top: 10px; left: auto; bottom: auto; }
.stage.pip-bl #localVideo { left: 10px; bottom: 10px; right: auto; top: auto; }
/* keep the name card clear of the own video */
.stage.video.pip-tl .peer { left: auto; right: 12px; text-align: right; }

/* attachments: photo and voice */
.attachbtn { width: 46px; height: 46px; border-radius: 50%; background: var(--card); color: var(--ink); border: 1px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; }
.sendbtn.mic { background: var(--card); color: var(--accent); border: 1px solid var(--line); }
.attachmenu { padding: 8px 0 0; }
.attachitem { display: block; width: 100%; min-height: 48px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-size: 18px; text-align: left; padding: 0 16px; color: var(--ink); }
.chatnote { color: var(--red); padding: 6px 4px 0; text-align: center; }
.msg.media { padding: 4px 4px 6px; }
.msg.media .meta, .msg.media .cap { padding: 0 8px; }
.msg.media .cap { margin-top: 4px; }
.photo { position: relative; max-width: 66vw; border-radius: 12px; overflow: hidden; background: var(--chip); cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 14px; }
.photo.ph { animation: phpulse 1.4s infinite; }
.photo.bad { padding: 8px; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pbad { display: none; position: relative; z-index: 1; }
.photo.bad .pbad { display: block; }
.pring { position: relative; display: none; width: 64px; height: 64px; align-items: center; justify-content: center; }
.photo.loading .pring { display: flex; }
.pring .ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.ptxt { position: relative; font-size: 15px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .rbg { stroke: var(--line); }
.ring .rfg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
.indet .ring { animation: ringspin 1s linear infinite; }
@keyframes ringspin { to { transform: rotate(270deg); } }
.album { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: min(260px, 66vw); border-radius: 12px; overflow: hidden; }
.album .photo { width: auto; aspect-ratio: 1; border-radius: 0; max-width: none; }
.album.n3 .photo:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.photo .more { position: absolute; inset: 0; z-index: 2; background: rgba(0,0,0,.55); color: #fff; font-size: 28px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
@keyframes phpulse { 50% { opacity: .65; } }
/* voice row: ▶ | wide seek bar with the time under it | speed; the bar gets most of the bubble's width */
.vp { display: grid; grid-template-columns: 52px 1fr auto; grid-template-areas: 'play seek speed' 'play dur speed' 'msg msg msg'; align-items: center; column-gap: 8px; width: min(340px, 66vw); min-height: 52px; }
.vp > .vwrap { grid-area: play; } .vp > .vseek { grid-area: seek; } .vp > .vdur { grid-area: dur; } .vp > .vspeed { grid-area: speed; } .vp > .vmsg { grid-area: msg; }
.vp.nope { display: block; width: auto; min-width: 0; font-size: 15px; color: var(--muted); font-style: italic; }
.vwrap { position: relative; width: 52px; height: 52px; flex: none; display: flex; align-items: center; justify-content: center; }
.vwrap .ring { position: absolute; inset: 0; width: 100%; height: 100%; visibility: hidden; }
.vwrap.loading .ring { visibility: visible; }
.vplay { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 16px; padding: 0; }
.vspeed { min-width: 48px; height: 44px; flex: none; border-radius: 22px; background: var(--chip); border: 1px solid var(--line); font-size: 16px; padding: 0 8px; color: var(--ink); font-variant-numeric: tabular-nums; }
.vmsg { display: none; flex-basis: 100%; font-size: 15px; color: var(--red); cursor: pointer; padding: 2px 4px 4px; }
.vp.err .vmsg { display: block; }
.vseek { position: relative; min-width: 0; height: 44px; display: flex; align-items: center; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; border-radius: 8px; }
.vseek:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vbar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.vthumb { position: absolute; top: 50%; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--card); opacity: 0; transition: opacity .15s; pointer-events: none; }
.vp.cur .vthumb, .vp.drag .vthumb { opacity: 1; }
.vp.drag .vthumb { width: 20px; height: 20px; margin: -10px 0 0 -10px; }
.vfill { height: 100%; width: 0; background: var(--accent); }
.vdur { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -10px; line-height: 18px; white-space: nowrap; }
.vrbar { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.vrdot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--red); flex: none; animation: recpulse 1s infinite; }
/* rings around the red dot grow with the microphone level (--lvl 0..1, set from an analyser) */
.vrlevel { --lvl: 0; position: relative; width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; }
.vrlevel i { position: absolute; left: 50%; top: 50%; width: calc(14px + var(--lvl) * 12px); height: calc(14px + var(--lvl) * 12px); border-radius: 50%;
  border: 2px solid var(--red); transform: translate(-50%, -50%); opacity: calc(var(--lvl) * 1.2); transition: width .08s linear, height .08s linear, opacity .08s linear; }
.vrlevel i + i { width: calc(14px + var(--lvl) * 24px); height: calc(14px + var(--lvl) * 24px); opacity: calc(var(--lvl) * .7); }
.vrtime { flex: 1; font-variant-numeric: tabular-nums; font-weight: 600; min-width: 0; white-space: nowrap; }
.vrtime.warn { color: var(--red); }
.vrbtn { min-height: 46px; border-radius: 999px; padding: 0 14px; background: var(--card); color: var(--ink); border: 1px solid var(--line); font-size: 16px; flex: none; }
.vrbtn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.photoprev { display: flex; flex-direction: column; gap: 12px; max-height: 100%; }
.photoprev img { max-width: 100%; max-height: 46vh; object-fit: contain; border-radius: 12px; align-self: center; background: #000; }
.prevnote { color: var(--warn); text-align: center; font-size: 15px; }
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; overflow-y: auto; max-height: 44vh; }
.pthumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #000; }
.photoprev .pgrid img { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; border-radius: 0; }
.prm { position: absolute; top: 0; right: 0; width: 44px; height: 44px; padding: 0; background: none; border: 0; }
.prm::before { content: '✕'; position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: 15px; line-height: 28px; text-align: center; }
.photoprev input { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; }
.prevbtns { display: flex; gap: 10px; }
.prevbtns .big { flex: 1; min-width: 0; margin: 0; padding: 14px 8px; }
.viewer { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; }
.viewerbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: max(12px, env(safe-area-inset-top)) 12px 8px; }
.viewerstage { position: relative; flex: 1; min-height: 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.viewer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.viewermsg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; font-size: 18px; padding: 24px; }
.viewercount { color: #fff; font-size: 18px; font-variant-numeric: tabular-nums; }
.vnav { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 76px; padding: 0; border-radius: 14px; background: rgba(0,0,0,.5); color: #fff; font-size: 42px; line-height: 1; z-index: 2; }
.vnav.prev { left: 6px; } .vnav.next { right: 6px; }

/* "at the ear" lock: a black layer that swallows every touch; only a 2-second hold on the ring at the bottom opens it */
.earlock { position: fixed; inset: 0; z-index: 2147483000; background: #000; display: flex; align-items: flex-end; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.earhint { opacity: .35; text-align: center; padding: 0 24px max(28px, env(safe-area-inset-bottom)); max-width: 360px; }
.earhint p { margin: 14px 0 0; font-size: 16px; line-height: 1.35; color: #fff; }
.earhold { position: relative; width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.earhold svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.earring-bg, .earring { fill: none; stroke-width: 4; }
.earring-bg { stroke: #fff; opacity: .5; }
.earring { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 207.35; stroke-dashoffset: 207.35; }
.earhold .ic { width: 30px; height: 30px; pointer-events: none; }

/* ---- tab bar (like SC: two-tone icons, solid when active, accent colour) ---- */
.tabbar { flex: none; display: flex; border-top: 1px solid var(--line); background: var(--card); padding-bottom: var(--safe-bottom); }
.tab { flex: 1; min-width: 0; min-height: 56px; background: none; padding: 8px 2px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 13px; }
.tab .tic { position: relative; display: block; width: 24px; height: 24px; }
.tab .tic .ic { position: absolute; inset: 0; }
.tab .tic .on, .tab.active .tic .off { display: none; }
.tab.active .tic .on { display: block; }
.tab.active { color: var(--accent); }
.tab .tl { line-height: 1.1; font-weight: 500; }

/* ---- settings ---- */
.sect { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; flex: none; }
.sect h3 { margin: 0 0 4px; font-size: 18px; }
.sect p { margin: 0; }
.themes { display: flex; flex-wrap: wrap; gap: 10px 8px; margin-top: 10px; }
.theme { width: 66px; min-height: 44px; padding: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 5px; }
.theme .sw { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; }
.theme.sel .sw { border-color: var(--accent); }
.theme.sel .nm { color: var(--ink); font-weight: 600; }
.theme .adot { width: 16px; height: 16px; border-radius: 50%; }
.theme .nm { font-size: 12px; text-align: center; line-height: 1.15; }
.linkrow { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; background: none; color: var(--ink); font-size: 17px; text-align: left; }
.sect h3 + .linkrow, .sect p + .linkrow { margin-top: 4px; }
.linkrow + .linkrow { border-top: 1px solid var(--line); }
.linkrow .chev { color: var(--muted); width: 20px; height: 20px; }
.linkrow .persist { font-size: 15px; color: var(--muted); }
#access .sect { display: flex; flex-direction: column; gap: 8px; }
#access .glist.inner { overflow: visible; flex: none; padding: 4px 0; }
#access .gform { padding: 4px 0; border-bottom: 0; }
#access a { color: var(--accent-text); }
#access .gitem { background: var(--bg); }
#settings .glist, #access .glist:not(.inner), #chats .glist { padding-bottom: 12px; }
#chats .glist { padding-top: 4px; }
#main.incall .pushinfo { display: none; }
.pushinfo { padding-top: 6px; text-align: left; }
#main.lobby .pushinfo { padding: 8px 2px; }
#main:not(.lobby) .pushinfo { text-align: center; }
#access a { display: inline-block; min-height: 44px; line-height: 44px; }

/* ---- bottom sheet (like SC: dim layer, card with 18px top corners; slides up from the bottom) ---- */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; animation: sheetfade .18s ease-out; }
.sheet { background: var(--card); color: var(--ink); width: 100%; max-width: 560px; margin: 0 auto; border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 20px 18px calc(18px + var(--safe-bottom)); max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; animation: sheetup .22s ease-out; }
.sheet h2 { margin: 0 0 8px; font-size: 21px; line-height: 1.25; overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; font-size: 17px; line-height: 1.4; }
.sheet-body p { margin: 0 0 10px; color: var(--ink); }
.sheet-body p:last-child { margin-bottom: 0; }
.sheet-row { display: flex; gap: 10px; margin-top: 18px; flex: none; }
.sbtn { flex: 1; min-width: 0; min-height: 52px; border-radius: 12px; padding: 10px 8px; font-size: 19px; font-weight: 700; background: var(--chip); color: var(--ink); }
.sbtn.primary { background: color-mix(in srgb, var(--accent-text) 90%, #000); color: var(--on-accent); }
.sbtn.danger { background: color-mix(in srgb, var(--red) 82%, #000); color: #fff; }
.sbtn:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }
@keyframes sheetup { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes sheetfade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet-bg, .sheet { animation: none; } }
/* version history inside the sheet */
.cl-entry { padding: 10px 0; border-top: 1px solid var(--line); }
.cl-entry:first-child { border-top: 0; padding-top: 0; }
.cl-h { font-weight: 700; font-size: 17px; }
.cl-h .cur { color: var(--accent-text); font-weight: 600; }
.cl-entry ul { margin: 6px 0 0; padding-left: 20px; }
.cl-entry li { margin: 0 0 6px; font-size: 16px; }

/* ---- "a new version is out" bar (like SC): a plate at the top, never in a call ---- */
.update-bar { position: fixed; left: 50%; top: calc(var(--safe-top) + 10px); transform: translateX(-50%); z-index: 15; display: flex; align-items: center; gap: 12px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 5px 5px 5px 16px; font-size: 16px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.28); white-space: nowrap; max-width: calc(100vw - 24px); }
.update-bar button { min-height: 44px; border-radius: 10px; padding: 0 16px; font-size: 16px; font-weight: 700; background: color-mix(in srgb, var(--accent-text) 90%, #000); color: var(--on-accent); }
