:root {
  --ink: #11100d;
  --ink-2: #1b1914;
  --ink-3: #252119;
  --surface: #fff8ec;
  --surface-soft: #f5ead8;
  --gold: #d9aa63;
  --gold-2: #f0d092;
  --teal: #2fb8a4;
  --rose: #bd6a6a;
  --text: #f8f0e4;
  --muted: #b7aa98;
  --paper-text: #2f261a;
  --paper-muted: #6b5b43;
  --line: rgba(255, 248, 236, 0.16);
  --danger: #f2a19b;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #070604;
  color: var(--text);
}

body {
  min-height: 100dvh;
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 184, 164, 0.7);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.04), transparent 36%),
    var(--ink);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.35);
}

.screen {
  min-height: 100dvh;
  padding: 48px 20px 22px;
}

.screen.paper {
  background: var(--surface);
  color: var(--paper-text);
}

.screen.centered {
  display: grid;
  align-content: center;
  gap: 22px;
}

.topbar,
.nav-line {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 800;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(240, 208, 146, 0.75);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(217, 170, 99, 0.86), rgba(47, 184, 164, 0.72));
}

.ghost-link {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--gold-2);
  cursor: pointer;
  font-weight: 700;
}

.paper .ghost-link {
  color: #785c2f;
}

.nav-title {
  font-size: 16px;
  font-weight: 800;
}

.hero-card,
.upload-box,
.dark-card,
.paper-card,
.metric,
.poster-card {
  border-radius: 8px;
}

.hero-card {
  position: relative;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(240, 208, 146, 0.24);
  background: #0f1110;
}

.hero-card img {
  width: 100%;
  height: 248px;
  object-fit: cover;
  object-position: center 38%;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 16, 13, 0) 42%, rgba(17, 16, 13, 0.88) 100%);
}

.hero-badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.hero-badge {
  position: absolute;
  z-index: 2;
  left: 14px;
  bottom: 14px;
  padding: 0 12px;
  border: 1px solid rgba(240, 208, 146, 0.5);
  background: rgba(17, 16, 13, 0.72);
  color: var(--gold-2);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.home-title {
  margin: 22px 0 10px;
  font-size: 31px;
  line-height: 1.12;
  letter-spacing: 0;
}

.home-copy,
.muted {
  color: var(--muted);
  line-height: 1.7;
}

.home-copy {
  margin-bottom: 18px;
  font-size: 15px;
}

.proof-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 18px;
}

.proof,
.dark-card {
  border: 1px solid var(--line);
  background: rgba(255, 248, 236, 0.06);
}

.proof {
  min-height: 64px;
  padding: 9px;
}

.proof strong {
  display: block;
  margin-bottom: 3px;
  color: var(--surface);
  font-size: 15px;
}

.proof span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.button-stack {
  display: grid;
  gap: 12px;
}

.primary-btn,
.secondary-btn,
.soft-btn,
.danger-btn {
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.primary-btn {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #23190d;
  box-shadow: 0 14px 34px rgba(217, 170, 99, 0.24);
}

.secondary-btn {
  border: 1px solid rgba(255, 248, 236, 0.22);
  background: rgba(255, 248, 236, 0.06);
  color: var(--text);
}

.soft-btn {
  background: rgba(217, 170, 99, 0.12);
  color: var(--gold-2);
}

.danger-btn {
  border: 1px solid rgba(242, 161, 155, 0.42);
  background: rgba(242, 161, 155, 0.1);
  color: var(--danger);
}

.primary-btn[disabled],
.secondary-btn[disabled],
.soft-btn[disabled] {
  opacity: 0.48;
  cursor: not-allowed;
}

.disclaimer {
  margin: 12px 0 0;
  color: rgba(248, 240, 228, 0.58);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.sheet {
  min-height: 100dvh;
  display: grid;
  align-items: end;
  padding: 24px 14px 14px;
  background:
    linear-gradient(180deg, rgba(17, 16, 13, 0.25), rgba(17, 16, 13, 0.96)),
    url("assets/palm-scan-hero.png") center / cover;
}

.sheet-panel {
  border: 1px solid rgba(255, 248, 236, 0.2);
  border-radius: 8px;
  background: rgba(255, 248, 236, 0.97);
  color: var(--paper-text);
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: rgba(47, 38, 26, 0.22);
}

.sheet-panel h1,
.sheet-panel h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.25;
}

.sheet-panel p,
.sheet-panel li {
  color: #65543c;
  font-size: 14px;
  line-height: 1.62;
}

.privacy-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 16px 0;
  list-style: none;
}

.privacy-list li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
}

.mini-check {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  border: 1px solid rgba(47, 184, 164, 0.55);
  background: rgba(47, 184, 164, 0.16);
}

.agreement {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  margin: 14px 0 16px;
  color: #5b4c35;
  font-size: 12px;
  line-height: 1.5;
}

