:root {
  --accent: #22d3ee;
  --accent2: #10b981;
  --orb-scale: 1;
}
* { box-sizing: border-box; }
html, body { background: #000; }
body {
  font-family: Inter, 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }

/* Tabs */
.tab { display: none; }
.tab.is-active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tab-btn {
  padding: .5rem .85rem; border-radius: .6rem; font-size: .875rem; font-weight: 500;
  color: #a1a1aa; transition: color .15s, background .15s;
}
.tab-btn:hover { color: #fff; background: rgba(255,255,255,.06); }
.tab-btn[aria-current="page"] { color: #000; background: var(--accent); }
.bottom-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .6rem 0 .75rem; font-size: .75rem; color: #a1a1aa; min-height: 56px;
}
.bottom-tab span { font-size: 1.05rem; }
.bottom-tab[aria-current="page"] { color: var(--accent); }
.tab-btn:focus-visible, .bottom-tab:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, label:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Panels & controls */
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015));
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 1.1rem;
}
.label { display: block; font-size: .8rem; font-weight: 500; color: #a1a1aa; margin-bottom: .35rem; }
.field {
  background: #0a0a0a; border: 1px solid rgba(255,255,255,.12); color: #f4f4f5;
  border-radius: .7rem; padding: .7rem .85rem; font-size: 1rem; min-height: 44px;
  transition: border-color .15s;
}
.field:focus { border-color: var(--accent); outline: none; }
.field::placeholder { color: #71717a; }
select.field { appearance: auto; }
.color-field { width: 100%; height: 44px; background: #0a0a0a; border: 1px solid rgba(255,255,255,.12); border-radius: .7rem; padding: 4px; cursor: pointer; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000; font-weight: 600; border-radius: .7rem; padding: .7rem 1.1rem; min-height: 44px;
  transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.15); color: #e4e4e7; border-radius: .7rem;
  padding: .65rem 1rem; min-height: 44px; font-weight: 500; transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.3); }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border-radius: .7rem;
  border: 1px solid rgba(255,255,255,.15); color: var(--accent); transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.07); }
.icon-btn.is-live { background: var(--accent); color: #000; }
.small-btn { font-size: .75rem; padding: .35rem .6rem; border-radius: .5rem; border: 1px solid rgba(255,255,255,.14); color: #d4d4d8; min-height: 32px; transition: background .15s; }
.small-btn:hover { background: rgba(255,255,255,.08); }
.small-btn.danger:hover { background: rgba(244,63,94,.18); border-color: rgba(244,63,94,.5); color: #fecdd3; }

.chip {
  font-size: .8rem; padding: .45rem .8rem; border-radius: 999px; min-height: 36px;
  border: 1px solid rgba(255,255,255,.14); color: #d4d4d8; transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: #fff; }

.switch { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); cursor: pointer; }

/* Mini orb + badges */
.mini-orb {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, var(--accent) 35%, var(--accent2) 75%);
  box-shadow: 0 0 14px var(--accent);
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #71717a; }
.sync-dot.ok { background: var(--accent2); box-shadow: 0 0 8px var(--accent2); }
.sync-dot.off { background: #f59e0b; }
.shelter-badge {
  display: none; font-size: .75rem; font-weight: 600; padding: .3rem .65rem; border-radius: 999px;
  background: rgba(251,191,36,.15); color: #fde68a; border: 1px solid rgba(251,191,36,.4);
}
.shelter-badge.is-open { display: inline-flex; gap: .3rem; align-items: center; }
.shelter-banner { display: none; }
.shelter-banner.is-open { display: block; }
.shelter-card { display: none; }
.shelter-card.is-open { display: block; }
.test-out {
  white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem; background: #050505; border: 1px dashed rgba(255,255,255,.12); border-radius: .6rem;
  padding: .75rem; color: #a7f3d0; min-height: 2.5rem; max-width: 100%; overflow-x: auto;
}

/* Orb */
.orb-wrap { position: relative; display: grid; place-items: center; padding: 1.5rem; }
.orb-btn {
  position: relative; display: grid; place-items: center; border-radius: 50%;
  width: min(calc(200px * var(--orb-scale)), 66vw); aspect-ratio: 1;
  cursor: pointer; background: transparent;
}
.orb-core {
  position: absolute; inset: 12%; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.85) 0, rgba(255,255,255,0) 22%),
    radial-gradient(circle at 50% 55%, var(--accent) 0, var(--accent2) 58%, #001a14 100%);
  box-shadow: 0 0 50px var(--accent), 0 0 120px rgba(16,185,129,.25), inset 0 -18px 40px rgba(0,0,0,.55);
  animation: breathe 4.5s ease-in-out infinite;
  transition: transform .3s;
}
.orb-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 20%, var(--accent) 35%, transparent 50%, var(--accent2) 75%, transparent 90%);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%, #000 66%, transparent 67%);
          mask: radial-gradient(circle, transparent 62%, #000 63%, #000 66%, transparent 67%);
  animation: spin 9s linear infinite; opacity: .7;
}
.orb-btn:hover .orb-core { transform: scale(1.03); }
.orb-btn:active .orb-core { transform: scale(.97); }
.orb-wrap[data-state="listening"] .orb-core { animation: listen 1.1s ease-in-out infinite; }
.orb-wrap[data-state="listening"] .orb-ring { animation-duration: 3s; opacity: 1; }
.orb-wrap[data-state="thinking"] .orb-ring { animation-duration: .9s; opacity: 1; }
.orb-wrap[data-state="thinking"] .orb-core { filter: saturate(1.4) brightness(.9); }
.orb-wrap[data-state="speaking"] .orb-core { animation: speak .45s ease-in-out infinite alternate; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes listen { 0%,100% { transform: scale(1); box-shadow: 0 0 50px var(--accent); } 50% { transform: scale(1.08); box-shadow: 0 0 90px var(--accent), 0 0 160px var(--accent2); } }
@keyframes speak { from { transform: scale(.98); } to { transform: scale(1.06); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat */
.msg { max-width: 88%; padding: .65rem .9rem; border-radius: 1rem; font-size: .95rem; line-height: 1.55; white-space: pre-line; word-break: break-word; }
.msg-user { margin-left: auto; background: rgba(255,255,255,.08); border-bottom-right-radius: .3rem; }
.msg-bot { background: rgba(34,211,238,.06); border: 1px solid rgba(255,255,255,.08); border-bottom-left-radius: .3rem; }
.msg-bot.is-test { border-style: dashed; border-color: rgba(251,191,36,.5); }
.msg-meta { display: block; font-size: .7rem; color: #71717a; margin-top: .3rem; }

.list-row {
  display: flex; align-items: flex-start; gap: .75rem; justify-content: space-between;
  padding: .7rem .8rem; border-radius: .75rem; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
}
.list-row.is-off { opacity: .55; }
.code-pill { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; color: var(--accent); background: rgba(255,255,255,.05); padding: .1rem .4rem; border-radius: .35rem; }
.layer-card { padding: 1rem; border-radius: 1rem; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.025); }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); transition: transform .15s; }
.swatch:hover { transform: scale(1.1); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #111; border: 1px solid rgba(255,255,255,.15); color: #fff; padding: .7rem 1rem; border-radius: .8rem;
  font-size: .875rem; max-width: min(92vw, 460px); transition: all .25s; z-index: 50; text-align: center;
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 768px) { .toast { bottom: 28px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
