/* WHYZ V0.1 — dark, premium, minimal, cinematic. See docs/ARCHITECTURE.md. */

@font-face {
  font-family: "Manrope";
  src: url("../public/assets/fonts/manrope-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../public/assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #050506;
  --bg2: #0b0b0d;
  --surface: #0f0f12;
  --surface2: #16161a;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f2f0eb;
  --muted: #8b8894;
  --violet: #6c5ce7;
  --violet2: #9b8cff;
  --violet-rgb: 108, 92, 231;
  --good: #2fd899;
  --good-rgb: 47, 216, 153;
  --danger: #ff4d6d;
  --danger-rgb: 255, 77, 109;
  --radius: 18px;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 50% 28%, rgba(var(--violet-rgb), 0.14), transparent 46%), var(--bg2) linear-gradient(180deg, #000 0%, var(--bg2) 60%, #000 100%);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#whyz-app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  width: 100vw;
}

/* ---------- Status bar ---------- */

#status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 8px;
  padding: 22px 32px;
  font-family: var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
  z-index: 5;
}

.status-id {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--violet2);
  box-shadow: 0 0 10px var(--violet2);
}
.status-dot.state-sleep { background: var(--muted); box-shadow: none; animation: none; }
.status-dot.state-error { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.status-dot.state-success { background: var(--good); box-shadow: 0 0 10px var(--good); }
.status-dot { animation: pulse 1.8s infinite; }
@keyframes pulse {
  50% { opacity: 0.35; transform: scale(0.7); }
}

#demo-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: 0.2s;
}
#demo-toggle:hover {
  color: var(--text);
  border-color: rgba(var(--violet-rgb), 0.5);
}

/* ---------- Stage ---------- */

#stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* Shared WHYZ environment — one constant backdrop behind all six
   Panther states (masterprompt Phase C section 6). Intentionally
   restrained: a faint grid for depth, a few soft drifting particles.
   Never redrawn or recolored per state — only the halo (see below)
   reacts to state. */
#stage-environment {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#env-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 50% 42%, #000 0%, transparent 70%);
  opacity: 0.5;
}

#env-particles {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 12% 22%, rgba(var(--violet-rgb), 0.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 82% 18%, rgba(var(--violet-rgb), 0.4), transparent 60%),
    radial-gradient(2px 2px at 74% 68%, rgba(var(--violet-rgb), 0.35), transparent 60%),
    radial-gradient(1.5px 1.5px at 22% 76%, rgba(var(--violet-rgb), 0.4), transparent 60%),
    radial-gradient(1.5px 1.5px at 90% 80%, rgba(var(--violet-rgb), 0.3), transparent 60%),
    radial-gradient(1.5px 1.5px at 8% 55%, rgba(var(--violet-rgb), 0.3), transparent 60%);
  animation: drift 22s ease-in-out infinite;
  opacity: 0.7;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-6px, 8px); }
}

#agent-network {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}

#agent-orbit {
  /* Deliberately not a perfect circle: a node at the true bottom of a
     square orbit reaches #stage's own edge (clipped by its
     overflow:hidden) before one at a diagonal does, since it carries
     the full radius vertically instead of radius*cos(45°). Squashing
     height ~15% relative to width keeps every node (and its label)
     clear of the stage bounds at every screen size, while leaving the
     side nodes' horizontal reach — and the Panther's framing — alone. */
  position: relative;
  width: min(82vh, 820px);
  height: min(70vh, 700px);
}

.agent-link {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 1px;
  transform-origin: 0 0;
  background: linear-gradient(90deg, rgba(var(--violet-rgb), 0.55), transparent 85%);
  opacity: 0.18;
  transition: opacity 0.4s ease, background 0.4s ease;
}
.agent-link.is-active {
  opacity: 0.9;
  background: linear-gradient(90deg, rgba(var(--violet-rgb), 0.9), rgba(var(--violet-rgb), 0.05));
}
.agent-link.is-error {
  background: linear-gradient(90deg, rgba(var(--danger-rgb), 0.9), rgba(var(--danger-rgb), 0.05));
  opacity: 0.9;
}

.agent-node {
  position: absolute;
  width: 92px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  opacity: 0.82;
  transition: opacity 0.3s ease;
}
.agent-node[data-state="active"],
.agent-node[data-state="working"],
.agent-node[data-state="completed"],
.agent-node[data-state="error"] {
  opacity: 1;
}

.agent-node-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(15, 15, 18, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--muted);
  transition: 0.35s ease;
}

.agent-node-label {
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--mono);
  transition: color 0.3s ease;
}

