/* Màn hình CTV v4 — đăng ký, đăng nhập, bảng điều khiển, chờ, thông tin khách, camera, kết quả. */

.hero {
  padding: var(--space-32) 0 var(--space-24);
  text-align: left;
}

.hero h1 {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  line-height: 1.2;
  margin: var(--space-16) 0 var(--space-8);
}

.auth-foot {
  text-align: center;
  margin-top: var(--space-24);
  color: var(--color-muted);
  font-size: 0.92rem;
}

.dash-hello h1 {
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.dash-hello p {
  margin-top: var(--space-8);
}

/* Khoảng cách thẻ / nút ≥ 16px — QT + 2 menu; TNV + thẻ CTV + báo cáo. */
.dash-stack,
.gate-list,
.action-list,
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.dash-stack {
  margin-top: var(--space-16);
}

.gate-list .card + .card,
.action-list .card + .card,
.dash-stack .card + .card,
.stack .card + .card {
  margin-top: 0;
}

.muted-lead {
  margin-bottom: var(--space-16);
}

.tiny-spaced {
  margin-top: var(--space-16);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.spinner {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-50);
  border: 4px solid var(--color-surface-2);
  border-top-color: var(--color-primary);
  animation: spin 0.9s linear infinite;
}

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

.choice-set {
  border: 0;
  margin: 0 0 var(--space-16);
  padding: 0;
}

.choice-set legend {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: var(--space-8);
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
}

.choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 var(--space-12);
  border-radius: var(--radius-12);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.choice:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: #c7d2fe;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.qt-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.qt-box strong {
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.action-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.action-card:hover {
  text-decoration: none;
}

.action-card h2 {
  font-size: 1.05rem;
  margin-bottom: var(--space-8);
}

/* Màn chờ: nền tối, nút nhịp */
body.idle-page {
  background: #05070f;
}

body.idle-page::before {
  content: none;
}

.app--idle {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px 20px 40px;
}

.pulse-cta {
  width: 176px;
  height: 176px;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #6366f1, #312e81 68%, #1e1b4b);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55);
  animation: pulse-ring 2s ease-out infinite;
  cursor: pointer;
}

.pulse-cta:hover {
  transform: none;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55); }
  70% { box-shadow: 0 0 0 28px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.idle-hint {
  margin-top: var(--space-24);
  max-width: 280px;
}

.stub-card {
  text-align: left;
}

.stage-note {
  margin-top: var(--space-24);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .pulse-cta,
  .spinner {
    animation: none !important;
  }
}

/* Camera */
.camera-stage {
  position: relative;
  margin: var(--space-16) 0 var(--space-24);
  border-radius: var(--radius-20);
  overflow: hidden;
  background: #050816;
  aspect-ratio: 3 / 4;
  box-shadow: var(--shadow-lg);
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-video.is-mirrored {
  transform: scaleX(-1);
}

.still-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-oval {
  pointer-events: none;
  position: absolute;
  inset: 10% 16%;
  border: 3px solid rgba(148, 163, 184, 0.55);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(5, 8, 22, 0.55);
}

.camera-oval.is-ready {
  border-color: var(--color-accent);
  box-shadow:
    0 0 0 9999px rgba(5, 8, 22, 0.5),
    0 0 24px rgba(16, 185, 129, 0.45);
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 5rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.camera-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  background: rgba(5, 8, 22, 0.72);
  z-index: 2;
}

.camera-guide {
  min-height: 3rem;
  text-align: center;
  font-weight: 600;
  color: var(--color-muted);
}

.camera-guide.is-ok {
  color: var(--color-accent);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin-top: var(--space-20);
}

/* Analyzing */
.progress-wrap {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto var(--space-16);
}

.progress-ring {
  width: 168px;
  height: 168px;
}

.progress-ring__track,
.progress-ring__arc {
  fill: none;
  stroke-width: 8;
}

.progress-ring__track {
  stroke: var(--color-surface-2);
}

.progress-ring__arc {
  stroke: var(--color-accent);
  stroke-linecap: round;
  transform-origin: 60px 60px;
}

.particles {
  position: absolute;
  inset: 24px;
  width: 120px;
  height: 120px;
  pointer-events: none;
}

.progress-wrap strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: var(--space-16) 0 0;
  width: 100%;
  text-align: left;
}

.checklist li {
  padding: 10px 0 10px 32px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted);
  position: relative;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
}

