:root {
  --bg-primary: #000000;
  --ink: #ffffff;
  --muted: #b7c0ca;
  --cyan: #00d4ff;
  --green: #59f28d;
  --amber: #ffd166;
  --coral: #ff6f61;
  --blue: #2f8cc3;
  --navy: #0c2532;
  --panel: rgba(10, 13, 16, 0.9);
  --panel-strong: #111820;
  --line: rgba(255, 255, 255, 0.22);
  --focus-glow: rgba(0, 212, 255, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg-primary);
}

body {
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button {
  color: inherit;
  font: inherit;
}

#app {
  width: 600px;
  height: 600px;
  background: var(--bg-primary);
  background-size: 100% 100%;
  overflow: hidden;
}

.stage {
  background: #000000;
  height: 600px;
  overflow: hidden;
  position: relative;
  width: 600px;
}

.hud {
  display: none;
}

.hud-kicker,
.dialog-speaker,
.stage-status,
.prompt-chip {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: uppercase;
}

.hud h1 {
  color: var(--ink);
  font-size: 20px;
  font-weight: 850;
  line-height: 1.1;
  margin-top: 4px;
  max-width: 282px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-status {
  background: rgba(89, 242, 141, 0.12);
  border: 1px solid rgba(89, 242, 141, 0.38);
  border-radius: 999px;
  color: var(--green);
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 8px;
}

.capture-preview {
  background:
    linear-gradient(140deg, rgba(0, 212, 255, 0.08), transparent 45%),
    #000000;
  height: 600px;
  inset: 0;
  object-fit: cover;
  opacity: 0;
  position: absolute;
  transform: scale(1);
  transition:
    filter 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
  width: 600px;
  z-index: 0;
}

.stage[data-preview="ready"] .capture-preview,
.stage[data-preview="frozen"] .capture-preview,
.stage[data-preview="live"] .capture-preview {
  opacity: 0;
  transform: scale(1);
}

.stage[data-preview="frozen"] .capture-preview {
  filter: saturate(0.92) contrast(1.04) brightness(0.72);
}

.stage[data-preview="live"] .capture-preview {
  filter: saturate(0.86) brightness(0.58);
}

.stage[data-state="thinking"] .capture-preview,
.stage[data-state="answer"] .capture-preview {
  filter: brightness(0.62) saturate(0.9);
}

.reticle {
  display: none;
}

.stage[data-preview="ready"] .reticle,
.stage[data-preview="frozen"] .reticle,
.stage[data-preview="live"] .reticle {
  opacity: 0.76;
}

.stage[data-reticle="active"] .reticle {
  opacity: 1;
  transform: scale(1);
}

.reticle::after {
  border: 1px dashed rgba(0, 212, 255, 0.58);
  content: "";
  height: 150px;
  left: 51px;
  position: absolute;
  top: 51px;
  width: 150px;
  z-index: 2;
}

.object-highlight {
  border: 3px solid #ff2f3f;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.7),
    0 0 12px rgba(255, 47, 63, 0.68);
  display: none;
  height: 46px;
  left: 82px;
  position: absolute;
  top: 82px;
  width: 46px;
  z-index: 7;
}

.object-highlight[data-active="true"] {
  display: block;
}

.object-highlight-label {
  background: #ff2f3f;
  color: #ffffff;
  font-size: 10px;
  font-weight: 850;
  left: -3px;
  max-width: 118px;
  overflow: hidden;
  padding: 3px 5px;
  position: absolute;
  text-overflow: ellipsis;
  text-transform: uppercase;
  top: -24px;
  white-space: nowrap;
}

.capture-flash {
  border: 1px solid rgba(255, 255, 255, 0.5);
  height: 600px;
  left: 0;
  opacity: 0;
  position: absolute;
  top: 0;
  width: 600px;
  z-index: 3;
}

.stage[data-preview="ready"] .capture-flash,
.stage[data-preview="frozen"] .capture-flash {
  animation: frame-pop 620ms steps(2, end) 1;
}

.stage[data-preview="live"] .capture-flash {
  animation: frame-pop 420ms steps(2, end) 1;
}

.reticle-corner {
  border-color: var(--cyan);
  border-style: solid;
  height: 42px;
  position: absolute;
  width: 42px;
  z-index: 4;
}

.corner-a {
  border-width: 4px 0 0 4px;
  left: 0;
  top: 0;
}

.corner-b {
  border-width: 4px 4px 0 0;
  right: 0;
  top: 0;
}

.corner-c {
  border-width: 0 0 4px 4px;
  bottom: 0;
  left: 0;
}

.corner-d {
  border-width: 0 4px 4px 0;
  bottom: 0;
  right: 0;
}

.prompt-chip {
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(0, 212, 255, 0.46);
  border-radius: 4px;
  left: 50%;
  min-width: 76px;
  padding: 6px 8px;
  position: absolute;
  text-align: center;
  top: -36px;
  transform: translateX(-50%);
}

.avatar-scene {
  height: 386px;
  left: 86px;
  pointer-events: none;
  position: absolute;
  top: 82px;
  width: 428px;
  z-index: 8;
}

.avatar-orbit {
  display: none;
}

.orbit-a {
  height: 278px;
  width: 342px;
}

.orbit-b {
  border-color: rgba(89, 242, 141, 0.18);
  height: 212px;
  transform: translate(-50%, -50%) rotateX(68deg) rotateZ(18deg);
  width: 278px;
}

.avatar-floor {
  display: none;
}

.mentor-avatar3d {
  height: 318px;
  image-rendering: pixelated;
  left: 112px;
  position: absolute;
  top: 36px;
  transform: perspective(520px) rotateX(4deg) rotateY(-8deg);
  transform-style: preserve-3d;
  width: 204px;
}

.avatar-shadow {
  background: rgba(0, 0, 0, 0.56);
  border-radius: 50%;
  bottom: 10px;
  filter: blur(10px);
  height: 24px;
  left: 30px;
  position: absolute;
  transform: translateZ(-24px);
  width: 148px;
}

.avatar-body {
  background:
    linear-gradient(90deg, #123447 0, #2e8abd 36%, #44a6d8 58%, #14506b 100%);
  border: 5px solid #071014;
  border-radius: 34px 34px 22px 22px;
  bottom: 42px;
  box-shadow:
    inset -18px 0 0 rgba(0, 0, 0, 0.18),
    13px 16px 0 rgba(0, 0, 0, 0.16);
  height: 116px;
  left: 39px;
  position: absolute;
  width: 126px;
  z-index: 3;
}

.avatar-chest {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.02));
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  height: 48px;
  left: 26px;
  position: absolute;
  top: 22px;
  width: 62px;
}