.agent-node[data-state="active"] .agent-node-dot,
.agent-node[data-state="working"] .agent-node-dot {
  border-color: rgba(var(--violet-rgb), 0.7);
  box-shadow: 0 0 22px rgba(var(--violet-rgb), 0.35);
  color: var(--violet2);
}
.agent-node[data-state="active"] .agent-node-label,
.agent-node[data-state="working"] .agent-node-label {
  color: var(--text);
}
.agent-node[data-state="working"] .agent-node-dot {
  animation: pulse 1.4s infinite;
}
.agent-node[data-state="completed"] .agent-node-dot {
  border-color: rgba(var(--good-rgb), 0.6);
  color: var(--good);
  box-shadow: 0 0 16px rgba(var(--good-rgb), 0.25);
}
.agent-node[data-state="completed"] .agent-node-label {
  color: var(--text);
}
.agent-node[data-state="error"] .agent-node-dot {
  border-color: rgba(var(--danger-rgb), 0.7);
  color: var(--danger);
  box-shadow: 0 0 18px rgba(var(--danger-rgb), 0.3);
}
.agent-node[data-state="error"] .agent-node-label {
  color: var(--danger);
}

/* ---------- Panther ----------
   Real asset renderer (masterprompt Phase C). Structure:
     #panther-stage            fixed-aspect box, the visual anchor
       #panther-halo             behind everything, state-reactive glow
       #panther-breathe          subtle "alive" scale-breathing wrapper
         img.panther-img (×2)      crossfade layers; JS sets translate+scale
                                    per docs/PANTHER-VISUAL-SYSTEM.md
       #panther-caption          dynamic HTML text, never baked into the PNG
*/

#panther-stage {
  position: relative;
  z-index: 2;
  width: clamp(280px, 30vw, 500px);
  aspect-ratio: 1402 / 1122;
  display: grid;
  place-items: center;
}

#panther-halo {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--violet-rgb), 0.32), rgba(var(--violet-rgb), 0.08) 45%, transparent 72%);
  filter: blur(6px);
  opacity: 0.6;
  z-index: 0;
  transition: opacity 0.7s ease, background 0.7s ease;
}

#panther-breathe {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
  animation: panther-breathe 7s ease-in-out infinite;
  --breathe-amt: 0.012;
}
/* Old static PNG layer is the intentional fallback for states with no
   V2 video (ARISE, ASCEND, ERROR) — but must stay fully hidden whenever
   the video layer is actively showing, so it can't bleed through the
   video's soft edge mask. */
#panther-stage:has(#panther-video-layer.is-visible) #panther-breathe {
  opacity: 0;
  transition: opacity 0.3s ease;
}
@keyframes panther-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(calc(1 + var(--breathe-amt))); }
}

.panther-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity 0.6s ease;
  will-change: opacity, transform;
}
.panther-img.is-visible {
  opacity: 1;
}

/* Video renderer (Phase D) — an overlay above the PNG layer, faded in
   only for states/hops with real video coverage; when hidden, the PNG
   layer underneath (already correctly updated by pantherView.js for
   every state, unconditionally) shows through untouched. See
   components/panther/pantherMediaPlayer.js and
   docs/PANTHER-MEDIA-SYSTEM.md. ASSET BLOCKER: most source clips carry
   a plain white background (docs/ASSET-BLOCKERS.md) — intentionally
   NOT masked/cropped/recolored here, per explicit instruction; this
   will look inconsistent with the dark theme until those are
   re-exported, by design, for now. */
#panther-video-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
#panther-video-layer.is-visible {
  opacity: 1;
}

.panther-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  /* Soft-fade the clip's own rectangular edges into the ambient stage
     behind it instead of a hard video border. */
  mask-image: radial-gradient(ellipse 78% 82% at 50% 52%, #000 62%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 78% 82% at 50% 52%, #000 62%, transparent 100%);
}
.panther-video.is-visible {
  opacity: 1;
}

#panther-caption {
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translate(-50%, 100%);
  text-align: center;
  white-space: nowrap;
  z-index: 2;
}
#panther-caption-state {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
}
#panther-caption-text {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 2px;
}

/* Halo variants — the same restrained language, one intensity/color/
   rhythm per state. Never a hard cut: durations sit in the 400-900ms+
   ambient range, per masterprompt Phase C section 9. */

#panther-breathe[data-state="SLEEP"] { animation-duration: 10s; --breathe-amt: 0.006; }
.panther-halo--sleep {
  --halo-base-opacity: 0.28;
  opacity: 0.28;
  animation: halo-pulse-slow 6s ease-in-out infinite;
}

#panther-breathe[data-state="AWAKE"],
#panther-breathe[data-state="LISTENING"] { animation-duration: 6.5s; --breathe-amt: 0.012; }
.panther-halo--awake {
  opacity: 0.62;
}
.panther-halo--listening {
  opacity: 0.68;
  background: radial-gradient(circle, rgba(var(--violet-rgb), 0.4), rgba(var(--violet-rgb), 0.1) 40%, transparent 68%);
  animation: halo-pulse-tight 2.4s ease-in-out infinite;
}

