:root {
  --cyan: #5f82ff;
  --cyan-dim: #1a4dff;
  --bg: #000000;
  --ink: #f4f4f5;
  --muted: #8b8f98;
  --danger: #f23f43;
  --ok: #23a559;
  --glass: rgba(11, 11, 11, 0.78);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  overflow: hidden;
  user-select: none;
}
body.theme-cyan { --cyan: #4de8ff; --cyan-dim: #1a6f86; --bg: #02060c; --ink: #d7f6ff; }
body.theme-amber { --cyan: #ffc14d; --cyan-dim: #8a6420; --ink: #fff4d7; --bg: #0b0904; }
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 80;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hidden { display: none !important; }

.boot {
  position: fixed; inset: 0; background: #000; z-index: 40;
  display: grid; place-items: center;
}
.boot-point {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan), 0 0 60px var(--cyan);
  opacity: 0; transform: scale(0.2);
  transition: opacity 800ms ease, transform 1200ms ease;
}
.boot-point.on { opacity: 1; transform: scale(1); }
.boot-rings { position: absolute; width: 280px; height: 280px; }
.boot-rings span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--cyan) 30%, transparent);
  opacity: 0; transform: scale(0.4);
}
.boot-rings.on span { animation: ringOut 2.4s ease forwards; }
.boot-rings.on span:nth-child(2) { animation-delay: 0.25s; }
.boot-rings.on span:nth-child(3) { animation-delay: 0.5s; }
@keyframes ringOut {
  to { opacity: 1; transform: scale(1.35); border-color: color-mix(in srgb, var(--cyan) 55%, transparent); }
}
.boot-diag {
  position: absolute; left: 8%; bottom: 12%;
  font: 13px/1.85 "Plus Jakarta Sans", sans-serif;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: pre;
}

