/* ==========================================================================
   AIBAO WAKE CAPTURE · CYBERPUNK INDUSTRIAL HI-FI THEME
   Brand Palette: Emerald #93c652 -> Teal #36acc6 -> Deep Blue #2470b4
   ========================================================================== */

:root {
  color-scheme: dark;
  --green: #93c652;
  --teal: #36acc6;
  --blue: #2a91d0;
  --deep: #2470b4;
  --bg-deep: #07090b;
  --bg-surface: #0e1216;
  --panel-bg: rgba(16, 21, 26, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-highlight: rgba(54, 172, 198, 0.35);
  --text-main: #f0f4f8;
  --text-muted: #7e8d98;
  --text-dim: #4d5b66;
  --brand-gradient: linear-gradient(135deg, var(--green) 0%, var(--teal) 55%, var(--deep) 100%);
  --glow-brand: 0 0 35px rgba(54, 172, 198, 0.25), 0 0 70px rgba(147, 198, 82, 0.15);
  --level: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-size: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-deep);
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   AMBIENT BACKGROUND SYSTEM
   ========================================================================== */
.bg-system {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

/* 柔光极光流动光球 */
.aurora-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform, opacity;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.aurora-top {
  width: 75vmax;
  height: 60vmax;
  left: -20vmax;
  top: -25vmax;
  background: radial-gradient(circle, rgba(147, 198, 82, 0.12) 0%, rgba(54, 172, 198, 0.08) 45%, transparent 70%);
  animation: floatTop 24s ease-in-out infinite alternate;
}

.aurora-bottom {
  width: 80vmax;
  height: 70vmax;
  right: -25vmax;
  bottom: -30vmax;
  background: radial-gradient(circle, rgba(36, 112, 180, 0.18) 0%, rgba(42, 145, 208, 0.1) 40%, transparent 70%);
  animation: floatBottom 28s ease-in-out infinite alternate;
}

@keyframes floatTop {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(15vw, 12vh) scale(1.15); }
}

@keyframes floatBottom {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-14vw, -10vh) scale(1.1); }
}

body[data-state="recording"] .aurora-top {
  opacity: 1.6;
  filter: blur(70px);
}
body[data-state="recording"] .aurora-bottom {
  opacity: 1.4;
  filter: blur(70px);
}

/* 精密极细点阵网格 */
.cyber-grid {
  position: absolute;
  inset: 0;
  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: 32px 32px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 65%, transparent 100%);
  mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 65%, transparent 100%);
}

/* 四周暗角，聚焦中央 */
.vignette-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(7, 9, 11, 0.6) 80%, rgba(7, 9, 11, 0.95) 100%);
}

/* 底部流光地平线（借鉴管理台底部输入框的青绿科技光晕） */
.horizon-glow {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--blue) 25%, var(--teal) 50%, var(--green) 75%, transparent 100%);
  opacity: 0.6;
  box-shadow: 0 -4px 24px rgba(54, 172, 198, 0.45), 0 -1px 8px rgba(147, 198, 82, 0.4);
  transition: opacity 0.5s ease;
}

body[data-state="recording"] .horizon-glow {
  opacity: 0.95;
  box-shadow: 0 -6px 36px rgba(54, 172, 198, 0.7), 0 -2px 14px rgba(147, 198, 82, 0.6);
}

/* ==========================================================================
   APP LAYOUT & HEADER
   ========================================================================== */
main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  padding: 8px 16px;
  background: var(--bg-surface);
  color: var(--text-main);
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus {
  top: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mini-logo {
  width: 20px;
  height: 22px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(54, 172, 198, 0.5));
}

.brand-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.brand-divider {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 300;
  margin: 0 1px;
}

.brand-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* 磨砂状态胶囊 */
.status-capsule {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: rgba(22, 28, 34, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.3s ease;
}

body[data-state="idle"] .status-dot {
  background: var(--teal);
  box-shadow: 0 0 8px rgba(54, 172, 198, 0.6);
}

body[data-state="recording"] .status-capsule {
  color: #fff;
  border-color: rgba(147, 198, 82, 0.4);
  background: rgba(20, 32, 28, 0.75);
}
body[data-state="recording"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 10px var(--green), 0 0 20px rgba(147, 198, 82, 0.7);
  animation: blinkDot 1.2s infinite ease-in-out;
}

@keyframes blinkDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ==========================================================================
   CENTER PANEL & STAGE
   ========================================================================== */
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  position: relative;
  width: 100%;
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 280px;
  margin: 10px 0;
}

/* 声波 Canvas */
canvas#meter {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ==========================================================================
   THE LIVING ORB (CENTER CONTROLLER)
   ========================================================================== */
.orb {
  position: relative;
  z-index: 2;
  width: 140px;
  height: 140px;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.orb:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* 按钮实体外壳（深色精密磨砂晶体） */
.orb-backdrop {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #222b32 0%, #12181d 58%, #0a0d10 100%);
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.75),
    0 4px 12px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.15),
    inset 0 -2px 6px rgba(0, 0, 0, 0.8);
  transition: all 0.25s ease;
}

/* 极细微高光切角边缘 */
.specular-rim {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* 录音时的脉冲发光环 */
.pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px solid var(--teal);
  opacity: 0;
  pointer-events: none;
}
.pulse-ring.r2 {
  border-color: var(--green);
}