#panther-breathe[data-state="ARISE"],
#panther-breathe[data-state="ASCEND"] { animation-duration: 5s; --breathe-amt: 0.016; }
.panther-halo--arise {
  opacity: 0.85;
  animation: halo-expand 1.6s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}
.panther-halo--ascend {
  opacity: 0.9;
  background: radial-gradient(circle, rgba(var(--violet-rgb), 0.5), rgba(var(--violet-rgb), 0.14) 45%, transparent 74%);
  animation: halo-expand 1.6s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}

#panther-breathe[data-state="WORKING"],
#panther-breathe[data-state="THINKING"] { animation-duration: 4.2s; --breathe-amt: 0.014; }
.panther-halo--working {
  opacity: 0.75;
  animation: halo-pulse-energized 2.1s ease-in-out infinite;
}
.panther-halo--thinking {
  --halo-base-opacity: 0.55;
  opacity: 0.55;
  animation: halo-pulse-slow 3.4s ease-in-out infinite;
}

#panther-breathe[data-state="APPROVAL_REQUIRED"] { animation-duration: 7.5s; --breathe-amt: 0.008; }
.panther-halo--approval {
  --halo-base-opacity: 0.55;
  opacity: 0.55;
  animation: halo-pulse-slow 4.2s ease-in-out infinite;
}

#panther-breathe[data-state="SUCCESS"] { animation-duration: 6s; --breathe-amt: 0.01; }
.panther-halo--success {
  background: radial-gradient(circle, rgba(var(--good-rgb), 0.4), rgba(var(--good-rgb), 0.1) 45%, transparent 72%);
  animation: halo-success-settle 1.4s ease-out 1;
}

#panther-breathe[data-state="ERROR"] { animation-duration: 5s; --breathe-amt: 0.01; }
.panther-halo--error {
  background: radial-gradient(circle, rgba(var(--danger-rgb), 0.42), rgba(var(--danger-rgb), 0.1) 45%, transparent 72%);
  opacity: 0.8;
  animation: halo-pulse-energized 1.5s ease-in-out infinite;
}

@keyframes halo-pulse-slow {
  0%, 100% { transform: scale(1); opacity: var(--halo-base-opacity, 0.5); }
  50% { transform: scale(1.03); opacity: calc(var(--halo-base-opacity, 0.5) * 0.65); }
}
@keyframes halo-pulse-tight {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}
@keyframes halo-expand {
  0% { transform: scale(0.97); opacity: 0.55; }
  70% { transform: scale(1.06); opacity: 0.95; }
  100% { transform: scale(0.97); opacity: 0.55; }
}
@keyframes halo-pulse-energized {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.045) rotate(1.5deg); }
}
@keyframes halo-success-settle {
  0% { transform: scale(0.95); opacity: 0.5; }
  35% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 0.6; }
}

/* ---------- Side panel ---------- */

#side-panel {
  position: absolute;
  top: 88px;
  right: 24px;
  width: 220px;
  z-index: 4;
}

/* Secondary system intelligence rail — deliberately quieter than the
   Panther/state hierarchy (masterprompt Phase C section 13): one
   translucent panel, compact rows, no competing card shadows. */
.side-rail {
  background: rgba(10, 10, 12, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.side-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.side-row:last-child {
  border-bottom: none;
}

.side-row h3 {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.side-row .side-value {
  font-size: 17px;
  font-weight: 700;
}

.side-row .side-empty {
  font-size: 11px;
  color: var(--muted);
}

.decision-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.decision-row:first-of-type {
  border-top: none;
}

.decision-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.decision-tag.pending_approval { color: var(--violet2); border-color: rgba(var(--violet-rgb), 0.5); }
.decision-tag.approved { color: var(--violet2); border-color: rgba(var(--violet-rgb), 0.5); }
.decision-tag.rejected { color: var(--danger); border-color: rgba(var(--danger-rgb), 0.5); }
.decision-tag.execution_confirmed { color: var(--good); border-color: rgba(var(--good-rgb), 0.5); }

/* ---------- Approval layer ---------- */

#approval-layer {
  position: absolute;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.approval-card {
  background: var(--surface2);
  border: 1px solid rgba(var(--violet-rgb), 0.4);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 340px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.approval-card .approval-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet2);
}

.approval-card .approval-title {
  font-size: 15px;
  font-weight: 600;
}

.approval-actions {
  display: flex;
  gap: 10px;
}

.approval-actions button {
  flex: 1;
  font: inherit;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: 0.2s;
}
.approve-btn:hover {
  border-color: rgba(var(--good-rgb), 0.6);
  color: var(--good);
}
.reject-btn:hover {
  border-color: rgba(var(--danger-rgb), 0.6);
  color: var(--danger);
}

/* ---------- Operator bar ---------- */

#operator-bar {
  padding: 22px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 5;
}

#operator-form {
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

#operator-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 14px 20px;
  color: var(--text);
  font: 14px var(--sans);
}
#operator-input:focus {
  outline: none;
  border-color: rgba(var(--violet-rgb), 0.6);
}
#operator-input::placeholder {
  color: var(--muted);
}

