/* Sat-Link, the call app (call.html). A phone screen: full height on a phone, a phone-shaped column on a desktop. */
body.callapp { margin: 0; min-height: 100dvh; background: #050806; color: #eef3ef; font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; display: flex; justify-content: center; -webkit-font-smoothing: antialiased; }
.ca { position: relative; width: 100%; max-width: 440px; height: 100dvh; overflow: hidden; background: #0b100d; }
@media (min-width: 600px) and (min-height: 700px) {
  body.callapp { align-items: center; }
  .ca { height: min(900px, 94dvh); border-radius: 38px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 10px #151a17, 0 0 0 11px #2a312c; }
}

/* screens */
.ca__home, .ca__call, .ca__ended { position: absolute; inset: 0; display: none; }
.ca[data-screen="home"] .ca__home { display: flex; }
.ca[data-screen="call"] .ca__call { display: block; }
.ca[data-screen="ended"] .ca__ended { display: flex; }

/* the video: soft, a little grain and vignette, graded for the time of day */
.ca__video { position: absolute; inset: 0; display: none; background: #000; overflow: hidden; }
.ca[data-screen="call"] .ca__video, .ca[data-screen="ended"] .ca__video { display: block; }
.ca__video canvas { width: 100%; height: 100%; display: block; filter: saturate(1.06) contrast(1.04); }
.ca__video.is-golden canvas { filter: sepia(0.16) saturate(1.2) contrast(1.03); }
.ca__video.is-dawn canvas { filter: saturate(0.85) hue-rotate(-8deg) contrast(1.04); }
.ca__video.is-night canvas { filter: saturate(0.72) contrast(1.08); }
.ca.is-weak .ca__video canvas { image-rendering: pixelated; filter: saturate(0.8) contrast(1.12); }
.ca__grain { position: absolute; inset: -10%; opacity: 0.08; mix-blend-mode: overlay; pointer-events: none; animation: ca-grain 0.45s steps(3) infinite; }
.ca.is-weak .ca__grain { opacity: 0.16; }
@keyframes ca-grain { 0% { transform: translate(0, 0); } 33% { transform: translate(-3%, 2%); } 66% { transform: translate(2%, -3%); } }
.ca__vignette { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 42%, transparent 55%, rgba(0, 0, 0, 0.45)); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .ca__grain { animation: none; } }

/* home: the contact */
.ca__home { flex-direction: column; gap: 16px; padding: calc(26px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom)); background: radial-gradient(120% 60% at 50% 0%, #1b3325, #0b100d 70%); overflow-y: auto; }
.ca__brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; letter-spacing: 0.01em; }
.ca__brand small { font-weight: 500; font-size: 0.68rem; color: #9fb3a6; border: 1px solid #2f4236; border-radius: 999px; padding: 2px 8px; }
.ca__logo { color: #3ddc84; }
.ca__lede { margin: -8px 0 0; color: #9fb3a6; font-size: 0.9rem; }
.ca__card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 22px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); }
.ca__avatar { width: 64px; height: 64px; flex: none; border-radius: 50%; object-fit: cover; background: #1d2a22; box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.35); }
.ca__who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ca__who b { font-size: 1.05rem; }
.ca__who span { color: #cfe0d4; font-size: 0.86rem; }
.ca__who small { color: #8ea596; font-size: 0.76rem; line-height: 1.35; }
.ca__doing { color: #b9d3c1 !important; }
.ca__pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.82rem; color: #9fb3a6; }
.ca__pick select { font: inherit; font-size: 0.86rem; color: #eef3ef; background: #16211b; border: 1px solid #2f4236; border-radius: 10px; padding: 6px 10px; }
.ca__dial { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px; border: 0; border-radius: 999px; background: #3ddc84; color: #062112; font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; box-shadow: 0 10px 30px rgba(61, 220, 132, 0.25); }
.ca__dial:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.ca__dial:not(:disabled):hover { background: #52e896; }
.ca__note { margin: 0; color: #8ea596; font-size: 0.78rem; line-height: 1.45; }
.ca__links { display: flex; gap: 6px; align-items: center; justify-content: center; color: #6f8577; font-size: 0.8rem; }
.ca__links a, .ca__links button { color: #b9d3c1; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
.ca__links a:hover, .ca__links button:hover { color: #fff; }

/* the call: top bar, your (camera-off) tile, captions, the typed line, the controls */
.ca__top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; justify-content: space-between; align-items: flex-start; padding: calc(14px + env(safe-area-inset-top)) 18px 34px; background: linear-gradient(rgba(0, 0, 0, 0.55), transparent); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.ca__top b { display: block; font-size: 1.15rem; }
.ca__top span { font-size: 0.78rem; color: #d7e2da; font-variant-numeric: tabular-nums; }
.ca__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.ca__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.ca__bars i { width: 3px; border-radius: 1px; background: rgba(255, 255, 255, 0.3); }
.ca__bars i:nth-child(1) { height: 4px; } .ca__bars i:nth-child(2) { height: 6px; } .ca__bars i:nth-child(3) { height: 9px; } .ca__bars i:nth-child(4) { height: 12px; }
.ca__bars[data-n="1"] i:nth-child(-n+1), .ca__bars[data-n="2"] i:nth-child(-n+2), .ca__bars[data-n="3"] i:nth-child(-n+3), .ca__bars[data-n="4"] i { background: #fff; }
.ca__bars[data-n="1"] i:nth-child(-n+1) { background: #ff8a80; }
.ca__self { position: absolute; top: calc(74px + env(safe-area-inset-top)); right: 14px; z-index: 3; width: 82px; height: 114px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; box-sizing: border-box; border-radius: 14px; background: rgba(20, 27, 23, 0.85); border: 1px solid rgba(255, 255, 255, 0.12); color: #9fb3a6; text-align: center; }
.ca__self span { font-size: 1.2rem; opacity: 0.6; }
.ca__self small { font-size: 0.62rem; line-height: 1.25; }
.ca__weak { position: absolute; top: calc(78px + env(safe-area-inset-top)); left: 14px; z-index: 3; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #ffd28a; font-size: 0.72rem; }
.ca__captions { position: absolute; left: 14px; right: 14px; bottom: calc(112px + env(safe-area-inset-bottom)); z-index: 3; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.ca.is-typing .ca__captions { bottom: calc(168px + env(safe-area-inset-bottom)); }
.ca__cap { margin: 0; max-width: 86%; padding: 7px 11px; border-radius: 14px; background: rgba(0, 0, 0, 0.58); font-size: 0.92rem; line-height: 1.35; transition: opacity 0.6s; }
.ca__cap--them { align-self: flex-start; }
.ca__cap--you { align-self: flex-end; background: rgba(61, 220, 132, 0.3); }
.ca__cap--sys { align-self: center; max-width: 94%; font-size: 0.78rem; color: #ffe3e4; background: rgba(229, 72, 77, 0.32); text-align: center; }
.ca__cap.is-old { opacity: 0.35; }
.ca__typed { position: absolute; left: 12px; right: 12px; bottom: calc(104px + env(safe-area-inset-bottom)); z-index: 4; display: flex; gap: 8px; }
.ca__typed input { flex: 1; min-width: 0; padding: 11px 15px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(10, 14, 12, 0.8); color: #fff; font: inherit; font-size: 16px; backdrop-filter: blur(8px); }
.ca__typed input:focus { outline: none; border-color: rgba(61, 220, 132, 0.7); }
.ca__typed button { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #3ddc84; color: #062112; font-size: 1rem; cursor: pointer; }
.ca__controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: space-around; padding: 14px 26px calc(20px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); }
.ca__ctl { width: 64px; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }
.ca__ctl span { font-size: 1.35rem; line-height: 1; }
.ca__ctl small { font-size: 0.6rem; }
.ca__ctl:hover { background: rgba(255, 255, 255, 0.24); }
.ca__ctl.is-on { background: #fff; color: #111; }
.ca__ctl.is-off { background: rgba(229, 72, 77, 0.38); }
.ca__ctl--end, .ca__ctl--end:hover { background: #e5484d; }
.ca__ctl:focus-visible, .ca__dial:focus-visible { outline: 2px solid #3ddc84; outline-offset: 3px; }

/* ringing: their photo, blurred behind their face, until they pick up */
.ca__ringing { position: absolute; inset: 0; z-index: 5; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; overflow: hidden; background: #0b100d; }
.ca.is-ringing .ca__ringing { display: flex; }
.ca__ringbg { position: absolute; inset: -40px; background-size: cover; background-position: center 20%; filter: blur(28px) brightness(0.5) saturate(1.1); }
.ca__ringface { position: relative; width: 132px; height: 132px; border-radius: 50%; object-fit: cover; animation: ca-pulse 1.6s ease-out infinite; }
@keyframes ca-pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.55); } 100% { box-shadow: 0 0 0 26px rgba(61, 220, 132, 0); } }
.ca__ringing b { position: relative; font-size: 1.6rem; }
.ca__ringing span { position: relative; color: #cfe0d4; font-size: 0.86rem; }

/* after the call: the last frame, dimmed */
.ca__ended { z-index: 7; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(5, 8, 6, 0.72); backdrop-filter: blur(6px); cursor: pointer; text-align: center; padding: 24px; }
.ca__ended b { font-size: 1.3rem; }
.ca__ended span { color: #cfe0d4; font-variant-numeric: tabular-nums; max-width: 30ch; line-height: 1.4; }

/* the game's video mode (engine/client/ui/video-call.js): the same call screen over the game's own canvas */
.ca.ca--game { position: fixed; inset: 0; z-index: 40; width: auto; max-width: none; height: auto; background: transparent; border-radius: 0; box-shadow: none; pointer-events: none; }
.ca.ca--game[hidden] { display: none; }
.ca--game .ca__call { display: block; }
.ca--game .ca__top, .ca--game .ca__self, .ca--game .ca__typed, .ca--game .ca__controls, .ca--game .ca__ringing, .ca--game .ca__weak { pointer-events: auto; }
.ca--game .ca__controls { justify-content: center; gap: 22px; }
.ca__fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
body.is-video #game { filter: saturate(1.06) contrast(1.04); }
body.is-video.is-video-dark #game { filter: saturate(0.75) contrast(1.08); }
body.is-video.is-video-weak #game { image-rendering: pixelated; filter: saturate(0.8) contrast(1.12); }
.ca__ctl--field { background: rgba(61, 220, 132, 0.3); }
.ca__ctl--field:hover { background: rgba(61, 220, 132, 0.45); }
.ca__mission { color: #d7c28a !important; }

/* the talk button: hands-free (a tap switches to hold to talk) or hold to talk (press and hold); the pill switches back */
.ca__ctl--talk { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ca__ctl--talk.is-talking, .ca__ctl--talk.is-talking:hover { background: #3ddc84; color: #062112; }
.ca__mode { display: block; width: max-content; margin-top: 6px; padding: 3px 9px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; background: rgba(0, 0, 0, 0.35); color: #d7e2da; font: 600 0.66rem var(--font-body, system-ui, sans-serif); cursor: pointer; }
.ca__mode:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
/* five controls now (Mute, Talk, Type, Field or Play, End): smaller circles and a tighter gap on a phone so the row never overflows */
.ca__ctl small { text-align: center; line-height: 1.1; }
@media (max-width: 480px) {
  .ca__ctl { width: 56px; height: 56px; }
  .ca__controls { padding-left: 12px; padding-right: 12px; }
  .ca--game .ca__controls { gap: 10px; }
}
