/* Lumme Jarvis — one-viewport HUD, light + dark */

#page-jarvis {
  --jv-accent: #ff5300;
  --jv-accent-2: #ff7433;
  --jv-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --jv-stage: min(340px, 36vmin, calc(100dvh - 320px));

  /* Light (default) — warm cream, matches Lumme shell */
  --jv-bg: #fbf6f3;
  --jv-bg-mid: #fff7f2;
  --jv-glow: rgba(255, 83, 0, 0.18);
  --jv-glow-soft: rgba(255, 116, 51, 0.1);
  --jv-ink: #130600;
  --jv-muted: rgba(19, 6, 0, 0.55);
  --jv-dim: rgba(19, 6, 0, 0.38);
  --jv-pill: rgba(19, 6, 0, 0.05);
  --jv-pill-hover: rgba(19, 6, 0, 0.09);
  --jv-line: rgba(19, 6, 0, 0.1);
  --jv-border: rgba(19, 6, 0, 0.08);
  --jv-form-bg: rgba(255, 255, 255, 0.85);
  --jv-icon: #2e211b;
  --jv-icon-muted: rgba(19, 6, 0, 0.4);
  --jv-dot: rgba(19, 6, 0, 0.28);
  --jv-reply-dim: rgba(19, 6, 0, 0.18);
  --jv-reply-wait: rgba(19, 6, 0, 0.35);
  --jv-chip-border: rgba(19, 6, 0, 0.08);

  width: 100%;
  height: 100%;
  min-height: 0;
}

html.dark #page-jarvis {
  --jv-bg: #130600;
  --jv-bg-mid: #1b0b03;
  --jv-glow: rgba(255, 83, 0, 0.22);
  --jv-glow-soft: rgba(82, 30, 5, 0.55);
  --jv-ink: #ffffff;
  --jv-muted: rgba(255, 255, 255, 0.55);
  --jv-dim: rgba(255, 255, 255, 0.38);
  --jv-pill: rgba(255, 255, 255, 0.08);
  --jv-pill-hover: rgba(255, 255, 255, 0.14);
  --jv-line: rgba(255, 255, 255, 0.12);
  --jv-border: rgba(255, 83, 0, 0.16);
  --jv-form-bg: rgba(255, 255, 255, 0.05);
  --jv-icon: #ffffff;
  --jv-icon-muted: rgba(255, 255, 255, 0.45);
  --jv-dot: rgba(255, 255, 255, 0.4);
  --jv-reply-dim: rgba(255, 255, 255, 0.16);
  --jv-reply-wait: rgba(255, 255, 255, 0.35);
  --jv-chip-border: transparent;
}

body.jarvis-open #page-jarvis {
  display: block;
}

.jv-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: calc(100dvh - 112px);
  max-height: calc(100dvh - 112px);
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--jv-border);
  color: var(--jv-ink);
  font-family: 'Outfit', ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(65% 50% at 50% 36%, var(--jv-glow), transparent 60%),
    radial-gradient(90% 70% at 50% 100%, var(--jv-glow-soft), transparent 55%),
    linear-gradient(180deg, var(--jv-bg-mid), var(--jv-bg));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

html:not(.dark) .jv-shell {
  box-shadow: 0 10px 28px rgba(19, 6, 0, 0.06);
}

.jv-top,
.jv-main,
.jv-foot {
  position: relative;
  z-index: 1;
}

.jv-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 0;
}

.jv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--jv-dot);
  flex-shrink: 0;
}

.jv-dot.is-live {
  background: var(--jv-accent);
  box-shadow: 0 0 10px var(--jv-accent);
}

.jv-brand {
  font: 500 17px/1 'Outfit', sans-serif;
  color: var(--jv-ink);
}

.jv-state {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--jv-accent);
  min-height: 1em;
}

.jv-top-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.jv-iconbtn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--jv-pill);
  color: var(--jv-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.jv-iconbtn:hover {
  background: var(--jv-pill-hover);
}

.jv-iconbtn.is-off {
  color: var(--jv-icon-muted);
}

.jv-iconbtn .material-symbols-outlined {
  font-size: 20px;
}

.jv-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 0;
  padding: 8px 16px;
  overflow: hidden;
}