#operator-submit {
  background: var(--violet);
  border: none;
  color: #fff;
  border-radius: 999px;
  padding: 0 22px;
  font: 600 13px var(--sans);
  cursor: pointer;
  transition: 0.2s;
}
#operator-submit:hover {
  box-shadow: 0 0 24px rgba(var(--violet-rgb), 0.4);
}

#operator-feedback {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  min-height: 14px;
}

/* ---------- Voice control (Phase E) ---------- */

#voice-mic-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 0 18px;
  font: 600 13px var(--sans);
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}
#voice-mic-button:hover:not(:disabled) {
  border-color: rgba(var(--violet-rgb), 0.6);
  color: var(--violet2);
}
#voice-mic-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#voice-mic-button[data-voice-state="listening"] {
  background: rgba(var(--danger-rgb), 0.14);
  border-color: rgba(var(--danger-rgb), 0.5);
  color: var(--danger);
  animation: pulse 1.8s infinite;
}
#voice-mic-button[data-voice-state="thinking"] {
  border-color: rgba(var(--violet-rgb), 0.5);
  color: var(--violet2);
}

#voice-status {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  min-height: 14px;
}

/* ---------- Demo panel ---------- */

#demo-panel {
  position: absolute;
  top: 66px;
  left: 28px;
  width: 220px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  background: rgba(15, 15, 18, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(8px);
}
#demo-panel[hidden] {
  display: none;
}
#demo-panel h3 {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
#demo-panel h3:not(:first-child) {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
#demo-panel button {
  font: 11px var(--mono);
  letter-spacing: 0.05em;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: 0.2s;
}
#demo-panel button:hover {
  border-color: rgba(var(--violet-rgb), 0.5);
  color: var(--violet2);
}
#demo-panel button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Responsive ----------
   Primary target is desktop 1440px+ (masterprompt Phase C section 17).
   Below that, the orbit/side-rail simplify first; the Panther stays
   the dominant element at every width down to mobile. */

@media (max-width: 1280px) {
  #side-panel {
    width: 196px;
    top: 78px;
    right: 18px;
  }
  #agent-orbit {
    width: min(74vh, 680px);
    height: min(63vh, 580px);
  }
}

@media (max-width: 1024px) {
  #panther-stage {
    width: clamp(240px, 38vw, 380px);
  }
  #agent-orbit {
    width: min(70vh, 560px);
    height: min(59vh, 470px);
  }
  .agent-node {
    width: 76px;
  }
  .agent-node-dot {
    width: 28px;
    height: 28px;
  }
  #side-panel {
    width: 176px;
  }
}

@media (max-width: 720px) {
  #status-bar {
    padding: 16px 18px;
    font-size: 10px;
  }
  #demo-toggle {
    padding: 7px 10px;
  }
  #side-panel {
    display: none;
  }
  #demo-panel {
    width: 180px;
  }
  #agent-orbit {
    width: 94vw;
    height: 80vw;
  }
  #panther-stage {
    width: clamp(180px, 52vw, 260px);
  }
  .agent-node {
    width: 64px;
  }
  .agent-node-dot {
    width: 24px;
    height: 24px;
  }
  .agent-node-label {
    font-size: 8px;
  }
  #panther-caption-state {
    font-size: 11px;
  }
  #panther-caption-text {
    font-size: 9px;
  }
}

/* ---------- Motion & accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  .status-dot,
  .agent-node-dot,
  #env-particles,
  #panther-breathe,
  #panther-halo,
  .panther-halo--sleep,
  .panther-halo--listening,
  .panther-halo--arise,
  .panther-halo--ascend,
  .panther-halo--working,
  .panther-halo--thinking,
  .panther-halo--approval,
  .panther-halo--success,
  .panther-halo--error {
    animation: none !important;
  }
  .panther-img {
    transition-duration: 0.05s !important;
  }
  #panther-halo {
    transition-duration: 0.05s !important;
  }
  .agent-link,
  .agent-node-dot,
  .agent-node-label,
  #demo-toggle,
  #operator-submit,
  .approval-actions button {
    transition-duration: 0.05s !important;
  }
}

/* ==========================================================
   WHYZ RESPONSIVE V1 — Mobile / Tablet foundation
   Added 2026-09-18
   ========================================================== */

html,
body {
  width: 100%;
  min-height: 100%;
  overscroll-behavior: none;
}

#whyz-app {
  height: 100vh;
  height: 100dvh;
  min-height: 100dvh;
}

