/* Vi, as on VIPER's live page (viper/watch/page.html), for the console's Vi home (vi.js). */
.vi-home {
  --surface: #ffffff; --surface2: #f3f4f8; --line: #e6e8ef; --line2: #d6d9e3; --text: #1b1d29; --muted: #636a80; --dim: #9aa0b4;
  --accent: #6656f5; --accent-soft: #f1efff; --accent-line: #dad5ff; --red-dot: #ef4444;
  --shadow-lg: 0 2px 6px rgba(17, 24, 39, .04), 0 22px 54px rgba(17, 24, 39, .10);
  --stage: radial-gradient(230px 190px at 50% 62%, #ebe5ff 0%, rgba(235, 229, 255, 0) 72%),
           radial-gradient(160px 130px at 78% 26%, rgba(255, 214, 232, .75), transparent 70%),
           radial-gradient(160px 130px at 20% 30%, rgba(205, 240, 255, .7), transparent 70%),
           linear-gradient(180deg, #fbfaff, #ffffff);
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start;
}
@media (prefers-color-scheme: dark) {
  .vi-home {
    --surface: #161922; --surface2: #1d212c; --line: #262b38; --line2: #343b4c; --text: #eceef5; --muted: #a2a8bb; --dim: #6c7388;
    --accent: #8d80ff; --accent-soft: #242046; --accent-line: #3c3672; --shadow-lg: 0 20px 50px rgba(0, 0, 0, .4);
    --stage: radial-gradient(230px 190px at 50% 62%, rgba(124, 108, 255, .3), transparent 72%),
             radial-gradient(160px 130px at 78% 26%, rgba(236, 72, 153, .16), transparent 70%),
             linear-gradient(180deg, #1b1932, #161922);
  }
}
@keyframes ping-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } 100% { box-shadow: none; } }
.vi-aside button, .vi-aside input { font: inherit; color: inherit; }
.vi-aside .vi-chips button, .vi-aside form.vi-ask .mic { cursor: pointer; }
.vi-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.vi-side .panel { margin: 0; }
.vi-phases { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.vi-phases li { padding: 3px 10px; border-radius: 99px; background: var(--idle-bg); color: var(--muted); font-size: 12.5px; }
.vi-phases li.ok { background: var(--ok-bg); color: var(--ok); }
.vi-phases li.now { background: var(--run-bg); color: var(--run); font-weight: 600; }
.vi-phases li.bad { background: var(--bad-bg); color: var(--bad); }
.vi-ask-card { border-color: var(--accent); }
.vi-runs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.vi-runs button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.vi-runs button.on { border-color: var(--accent); }
.vi-runs .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1000px) {
  .vi-home { grid-template-columns: minmax(0, 1fr); }
  .vi-aside { position: static; height: 640px; min-height: 0; order: -1; }
}

/* Vi */
.vi-aside { position: sticky; top: 76px; align-self: start; height: calc(100vh - 100px); min-height: 560px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow-lg); }
.vi-stage { position: relative; background: var(--stage); padding: 16px 18px 0; }
.vi-name { display: flex; align-items: center; gap: 10px; }
.vi-name b { font-size: 17px; font-weight: 700; display: block; line-height: 1.15; }
.vi-name .role { color: var(--muted); font-size: 12.5px; display: block; }
.vi-mood { margin-left: auto; padding: 3px 11px; border-radius: 99px; background: var(--surface); color: var(--accent); font-size: 12.5px; font-weight: 600;
  box-shadow: 0 1px 3px rgba(17, 24, 39, .08); }