.jv-stage {
  position: relative;
  width: var(--jv-stage);
  height: var(--jv-stage);
  flex: 0 0 auto;
}

.jv-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.jv-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.jv-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.jv-ring-hour {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: var(--jv-dim);
  pointer-events: none;
}

.jv-copy {
  width: min(680px, 100%);
  flex: 0 1 auto;
  max-height: 96px;
  overflow: hidden;
  text-align: center;
  padding: 0 4px;
}

/* Active reply: give text room, shrink orb via --jv-stage, never show a loud scrollbar */
.jv-shell.has-reply {
  --jv-stage: min(260px, 28vmin, calc(100dvh - 400px));
}

.jv-copy.is-long {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* old Edge */
  mask-image: linear-gradient(180deg, #000 0%, #000 88%, transparent 100%);
}

.jv-copy.is-long::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.jv-greet-title {
  font: 300 clamp(22px, 3.2vw, 36px) / 1.15 'Outfit', sans-serif;
  color: var(--jv-ink);
  margin: 0;
}

.jv-greet-next {
  margin-top: 8px;
  font-size: 13px;
  color: var(--jv-muted);
}

.jv-greet-next b {
  color: var(--jv-accent);
  font-weight: 500;
}

.jv-greet-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--jv-muted);
}

.jv-ask {
  font-size: 13px;
  color: var(--jv-muted);
}

.jv-reply {
  margin-top: 6px;
  font: 300 clamp(16px, 2.1vw, 22px) / 1.35 'Outfit', sans-serif;
  color: var(--jv-ink);
  text-wrap: pretty;
}

.jv-shell.has-reply .jv-ask {
  margin-bottom: 2px;
}

.jv-reply .is-dim {
  color: var(--jv-reply-dim);
}

.jv-reply .is-wait {
  color: var(--jv-reply-wait);
}

.jv-pending {
  margin-top: 10px;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
}

.jv-pending button {
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  font: 400 13px/1 'Outfit', sans-serif;
  cursor: pointer;
}

.jv-pending [data-jv-cancel] {
  background: var(--jv-pill);
  color: var(--jv-ink);
}

.jv-pending [data-jv-confirm] {
  background: var(--jv-accent);
  color: #fff;
}

.jv-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 16px 14px;
}

.jv-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.jv-chip {
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--jv-chip-border);
  border-radius: 999px;
  background: var(--jv-pill);
  color: var(--jv-ink);
  font: 400 13px/1 'Outfit', sans-serif;
  cursor: pointer;
}

.jv-chip:hover {
  background: var(--jv-pill-hover);
}

.jv-mic {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 14px;
  background: var(--jv-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(255, 83, 0, 0.4);
  flex-shrink: 0;
}

.jv-mic.is-hot {
  background: #e84a00;
}

.jv-mic .material-symbols-outlined {
  font-size: 24px;
}

.jv-form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(560px, 100%);
  padding: 4px 4px 4px 14px;
  border-radius: 14px;
  border: 1px solid var(--jv-line);
  background: var(--jv-form-bg);
}

.jv-form input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--jv-ink);
  font: 400 14px/1.4 'Outfit', sans-serif;
  padding: 8px 0;
}

.jv-form input::placeholder {
  color: var(--jv-dim);
}

.jv-form button[type='submit'] {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 83, 0, 0.14);
  color: var(--jv-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-height: 760px) {
  #page-jarvis {
    --jv-stage: min(280px, 32vmin, calc(100dvh - 300px));
  }
  .jv-copy {
    max-height: 72px;
  }
  .jv-greet-sub {
    display: none;
  }
}

@media (max-height: 640px) {
  #page-jarvis {
    --jv-stage: min(220px, 28vmin, calc(100dvh - 270px));
  }
  .jv-shell {
    height: calc(100dvh - 96px);
    max-height: calc(100dvh - 96px);
  }
  .jv-chip {
    height: 34px;
    font-size: 12px;
  }
}

@media (max-width: 720px) {
  .jv-shell {
    border-radius: 16px;
    height: calc(100dvh - 96px);
    max-height: calc(100dvh - 96px);
  }
  #page-jarvis {
    --jv-stage: min(260px, 58vw, calc(100dvh - 310px));
  }
}