/* iOS / Android safe areas */
#status-bar {
  padding-top: max(22px, env(safe-area-inset-top));
  padding-left: max(32px, env(safe-area-inset-left));
  padding-right: max(32px, env(safe-area-inset-right));
}

#operator-bar {
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  padding-left: max(32px, env(safe-area-inset-left));
  padding-right: max(32px, env(safe-area-inset-right));
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  #voice-mic-button,
  #operator-submit,
  #demo-toggle,
  .whyz-quicklink,
  .approval-actions button {
    min-height: 44px;
  }

  #operator-input {
    min-height: 44px;
    font-size: 16px;
  }
}

/* ---------- Tablet ---------- */
@media (min-width: 721px) and (max-width: 1366px) {
  #status-bar {
    padding: max(18px, env(safe-area-inset-top))
             max(22px, env(safe-area-inset-right))
             18px
             max(22px, env(safe-area-inset-left));
  }

  #operator-bar {
    padding: 18px
             max(22px, env(safe-area-inset-right))
             max(22px, env(safe-area-inset-bottom))
             max(22px, env(safe-area-inset-left));
  }

  #panther-stage {
    width: clamp(280px, 42vw, 420px);
  }
}

/* ---------- Phone ---------- */
@media (max-width: 720px) {
  #status-bar {
    padding: max(12px, env(safe-area-inset-top))
             max(14px, env(safe-area-inset-right))
             10px
             max(14px, env(safe-area-inset-left));
  }

  #operator-bar {
    padding: 10px
             max(12px, env(safe-area-inset-right))
             max(12px, env(safe-area-inset-bottom))
             max(12px, env(safe-area-inset-left));
    gap: 6px;
  }

  #operator-form {
    gap: 7px;
  }

  #operator-input {
    min-width: 0;
    padding: 12px 14px;
    font-size: 16px;
  }

  #voice-mic-button {
    padding: 0 14px;
    min-width: 72px;
  }

  #operator-submit {
    padding: 0 16px;
  }
}

/* ==========================================================
   WHYZ RESPONSIVE V1 — Panther-first mobile layout
   ========================================================== */

@media (max-width: 720px) {
  #stage {
    min-height: 0;
    padding: 0 8px;
  }

  #panther-stage {
    width: clamp(240px, 72vw, 340px);
    max-height: 46dvh;
  }

  #panther-caption {
    bottom: -4px;
  }

  #agent-orbit {
    width: min(96vw, 430px);
    height: min(72vw, 340px);
    opacity: 0.72;
  }

  .agent-node {
    width: 58px;
  }

  .agent-node-dot {
    width: 24px;
    height: 24px;
  }

  .agent-node-label {
    font-size: 7px;
    line-height: 1.15;
  }

  #operator-form {
    max-width: 100%;
  }

  #voice-mic-button,
  #operator-submit {
    flex: 0 0 auto;
  }

  #operator-feedback,
  #voice-status {
    font-size: 10px;
    line-height: 1.35;
  }

  #approval-layer {
    width: calc(100% - 24px);
    bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .approval-card {
    width: 100%;
    min-width: 0;
    max-width: 420px;
  }

  #demo-panel {
    top: 58px;
    left: 12px;
    width: min(240px, calc(100vw - 24px));
    max-height: calc(100dvh - 150px);
  }
}

/* Small phones / short screens */
@media (max-width: 420px), (max-height: 700px) and (max-width: 720px) {
  #status-bar {
    padding-bottom: 6px;
  }

  #panther-stage {
    width: clamp(210px, 64vw, 280px);
  }

  #agent-orbit {
    width: min(88vw, 360px);
    height: min(64vw, 270px);
  }

  .agent-node-label {
    display: none;
  }

  #panther-caption-state {
    font-size: 10px;
  }

  #panther-caption-text {
    font-size: 8px;
  }

  #operator-bar {
    padding-top: 6px;
  }
}

/* Phone landscape */
@media (max-height: 520px) and (orientation: landscape) {
  #side-panel {
    display: none;
  }

  #panther-stage {
    width: min(38vw, 250px);
  }

  #agent-orbit {
    width: min(58vw, 420px);
    height: min(45vh, 230px);
  }

  .agent-node-label {
    display: none;
  }

  #status-bar {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 4px;
  }

  #operator-bar {
    padding-top: 4px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
}

/* ==========================================================
   WHYZ MOBILE V1.1 — readability cleanup
   ========================================================== */