.hud {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  grid-template-rows: 48px 1fr 56px;
  grid-template-areas:
    "chrome chrome chrome"
    "left stage right"
    "dock dock dock";
  animation: rise 720ms var(--ease);
}
.chrome { grid-area: chrome; }
.rail.left { grid-area: left; }
.stage { grid-area: stage; }
.rail.right { grid-area: right; }
.dock { grid-area: dock; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.chrome, .rail, .stage, .dock { position: relative; z-index: 1; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.chrome {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(11,11,11,0.92), transparent);
  -webkit-app-region: drag;
}
.chrome button, .chrome a, .win-btns { -webkit-app-region: no-drag; }
.mark { letter-spacing: 0; font-size: 15px; color: var(--ink); font-weight: 500; }
.mark .hi { color: var(--muted); font-weight: 400; margin-right: 6px; }
.mark em { font-family: Lora, Georgia, serif; font-style: italic; color: #fff; }
.clock { font-variant-numeric: tabular-nums; letter-spacing: 0.2em; }
.win-btns button {
  background: transparent; border: 1px solid rgba(77,232,255,0.25);
  color: var(--ink); width: 28px; height: 22px; margin-left: 6px; cursor: pointer;
}

.rail { padding: 14px 12px; display: flex; flex-direction: column; gap: 12px; }
.panel {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px;
  backdrop-filter: blur(10px);
  transition: transform 320ms var(--ease);
}
.panel:hover { transform: translateY(-2px); }
.panel h3 {
  font-size: 12px; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 10px; font-weight: 500;
}
.meter { display: flex; justify-content: space-between; font-size: 12px; margin: 6px 0; }
.meter b { color: var(--cyan); font-weight: 500; }
#actionLog, #history {
  list-style: none; max-height: 42vh; overflow: auto;
  font: 12px/1.55 "Plus Jakarta Sans", sans-serif;
  color: var(--muted);
  letter-spacing: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
#actionLog li { margin-bottom: 6px; border-left: 2px solid var(--cyan-dim); padding-left: 8px; }
.log-user { color: var(--ink); }
.log-ai { color: var(--cyan); }

.stage {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
}
.orb-wrap { position: relative; width: 280px; height: 280px; }
.orb, .orb-halo, .orb-ring, .wave { position: absolute; inset: 0; margin: auto; border-radius: 50%; }
.orb {
  width: 92px; height: 92px;
  background: radial-gradient(circle at 35% 30%, #fff, var(--cyan) 42%, #0a1028 78%);
  box-shadow: 0 0 40px rgba(26,77,255,0.45), 0 0 90px rgba(26,77,255,0.22);
  animation: idlePulse 4.2s var(--ease) infinite;
}
.orb-halo {
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(77,232,255,0.18), transparent 70%);
}
.orb-ring { border: 1px solid rgba(77,232,255,0.28); }
.orb-ring.r1 { width: 200px; height: 200px; animation: spin 18s linear infinite; }
.orb-ring.r2 { width: 240px; height: 240px; border-style: dashed; animation: spin 28s linear infinite reverse; }
.wave { width: 110px; height: 110px; border: 2px solid transparent; }
.hud.listening .orb { animation: listenPulse 0.9s ease-in-out infinite; filter: brightness(1.35); }
.hud.thinking .orb { animation: thinkSpin 1.4s linear infinite; }
.hud.speaking .orb { animation: speakPulse 0.45s ease-in-out infinite; }
.hud.executing .exec-banner { display: block; }
@keyframes idlePulse { 50% { transform: scale(1.06); } }
@keyframes listenPulse { 50% { transform: scale(1.18); box-shadow: 0 0 70px var(--cyan); } }
@keyframes thinkSpin { to { transform: rotate(360deg) scale(1.05); } }
@keyframes speakPulse { 50% { transform: scale(1.22); } }
@keyframes spin { to { transform: rotate(360deg); } }

.status-line, .prompt-line, .exec-banner {
  letter-spacing: 0; font-size: 15px; color: var(--muted);
  min-height: 1.2em;
}
.prompt-line { color: var(--ink); font-family: Lora, Georgia, serif; font-style: italic; }
.exec-banner { color: var(--cyan); font-size: 13px; }
.voice-bar { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.listen {
  background: #1a4dff; color: #fff;
  border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer;
}
.listen.hot { filter: brightness(1.12); box-shadow: 0 8px 24px rgba(26,77,255,0.35); }
.text-form { display: flex; gap: 8px; width: min(520px, 86%); }
.text-form input {
  flex: 1; background: #0b0b0b; border: 1px solid rgba(255,255,255,0.08);
  color: var(--ink); padding: 10px 12px; outline: none; border-radius: 10px;
}
.text-form button, .ghost, .dock button, .settings button {
  background: #0b0b0b; border: 1px solid rgba(255,255,255,0.08);
  color: var(--ink); padding: 9px 12px; cursor: pointer; border-radius: 10px;
  transition: transform 240ms var(--ease);
}
.text-form button:hover, .ghost:hover, .dock button:hover, .settings button:hover {
  transform: translateY(-1px);
}
.ghost { margin-top: 10px; width: 100%; font-size: 11px; }
.download {
  display: inline-block;
  background: #1a4dff;
  color: #fff !important;
  text-decoration: none;
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
}

.dock {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.confirm { border-color: var(--ok) !important; color: var(--ok) !important; }
.cancel { border-color: var(--danger) !important; color: var(--danger) !important; }

.settings {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0, 0, 0, 0.72);
  display: grid; place-items: center;
}
.settings-inner {
  width: min(820px, 92vw); max-height: 86vh; overflow: auto;
  background: #0b0b0b; border: 1px solid rgba(255,255,255,0.08); padding: 20px 22px;
  border-radius: 14px;
}
.settings-inner header, .settings-inner nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.settings-inner h2 { letter-spacing: 0; font-size: 18px; flex: 1; font-family: Lora, Georgia, serif; font-style: italic; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 12px; }
.hint.ok { color: #8ecb9a; }
.download:hover { filter: brightness(1.08); }
body.desktop .download,
body.installed .download,
body.installed #iosHint { display: none; }
body:not(.desktop) #btnMax { display: none; }
body.hosted label:has(#sStartWin),
body.hosted label:has(#sStartMin),
body.hosted label:has(#sAlwaysTop),
body.hosted [data-tab="apps"],
body.hosted [data-pane="apps"] { display: none; }
.install-hint { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  html, body { overflow: auto; }
  .hud {
    position: relative;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    grid-template-areas:
      "chrome"
      "stage"
      "dock"
      "right"
      "left";
  }
  .win-btns { display: none; }
  .orb-wrap { width: 200px; height: 200px; }
  .rail { padding: 8px 12px 16px; }
  #actionLog, #history { max-height: 24vh; }
  .dock { flex-wrap: wrap; height: auto; padding: 10px 12px 16px; }
  .text-form { width: 92%; }
  .mark { font-size: 14px; }
  .clock { font-size: 12px; letter-spacing: 0.08em; }
}
.desktop-badge {
  font-size: 12px;
  color: #8ecb9a;
  padding: 9px 0;
}
.settings label { display: block; margin: 10px 0; font-size: 13px; }
.settings input, .settings select, .settings textarea {
  width: 100%; margin-top: 4px; background: #02080e; color: var(--ink);
  border: 1px solid rgba(255,255,255,0.08); padding: 6px 8px; border-radius: 8px;
}
.settings input[type="checkbox"] { width: auto; }
.settings input[type="range"] { width: 240px; }
#setNav button.on { background: rgba(26,77,255,0.28); color: #fff; }
#devOut { margin-top: 10px; font-size: 11px; color: var(--cyan); white-space: pre-wrap; }
.dev-row { display: flex; flex-wrap: wrap; gap: 8px; }

.hud.reduced .orb, .hud.reduced .orb-ring { animation: none !important; }
.hud.hidden-win .orb { animation: none !important; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--cyan-dim); }