.agreement input {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.step-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 18px;
}

.step-dots span {
  width: 30px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 248, 236, 0.16);
}

.step-dots span.active {
  background: var(--gold);
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 248, 236, 0.06);
}

.segment button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.segment button.active {
  color: #24170b;
  background: var(--gold-2);
}

.upload-box {
  margin: 18px 0;
  border: 1px dashed rgba(240, 208, 146, 0.44);
  padding: 18px;
  background: rgba(255, 248, 236, 0.05);
}

.preview-frame {
  position: relative;
  min-height: 276px;
  overflow: hidden;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #15140f;
}

.preview-frame img {
  width: 100%;
  height: 276px;
  object-fit: cover;
}

.scan-frame {
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(240, 208, 146, 0.36);
  border-radius: 8px;
}

.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  width: 54px;
  height: 54px;
  border-color: var(--teal);
  border-style: solid;
}

.scan-frame::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.scan-frame::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 2px 2px 0;
}

.upload-caption {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
}

.upload-caption strong {
  display: block;
  margin-bottom: 4px;
}

.upload-caption span {
  color: var(--muted);
  font-size: 12px;
}

.tip-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.tip {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 248, 236, 0.05);
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--teal);
}

.quality-card {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 248, 236, 0.06);
}

.quality-card strong {
  display: block;
  margin-bottom: 6px;
}

.quality-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.analysis-visual {
  position: relative;
  width: 250px;
  height: 250px;
  margin: 0 auto;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(from 30deg, rgba(47, 184, 164, 0.08), rgba(240, 208, 146, 0.7), rgba(47, 184, 164, 0.18), rgba(240, 208, 146, 0.05));
}

.analysis-visual::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  background: var(--ink);
}

.analysis-visual img {
  position: relative;
  width: 210px;
  height: 210px;
  border-radius: 999px;
  object-fit: cover;
}

.analysis-copy {
  text-align: center;
}

.analysis-copy h1 {
  margin-bottom: 10px;
  font-size: 26px;
}

.progress-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 248, 236, 0.06);
}

.progress-track {
  height: 8px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 248, 236, 0.12);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold-2));
  transition: width 220ms ease-out;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}

.progress-row.active {
  color: var(--surface);
  font-weight: 800;
}

.report-hero {
  margin: 12px 0 16px;
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(145deg, rgba(17, 16, 13, 0.72), rgba(36, 28, 20, 0.94)), #17130e;
  color: var(--surface);
}

.report-meta,
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.report-meta {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
}

.score-row {
  align-items: end;
}

.score-row h1 {
  margin-bottom: 4px;
  font-size: 25px;
  line-height: 1.15;
}

.score-num {
  color: var(--gold-2);
  font-size: 54px;
  font-weight: 900;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.tag {
  padding: 0 11px;
  background: rgba(240, 208, 146, 0.13);
  color: var(--gold-2);
}

.paper-card {
  padding: 16px;
  margin-bottom: 12px;
  background: #fffdf6;
  box-shadow: 0 10px 24px rgba(79, 57, 25, 0.08);
}

.paper-card h2 {
  margin-bottom: 8px;
  font-size: 17px;
}

.paper-card p {
  margin-bottom: 0;
  color: var(--paper-muted);
  font-size: 14px;
  line-height: 1.72;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.metric {
  padding: 12px;
  background: var(--surface-soft);
}

.metric span {
  color: #7d6d56;
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.advice-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.advice-list li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  color: var(--paper-muted);
  font-size: 14px;
  line-height: 1.55;
}

.advice-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(47, 184, 164, 0.14);
  color: #167f73;
  font-size: 12px;
  font-weight: 800;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 0.76fr;
  gap: 10px;
  margin: 18px -10px -12px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 248, 236, 0.94);
  box-shadow: 0 -10px 30px rgba(47, 38, 26, 0.16);
}

.sticky-actions .secondary-btn {
  color: #3d301f;
  border-color: rgba(61, 48, 31, 0.15);
  background: #efe3d0;
}

.poster-card {
  overflow: hidden;
  border: 1px solid rgba(240, 208, 146, 0.36);
  background: #16130f;
}

.poster-card img {
  width: 100%;
  max-height: 580px;
  object-fit: contain;
  background: #16130f;
}

.error-card {
  border: 1px solid rgba(242, 161, 155, 0.35);
  border-radius: 8px;
  padding: 14px;
  background: rgba(242, 161, 155, 0.09);
  color: #ffe0dc;
}

@media (min-width: 720px) {
  .app-shell {
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: calc(100dvh - 48px);
    border-radius: 30px;
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .analysis-visual {
    animation: spin-slow 7s linear infinite;
  }

  .analysis-visual img {
    animation: counter-spin 7s linear infinite;
  }

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

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