:root {
  color-scheme: dark;
  --bg-start: #040716;
  --bg-end: #161036;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --panel: rgba(12, 16, 38, 0.52);
  --panel-strong: rgba(20, 25, 50, 0.68);
  --text: #f8fbff;
  --muted: rgba(231, 238, 255, 0.7);
  --cyan: #67e8f9;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --pink: #f9a8d4;
  --gold: #fef08a;
  --danger: #fb7185;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-start);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 16% 18%, rgba(103, 232, 249, 0.18), transparent 23rem),
    radial-gradient(circle at 86% 16%, rgba(249, 168, 212, 0.2), transparent 24rem),
    radial-gradient(circle at 50% 86%, rgba(167, 139, 250, 0.18), transparent 28rem),
    linear-gradient(160deg, var(--bg-start) 0%, #0a1028 48%, var(--bg-end) 100%);
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(34px);
  opacity: 0.52;
}

body::before {
  width: 260px;
  height: 260px;
  top: 8%;
  right: -100px;
  background: rgba(103, 232, 249, 0.22);
}

body::after {
  width: 300px;
  height: 300px;
  left: -100px;
  bottom: 6%;
  background: rgba(249, 168, 212, 0.18);
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

.page-shell {
  min-height: 100vh;
  position: relative;
  padding: 20px;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.45;
  pointer-events: none;
}

.ambient-one {
  width: 180px;
  height: 180px;
  top: 18%;
  left: 10%;
  background: rgba(103, 232, 249, 0.16);
  animation: drift 14s ease-in-out infinite alternate;
}

.ambient-two {
  width: 240px;
  height: 240px;
  right: 9%;
  top: 16%;
  background: rgba(168, 85, 247, 0.18);
  animation: drift 18s ease-in-out infinite alternate-reverse;
}

.ambient-three {
  width: 210px;
  height: 210px;
  left: 38%;
  bottom: 12%;
  background: rgba(249, 168, 212, 0.12);
  animation: drift 16s ease-in-out infinite alternate;
}

.experience-shell {
  position: relative;
  width: min(1480px, 100%);
  min-height: calc(100vh - 40px);
  margin: 0 auto;
}

.brand-pill,
.top-status-pill,
.dock,
.three-stage {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055));
  border: 1px solid var(--line);
  box-shadow:
    0 28px 80px rgba(2, 6, 23, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(24px) saturate(125%);
  -webkit-backdrop-filter: blur(24px) saturate(125%);
}

.brand-pill {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 20px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #08111d;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  box-shadow: 0 8px 24px rgba(249, 168, 212, 0.35);
}

.brand-copy {
  display: grid;
}

.brand-copy strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-copy span {
  font-size: 12px;
  color: var(--muted);
}

.top-status-pill {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-dot,
.status-badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(103, 232, 249, 0.8);
}

.three-stage {
  position: relative;
  min-height: calc(100vh - 40px);
  border-radius: 36px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.1), transparent 20rem),
    linear-gradient(180deg, rgba(18, 24, 52, 0.74) 0%, rgba(9, 13, 31, 0.5) 100%);
}

.three-stage::before,
.three-stage::after {
  content: "";
  position: absolute;
  inset: auto;
  border-radius: 999px;
  filter: blur(18px);
  pointer-events: none;
}

.three-stage::before {
  width: 32vw;
  height: 32vw;
  max-width: 360px;
  max-height: 360px;
  top: 14%;
  left: 10%;
  background: rgba(103, 232, 249, 0.12);
}

.three-stage::after {
  width: 28vw;
  height: 28vw;
  max-width: 320px;
  max-height: 320px;
  right: 12%;
  bottom: 22%;
  background: rgba(249, 168, 212, 0.12);
}

.three-stage canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.stage-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.assistant-overlay {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  pointer-events: none;
}

.dock {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 18px;
  border-radius: 30px;
  pointer-events: auto;
}

.dock-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dock-kicker {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 800;
  color: var(--cyan);
}

.dock h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.05em;
}

.dock-copy {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 650px;
}

.status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  font-weight: 700;
}

.status-badge.is-live {
  background: rgba(103, 232, 249, 0.14);
}

.status-badge.is-awake {
  background: rgba(249, 168, 212, 0.16);
}

.media-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 104px;
  padding: 14px;
  margin-bottom: 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.panel-label,
.transcript-label,
.config-card span {
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  font-weight: 800;
}

.media-copy {
  min-width: 0;
}

