:root {
  --bg: #fffdf8;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #ff6f61;
  --brand-strong: #ef5d4f;
  --brand-soft: #ffe7d8;
  --line: #f1dfd2;
  --accent: #10b981;
  --shadow: 0 18px 50px rgba(23, 35, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 8% -12%, #ffe7db 0%, transparent 58%),
    radial-gradient(920px 460px at 96% -6%, #ddfff3 0%, transparent 54%),
    var(--bg);
  min-height: 100vh;
}

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 111, 97, 0.05), rgba(16, 185, 129, 0.05));
}

.app-shell {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 16px 52px;
}

body.mode-landing .app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 16px;
  padding-bottom: 24px;
}

body.mode-landing .hero {
  margin-top: 0;
}

.hero,
.panel,
.privacy-card {
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.hero {
  text-align: center;
}

.eyebrow {
  margin: 0;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #bff7e5;
  background: #ecfff7;
  color: #0f766e;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 10px 0 6px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.panel,
.privacy-card {
  background: var(--surface);
  border: 1px solid #efdfd3;
  border-radius: 20px;
  box-shadow: 0 12px 28px rgba(23, 35, 54, 0.08);
}

.panel {
  margin-top: 18px;
  padding: 24px;
  display: none;
}

.panel.active {
  display: block;
  animation: pop-in 220ms ease;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.landing-stage {
  display: block;
}

.landing-copy h2 {
  margin: 0;
  font-size: 1.4rem;
  text-align: center;
}

.landing-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.92rem;
  text-align: center;
  white-space: nowrap;
}

.landing-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.landing-actions .btn {
  min-width: 140px;
}

#landing-view.panel {
  max-width: 500px;
  padding: 18px 18px 16px;
  border-radius: 16px;
  border-color: #f2e7dd;
  box-shadow: 0 8px 20px rgba(23, 35, 54, 0.06);
  margin-left: auto;
  margin-right: auto;
}

.fullscreen-panel.active {
  position: fixed;
  inset: 0;
  z-index: 30;
  margin: 0;
  max-width: none;
  border-radius: 0;
  border: 0;
  padding: 14px;
  background: #0c111b;
  color: #f8fafc;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #06070b;
}

.fullscreen-panel .video-wrap {
  height: min(72vh, 680px);
  margin: 0 auto;
  max-width: 860px;
}

video,
.face-overlay-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
  transform-origin: center;
}

.face-overlay-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.guide-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff7ed;
  background: rgba(124, 45, 18, 0.55);
  border: 1px solid rgba(255, 237, 213, 0.45);
  backdrop-filter: blur(2px);
  z-index: 4;
}

.guide-hint.ready {
  color: #ecfdf5;
  background: rgba(5, 150, 105, 0.4);
  border-color: rgba(167, 243, 208, 0.55);
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: #fff;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
}

.analysis-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
  z-index: 5;
}

.analysis-overlay.hidden {
  display: none;
}

.analysis-card {
  width: min(88%, 420px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(17, 24, 39, 0.72);
  padding: 16px;
  text-align: center;
}

.analysis-loader {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fde68a;
  animation: spin 900ms linear infinite;
}

.analysis-title {
  margin: 0;
  color: #fde68a;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.analysis-title::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 999px;
  background: #f59e0b;
  animation: analysis-pulse 920ms ease-in-out infinite;
}

.analysis-step {
  margin: 8px 0 0;
  color: #f8fafc;
  font-size: 0.9rem;
}

.analysis-progress {
  margin-top: 12px;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.analysis-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fb923c, #f97316);
  transition: width 220ms ease;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes analysis-pulse {
  0% {
    opacity: 0.35;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 0.35;
    transform: scale(0.9);
  }
}

.actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
  box-shadow: 0 10px 20px rgba(255, 111, 97, 0.28);
}

.btn-secondary {
  color: #7c2d12;
  background: var(--brand-soft);
}

.status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: center;
}

.fullscreen-panel .status {
  color: #d1d5db;
}

.engine-badge {
  margin: 8px auto 0;
  display: block;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #065f46;
  background: #d1fae5;
}

.engine-badge.fallback {
  color: #7c2d12;
  background: #ffedd5;
}

.fullscreen-panel .engine-badge {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.22);
}

.fullscreen-panel .engine-badge.fallback {
  color: #fdba74;
  background: rgba(194, 65, 12, 0.25);
}

.result-head p {
  margin: 0 auto;
  max-width: 44ch;
  color: var(--muted);
  text-align: center;
  font-size: 0.93rem;
}

.result-card {
  margin: 14px auto 0;
  max-width: 620px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fffcf8;
}

.result-card h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  text-align: center;
}

.result-card .tone {
  margin: 0;
  text-align: center;
  color: #0f766e;
  font-weight: 700;
}

.result-card p {
  margin: 8px 0 0;
  color: #3d3d3d;
  line-height: 1.5;
  text-align: center;
}

.result-card .tips {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #6b7280;
  font-size: 0.93rem;
}

.result-card .result-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  justify-items: center;
}

.result-card .result-portrait {
  width: 146px;
  height: 146px;
  border-radius: 14px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.result-card .part-readout {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 8px;
}

.result-card .part-readout p {
  margin: 0;
  font-size: 0.9rem;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #f1e9df;
}

.result-card .part-readout .part-summary {
  font-weight: 700;
  color: #4a2a14;
  background: #fff4ec;
  border-color: #f6d7c0;
}

.privacy-card {
  margin-top: 16px;
  padding: 18px;
}

.privacy-card h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.privacy-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px 12px 32px;
  }

  .hero h1 {
    font-size: clamp(1.72rem, 8vw, 2.2rem);
  }

  .panel,
  .privacy-card {
    border-radius: 16px;
    padding: 16px;
  }

  .landing-actions {
    flex-direction: column;
  }

  .landing-actions .btn,
  .actions .btn {
    width: 100%;
    min-width: 0;
  }

  .fullscreen-panel.active {
    padding: 12px;
  }

  .fullscreen-panel .video-wrap {
    height: 64vh;
  }

  .result-card .result-portrait {
    width: 128px;
    height: 128px;
  }
}