.avatar-badge {
  background: var(--green);
  border: 3px solid #071014;
  border-radius: 50%;
  height: 18px;
  position: absolute;
  right: 24px;
  top: 26px;
  width: 18px;
}

.avatar-neck {
  background: #d9915d;
  border: 4px solid #071014;
  border-radius: 12px;
  height: 34px;
  left: 78px;
  position: absolute;
  top: 138px;
  width: 48px;
  z-index: 2;
}

.avatar-head {
  background:
    linear-gradient(130deg, #ffe0ad 0, #ffd399 54%, #db8f5d 100%);
  border: 5px solid #071014;
  border-radius: 40px 34px 38px 38px;
  box-shadow:
    inset -18px -6px 0 rgba(120, 63, 36, 0.16),
    16px 18px 0 rgba(0, 0, 0, 0.15);
  height: 142px;
  left: 22px;
  position: absolute;
  top: 12px;
  width: 160px;
  z-index: 4;
}

.avatar-side {
  background: #c87449;
  border: 5px solid #071014;
  border-left: 0;
  border-radius: 0 34px 34px 0;
  height: 116px;
  position: absolute;
  right: -22px;
  top: 16px;
  width: 34px;
  z-index: -1;
}

.avatar-hair {
  background:
    linear-gradient(90deg, #2a1b14 0, #3f271c 70%, #17100c 100%);
  border-radius: 34px 30px 12px 12px;
  height: 42px;
  left: -1px;
  position: absolute;
  top: -1px;
  width: 152px;
}

.avatar-face-glow {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  filter: blur(6px);
  height: 24px;
  left: 32px;
  position: absolute;
  top: 46px;
  width: 42px;
}

.avatar-eye {
  background: #071014;
  border-radius: 50%;
  height: 12px;
  position: absolute;
  top: 70px;
  width: 12px;
}

.eye-left {
  left: 47px;
}

.eye-right {
  right: 47px;
}

.avatar-cheek {
  background: rgba(255, 111, 97, 0.34);
  border-radius: 50%;
  height: 12px;
  position: absolute;
  top: 94px;
  width: 18px;
}

.cheek-left {
  left: 30px;
}

.cheek-right {
  right: 30px;
}

.avatar-mouth {
  background: var(--coral);
  border: 3px solid #071014;
  border-radius: 0 0 16px 16px;
  bottom: 27px;
  height: 11px;
  left: 61px;
  position: absolute;
  transition: height 90ms ease;
  width: 38px;
}

.avatar-arm {
  background: #226f99;
  border: 5px solid #071014;
  border-radius: 28px;
  bottom: 74px;
  height: 84px;
  position: absolute;
  width: 34px;
  z-index: 2;
}

.arm-left {
  left: 20px;
  transform: rotate(10deg);
}

.arm-right {
  right: 20px;
  transform: rotate(-14deg);
}

.avatar-foot {
  background: #071014;
  border-radius: 10px 10px 4px 4px;
  bottom: 28px;
  height: 22px;
  position: absolute;
  width: 46px;
  z-index: 2;
}

.foot-left {
  left: 48px;
}

.foot-right {
  right: 48px;
}

.mentor-avatar3d[data-speaking="true"] .avatar-mouth {
  animation: talk 280ms steps(2, end) infinite;
}

.stage[data-state="thinking"] .mentor-avatar3d {
  filter: drop-shadow(0 0 18px rgba(0, 212, 255, 0.34));
}

.stage[data-state="answer"] .avatar-orbit {
  opacity: 1;
}

.dialog-box {
  background: transparent;
  border: 0;
  border-radius: 0;
  bottom: 0;
  box-shadow: none;
  display: block;
  height: 600px;
  left: 0;
  min-height: 0;
  opacity: 0;
  padding: 0;
  position: absolute;
  text-align: left;
  transform: none;
  width: 600px;
  z-index: 10;
}

.stage[data-dialog="visible"] .dialog-box,
.dialog-box:focus {
  opacity: 0;
  transform: none;
}

.dialog-text {
  display: none;
}

.dialog-caret {
  display: none;
}

.focusable {
  cursor: pointer;
}

.focusable:focus {
  border-color: var(--cyan);
  box-shadow: none;
  outline: none;
  transform: none;
}

.stage:has(.dialog-box:focus) .mentor-avatar3d {
  filter: drop-shadow(0 0 18px rgba(0, 212, 255, 0.38));
}

@keyframes avatar-float {
  0%,
  100% {
    transform: perspective(520px) rotateX(4deg) rotateY(-8deg) translateY(0);
  }
  50% {
    transform: perspective(520px) rotateX(3deg) rotateY(6deg) translateY(-8px);
  }
}

@keyframes talk {
  0%,
  100% {
    height: 8px;
  }
  50% {
    height: 24px;
  }
}

@keyframes frame-pop {
  0% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 599px) {
  html,
  body,
  #app {
    transform-origin: top left;
  }
}