.media-copy strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-copy p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.media-commands {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 180px;
  border-radius: 20px;
  padding: 14px;
  color: rgba(248, 251, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.youtube-panel {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
}

.youtube-frame-shell {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(4, 7, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#youtube-player,
#youtube-player iframe,
.empty-player {
  width: 100%;
  height: 100%;
}

.empty-player {
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-size: 13px;
}

.music-panel {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.album-art {
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: #07111f;
  font-size: 30px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  box-shadow: 0 14px 32px rgba(249, 168, 212, 0.18);
}

.album-art img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
}

.translate-panel {
  grid-template-columns: minmax(0, 0.9fr) minmax(220px, 1.1fr);
}

.translation-log {
  display: grid;
  gap: 8px;
  max-height: 132px;
  overflow: auto;
}

.translation-line {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.translation-line span {
  color: rgba(231, 238, 255, 0.6);
  font-size: 12px;
}

.translation-line strong {
  font-size: 14px;
  line-height: 1.35;
}

.message-strip {
  display: grid;
  gap: 12px;
  max-height: 230px;
  overflow: auto;
  padding-right: 4px;
}

.message-strip::-webkit-scrollbar,
.translation-log::-webkit-scrollbar {
  width: 8px;
}

.message-strip::-webkit-scrollbar-thumb,
.translation-log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.user .message-stack {
  align-items: flex-end;
}

.mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.assistant-avatar {
  background: linear-gradient(135deg, rgba(249, 168, 212, 0.9), rgba(103, 232, 249, 0.82));
  color: #08111d;
}

.user-avatar {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.message-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: min(620px, 82vw);
}

.bubble {
  padding: 13px 15px;
  border-radius: 18px;
  line-height: 1.55;
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.message-row.assistant .bubble {
  border-bottom-left-radius: 8px;
}

.message-row.user .bubble {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.28), rgba(249, 168, 212, 0.18));
  border-bottom-right-radius: 8px;
}

.message-meta {
  font-size: 11px;
  color: rgba(231, 238, 255, 0.52);
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
}

.typing-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  animation: bounce 1s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

.error-note {
  margin: 12px 0 0;
  color: #fecdd3;
  font-size: 13px;
}

.voice-bar {
  margin-top: 16px;
  display: grid;
  grid-template-columns: auto 1fr minmax(120px, auto);
  gap: 14px;
  align-items: center;
}

.mic-button {
  position: relative;
  width: 82px;
  height: 82px;
  border: 0;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(249, 168, 212, 0.92), rgba(103, 232, 249, 0.82));
  color: #06111c;
  box-shadow:
    0 14px 36px rgba(96, 165, 250, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
  overflow: hidden;
  cursor: pointer;
}

.mic-button.listening {
  animation: pulseButton 1.6s ease-in-out infinite;
}

.mic-icon {
  position: relative;
  z-index: 2;
  font-size: 28px;
}

.mic-ripple {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 22px;
  opacity: 0;
}

.mic-button.listening .mic-ripple {
  animation: ripple 1.8s ease-out infinite;
}

.mic-button.listening .ripple-two {
  animation-delay: 0.6s;
}

.transcript-card,
.config-card {
  min-height: 82px;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.transcript-card strong {
  font-size: 15px;
  line-height: 1.4;
}

.hint-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.hint-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  color: rgba(231, 238, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.config-card strong {
  font-size: 18px;
  text-transform: capitalize;
}

.config-card small {
  color: var(--muted);
  font-weight: 700;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(18px, -24px, 0) scale(1.08);
  }
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

@keyframes pulseButton {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

@keyframes ripple {
  0% {
    opacity: 0.6;
    transform: scale(0.92);
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

@media (max-width: 980px) {
  .page-shell {
    padding: 14px;
  }

  .assistant-overlay {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .three-stage {
    min-height: calc(100vh - 28px);
    border-radius: 28px;
  }

  .dock {
    padding: 16px;
    border-radius: 24px;
  }

  .dock-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .media-panel,
  .youtube-panel,
  .music-panel,
  .translate-panel,
  .voice-bar {
    grid-template-columns: 1fr;
  }

  .youtube-frame-shell {
    min-height: 190px;
  }

  .media-commands {
    min-width: 0;
    min-height: 54px;
  }

  .mic-button {
    width: 76px;
    height: 76px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow-y: auto;
  }

  .experience-shell {
    min-height: calc(100vh - 28px);
  }

  .brand-pill,
  .top-status-pill {
    position: static;
    margin-bottom: 12px;
  }

  .top-status-pill {
    display: inline-flex;
    width: 100%;
    justify-content: center;
  }

  .three-stage {
    min-height: 58vh;
  }

  .assistant-overlay {
    position: static;
    margin-top: -38px;
    padding-bottom: 14px;
  }

  .dock {
    width: 100%;
  }

  .message-stack {
    max-width: calc(100vw - 110px);
  }

  .message-strip {
    max-height: 220px;
  }
}

/* AGA spine: explicit, glanceable state machine */
.state-rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 14px;
}

.state-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border-radius: 999px;
  color: rgba(248, 251, 255, 0.62);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.state-node i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.6;
}

.state-node.active {
  color: #06111c;
  background: linear-gradient(135deg, rgba(254, 240, 138, 0.95), rgba(103, 232, 249, 0.86));
  border-color: rgba(255, 255, 255, 0.36);
  box-shadow: 0 10px 28px rgba(103, 232, 249, 0.2);
}

@media (max-width: 640px) {
  .state-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