/* Logo 居中呈现 */
.logo {
  position: relative;
  z-index: 3;
  width: 66px;
  height: 74px;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 16px rgba(54, 172, 198, 0.3));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
}

.mark-dot {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s ease;
}

/* 悬停与待机微动 */
@media (hover: hover) {
  .orb:hover:not(:disabled) .orb-backdrop {
    box-shadow: 
      0 20px 48px rgba(0, 0, 0, 0.85),
      0 0 24px rgba(54, 172, 198, 0.25),
      inset 0 1px 2px rgba(255, 255, 255, 0.22);
  }
  .orb:hover:not(:disabled) .logo {
    transform: scale(1.03);
    filter: drop-shadow(0 0 20px rgba(54, 172, 198, 0.5));
  }
}

/* 正在录音状态（Active Holding State） */
body[data-state="recording"] .orb {
  transform: scale(1.08);
}

body[data-state="recording"] .orb-backdrop {
  background: radial-gradient(circle at 38% 32%, #26343d 0%, #131c22 60%, #0a0e12 100%);
  box-shadow: 
    0 0 0 4px rgba(54, 172, 198, 0.15),
    0 0 35px rgba(54, 172, 198, 0.35),
    0 0 70px rgba(147, 198, 82, 0.2),
    0 20px 50px rgba(0, 0, 0, 0.85),
    inset 0 1px 2px rgba(255, 255, 255, 0.25);
}

body[data-state="recording"] .specular-rim {
  border-color: rgba(147, 198, 82, 0.45);
}

body[data-state="recording"] .logo {
  filter: drop-shadow(0 0 24px rgba(54, 172, 198, 0.75)) drop-shadow(0 0 45px rgba(147, 198, 82, 0.45));
  animation: logoBreathe 1.5s ease-in-out infinite alternate;
  transform-origin: 50% 55%;
}

body[data-state="recording"] .mark-dot {
  animation: dotOrbit 1.5s ease-in-out infinite alternate;
}

body[data-state="recording"] .pulse-ring {
  animation: ringExpand 2.2s cubic-bezier(0.2, 0.8, 0.4, 1) infinite;
}
body[data-state="recording"] .pulse-ring.r2 {
  animation-delay: 1.1s;
}

@keyframes logoBreathe {
  0% { transform: scale(1) rotate(-1.5deg); }
  100% { transform: scale(calc(1.06 + var(--level) * 0.22)) rotate(2.5deg); }
}

@keyframes dotOrbit {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(12%, -14%) scale(calc(1.12 + var(--level) * 0.3)); }
}

@keyframes ringExpand {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* 提交成功涟漪动画 */
.sent .orb {
  animation: submitSuccess 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes submitSuccess {
  0% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(147, 198, 82, 0.8); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 35px rgba(147, 198, 82, 0); }
  100% { transform: scale(1); }
}

/* ==========================================================================
/* ==========================================================================
   MINIMAL PROMPT DOTS (TEXT-FREE CYBER INDICATOR)
   ========================================================================== */
.prompt-dots {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  background: rgba(18, 24, 30, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  margin-top: 14px;
  z-index: 2;
  transition: border-color 0.3s ease;
}

.prompt-dots:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.prompt-dots .task {
  position: relative;
  display: block;
  width: 8px;
  height: 8px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 扩展点击热区 */
.prompt-dots .task::before {
  content: "";
  position: absolute;
  inset: -10px -8px;
  border-radius: 999px;
}

.prompt-dots .task:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.prompt-dots .task.selected {
  width: 22px;
  background: linear-gradient(90deg, var(--green) 0%, var(--teal) 100%);
  box-shadow: 0 0 10px rgba(147, 198, 82, 0.7), 0 0 20px rgba(54, 172, 198, 0.4);
}

.prompt-dots .task.done:not(.selected) {
  background: var(--teal);
  box-shadow: 0 0 6px rgba(54, 172, 198, 0.6);
}

/* ==========================================================================
   FEEDBACK & ERROR NOTICES
   ========================================================================== */
.feedback-area {
  min-height: 28px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

#notice {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--green);
  text-align: center;
  animation: fadeIn 0.25s ease-out;
}

#notice.error {
  color: #f87171;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.4);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 重新提交按钮（仅在异常重试时显示） */
#review {
  margin-top: 12px;
  z-index: 2;
}

.retry-btn {
  padding: 8px 22px;
  background: var(--brand-gradient);
  border: none;
  border-radius: 999px;
  color: #07151f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(54, 172, 198, 0.35);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.retry-btn:active {
  transform: scale(0.96);
}

.text-button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
}

/* ==========================================================================
   FOOTER HINT
   ========================================================================== */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  z-index: 2;
}

.hint-text {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 400;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

body[data-state="recording"] .hint-text {
  opacity: 0.3;
}

/* ==========================================================================
   RESPONSIVE & ACCESSIBILITY
   ========================================================================== */
@media (max-width: 360px) {
  .orb {
    width: 124px;
    height: 124px;
  }
  .logo {
    width: 58px;
    height: 64px;
  }
  .stage {
    height: 240px;
  }
}

@media (max-height: 580px) and (orientation: landscape) {
  main {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .stage {
    height: 160px;
    margin: 0;
  }
  .orb {
    width: 96px;
    height: 96px;
  }
  .logo {
    width: 44px;
    height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