@media (max-width: 720px) {

  /* Development control stays functional but invisible in production UI */
  #demo-toggle {
    display: none !important;
  }

  /* Give agent network more room around the Panther */
  #agent-orbit {
    width: min(98vw, 440px);
    height: min(88vw, 390px);
  }

  /* Keep agent labels above Panther/video layers */
  .agent-node {
    z-index: 4;
  }

  .agent-node-label {
    position: relative;
    z-index: 5;
    font-size: 8px;
    font-weight: 600;
    color: rgba(242, 240, 235, 0.88);
    text-shadow:
      0 1px 4px #000,
      0 0 8px #000;
  }

  .agent-node-dot {
    position: relative;
    z-index: 5;
    background: rgba(5, 5, 6, 0.82);
  }

  /* Panther remains dominant without swallowing the agent ring */
  #panther-stage {
    width: clamp(220px, 64vw, 300px);
  }

  /* Move Panther state/caption away from CONTENT agent */
  #panther-caption {
    bottom: -16px;
    transform: translate(-50%, 100%);
    z-index: 6;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(5, 5, 6, 0.68);
    backdrop-filter: blur(6px);
  }

  #panther-caption-state,
  #panther-caption-text {
    text-shadow: 0 1px 5px #000;
  }
}

/* Preserve labels on normal-size phones */
@media (min-width: 390px) and (max-width: 720px) {
  .agent-node-label {
    display: block;
  }
}

/* ==========================================================
   WHYZ TABLET V1.1 — agent readability cleanup
   ========================================================== */

@media (min-width: 721px) and (max-width: 1366px) {

  /* Hide development control on tablet */
  #demo-toggle {
    display: none !important;
  }

  /* More space between Panther and agents */
  #agent-orbit {
    width: min(72vw, 620px);
    height: min(62vw, 520px);
  }

  /* Panther remains dominant, but no longer covers agents */
  #panther-stage {
    width: clamp(250px, 34vw, 350px);
  }

  /* Agent labels stay readable above visual layers */
  .agent-node {
    z-index: 4;
  }

  .agent-node-dot {
    position: relative;
    z-index: 5;
    background: rgba(5, 5, 6, 0.82);
  }

  .agent-node-label {
    position: relative;
    z-index: 5;
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: rgba(242, 240, 235, 0.9);
    text-shadow:
      0 1px 4px #000,
      0 0 8px #000;
  }

  /* Keep SLEEP / IDLE separate from CONTENT */
  #panther-caption {
    bottom: -18px;
    transform: translate(-50%, 100%);
    z-index: 6;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(5, 5, 6, 0.68);
    backdrop-filter: blur(6px);
  }
}

/* Tablet portrait */
@media (min-width: 721px) and (max-width: 1366px) and (orientation: portrait) {
  #agent-orbit {
    width: min(82vw, 650px);
    height: min(68vw, 540px);
  }

  #panther-stage {
    width: clamp(250px, 38vw, 340px);
  }
}

/* ==========================================================
   WHYZ TABLET V1.2 — explicit agent positions
   ========================================================== */

@media (min-width: 721px) and (max-width: 1366px) {

  #demo-toggle {
    display: none !important;
  }

  #agent-orbit {
    width: min(88vw, 720px);
    height: min(68vw, 560px);
  }

  #panther-stage {
    width: clamp(230px, 31vw, 315px);
  }

  /* Top */
  .agent-node[data-agent-id="research"] {
    left: 50% !important;
    top: 3% !important;
  }

  /* Upper right */
  .agent-node[data-agent-id="lead_intelligence"] {
    left: 82% !important;
    top: 14% !important;
  }

  /* Right */
  .agent-node[data-agent-id="sales"] {
    left: 96% !important;
    top: 40% !important;
  }

  /* Lower right */
  .agent-node[data-agent-id="crm"] {
    left: 83% !important;
    top: 76% !important;
  }

  /* Bottom */
  .agent-node[data-agent-id="content"] {
    left: 50% !important;
    top: 94% !important;
  }

  /* Lower left */
  .agent-node[data-agent-id="calendar"] {
    left: 17% !important;
    top: 76% !important;
  }

  /* Left */
  .agent-node[data-agent-id="delivery"] {
    left: 4% !important;
    top: 40% !important;
  }

  /* Upper left */
  .agent-node[data-agent-id="qa"] {
    left: 18% !important;
    top: 14% !important;
  }

  .agent-node {
    z-index: 8;
  }

  .agent-node-label,
  .agent-node-dot {
    z-index: 9;
  }
}

/* WHYZ TABLET V1.3 — Content visibility fix */
@media (min-width: 721px) and (max-width: 1366px) {
  .agent-node[data-agent-id="content"] {
    left: 50% !important;
    top: 84% !important;
    z-index: 10 !important;
  }

  .agent-node[data-agent-id="content"] .agent-node-label,
  .agent-node[data-agent-id="content"] .agent-node-dot {
    position: relative;
    z-index: 11;
  }
}

/* ==========================================================
   WHYZ TABLET V1.5 — lift complete Panther/agent composition
   ========================================================== */

