/* Màn hình — login / register / dashboard / khung session 5 */

.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);
}

.quiz-prompt {
  font-size: 1.15rem;
  margin: var(--space-8) 0 var(--space-16);
}

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

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

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  margin-top: var(--space-16);
}

.stat-grid + .card {
  margin-top: var(--space-16);
}

.stat {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-12);
  padding: var(--space-16);
}

.stat span {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.stat strong {
  font-size: 1.05rem;
}

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

/* Camera: placeholder video + khung overlay */
.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;
  background:
    repeating-linear-gradient(
      -12deg,
      #0b1020 0 12px,
      #10162b 12px 24px
    );
}

.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);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.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);
}

.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);
}

.result-title {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.3;
  margin: var(--space-8) 0;
}

.result-pcts {
  margin-bottom: var(--space-16);
}

.donut-block {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-16);
  align-items: center;
  margin: var(--space-16) 0 var(--space-24);
}

.donut {
  width: 160px;
  height: 160px;
}

.legend {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.88rem;
}

.legend li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 12px;
}

.swatch--main { background: #4c1d95; }
.swatch--sub { background: #10b981; }
.swatch--wait { background: #cbd5e1; }

.quiz-bar {
  height: 6px;
  background: var(--color-surface-2);
  border-radius: var(--radius-50);
  overflow: hidden;
  margin-bottom: var(--space-16);
}

.quiz-bar span {
  display: block;
  height: 100%;
  width: 16.66%;
  background: var(--color-primary);
  transition: width 0.2s ease;
}

.quiz-option.is-selected {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.quiz-key {
  display: inline-flex;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-soft);
  font-size: 0.75rem;
  font-weight: 700;
}

.report-body {
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-top: var(--space-16);
}

.report-body h1,
.report-body h2,
.report-body h3 {
  color: var(--color-text);
  margin: var(--space-16) 0 var(--space-8);
}

.report-body h1 { font-size: 1.15rem; }
.report-body h2 { font-size: 1.05rem; }
.report-body h3 { font-size: 1rem; }

.report-body ul,
.report-body ol {
  padding-left: 1.2rem;
  margin: var(--space-8) 0 var(--space-16);
}

.report-body li + li {
  margin-top: 6px;
}

.report-body p + p {
  margin-top: var(--space-12);
}

@media (max-width: 420px) {
  .donut-block {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (min-width: 768px) {
  :root {
    --app-max: 560px;
  }
}

.coming {
  margin-top: var(--space-16);
  font-size: 0.82rem;
  color: var(--color-faint);
}

.scan-line {
  position: absolute;
  left: 16%;
  right: 16%;
  height: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 16px var(--color-accent);
  animation: scan 2.4s ease-in-out infinite;
}

@keyframes scan {
  0% { top: 18%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 78%; opacity: 0; }
}

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

.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); }
}

.result-ring {
  width: 160px;
  height: 160px;
  margin: var(--space-24) auto;
  border-radius: var(--radius-50);
  border: 8px solid var(--color-primary-soft);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
}

.result-ring strong {
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: var(--space-12);
  padding: var(--space-16);
  border-radius: var(--radius-12);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.quiz-option:hover {
  border-color: var(--color-primary);
}

.quiz-option:active {
  transform: scale(0.99);
}

.report-body {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.report-body p + p {
  margin-top: var(--space-12);
}

.coming {
  margin-top: var(--space-16);
  font-size: 0.82rem;
  color: var(--color-faint);
}

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

.lang-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-12);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.lang-switch button.is-active {
  background: var(--color-primary-soft);
  color: var(--color-text);
}

.app--wide {
  max-width: min(var(--app-max), 100%);
}

@media (min-width: 720px) {
  .app--wide {
    max-width: 720px;
  }
  .app--wide.landing {
    max-width: 960px;
  }
}

.stat-grid--4 {
  grid-template-columns: 1fr 1fr;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.admin-table th {
  color: var(--color-faint);
  font-weight: 600;
  font-size: 0.75rem;
}

.first-init-banner {
  background: var(--color-accent-soft);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-12);
  padding: var(--space-12) var(--space-16);
  margin: var(--space-12) 0;
}

.kv-prefix {
  margin-top: var(--space-12);
}

.kv-list {
  margin: var(--space-8) 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  word-break: break-all;
}

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

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 var(--space-16);
}

.admin-tab {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  border-radius: var(--radius-50);
  min-height: 36px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}

.admin-tab.is-active {
  background: var(--color-primary-soft);
  color: var(--color-text);
  border-color: transparent;
}

.skeleton-stack {
  display: grid;
  gap: 12px;
  margin: var(--space-16) 0;
}

.skeleton-stack[hidden],
#dash-main[hidden],
#dash-fallback[hidden] {
  display: none !important;
}

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

.skeleton {
  border-radius: var(--radius-12);
  background: linear-gradient(90deg, #1a2340 0%, #3a4a78 50%, #1a2340 100%);
  background-size: 200% 100%;
  animation: shimmer 1.1s ease infinite;
  border: 1px solid rgba(165, 180, 252, 0.28);
}

.skeleton--title { height: 28px; width: 55%; }
.skeleton--line { height: 14px; width: 40%; }
.skeleton--card { height: 88px; }

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.landing-hero {
  padding: var(--space-24) 0 var(--space-16);
}

.landing-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.04em;
  line-height: 1.2;
  margin: var(--space-12) 0;
}

.landing-lead {
  max-width: 36rem;
}

.landing-grid {
  display: grid;
  gap: var(--space-12);
  margin: var(--space-16) 0;
}

.landing-list {
  margin: var(--space-12) 0 0;
  padding-left: 1.2rem;
  color: var(--color-muted);
}

.landing-list li + li {
  margin-top: 8px;
}

.landing-privacy h2 {
  font-size: 1.05rem;
}

@media (min-width: 720px) {
  .landing-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

@media (min-width: 720px) {
  .stat-grid--4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }

  .actions--row {
    flex-direction: row;
  }
}

/* PDF xuất báo cáo — nền giấy trắng, font Việt */
.pdf-mount {
  position: absolute;
  left: -10000px;
  top: 0;
  width: 210mm;
  pointer-events: none;
}

.pdf-sheet {
  width: 190mm;
  min-height: 277mm;
  background: #ffffff;
  color: #1c1917;
  font-family: "Be Vietnam Pro", "Noto Sans", "DejaVu Sans", sans-serif;
  font-size: 12px;
  line-height: 1.55;
  padding: 14mm 12mm 18mm;
  position: relative;
  box-sizing: border-box;
}

.pdf-watermark {
  position: absolute;
  inset: 28% 0 auto;
  text-align: center;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0b1020;
  opacity: 0.07;
  transform: rotate(-22deg);
  pointer-events: none;
}

.pdf-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid #0ea5e9;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.pdf-logo {
  width: 42px;
  height: 42px;
}