.vi-now { padding: 0 18px 10px; color: var(--muted); font-size: 13px; min-height: 29px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.vi-orbstage { position: relative; display: grid; place-items: center; height: 222px; }
.vi-bubble { position: relative; z-index: 1; margin: -6px 16px 12px; padding: 13px 16px; border-radius: 18px; background: var(--surface); color: var(--text);
  border: 1px solid var(--accent-line); min-height: 50px; font-size: 14.5px; line-height: 1.55; box-shadow: 0 10px 28px rgba(102, 86, 245, .12);
  max-height: 150px; overflow: auto; white-space: pre-wrap; }
.vi-wave { display: flex; gap: 3px; align-items: flex-end; height: 14px; position: absolute; right: 12px; bottom: 9px; opacity: 0; transition: opacity .3s; }
.vi-wave i { width: 3px; border-radius: 2px; background: var(--accent); height: 4px; }
.vi-talking .vi-wave { opacity: 1; } .vi-talking .vi-wave i { animation: eq .5s ease-in-out infinite alternate; }
.vi-wave i:nth-child(2) { animation-delay: .1s !important; } .vi-wave i:nth-child(3) { animation-delay: .2s !important; } .vi-wave i:nth-child(4) { animation-delay: .3s !important; }
@keyframes eq { from { height: 3px; } to { height: 14px; } }
.vi-chat { flex: 1; overflow-y: auto; padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.vi-msg { max-width: 88%; padding: 9px 13px; border-radius: 18px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.vi-msg.vi { align-self: flex-start; background: var(--surface2); border-bottom-left-radius: 6px; }
.vi-msg.you { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.vi-msg.quiet { align-self: center; max-width: 100%; background: transparent; padding: 0 4px; color: var(--dim); font-size: 12px; text-align: center; }
.vi-chips { display: flex; gap: 6px; padding: 10px 16px 0; overflow-x: auto; scrollbar-width: none; }
.vi-chips::-webkit-scrollbar { display: none; }
.vi-chips button { flex: none; padding: 6px 13px; border-radius: 99px; font-size: 13px; font-weight: 500; background: var(--surface); border: 1px solid var(--line); transition: all .15s; }
.vi-chips button:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
form.vi-ask { display: flex; gap: 8px; padding: 10px 16px 12px; }
form.vi-ask input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 99px; background: var(--surface2); border: 1px solid transparent; outline: none; transition: all .15s; }
form.vi-ask input:focus { border-color: var(--accent-line); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
form.vi-ask .send { height: 44px; padding: 0 18px; border-radius: 99px; border: 0; background: var(--accent); color: #fff; font-weight: 650; box-shadow: 0 4px 12px rgba(102, 86, 245, .3); }
form.vi-ask .mic { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); border: 0; color: var(--muted); }
form.vi-ask .mic.on { background: var(--red-dot); color: #fff; animation: ping-red 1.4s infinite; }
.vi-foot { padding: 0 18px 12px; color: var(--dim); font-size: 11.5px; text-align: center; }

/* Vi: a glowing orb; data-mood sets its colours and motion, .talking its voice */
@property --o1 { syntax: "<color>"; inherits: true; initial-value: #7b6cff; }
@property --o2 { syntax: "<color>"; inherits: true; initial-value: #4fb6ff; }
@property --o3 { syntax: "<color>"; inherits: true; initial-value: #ff8fd0; }
@property --o4 { syntax: "<color>"; inherits: true; initial-value: #ddd6ff; }
.vi-orb { --o1: #7b6cff; --o2: #4fb6ff; --o3: #ff8fd0; --o4: #ddd6ff;
  position: relative; width: 200px; height: 200px; display: grid; place-items: center; cursor: pointer; outline: none;
  -webkit-tap-highlight-color: transparent; transition: --o1 1.1s ease, --o2 1.1s ease, --o3 1.1s ease, --o4 1.1s ease; }
.vi-orb[data-mood="working"] { --o1: #5a5cf6; --o2: #22c3e6; --o3: #7aa7ff; --o4: #d6f3ff; }
.vi-orb[data-mood="thinking"] { --o1: #6a46ff; --o2: #a98bff; --o3: #5fa0ff; --o4: #e6deff; }
.vi-orb[data-mood="happy"] { --o1: #ff6aa9; --o2: #ffb547; --o3: #9b7bff; --o4: #ffe6f0; }
.vi-orb[data-mood="worried"] { --o1: #4a87d8; --o2: #79cdf5; --o3: #8fa3bf; --o4: #dde7f3; }
.vi-orb[data-mood="paused"] { --o1: #a3abc6; --o2: #c4cad9; --o3: #b9b3d6; --o4: #eef0f5; }
.vi-orb[data-mood="listening"] { --o1: #ff5c8d; --o2: #9a7bff; --o3: #ff9fcf; --o4: #ffe2ee; }
.vi-orb:focus-visible .o-body { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 6px var(--accent-line); }
.vi-orb > * { grid-area: 1 / 1; }
.o-halo { width: 172px; height: 172px; border-radius: 50%; opacity: .55; filter: blur(24px); transition: opacity .8s;
  background: radial-gradient(circle at 36% 38%, var(--o2), transparent 60%), radial-gradient(circle at 66% 64%, var(--o3), transparent 60%),
              radial-gradient(circle, var(--o1), transparent 68%);
  animation: vi-halo 6s ease-in-out infinite; }
@keyframes vi-halo { 50% { transform: scale(1.09); } }
.o-floor { align-self: end; width: 112px; height: 14px; margin-bottom: 4px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--o1) 30%, transparent), transparent); animation: vi-floor 6s ease-in-out infinite; }
@keyframes vi-floor { 50% { transform: scale(.88); opacity: .7; } }
.o-ring, .o-wave { width: 148px; height: 148px; border-radius: 50%; border: 2px solid var(--o1); opacity: 0; pointer-events: none; }
.o-wave { border-color: var(--o2); }
.o-move { position: relative; animation: vi-breathe 6s ease-in-out infinite; }
@keyframes vi-breathe { 50% { transform: translateY(-4px) scale(1.025); } }
.o-body { position: relative; width: 148px; height: 148px; border-radius: 50%; overflow: hidden; isolation: isolate; transition: opacity .8s, box-shadow .2s;
  background: radial-gradient(circle at 50% 42%, #fff 0%, var(--o4) 72%); }
.o-swirl { position: absolute; inset: 0; animation: vi-swirl 18s linear infinite; }
.o-swirl i { position: absolute; border-radius: 50%; filter: blur(19px); }
.o-swirl .b1 { width: 112px; height: 112px; left: -14px; top: 42px; background: var(--o1); animation: vi-drift1 9s ease-in-out infinite alternate; }
.o-swirl .b2 { width: 104px; height: 104px; left: 58px; top: -12px; background: var(--o2); animation: vi-drift2 11s ease-in-out infinite alternate; }
.o-swirl .b3 { width: 94px; height: 94px; left: 54px; top: 70px; background: var(--o3); opacity: .9; animation: vi-drift3 7.5s ease-in-out infinite alternate; }
@keyframes vi-swirl { to { transform: rotate(360deg); } }
@keyframes vi-drift1 { to { transform: translate(24px, -20px) scale(1.12); } }
@keyframes vi-drift2 { to { transform: translate(-28px, 22px) scale(.88); } }
@keyframes vi-drift3 { to { transform: translate(-16px, -32px) scale(1.16); } }
.o-sheen { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(58% 36% at 36% 18%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 72%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), inset 0 -14px 26px -10px color-mix(in srgb, var(--o1) 75%, transparent),
              inset 0 12px 20px -8px rgba(255, 255, 255, .8); }
.o-face { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, .75)) drop-shadow(0 1px 1.5px color-mix(in srgb, var(--o1) 70%, transparent)); }
.vi-look { transition: transform .25s ease-out; }
.o-face rect { fill: #fff; }
.o-face path { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.o-face .brows { stroke-width: 3; }
.o-eyes { transform-box: fill-box; transform-origin: center; animation: vi-blink 5.4s infinite; }
@keyframes vi-blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.1); } }
.o-face .happy, .o-face .shut, .o-face .brows { display: none; }
.vi-orb[data-mood="happy"] .o-eyes, .vi-orb[data-mood="paused"] .o-eyes { display: none; }
.vi-orb[data-mood="happy"] .happy, .vi-orb[data-mood="paused"] .shut, .vi-orb[data-mood="worried"] .brows { display: inline; }
.vi-orb[data-mood="thinking"] .vi-look { transform: translate(5px, -5px) !important; }
.vi-orb[data-mood="worried"] .vi-look { transform: translate(-1px, 3px) !important; }
.vi-orb[data-mood="listening"] .vi-look { transform: translate(0, 3px) !important; }
.o-orbit { position: absolute; inset: 0; display: none; animation: vi-swirl 2.6s linear infinite; }
.o-orbit i { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%;
  background: var(--o1); box-shadow: 0 0 8px 1px color-mix(in srgb, var(--o2) 80%, transparent); }
.o-orbit i:nth-child(1) { transform: rotate(0deg) translateX(85px); }
.o-orbit i:nth-child(2) { transform: rotate(-17deg) translateX(85px) scale(.72); opacity: .7; }
.o-orbit i:nth-child(3) { transform: rotate(-34deg) translateX(85px) scale(.48); opacity: .45; }
.vi-orb[data-mood="thinking"] .o-orbit { display: block; }
.vi-orb[data-mood="thinking"] .o-move { animation: vi-ponder 3.4s ease-in-out infinite; }
@keyframes vi-ponder { 50% { transform: scale(.955); } }
.vi-orb[data-mood="happy"] .o-move { animation: vi-hop .62s cubic-bezier(.3, .6, .4, 1) 3, vi-breathe 4s ease-in-out 1.9s infinite; }
@keyframes vi-hop { 0%, 100% { transform: translateY(0) scale(1); } 45% { transform: translateY(-15px) scale(1.02, .99); } 85% { transform: translateY(0) scale(1.05, .95); } }
.vi-orb[data-mood="worried"] .o-move { animation: vi-wobble 2.8s ease-in-out infinite; }
@keyframes vi-wobble { 0%, 64%, 100% { transform: none; } 12% { transform: rotate(-6deg) translateX(-3px); } 26% { transform: rotate(5deg) translateX(3px); }
  40% { transform: rotate(-3deg) translateX(-1px); } 52% { transform: rotate(1.5deg); } }
.vi-orb[data-mood="paused"] .o-move { animation: vi-doze 7s ease-in-out infinite; }
@keyframes vi-doze { 0%, 100% { transform: scale(.93); } 50% { transform: scale(.975); } }
.vi-orb[data-mood="paused"] .o-body { opacity: .82; } .vi-orb[data-mood="paused"] .o-halo { opacity: .22; }
.vi-orb[data-mood="listening"] .o-move { animation: none; transform: translateY(8px) scale(1.08); transition: transform .5s cubic-bezier(.3, 1.5, .5, 1); }
.vi-orb[data-mood="listening"] .o-halo { opacity: .8; }
.vi-orb[data-mood="listening"] .o-ring { animation: vi-inward 1.6s ease-out infinite; } .vi-orb .o-ring + .o-ring { animation-delay: .8s; }
@keyframes vi-inward { 0% { transform: translateY(8px) scale(1.5); opacity: 0; } 60% { opacity: .45; } 100% { transform: translateY(8px) scale(1.06); opacity: 0; } }
.o-spark { position: absolute; inset: 0; pointer-events: none; }
.o-spark i { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; opacity: 0;
  background: linear-gradient(135deg, #fff6d6 0%, #ffc94d 48%, #ff8fc0 100%);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.o-spark i:nth-child(1) { --a: -158deg; --d: 100px; --s: 1; } .o-spark i:nth-child(2) { --a: -118deg; --d: 98px; --s: .7; }
.o-spark i:nth-child(3) { --a: -64deg; --d: 102px; --s: 1.15; } .o-spark i:nth-child(4) { --a: -22deg; --d: 100px; --s: .75; }
.o-spark i:nth-child(5) { --a: 24deg; --d: 96px; --s: .6; } .o-spark i:nth-child(6) { --a: 156deg; --d: 96px; --s: .65; }
.vi-orb[data-mood="happy"] .o-spark i { animation: vi-burst .9s cubic-bezier(.2, .8, .3, 1) both, vi-twinkle 2.4s ease-in-out .9s infinite; }
.vi-orb[data-mood="happy"] .o-spark i:nth-child(even) { animation-delay: .08s, 1.5s; }
@keyframes vi-burst {
  0% { opacity: 0; transform: rotate(var(--a)) translateX(60px) rotate(calc(-1 * var(--a))) scale(0); }
  35% { opacity: 1; }
  100% { opacity: 1; transform: rotate(var(--a)) translateX(var(--d)) rotate(calc(-1 * var(--a))) scale(var(--s)); }
}
@keyframes vi-twinkle {
  0%, 100% { opacity: 1; transform: rotate(var(--a)) translateX(var(--d)) rotate(calc(-1 * var(--a))) scale(var(--s)); }
  50% { opacity: .35; transform: rotate(var(--a)) translateX(var(--d)) rotate(calc(-1 * var(--a))) scale(calc(var(--s) * .45)); }
}
@media (prefers-reduced-motion: reduce) { .vi-orb * { animation: none !important; } }