@media (min-width: 721px) and (max-width: 1366px) {
  #agent-network {
    transform: translateY(-8vh);
  }

  #panther-stage {
    transform: translateY(-8vh);
  }
}

/* ==========================================================
   WHYZ TABLET V1.6 — balanced vertical composition
   ========================================================== */

@media (min-width: 721px) and (max-width: 1366px) {

  /* Restore centered composition so Research remains visible */
  #agent-network,
  #panther-stage {
    transform: translateY(0) !important;
  }

  /* Keep Content safely above operator bar */
  .agent-node[data-agent-id="content"] {
    left: 50% !important;
    top: 64% !important;
    z-index: 12 !important;
  }
}

/* ==========================================================
   WHYZ TABLET V1.7 — separate Panther status from Content
   ========================================================== */

@media (min-width: 721px) and (max-width: 1366px) {

  /* Panther status belongs to Panther, not to Content node */
  #panther-caption {
    bottom: 18% !important;
    transform: translateX(-50%) !important;
    z-index: 15 !important;
  }

  /* Content gets its own clear position below Panther status */
  .agent-node[data-agent-id="content"] {
    left: 50% !important;
    top: 72% !important;
    z-index: 12 !important;
  }
}

/* WHYZ TABLET V1.8 — Panther caption final placement */
@media (min-width: 721px) and (max-width: 1366px) {
  #panther-caption {
    bottom: -8px !important;
    transform: translate(-50%, 100%) !important;
    z-index: 15 !important;
  }
}

/* WHYZ TABLET V1.9 — Content final spacing */
@media (min-width: 721px) and (max-width: 1366px) {
  .agent-node[data-agent-id="content"] {
    top: 88% !important;
  }
}

/* ==========================================================
   WHYZ MOBILE FINAL V2 — iPhone composition
   Single final override — keep mobile geometry stable
   ========================================================== */

@media (max-width: 720px) {

  /* ---------- Composition ---------- */

  #stage {
    position: relative;
    min-height: 0;
    padding: 0 8px;
    overflow: hidden;
  }

  /* ---------- Agent network ---------- */

  #agent-network {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
  }

  #agent-orbit {
    width: min(96vw, 430px);
    height: min(82vw, 360px);
    opacity: 0.82;
  }

  .agent-node {
    z-index: 8 !important;
    width: 58px;
  }

  .agent-node-dot {
    position: relative;
    z-index: 9 !important;
  }

  .agent-node-label {
    position: relative;
    z-index: 10 !important;
    display: block;
    font-size: 8px;
    line-height: 1.15;
    font-weight: 600;
    white-space: normal;
    text-align: center;
  }

  /* ---------- Panther ---------- */

  #panther-stage {
    position: relative;
    z-index: 4;
    width: clamp(220px, 64vw, 300px);
    max-height: 43dvh;
  }

  /*
   * Soft edge treatment:
   * lets the dark Panther asset disappear into the WHYZ environment
   * instead of reading as a hard rectangular image.
   */
  #panther-breathe,
  #panther-video-layer {
    border-radius: 18px;
    overflow: hidden;
  }

  .panther-img,
  .panther-video {
    border-radius: 18px;
  }

  #panther-caption {
    bottom: -16px !important;
    transform: translate(-50%, 100%) !important;
    z-index: 20 !important;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(5, 5, 6, 0.72);
    backdrop-filter: blur(6px);
  }

  /* Keep CONTENT visually separated from the Panther status */
  .agent-node[data-agent-id="content"] {
    left: 50% !important;
    top: 88% !important;
    z-index: 15 !important;
  }

  .agent-node[data-agent-id="content"] .agent-node-label,
  .agent-node[data-agent-id="content"] .agent-node-dot {
    position: relative;
    z-index: 16 !important;
  }

  /* ---------- Operator ---------- */

  #operator-bar {
    position: relative;
    z-index: 30;
  }

  #operator-form {
    width: 100%;
    max-width: 100%;
  }

  #operator-input {
    min-width: 0;
    font-size: 16px;
  }

  #voice-mic-button {
    min-width: 72px;
  }

  #operator-submit {
    min-width: 82px;
  }
}

/* Small iPhones */
@media (max-width: 389px) {

  #agent-orbit {
    width: 94vw;
    height: 78vw;
  }

  .agent-node {
    width: 54px;
  }

  .agent-node-label {
    font-size: 7px;
  }

  #panther-stage {
    width: 62vw;
  }
}


/* ==========================================================
   WHYZ MOBILE FINAL V3 — final visual polish
   ========================================================== */