.pdf-kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0ea5e9;
  font-weight: 600;
}

.pdf-header h1 {
  margin: 2px 0 0;
  font-size: 22px;
  letter-spacing: -0.03em;
  color: #0b1020;
}

.pdf-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  margin-bottom: 16px;
  font-size: 12px;
}

.pdf-meta span {
  display: block;
  color: #57534e;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pdf-article {
  color: #292524;
}

.pdf-article h1,
.pdf-article h2,
.pdf-article h3 {
  color: #0b1020;
  page-break-after: avoid;
}

.pdf-footer {
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid #e7e5e4;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 10px;
  color: #78716c;
}

@media (max-width: 520px) {
  .pdf-meta {
    grid-template-columns: 1fr;
  }
}

.feedback-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--color-accent);
  color: #042f1e;
  font-size: 1.4rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}

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

.feedback-modal[hidden] {
  display: none !important;
}

.feedback-modal__card {
  width: min(420px, 100%);
  margin-bottom: 72px;
}

.star-row {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
}

.star-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-12);
  background: var(--color-surface-2);
  color: var(--color-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.star-btn.is-on {
  background: var(--color-accent-soft);
  color: #fbbf24;
  border-color: transparent;
}

.pwa-install {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 35;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-16);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
}

.pwa-install__text {
  margin: 0 0 12px;
  font-size: 0.92rem;
}

.pwa-install__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#blog-heading {
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: clamp(2.6rem, 7vw, 3.6rem);
  letter-spacing: -0.04em;
  line-height: 1.12;
  margin: var(--space-16) 0 var(--space-8);
  max-width: 18ch;
}

.blog-card {
  display: block;
  text-decoration: none;
  color: inherit;
  margin-top: 12px;
}

.blog-card h2 {
  font-size: 0.95rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card p {
  font-size: 0.85rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 1.4em;
}

.blog-post-title {
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 8px 0 12px;
}

.blog-body h1,
.blog-body h2 {
  font-size: 1.05rem;
  line-height: 1.35;
}

.blog-related {
  display: block;
  margin-top: 8px;
  color: var(--color-link);
  font-weight: 600;
}

.blog-body {
  margin-top: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
}
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}

.cms-split {
  display: grid;
  gap: 16px;
}

.cms-preview {
  min-height: 160px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-12);
  padding: 12px;
  background: var(--color-bg-elevated);
}

.faq-list dt {
  font-weight: 600;
  margin-top: 12px;
}

.faq-list dd {
  margin: 6px 0 0;
  color: var(--color-muted);
}

@media (min-width: 720px) {
  .cms-split {
    grid-template-columns: 1fr 1fr;
  }
}

.field textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px var(--space-16);
  border-radius: var(--radius-12);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: inherit;
  font: inherit;
  resize: vertical;
}

.quiz-prompt {
  width: 100%;
  min-height: 64px;
  margin: 8px 0 12px;
  padding: 12px var(--space-16);
  border-radius: var(--radius-12);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: inherit;
  font: inherit;
  resize: vertical;
}

.chart-wrap {
  position: relative;
  width: 100%;
}