.checklist li.is-current {
  color: var(--color-text);
}

.checklist li.is-done::before {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.analyzing {
  min-height: 70dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-16);
}

/* Kết quả — thẻ linh vật + radar */
.character-card {
  width: 100%;
  max-width: 380px;
  margin: 16px auto;
  background: var(--gradient-primary);
  border-radius: 24px;
  padding: 20px;
  text-align: center;
  color: #fff;
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.3);
}

.character-line {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  line-height: 1.5;
}

.radar-wrap {
  width: 100%;
  max-width: 360px;
  margin: 8px auto 16px;
}

.trait-bars {
  margin: 8px 0 20px;
}

.trait-bar-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr 3rem;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.82rem;
}

.trait-bar-row--hi .trait-bar-label {
  color: #c7d2fe;
  font-weight: 700;
}

.trait-bar-track {
  height: 8px;
  border-radius: 99px;
  background: var(--color-surface-2);
  overflow: hidden;
}

.trait-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 99px;
}

.trait-bar-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}

.content-box {
  margin: 8px 0 16px;
  padding: 20px;
  background: var(--color-surface);
  border-radius: 20px;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  line-height: 1.8;
  font-size: 0.95rem;
}

.content-box h1,
.content-box h2 {
  color: var(--color-text);
  margin: var(--space-12) 0 var(--space-8);
}

.content-box h1 { font-size: 1.1rem; }
.content-box h2 { font-size: 1.02rem; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(5, 8, 22, 0.72);
}

.modal-content {
  width: min(430px, 100%);
  margin-bottom: 12px;
  max-height: min(88dvh, 720px);
  overflow: auto;
}

.modal-content h2 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

@media (min-width: 480px) {
  .modal-overlay {
    place-items: center;
  }
}

/* Landing 2 cửa */
.landing-hero {
  text-align: left;
  padding: var(--space-32) 0 var(--space-16);
}

.landing-hero h1 {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  margin: var(--space-16) 0 var(--space-8);
}

.gate-card h2 {
  font-size: 1.15rem;
  margin-bottom: var(--space-8);
}

.birthday-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: var(--space-8);
}

.field input:disabled,
.field select:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.gift-card dt {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: var(--space-8);
}

.gift-card dd {
  margin: 0;
  font-weight: 600;
}

.gift-card dd:first-of-type,
.gift-card dt:first-child {
  margin-top: 0;
}

.tnv-reveal {
  text-align: center;
}

.report-empty {
  text-align: left;
}

.lang-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

.lang-switch--hero {
  margin: var(--space-12) 0 0 auto;
  width: max-content;
}

.lang-btn {
  min-width: 40px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang-btn.is-active {
  background: var(--color-primary);
  color: #120f18;
}

.site-hero {
  padding: var(--space-32) 0 var(--space-20);
}

.site-hero h1 {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  margin: var(--space-16) 0 var(--space-8);
}

.site-hero--ctv .brand__tag { color: var(--color-ctv); }
.site-hero--user .brand__tag { color: var(--color-user); }

.gate-card--ctv {
  border-color: rgba(94, 224, 181, 0.28);
}

.gate-card--user {
  border-color: rgba(240, 178, 122, 0.28);
}

.landing-hint {
  margin-top: var(--space-16);
  font-size: 0.92rem;
}

.character-card {
  background: var(--gradient-primary);
}

/* Mobile 375 / 390 / 430 */
@media (max-width: 375px) {
  .app {
    padding: 0 16px 24px;
  }
  .hero h1,
  .landing-hero h1,
  .site-hero h1 {
    font-size: 1.42rem;
  }
  .character-card {
    padding: 16px;
  }
  .trait-bar-row {
    grid-template-columns: 6.2rem 1fr 2.6rem;
    font-size: 0.76rem;
  }
}

@media (min-width: 376px) and (max-width: 389px) {
  .app {
    padding: 0 18px 28px;
  }
}

@media (min-width: 390px) and (max-width: 429px) {
  .app {
    padding: 0 20px 32px;
  }
}

@media (min-width: 430px) {
  .app {
    padding: 0 20px 36px;
  }
}