@media (max-width: 720px) {

  /* Let the Panther asset dissolve into the dark environment */
  #panther-video-layer,
  #panther-breathe {
    -webkit-mask-image: radial-gradient(
      ellipse 78% 82% at 50% 50%,
      #000 62%,
      rgba(0,0,0,.92) 76%,
      transparent 100%
    );
    mask-image: radial-gradient(
      ellipse 78% 82% at 50% 50%,
      #000 62%,
      rgba(0,0,0,.92) 76%,
      transparent 100%
    );
  }

  /* Give CONTENT its own clean position */
  .agent-node[data-agent-id="content"] {
    top: 98% !important;
    z-index: 25 !important;
  }

  /* Keep Panther status visually above the agent ring */
  #panther-caption {
    bottom: -10px !important;
    z-index: 30 !important;
  }

  /* Pull the whole visual composition slightly downward,
     reducing the empty gap before the operator bar. */
  #agent-network,
  #panther-stage {
    transform: translateY(2vh);
  }

}

/* Very small phones */
@media (max-width: 389px) {

  .agent-node[data-agent-id="content"] {
    top: 96% !important;
  }

  #agent-network,
  #panther-stage {
    transform: translateY(1vh);
  }

}


/* WHYZ MOBILE FINAL V4 — Content separation + balance */

@media (max-width: 720px) {

  /* Content gets a completely independent position below WHYZ status */
  .agent-node[data-agent-id="content"] {
    top: 104% !important;
    z-index: 25 !important;
  }

  .agent-node[data-agent-id="content"] .agent-node-label {
    margin-top: 2px;
  }

  /* Slightly tighten the vertical composition */
  #agent-network,
  #panther-stage {
    transform: translateY(1vh);
  }

}

@media (max-width: 389px) {

  .agent-node[data-agent-id="content"] {
    top: 101% !important;
  }

}


/* WHYZ WAKE CONTROL */
#status-bar {
  cursor: pointer;
}

#status-bar:focus-visible {
  outline: 1px solid rgba(108, 92, 231, 0.8);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  #status-bar {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  #status-bar:active {
    opacity: 0.72;
  }
}


/* ==========================================================
   WHYZ OPERATOR — WAKE CONTROL
   ========================================================== */

#wake-button {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  width: 142px;
  height: 40px;

  border: 1px solid rgba(108, 92, 231, 0.55);
  border-radius: 999px;

  background: rgba(7, 7, 11, 0.82);

  color: rgba(242, 240, 235, 0.92);

  box-shadow:
    0 0 20px rgba(108, 92, 231, 0.12),
    inset 0 1px 0 rgba(255,255,255,0.05);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;

  cursor: pointer;
  z-index: 50;

  -webkit-tap-highlight-color: transparent;
}

#wake-button:active {
  transform: translateX(-50%) scale(0.96);
}

.wake-button-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;

  background: #6C5CE7;

  box-shadow:
    0 0 8px rgba(108, 92, 231, 0.85),
    0 0 16px rgba(108, 92, 231, 0.35);
}

.wake-button-label {
  white-space: nowrap;
}

#wake-button[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  #wake-button {
    top: calc(env(safe-area-inset-top) + 58px);
    width: 148px;
    height: 42px;
  }
}


/* ==========================================================
   WHYZ PANTHER — FINAL POLISH V1
   Platform glow + caption spacing only.
   ========================================================== */

@media (max-width: 720px) {

  /* Slightly stronger floor illumination beneath Panther */
  #panther-stage::after {
    width: 62%;
    height: 10%;
    bottom: 7%;
    background:
      radial-gradient(
        ellipse at center,
        rgba(108, 92, 231, 0.48) 0%,
        rgba(108, 92, 231, 0.20) 42%,
        rgba(108, 92, 231, 0.06) 64%,
        transparent 80%
      );
    filter: blur(10px);
  }

  /* Give the state indicator a little breathing room */
  #panther-caption {
    bottom: -22px !important;
  }

}

/* ==========================================================
   WHYZ QUICK LINKS — Executive Assistant / Kunden-Intake
   Revised 2026-09-27 (fix): the first attempt added a 4th
   grid-template-rows track to #whyz-app. That shrank the #stage
   1fr track's available space; #stage has no min-height:0 outside
   the phone breakpoint, so its content (sized for the original
   2-fixed-rows budget) no longer fit and visibly compressed toward
   the bottom. Fixed by NOT touching #whyz-app's rows at all: the
   links now live inside the existing #status-bar header, grouped
   with #demo-toggle in .header-actions so #status-bar keeps its
   original two-flex-child layout (.status-id / .header-actions)
   and only that single row's own auto height can change, exactly
   as it already could before this feature existed.
   ========================================================== */

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.whyz-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.whyz-quicklink {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: 0.2s;
}

.whyz-quicklink:hover {
  color: var(--text);
  border-color: rgba(var(--violet-rgb), 0.5);
}

.whyz-quicklink:focus-visible {
  outline: 2px solid rgba(var(--violet-rgb), 0.8);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .whyz-quicklink {
    padding: 7px 10px;
    font-size: 10px;
  }
}

