:root {
  --bg: #0b1020;
  --panel: rgba(18, 26, 48, 0.82);
  --border: rgba(120, 150, 255, 0.18);
  --text: #e8eeff;
  --muted: #8b97b8;
  --accent: #6ea8ff;
  --happy: #ff5a6e;
  --angry: #3a3f4b;
  --sad: #dfe7f5;
  --ok: #3ddc97;
  --warn: #ffb020;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 20% -10%, #1a2748 0%, transparent 55%),
              radial-gradient(900px 500px at 90% 10%, #2a1638 0%, transparent 50%),
              var(--bg);
  color: var(--text);
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 70%, rgba(110, 168, 255, 0.08), transparent 30%),
    radial-gradient(circle at 75% 40%, rgba(255, 90, 110, 0.06), transparent 28%);
  z-index: 0;
}

.header, .layout, .footer {
  position: relative;
  z-index: 1;
}

.header {
  text-align: center;
  padding: 28px 20px 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6ea8ff, #ff5a6e);
  box-shadow: 0 0 18px rgba(110, 168, 255, 0.8);
}

.brand h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.5px;
}

.badge {
  font-size: 12px;
  color: #cfe0ff;
  background: rgba(110, 168, 255, 0.15);
  border: 1px solid rgba(110, 168, 255, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  max-width: 1200px;
  margin: 18px auto 24px;
  padding: 0 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 16px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
}

.status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.status-loading {
  color: #ffd48a;
  background: rgba(255, 176, 32, 0.12);
  border-color: rgba(255, 176, 32, 0.3);
}

.status-ready {
  color: #9ef0c7;
  background: rgba(61, 220, 151, 0.12);
  border-color: rgba(61, 220, 151, 0.3);
}

.status-error {
  color: #ffb4b4;
  background: rgba(255, 90, 90, 0.12);
  border-color: rgba(255, 90, 90, 0.3);
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  background: #05070f;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

#video, #overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#overlay {
  pointer-events: none;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.hidden { display: none !important; }

.expr-bars {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 64px 1fr 42px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b8cff, #8fd3ff);
  transition: width 0.15s ease;
}

.bar-row.active .bar-fill {
  background: linear-gradient(90deg, #ff6b81, #ffb86b);
}

.bar-row.active span:first-child {
  color: #fff;
  font-weight: 600;
}

.face-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.06), transparent 55%),
    #0a0f1c;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
  min-height: 360px;
}

.face-img {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  border-radius: 12px;
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.55));
  animation: pop 0.28s ease;
}

@keyframes pop {
  from { transform: scale(0.92); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

.face-placeholder {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

.placeholder-ring {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 2px dashed rgba(110, 168, 255, 0.45);
  box-shadow: inset 0 0 30px rgba(110, 168, 255, 0.08);
}

.face-placeholder p {
  margin: 0 0 12px;
  color: #c9d4f0;
}

.tips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.tips b { color: #fff; }

.emotion-label {
  font-size: 13px;
  color: var(--accent);
}

.meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.meta-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
}

.meta-k {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.meta-v {
  font-size: 15px;
  font-weight: 600;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 24px;
}

/* face theme accents */
.result-panel.theme-happy {
  box-shadow: 0 0 0 1px rgba(255, 90, 110, 0.25), var(--shadow);
}
.result-panel.theme-angry {
  box-shadow: 0 0 0 1px rgba(80, 90, 110, 0.45), var(--shadow);
}
.result-panel.theme-sad {
  box-shadow: 0 0 0 1px rgba(200, 220, 255, 0.28), var(--shadow);
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .panel { min-height: auto; }
  .face-stage { min-height: 300px; }
}
