:root {
  color-scheme: dark;
  --cyan: #38bdf8; --ice: #bae6fd; --aqua: #22d3ee; --ink: #eaf7ff; --dim: rgba(186, 230, 253, .58);
  --line: rgba(125, 211, 252, .16); --glass: rgba(9, 28, 40, .55);
  --level: 0; /* 0..1, how loud the call is right now — the rings breathe with it */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); overflow: hidden;
  font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }

/* ── the sky behind everything ─────────────────────────────────────────────── */
.sky { position: fixed; inset: 0; background: radial-gradient(120% 80% at 50% 0%, #062434 0%, #020d15 52%, #000 100%); overflow: hidden; }
.glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.glow.g1 { width: 78vw; height: 78vw; left: -22vw; top: -14vw; background: #0b5d86; animation: drift 16s ease-in-out infinite alternate; }
.glow.g2 { width: 70vw; height: 70vw; right: -26vw; bottom: 4vh; background: #0a3f72; animation: drift 21s ease-in-out infinite alternate-reverse; }
.grid { position: absolute; inset: -40% -40% -10%; opacity: .5;
  background-image: linear-gradient(rgba(56, 189, 248, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(56, 189, 248, .09) 1px, transparent 1px);
  background-size: 46px 46px; transform: perspective(700px) rotateX(62deg) translateY(30%);
  -webkit-mask-image: linear-gradient(transparent 22%, #000 68%); mask-image: linear-gradient(transparent 22%, #000 68%);
  animation: slide 9s linear infinite; }
@keyframes drift { to { transform: translate(9vw, 7vh) scale(1.15); } }
@keyframes slide { to { background-position: 0 46px, 0 46px; } }

#app { position: relative; height: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: rise .5s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 20px;
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 18px 50px -24px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .06); }

/* ── the emblem: logo inside turning rings ─────────────────────────────────── */
.emblem { position: relative; width: min(64vw, 262px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; flex: none; }
.emblem.small { width: min(44vw, 176px); }
.emblem img { width: 74%; position: relative; filter: drop-shadow(0 0 22px rgba(56, 189, 248, .75)); transition: transform .18s ease, filter .3s ease; }
.emblem::before { content: ""; position: absolute; inset: 12%; border-radius: 50%; background: radial-gradient(circle, rgba(56, 189, 248, .42), transparent 68%); filter: blur(16px); }
.ring { position: absolute; border-radius: 50%; border: 1px solid transparent; }
.ring.r1 { inset: 3%; border-top-color: var(--ice); border-right-color: rgba(56, 189, 248, .55); animation: spin 5.5s linear infinite; }
.ring.r2 { inset: -5%; border: 1px dashed rgba(56, 189, 248, .32); animation: spin 34s linear infinite reverse; }
.ring.r3 { inset: -13%; border-bottom-color: rgba(56, 189, 248, .55); border-left-color: rgba(56, 189, 248, .16); animation: spin 11s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── sign in ───────────────────────────────────────────────────────────────── */
#view-signin { align-items: center; justify-content: center; text-align: center; }
h1 { margin: 26px 0 2px; font-weight: 200; font-size: 34px; letter-spacing: .56em; margin-right: -.56em; text-transform: uppercase; text-shadow: 0 0 24px rgba(56, 189, 248, .7); }
.lead { margin: 0 0 26px; color: var(--dim); letter-spacing: .04em; }
form { width: 100%; padding: 18px; display: flex; flex-direction: column; gap: 13px; text-align: left; }
form label span, .field span { display: block; margin: 0 0 6px 2px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
input, select { width: 100%; padding: 14px 15px; border-radius: 13px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(0, 0, 0, .42); outline: none; transition: border-color .2s, box-shadow .2s; }
input::placeholder { color: rgba(186, 230, 253, .28); }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(56, 189, 248, .14); }
.primary { margin-top: 4px; padding: 15px; border-radius: 14px; font-weight: 700; letter-spacing: .04em; color: #03202b;
  background: linear-gradient(135deg, #67e8f9, #22d3ee 45%, #38bdf8); box-shadow: 0 10px 30px -10px rgba(34, 211, 238, .8); transition: transform .12s ease; }
.primary:active { transform: scale(.98); }
.foot { margin: 16px 0 0; font-size: 13px; color: rgba(186, 230, 253, .42); }
.note { min-height: 20px; margin: 4px 0 0; font-size: 13.5px; text-align: center; color: #fda4af; }
.note.good { color: #6ee7b7; }

/* ── home ──────────────────────────────────────────────────────────────────── */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px 11px 15px; border-radius: 18px; }
.pc { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; flex: none; }
.dot.on { background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .18), 0 0 14px #34d399; }
.pc-text { min-width: 0; display: flex; flex-direction: column; }
.pc-text b { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-text small { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .06); flex: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hint { margin: 10px 4px 0; font-size: 13.5px; color: var(--dim); text-align: center; }
#pc-pick { margin-top: 10px; border-radius: 14px; }

#stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px 0; }
#orb:disabled { opacity: .5; }
#orb:active:not(:disabled) img { transform: scale(.94); }
.pulse { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(125, 211, 252, .5); opacity: 0; }
#orb:not(:disabled):not(.live) .pulse { animation: ping 2.8s ease-out infinite; }
#orb:not(:disabled):not(.live) .pulse.p2 { animation-delay: 1.4s; }
@keyframes ping { 0% { opacity: .7; transform: scale(.82); } 100% { opacity: 0; transform: scale(1.5); } }
/* in a call the emblem and rings follow the voice */
#orb.live img { transform: scale(calc(1 + var(--level) * .16)); filter: drop-shadow(0 0 calc(22px + var(--level) * 46px) rgba(125, 211, 252, 1)); }
#orb.live .ring.r1 { animation-duration: 1.7s; border-top-color: #fff; }
#orb.live .ring.r3 { animation-duration: 3.4s; transform-origin: center; }
#orb.live::before { inset: calc(12% - var(--level) * 16%); background: radial-gradient(circle, rgba(125, 211, 252, .62), transparent 68%); }
#call-name { margin-top: 30px; font-size: 26px; font-weight: 600; letter-spacing: .02em; }
.chip { margin-top: 8px; padding: 6px 14px; border-radius: 999px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ice);
  background: rgba(56, 189, 248, .1); border: 1px solid var(--line); }
.heard { margin-top: 14px; min-height: 46px; max-width: 92%; font-size: 15px; line-height: 1.5; color: rgba(234, 247, 255, .86); }

.dock { align-self: center; display: flex; gap: 14px; padding: 12px 16px; border-radius: 28px; margin: 4px 0 14px; animation: rise .4s cubic-bezier(.16, 1, .3, 1) both; }
.round { width: 68px; height: 68px; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); transition: transform .12s ease, background .2s; }
.round:active { transform: scale(.94); }
.round em { font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.round.danger { width: 78px; background: linear-gradient(135deg, #fb7185, #ef4444); border-color: transparent; box-shadow: 0 10px 28px -10px #ef4444; }
.round.danger em, .round[aria-pressed="true"] em { color: rgba(255, 255, 255, .92); }
.round[aria-pressed="true"] { background: linear-gradient(135deg, #fcd34d, #f59e0b); border-color: transparent; color: #2b1a00; }

#extras { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { padding: 10px 12px 8px; border-radius: 16px; min-width: 0; }
.field span { margin-bottom: 2px; }
.field select { padding: 4px 0; border: 0; background: transparent; box-shadow: none; font-size: 14.5px; font-weight: 600; text-overflow: ellipsis; }
.field select:disabled { opacity: .5; }
#home-note { margin-top: 10px; }

/* ── tabs: Jarvis · To-do · Notes ───────────────────────────────────────────── */
.tab { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabs { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; margin-top: 12px; border-radius: 22px; }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 16px; color: var(--dim); transition: background .2s, color .2s; }
.tabs button em { font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.tabs button.on { color: #fff; background: rgba(56, 189, 248, .16); box-shadow: inset 0 0 0 1px var(--line); }
h2 { margin: 16px 4px 12px; font-size: 24px; font-weight: 600; letter-spacing: .01em; }
.add { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 4px; border-radius: 16px; }
.add input { border: 0; background: transparent; box-shadow: none; padding: 11px 12px; }
.plus { flex: none; width: 42px; height: 42px; border-radius: 13px; font-size: 26px; line-height: 1; color: #03202b; background: linear-gradient(135deg, #67e8f9, #38bdf8); }
.list { flex: 1; min-height: 0; overflow-y: auto; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); text-align: left; width: 100%; }
.row .check { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 2px solid rgba(125, 211, 252, .6); display: grid; place-items: center; }
.row.done .check { background: #34d399; border-color: #34d399; }
.row.done .check::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #032; border-bottom: 2px solid #032; transform: rotate(-45deg) translateY(-1px); }
.row .text { flex: 1; min-width: 0; }
.row b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.row.done b { text-decoration: line-through; opacity: .5; }
.row small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row small.late { color: #fda4af; }
.empty { margin: 34px 0; text-align: center; color: var(--dim); }
.slim { padding: 11px 18px; align-self: flex-start; }
.quiet { padding: 10px 8px; color: var(--dim); }
.sheet { position: absolute; inset: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); z-index: 5; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: rgba(4, 16, 24, .94); animation: rise .3s cubic-bezier(.16, 1, .3, 1) both; }
.sheet textarea { flex: 1; min-height: 0; width: 100%; resize: none; padding: 14px 15px; border-radius: 13px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(0, 0, 0, .42); color: inherit; font: inherit; line-height: 1.55; outline: none; }
.sheet-row { display: flex; align-items: center; gap: 6px; }
.sheet-row span { flex: 1; }

@media (max-height: 640px) { .emblem { width: min(46vw, 190px); } #call-name { margin-top: 18px; font-size: 22px; } .heard { min-height: 24px; } }
@media (prefers-reduced-motion: reduce) { .glow, .grid, .ring, .pulse { animation: none !important; } }
