  :root {
    --bg: #03060d; --bg2: #071427; --panel: rgba(10, 24, 42, .58); --panel-solid: #0a182a;
    --line: rgba(94, 241, 255, .16); --line-strong: rgba(94, 241, 255, .45);
    --text: #dff7ff; --muted: #7f9fb4; --accent: #5ef1ff; --accent-2: #3b82f6; --accent-text: #021018;
    --danger: #ff4d6d; --rec: #ff3b5c; --ok: #7dff9b; --orange: #ff9f43;
    --glow: 0 0 18px rgba(94, 241, 255, .35); --glow-strong: 0 0 28px rgba(94, 241, 255, .6);
    --s1: #5ef1ff; --s2: #ff5ecf; --s3: #7dff9b; --s4: #ffc85e; --s5: #b49bff; --s6: #ff8f5e;
    --display: "Orbitron", "Segoe UI", system-ui, sans-serif;
    --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    color-scheme: dark;
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html { background: var(--bg); }
  body {
    margin: 0; min-height: 100vh; color: var(--text); font: 15px/1.5 var(--body);
    background:
      radial-gradient(1200px 600px at 50% -10%, rgba(59, 130, 246, .22), transparent 60%),
      radial-gradient(700px 500px at 110% 110%, rgba(94, 241, 255, .10), transparent 60%),
      linear-gradient(var(--bg), var(--bg2));
    background-attachment: fixed;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
  /* faint HUD grid */
  body::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image: linear-gradient(rgba(94, 241, 255, .045) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(94, 241, 255, .045) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
  }
  main { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 16px; }
  h1 { font: 700 20px/1.2 var(--display); letter-spacing: .12em; text-transform: uppercase; margin: 8px 0 18px;
       text-shadow: var(--glow); }
  h2 { font: 600 12px/1.2 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin: 26px 0 10px; opacity: .9; }
  h2::before { content: ""; display: inline-block; width: 14px; height: 2px; margin: 0 8px 3px 0; background: var(--orange); box-shadow: 0 0 6px var(--orange); vertical-align: middle; }
  button, input, select, textarea { font: inherit; color: inherit; }
  input, select, textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
    background: rgba(3, 10, 20, .65); outline: none; transition: border-color .2s, box-shadow .2s;
  }
  input::placeholder, textarea::placeholder { color: #56748a; }
  input:focus, select:focus, textarea:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(94, 241, 255, .12), var(--glow); }
  select { appearance: none; -webkit-appearance: none; padding-right: 36px;
    background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
    background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; }
  textarea { resize: vertical; min-height: 46px; }
  button {
    border: 1px solid transparent; border-radius: 12px; padding: 11px 18px; cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text);
    font: 600 13px/1 var(--display); letter-spacing: .08em; text-transform: uppercase;
    box-shadow: var(--glow); transition: transform .1s, box-shadow .2s, opacity .2s;
  }
  button:active { transform: scale(.97); }
  button.ghost { background: rgba(94, 241, 255, .06); color: var(--accent); border-color: var(--line); box-shadow: none; }
  button.ghost:hover { border-color: var(--line-strong); box-shadow: var(--glow); }
  button.danger { background: rgba(255, 77, 109, .06); color: var(--danger); border-color: rgba(255, 77, 109, .3); box-shadow: none; }
  button:disabled { opacity: .45; }
  .card {
    position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-bottom: 12px;
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 10px 30px rgba(0, 0, 0, .35);
  }
  /* HUD corner brackets */
  .card::before, .card::after { content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; border: 2px solid var(--accent); opacity: .7; }
  .card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
  .card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; border-color: var(--orange); }
  .label { font: 600 11px/1.2 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); opacity: .85; }
  .muted { color: var(--muted); font-size: 15px; }
  .row { display: flex; gap: 10px; align-items: center; }
  .row > * { flex: 1; }
  .row > button { flex: 0 0 auto; }
  .stack > * + * { margin-top: 10px; }
  .agent-row { display: flex; gap: 6px; align-items: center; padding: 2px 0; border-radius: 12px; touch-action: manipulation; }
  .agent-row.dragging { opacity: .4; }
  .agent-row.drag-over { box-shadow: inset 0 0 0 1px var(--accent); }
  .agent-row .drag-h { flex: 0 0 auto; cursor: grab; color: var(--muted); padding: 4px 6px; user-select: none; -webkit-user-select: none; font-size: 15px; line-height: 1; }
  .agent-row .drag-h:active { cursor: grabbing; }
  .agent-row .ag-move { flex: 0 0 auto; padding: 8px 10px; min-width: 36px; }
  .hidden { display: none !important; }
  .error { color: var(--danger); font-size: 15px; }

  /* top bar */
  .topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
  .brand { display: flex; align-items: center; gap: 10px; font: 800 15px/1 var(--display); letter-spacing: .38em; }
  .brand img { width: 30px; height: 30px; border-radius: 50%; filter: drop-shadow(0 0 6px rgba(94, 241, 255, .5)); }
  .brand span, .wordmark { background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 55%, var(--orange) 100%);
                           -webkit-background-clip: text; background-clip: text; color: transparent;
                           filter: drop-shadow(0 0 10px rgba(94, 241, 255, .35)); }
  /* live status light: data-s = ok | bad | rec | warn | think | speak */
  .status { font: 500 11px/1 var(--display); letter-spacing: .2em; color: var(--muted); display: flex; align-items: center; gap: 8px; --l: var(--ok); transition: color .3s; }
  .status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--l); box-shadow: 0 0 10px var(--l), 0 0 2px var(--l); animation: blink 2.4s infinite; }
  .status[data-s="bad"] { --l: var(--danger); color: var(--danger); }
  .status[data-s="rec"] { --l: var(--rec); color: var(--rec); } .status[data-s="rec"]::before { animation-duration: .9s; }
  .status[data-s="warn"] { --l: #ffc85e; color: var(--warn-c); } .status[data-s="warn"]::before { animation-duration: .6s; }
  .status[data-s="think"] { --l: var(--accent); color: var(--accent); } .status[data-s="think"]::before { animation-duration: .45s; }
  .status[data-s="speak"] { --l: #b49bff; color: var(--violet); } .status[data-s="speak"]::before { animation: pulse-l .7s ease-in-out infinite; }
  @keyframes pulse-l { 50% { transform: scale(1.6); box-shadow: 0 0 16px var(--l); } }

  /* floating activity pill (visible from anywhere while something is happening) */
  #activity { position: fixed; left: 50%; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; z-index: 6;
              bottom: calc(92px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 9px 16px;
              border-radius: 99px; background: rgba(6, 16, 30, .88); border: 1px solid var(--l, var(--accent));
              box-shadow: 0 0 18px color-mix(in srgb, var(--l, var(--accent)) 45%, transparent), 0 8px 30px rgba(0,0,0,.5);
              font: 600 11px/1 var(--display); letter-spacing: .16em; color: var(--l, var(--accent)); white-space: nowrap;
              backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: opacity .25s, transform .25s; }
  #activity.show { opacity: 1; transform: translate(-50%, 0); }
  #activity .light { width: 9px; height: 9px; border-radius: 50%; background: var(--l); box-shadow: 0 0 10px var(--l); animation: blink .6s infinite; }
  #activity .fx { display: flex; gap: 3px; align-items: flex-end; height: 12px; }
  #activity .fx i { width: 3px; border-radius: 2px; background: var(--l); box-shadow: 0 0 6px var(--l); }
  #activity[data-s="think"] .fx i { height: 4px; animation: dot 1.2s infinite; } /* typing dots */
  #activity[data-s="think"] .fx i:nth-child(2) { animation-delay: .15s; } #activity[data-s="think"] .fx i:nth-child(3) { animation-delay: .3s; }
  #activity[data-s="think"] .fx i:nth-child(4) { display: none; }
  #activity[data-s="speak"] .fx i, #activity[data-s="rec"] .fx i { height: 12px; animation: eq .8s ease-in-out infinite; transform-origin: bottom; }
  #activity .fx i:nth-child(2) { animation-delay: .2s !important; } #activity .fx i:nth-child(3) { animation-delay: .4s !important; } #activity .fx i:nth-child(4) { animation-delay: .1s !important; }
  #activity[data-s="warn"] .fx i { height: 4px; animation: dot 1s infinite; }
  @keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
  .msg.thinking .tlabel { font: 600 11px/1 var(--display); letter-spacing: .14em; color: var(--accent); margin-right: 4px; }
  @keyframes blink { 50% { opacity: .35; } }

  /* login */
  #login { max-width: 380px; margin: 0 auto; padding-top: calc(9vh + env(safe-area-inset-top)); text-align: center;
           z-index: auto; /* no separate layer, so the logo video's black blends away into the page */ }
  #login .wordmark { font: 800 34px/1 var(--display); letter-spacing: .38em; margin: 14px 0 8px; padding-left: .38em; }
  .login-logo { width: 190px; height: 190px; display: block; margin: 0 auto; animation: logo-breathe 4s ease-in-out infinite; }
  .login-video { width: 230px; height: 230px; object-fit: cover; border-radius: 50%; mix-blend-mode: screen; animation: none; background: transparent;
                 -webkit-mask-image: radial-gradient(circle, #000 62%, transparent 71%); mask-image: radial-gradient(circle, #000 62%, transparent 71%); }
  @keyframes logo-breathe { 50% { filter: drop-shadow(0 0 18px rgba(94, 241, 255, .45)) drop-shadow(0 0 30px rgba(255, 159, 67, .2)); } }
  #login .tag { font: 500 11px/1 var(--display); letter-spacing: .3em; color: var(--muted); margin-bottom: 26px; }
  #login .card { text-align: left; }
  #login .keep-in { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); cursor: pointer; }
  #login .keep-in input { width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }

  /* nav */
  nav.tabs {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5;
    display: flex; gap: 4px; padding: 6px; width: min(440px, calc(100% - 32px));
    background: rgba(6, 16, 30, .78); border: 1px solid var(--line); border-radius: 20px;
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
  }
  nav.tabs button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 7px;
    background: none; color: var(--muted); box-shadow: none; border-radius: 12px; font-size: 11px; letter-spacing: .14em;
  }
  nav.tabs button svg { width: 21px; height: 21px; }
  nav.tabs button.active { color: var(--accent); background: rgba(94, 241, 255, .09); text-shadow: var(--glow); }
  nav.tabs button.active svg { filter: drop-shadow(0 0 6px rgba(94, 241, 255, .8)); }

  /* arc-reactor record button */
  .recorder { text-align: center; padding: 26px 16px 18px; overflow: hidden; }
  .reactor { position: relative; width: 196px; height: 196px; margin: 4px auto 0; padding: 0; border-radius: 50%;
             background: none; border: 0; box-shadow: none; display: block; color: var(--accent); --c: var(--accent); }
  .reactor .ring { position: absolute; border-radius: 50%; inset: 0; pointer-events: none; }
  .reactor .r1 { border: 2px solid transparent; border-top-color: var(--c); border-bottom-color: var(--c); animation: spin 9s linear infinite; opacity: .8; }
  .reactor .r2 { inset: 16px; border: 1px dashed var(--orange); opacity: .55; animation: spin 16s linear infinite reverse; }
  .reactor.on .r2 { border-color: var(--c); }
  .reactor .r3 { inset: 30px; background: conic-gradient(from 0deg, transparent 0 8%, var(--c) 8% 10%, transparent 10% 25%, var(--c) 25% 27%,
                   transparent 27% 50%, var(--c) 50% 52%, transparent 52% 75%, var(--c) 75% 77%, transparent 77%);
                 -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%); mask: radial-gradient(circle, transparent 60%, #000 61%);
                 opacity: .7; animation: spin 6s linear infinite; }
  .reactor .core { position: absolute; inset: 50px; border-radius: 50%; display: grid; place-items: center;
                   background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .95), var(--c) 32%, rgba(4, 16, 30, .9) 72%);
                   box-shadow: 0 0 30px var(--c), 0 0 70px rgba(94, 241, 255, .35), inset 0 0 22px rgba(255, 255, 255, .5);
                   font: 800 13px/1 var(--display); letter-spacing: .22em; color: #02121c; padding-left: .22em; transition: box-shadow .3s; }
  .reactor:active .core { transform: scale(.97); }
  .reactor.on { --c: var(--rec); }
  .reactor.on .r1 { animation-duration: 2.2s; }
  .reactor.on .r2 { animation-duration: 4s; }
  .reactor.on .r3 { animation-duration: 1.6s; }
  .reactor.on .core { color: #fff; box-shadow: 0 0 34px var(--rec), 0 0 90px rgba(255, 59, 92, .45), inset 0 0 22px rgba(255, 255, 255, .45);
                      animation: breathe 1.6s ease-in-out infinite; background: radial-gradient(circle at 50% 45%, #ffd0d8, var(--rec) 34%, rgba(30, 4, 10, .9) 74%); }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes breathe { 50% { box-shadow: 0 0 50px var(--rec), 0 0 120px rgba(255, 59, 92, .55), inset 0 0 22px rgba(255, 255, 255, .45); } }
  .timer { font: 700 40px/1 var(--display); letter-spacing: .08em; font-variant-numeric: tabular-nums; margin: 22px 0 12px; text-shadow: var(--glow); }
  #recWave { width: 100%; height: 56px; display: block; }

  .list-item { display: block; width: 100%; text-align: left; margin-bottom: 10px; padding: 14px 16px;
               background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: none;
               font: 400 15px/1.45 var(--body); letter-spacing: 0; text-transform: none; border-radius: 12px;
               backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .list-item:hover { border-color: var(--line-strong); box-shadow: var(--glow); }
  .list-item .t { font-weight: 600; }
  .badge { display: inline-block; font: 600 11px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; padding: 4px 8px;
           border-radius: 99px; border: 1px solid var(--line-strong); color: var(--accent); margin-left: 8px; vertical-align: 2px; }

  .spk { display: grid; grid-template-columns: 14px 1fr; gap: 12px; align-items: center; }
  .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
  .seg { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .seg:last-child { border-bottom: 0; }
  .seg .when { color: var(--muted); font: 500 11px/1 var(--display); letter-spacing: .08em; margin-left: 8px; cursor: pointer; }
  .seg select { width: auto; padding: 4px 30px 4px 10px; font-size: 13px; border-radius: 12px; background-color: rgba(3, 10, 20, .6); }
  .seg > div { margin-top: 6px; }
  .seg .segplay { width: 26px; height: 26px; min-height: 0; padding: 0; margin-left: 6px; border-radius: 50%; font-size: 11px; line-height: 1;
                  background: transparent; border: 1px solid var(--line); color: var(--muted); box-shadow: none; vertical-align: middle; }
  .seg .segplay.on { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 40%, transparent); }
  .seg.playing > div { color: var(--accent); }

  .chat { display: flex; flex-direction: column; gap: 10px; }
  .msg { padding: 11px 14px; border-radius: 20px; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; }
  .msg.user { align-self: flex-end; background: linear-gradient(135deg, rgba(94, 241, 255, .9), rgba(59, 130, 246, .9)); color: var(--accent-text);
              border-bottom-right-radius: 4px; box-shadow: var(--glow); }
  .msg.assistant { align-self: flex-start; background: rgba(3, 10, 20, .6); border: 1px solid var(--line); border-left: 2px solid var(--accent);
                   border-bottom-left-radius: 4px; }
  .msg.thinking { display: flex; gap: 6px; align-items: center; padding: 14px 16px; }
  .msg.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: dot 1.2s infinite; }
  .msg.thinking i:nth-child(2) { animation-delay: .15s; } .msg.thinking i:nth-child(3) { animation-delay: .3s; }
  @keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
  .quick { display: flex; flex-wrap: wrap; gap: 8px; }
  .quick button { font-size: 11px; padding: 9px 12px; }
  audio { width: 100%; color-scheme: dark; border-radius: 12px; }
  #cTgBtn { background: linear-gradient(135deg, #2aabee, #229ed9); color: #fff; box-shadow: 0 0 18px rgba(42, 171, 238, .45); }
  /* voice orb */
  .voice-card { text-align: center; padding: 22px 16px 16px; }
  .reactor.voice { width: 150px; height: 150px; }
  .reactor.voice .r2 { inset: 12px; } .reactor.voice .r3 { inset: 23px; } .reactor.voice .core { inset: 38px; font-size: 11px; }
  .reactor.voice.listening { --c: var(--rec); }
  .reactor.voice.listening .r1 { animation-duration: 2.2s; } .reactor.voice.listening .r3 { animation-duration: 1.6s; }
  .reactor.voice.listening .core { color: #fff; background: radial-gradient(circle at 50% 45%, #ffd0d8, var(--rec) 34%, rgba(30, 4, 10, .9) 74%);
                                   box-shadow: 0 0 34px var(--rec), 0 0 90px rgba(255, 59, 92, .45); }
  .reactor.voice.working .r1, .reactor.voice.working .r3 { animation-duration: .9s; }
  .reactor.voice.speaking .core { animation: talk .9s ease-in-out infinite; }
  @keyframes talk { 50% { box-shadow: 0 0 50px var(--c), 0 0 120px rgba(94, 241, 255, .6), inset 0 0 22px rgba(255, 255, 255, .5); transform: scale(1.04); } }
  #vWave, #gWave { width: 100%; height: 40px; display: block; margin-top: 10px; }
  .vstatus { font: 600 11px/1.4 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); min-height: 16px; margin-top: 6px; }
  .heard { color: var(--muted); font-size: 15px; min-height: 20px; margin-top: 6px; font-style: italic; }
  .switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
  .switch input { display: none; }
  .switch .track { width: 42px; height: 24px; border-radius: 99px; background: rgba(94, 241, 255, .08); border: 1px solid var(--line-strong); position: relative; transition: .2s; }
  .switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .2s; }
  .switch input:checked + .track { background: rgba(94, 241, 255, .3); box-shadow: var(--glow); }
  .switch input:checked + .track::after { left: 21px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
  .vcontrols { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
 
  input[type=range] { padding: 0; accent-color: var(--accent); background: none; border: 0; box-shadow: none; }
  /* compact header rows */
  .head { display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; }
  .head h1 { margin: 0; flex: 1; }
  .head button { padding: 9px 11px; font-size: 11px; white-space: nowrap; flex: 0 0 auto; }
  .linkbtn { background: none; border: 0; box-shadow: none; color: var(--accent); padding: 6px 4px; font: 600 11px/1.2 var(--display);
             letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
  .linkbtn:active { transform: none; opacity: 1; }
  .rec-extras { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 6px; }

  /* Hermes chat locked in its own scrolling window, message box pinned underneath */
  .chatbox { height: calc(100dvh - 520px - env(safe-area-inset-bottom)); min-height: 200px; overflow-y: auto; overscroll-behavior: contain;
             padding: 12px; margin-bottom: 10px; scroll-behavior: smooth; }
  .chatbox::after { display: none; }
  .chatbox:not(:empty)::before { display: none; }
  .chatbox:empty::before { content: "Talk to Grok Bot — your conversation appears here."; position: static; width: auto; height: auto;
                           border: 0; opacity: 1; color: var(--muted); font-size: 15px; }
  .voice-card.compact { padding: 14px 16px 10px; }
  .voice-card.compact .reactor.voice { width: 118px; height: 118px; }
  .voice-card.compact .reactor.voice .r2 { inset: 9px; } .voice-card.compact .reactor.voice .r3 { inset: 18px; }
  .voice-card.compact .reactor.voice .core { inset: 30px; font-size: 11px; }
  .voice-card.compact #vWave, .voice-card.compact #gWave { height: 26px; margin-top: 6px; }
  .voice-card.compact .heard { min-height: 0; font-size: 13px; }
  .voice-card.compact .vcontrols { justify-content: center; margin-top: 8px; }
  .convo-chat { max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }

  /* Logs list with delete buttons */
  .li-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
  .li-row .list-item { margin: 0; flex: 1; }
  .li-row .trash { flex: 0 0 48px; padding: 0; display: grid; place-items: center; font-size: 17px; }

  /* Settings */
  .set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .set-row + .set-row { border-top: 1px solid var(--line); padding-top: 12px; }
  .set-row > button { white-space: nowrap; flex: 0 0 auto; padding: 10px 12px; font-size: 11px; }
  .pill-light { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
  .pill-light::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); box-shadow: 0 0 8px var(--c, transparent); }
  .pill-light.ok { --c: var(--ok); } .pill-light.bad { --c: var(--danger); }
  .seg-choice { display: flex; gap: 6px; flex-wrap: wrap; }
  .seg-choice button { flex: 1; padding: 10px 6px; font-size: 11px; background: rgba(94, 241, 255, .06); color: var(--accent);
                       border: 1px solid var(--line); box-shadow: none; }
  .seg-choice button.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text); box-shadow: var(--glow); }
  /* smart notes */
  .notes .sum { font-size: 15px; line-height: 1.55; }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip { font: 600 11px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; padding: 6px 9px; border-radius: 99px;
          border: 1px solid var(--line-strong); color: var(--accent); background: rgba(94, 241, 255, .06); }
  .todo { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
  .todo .tx { flex: 1; } .todo .meta { color: var(--muted); font-size: 13px; }
  .todo button { flex: 0 0 auto; padding: 8px 10px; font-size: 15px; }
  .notes-wait { display: flex; align-items: center; gap: 10px; color: var(--accent); font: 600 11px/1.3 var(--display); letter-spacing: .14em; }
  .notes-wait i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: dot 1.2s infinite; }
  .notes-wait i:nth-child(2) { animation-delay: .15s; } .notes-wait i:nth-child(3) { animation-delay: .3s; }
  /* ★ lines */
  .seg .starbtn { background: none; border: 0; box-shadow: none; padding: 0 4px; font-size: 17px; color: var(--muted); float: right; }
  .seg.star { border-left: 3px solid var(--warn-c); padding-left: 10px; margin-left: -13px; background: linear-gradient(90deg, rgba(255, 200, 94, .08), transparent 70%); }
  .seg.star .starbtn { color: var(--warn-c); text-shadow: 0 0 8px rgba(255, 200, 94, .8); }
  .seg.flash { animation: flash 1.6s ease-out 1; }
  @keyframes flash { 0% { background: rgba(94, 241, 255, .35); } 100% { background: transparent; } }
  #markBtn { margin-top: 12px; background: rgba(255, 200, 94, .1); color: var(--warn-c); border: 1px solid rgba(255, 200, 94, .45);
             box-shadow: 0 0 14px rgba(255, 200, 94, .25); }
  /* search + reminders on the Logs tab */
  .searchbar { position: relative; margin-bottom: 12px; }
  .searchbar input { padding-left: 38px; }
  .searchbar::before { content: "⌕"; position: absolute; left: 14px; top: 50%; transform: translateY(-52%); color: var(--accent); font-size: 18px; }
  .hit { font-size: 15px; color: var(--muted); margin-top: 6px; }
  .hit mark { background: rgba(94, 241, 255, .25); color: var(--text); border-radius: 3px; padding: 0 2px; }
  .li-sum { color: var(--muted); font-size: 15px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .rem { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
  .rem + .rem { border-top: 1px solid var(--line); }
  .rem .tx { flex: 1; font-size: 15px; } .rem .when { color: var(--warn-c); font: 600 11px/1.3 var(--display); letter-spacing: .08em; }
  .rem button { padding: 6px 10px; font-size: 12px; }
  /* Zumbrix's own "are you sure?" / message / question popups (instead of the browser's grey boxes) */
  #ask { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 4, 10, .72);
         padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
         backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: askFade .15s ease; }
  #ask .card { width: min(400px, 100%); min-width: 0; overflow-wrap: anywhere; animation: askPop .18s cubic-bezier(.2, .9, .3, 1.2); }
  #ask .ask-ico { font-size: 30px; line-height: 1; }
  #ask .ask-msg { font-size: 16px; line-height: 1.45; white-space: pre-wrap; }
  #ask .ask-sub { color: var(--muted); font-size: 15px; line-height: 1.4; margin-top: -4px; white-space: pre-wrap; }
  #ask .row button { flex: 1; }
  @keyframes askFade { from { opacity: 0; } }
  @keyframes askPop { from { opacity: 0; transform: scale(.94) translateY(8px); } }
  .em-atts { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.02); }
  .em-att { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(94, 241, 255, .07); border: 1px solid rgba(94, 241, 255, .25); }
  .em-att.off { opacity: .55; background: none; border-style: dashed; }
  .em-att.off .em-name { text-decoration: line-through; }
  .em-ico { font-size: 20px; flex: 0 0 auto; } .em-name { flex: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
  .em-tog, .em-x { flex: 0 0 auto; padding: 6px 10px; min-height: 0; font-size: 13px; }
  .em-att:not(.off) .em-tog { color: var(--accent); border-color: rgba(94, 241, 255, .45); }
  .em-add { justify-self: start; padding: 7px 12px; font-size: 15px; }
  .em-menu { display: grid; gap: 6px; } .em-menu button { text-align: left; justify-content: flex-start; font-size: 15px; }
  /* dialog */
  #dlg { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0, 4, 10, .7); padding: 16px;
         backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
  #dlg .card { width: min(420px, 100%); }
  /* popups never wider than the screen (long links wrap), and scroll when taller than it */
  #dlg { grid-template-columns: minmax(0, 1fr); justify-items: center; overflow-y: auto; overscroll-behavior: contain;
         padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
  #dlg .card { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word;
               max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; }
  #dlg .card * { min-width: 0; }
  .mail-del { flex: 0 0 auto; align-self: center; width: 34px; height: 34px; padding: 0; min-height: 0; font-size: 15px; opacity: .7; }
  .spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
          animation: spin .7s linear infinite; vertical-align: -1px; margin-right: 4px; }
  .mail-link { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
  .sharebar { display: flex; gap: 8px; margin: 12px 0 4px; }
  .sharebar button { flex: 1; font-size: 11px; padding: 10px 8px; }
  .reactor.voice.wake { --c: #7fa3b8; }
  .reactor.voice.wake .r1 { animation-duration: 14s; } .reactor.voice.wake .r3 { animation-duration: 10s; }
  .reactor.voice.wake .core { font-size: 11px; letter-spacing: .12em; box-shadow: 0 0 22px rgba(127, 163, 184, .5); animation: breathe-w 3s ease-in-out infinite; }
  @keyframes breathe-w { 50% { box-shadow: 0 0 34px rgba(94, 241, 255, .45); } }
  .spk { grid-template-columns: 14px 1fr auto; }
  .recog { font: 600 11px/1 var(--display); letter-spacing: .12em; color: var(--ok); white-space: nowrap; }
  /* tasks */
  .tgroup { margin: 18px 0 6px; }
  .task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
  .task:first-child { border-top: 0; }
  .task .chk { flex: 0 0 26px; height: 26px; padding: 0; border-radius: 50%; background: none; border: 2px solid var(--line-strong);
               box-shadow: none; color: var(--accent-text); font-size: 15px; line-height: 1; }
  .task.done .chk { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: var(--glow); }
  .task .chk { position: relative; isolation: isolate; transition: border-color .25s, box-shadow .25s; }
  .task .chk::before { content: ""; position: absolute; inset: -2px; border-radius: 50%; z-index: -1; transform: scale(0); opacity: 0;
                       background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
  .task.finishing .chk { border-color: transparent; box-shadow: var(--glow); animation: chkpop .42s cubic-bezier(.3, 1.6, .5, 1); }
  .task.finishing .chk::before { transform: scale(1); opacity: 1; transition: transform .28s ease-out, opacity .12s; }
  .task.finishing .tx > div:first-child { text-decoration: line-through; color: var(--muted); transition: color .3s; }
  .task.undoing .chk { animation: chkpop .3s ease-out; }
  .task.leaving { overflow: hidden; opacity: 0; max-height: 0 !important; padding-top: 0; padding-bottom: 0; border-top-width: 0;
                  transform: translateX(14px); transition: opacity .3s ease, max-height .32s ease .05s, padding .32s ease .05s, transform .3s ease; }
  @keyframes chkpop { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }
  @media (prefers-reduced-motion: reduce) { .task .chk, .task .chk::before, .task.leaving { animation: none !important; transition: none !important; } }
  .task .tx { flex: 1; min-width: 0; } .task.done .tx > div:first-child { text-decoration: line-through; color: var(--muted); }
  .task .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
  .task .meta a { color: var(--accent); text-decoration: none; }
  .task .acts { display: flex; gap: 4px; } .task .acts button { padding: 6px 8px; font-size: 13px; }
  .overdue { color: var(--danger) !important; } .today { color: var(--warn-c) !important; }
  .health-row .pill-light { max-width: 60%; text-align: right; }
  .ntmic { display: grid; place-items: center; gap: 8px; padding: 6px 0 4px; }
  .ntmic button { width: 84px; height: 84px; border-radius: 50%; padding: 0; font-size: 30px; line-height: 1;
                  background: radial-gradient(circle at 50% 40%, #e9fdff, var(--accent) 45%, rgba(4, 16, 30, .9) 80%); color: #02121c; }
  .ntmic button.on { background: radial-gradient(circle at 50% 40%, #ffd0d8, var(--rec) 45%, rgba(30, 4, 10, .9) 80%); color: #fff;
                     animation: breathe 1.4s ease-in-out infinite; }
  .ntmic .st { font: 600 11px/1.4 var(--display); letter-spacing: .14em; color: var(--accent); text-transform: uppercase; text-align: center; }
  #ntWave { width: 100%; height: 34px; }
  /* camera: show Hermes something */
  #cam { position: fixed; inset: 0; z-index: 25; background: #000; display: flex; flex-direction: column; }
  #cam .cam-top { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
  #cam .cam-top button { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); box-shadow: none; color: #fff; padding: 8px 12px; font-size: 15px; }
  #cam .cam-view { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
  #cam video, #cam #camShot { width: 100%; height: 100%; object-fit: contain; }
  #cam .cam-hint { position: absolute; left: 16px; right: 16px; bottom: 14px; text-align: center; color: #cfeef7; font-size: 15px;
                   text-shadow: 0 1px 4px #000; }
  #cam .cam-bottom { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(3, 6, 13, .95) 20%); }
  #cam .cam-controls { display: flex; align-items: center; justify-content: space-between; }
  #cam .shutter { width: 74px; height: 74px; border-radius: 50%; padding: 0; background: #fff; border: 5px solid rgba(94, 241, 255, .7);
                  box-shadow: 0 0 22px rgba(94, 241, 255, .55); }
  #cam .shutter:active { transform: scale(.93); }
  #cam .side { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; cursor: pointer;
               background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); }
  .chat-photo { display: block; max-width: 100%; max-height: 220px; border-radius: 12px; margin-bottom: 6px; }
  /* 🤫 whisper in my ear */
  .rec-actions { display: flex; gap: 8px; margin-top: 12px; }
  .rec-actions button { flex: 1; margin-top: 0 !important; }
  #askQuietBtn { background: rgba(180, 155, 255, .1); color: var(--violet); border: 1px solid rgba(180, 155, 255, .45);
                 box-shadow: 0 0 14px rgba(180, 155, 255, .25); }
  #askQuietBtn.on { background: rgba(180, 155, 255, .3); animation: breathe-q 1.2s ease-in-out infinite; }
  @keyframes breathe-q { 50% { box-shadow: 0 0 26px rgba(180, 155, 255, .6); } }
  #earAns { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(180, 155, 255, .08);
            border: 1px solid rgba(180, 155, 255, .3); color: #e6ddff; font-size: 15px; text-align: left; }
  #earAns b { color: var(--violet); font: 600 11px/1.4 var(--display); letter-spacing: .14em; }
  .ear-item { padding: 8px 0; border-top: 1px solid var(--line); } .ear-item:first-of-type { border-top: 0; }
  .ear-item .q { color: var(--violet); font-size: 15px; } .ear-item .a { margin-top: 2px; }
  .steps { margin: 6px 0 0; padding-left: 20px; font-size: 15px; line-height: 1.55; }
  .steps li + li { margin-top: 4px; }
  .steps code, .codebox { font: 13px/1.4 ui-monospace, Menlo, monospace; background: rgba(94, 241, 255, .08); border: 1px solid var(--line);
                          border-radius: 12px; padding: 1px 5px; word-break: break-all; }
  .codebox { display: block; padding: 8px 10px; margin: 6px 0; user-select: all; }
  details.help summary { cursor: pointer; color: var(--accent); font: 600 11px/1.3 var(--display); letter-spacing: .12em; text-transform: uppercase; padding: 6px 0; }
  .ev { display: flex; gap: 10px; padding: 7px 0; font-size: 15px; } .ev + .ev { border-top: 1px solid var(--line); }
  .ev .when { flex: 0 0 76px; color: var(--warn-c); font: 600 11px/1.5 var(--display); letter-spacing: .06em; }
  .logs-seg { margin: -6px 0 14px; }
  .person { display: flex; gap: 12px; align-items: center; padding: 11px 0; cursor: pointer; }
  .person + .person { border-top: 1px solid var(--line); }
  .avatar { flex: 0 0 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 700 15px var(--display);
            color: var(--accent-text); background: linear-gradient(135deg, var(--accent), var(--orange)); }
  .person .tx { flex: 1; min-width: 0; } .person .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .money { font: 700 22px/1.1 var(--display); letter-spacing: .04em; color: var(--text); }
  .receipt { display: flex; gap: 12px; align-items: center; padding: 11px 0; cursor: pointer; }
  .receipt + .receipt { border-top: 1px solid var(--line); }
  .receipt .amt { font: 700 15px var(--display); color: var(--warn-c); white-space: nowrap; }
  .receipt img { width: 42px; height: 42px; object-fit: cover; border-radius: 12px; flex: 0 0 42px; }
  .field-label { color: var(--muted); font-size: 12px; margin-bottom: -6px; }
  .to-chip { display: inline-flex; gap: 6px; align-items: center; margin: 2px 4px 2px 0; padding: 4px 9px; border-radius: 99px;
             background: rgba(94, 241, 255, .08); border: 1px solid var(--line-strong); font-size: 13px; }
  .warn { color: var(--warn-c); font-size: 13px; }
  /* ---- works the same on iPhone, Android (incl. foldables) and PC ---- */
  html, body { max-width: 100%; overflow-x: hidden; }
  /* iPhone zooms into any text box with text smaller than 16px (and stays zoomed): keep form text at 16px */
  input, select, textarea { font-size: 16px !important; }
  .row:not(:has(input, textarea, select)) { flex-wrap: wrap; }   /* rows of buttons wrap onto a 2nd line on narrow screens */
  .row > * { min-width: 0; }                 /* boxes shrink to fit instead of pushing buttons off-screen */
  img, video, canvas { max-width: 100%; }
  .chat .msg { max-width: min(88%, 560px); }
  .agentbar { display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 8px; margin: -2px 0 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .agentbar::-webkit-scrollbar { display: none; }
  .achip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 5px; border-radius: 99px; cursor: pointer;
           background: rgba(3,10,20,.5); border: 1px solid var(--line); color: var(--muted); font: 600 12px var(--display); letter-spacing: .04em; white-space: nowrap; }
  .achip .face { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: rgba(94,241,255,.1); font-size: 13px; }
  .achip.on { color: var(--accent-text); background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: var(--glow); }
  .achip.edit { color: var(--muted); font-size: 15px; padding: 5px 10px; }
  .msg .who { display: flex; align-items: center; gap: 6px; font: 600 11px var(--display); letter-spacing: .08em; color: var(--muted); margin-bottom: 5px; }
  .msg .who .face { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: rgba(94,241,255,.12); font-size: 11px; }
  .gen-img { display: block; width: 100%; max-width: 420px; border-radius: 12px; margin: 2px 0; }
  .mkimg { margin-top: 8px; font-size: 12px; }
  .slashmenu { background: rgba(6,16,30,.97); border: 1px solid var(--line-strong); border-radius: 12px; padding: 5px; margin-bottom: 8px;
               max-height: 46vh; overflow-y: auto; box-shadow: 0 10px 34px rgba(0,0,0,.5); }
  .slashmenu .cmd { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 12px; cursor: pointer; }
  .slashmenu .cmd.sel, .slashmenu .cmd:hover { background: rgba(94,241,255,.12); }
  .slashmenu .cmd .ico { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: rgba(94,241,255,.1); font-size: 13px; object-fit: cover; }
  .slashmenu .cmd .nm { font: 600 13px var(--display); letter-spacing: .03em; color: var(--text); }
  .slashmenu .cmd .ds { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }
  /* 🔊 small "listen" button on Hermes replies */
  .msg.assistant { position: relative; padding-right: 34px; }
  .msg .hear { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; padding: 0; border-radius: 50%; min-height: 0;
               font-size: 12px; line-height: 1; background: transparent; border: 1px solid var(--line); color: var(--muted); opacity: .75; }
  .msg .hear:hover, .msg .hear.on { opacity: 1; color: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 40%, transparent); }
  .msg.thinking { padding-right: 14px; }
  /* while the on-screen keyboard is open, hide the bottom menu so it doesn't cover what you're typing */
  body.kb-open nav.tabs, body.kb-open #activity { display: none !important; }
  body.kb-open { padding-bottom: 12px; }
  /* On the Hermes tab the pill would cover the message box, and the top status + "Hermes is writing" already say it */
  body[data-view="assistant"] #activity, body[data-view="grok"] #activity { display: none !important; }
  #view-grok .chatbox { height: calc(100dvh - 480px - env(safe-area-inset-bottom)); min-height: 120px; padding-bottom: 22px; scroll-padding-bottom: 22px; }
  #gTalk.listening { background: var(--rec); color: #fff; border-color: transparent; box-shadow: 0 0 16px var(--rec); }
  #gTalk.speaking { background: var(--accent); color: var(--accent-text); }
  #gTalk.working { opacity: .8; }
  #gWorkStatus { font-size: 13px; line-height: 1.35; margin: 0 0 8px; padding: 8px 12px; border-radius: 12px;
    border: 1px solid var(--line); background: rgba(3, 10, 20, .45); }
  #gWorkStatus[hidden] { display: none !important; }
  #view-grok img.grok-inline { display: block; width: auto; max-width: 100%; height: auto; border-radius: 12px; margin: 6px 0; }
  @media (min-width: 900px) { main { max-width: 820px; } }   /* PC / unfolded Fold: a little roomier */
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }
