:root {
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --cyan: #06b6d4;
  --green: #22c55e;
  --orange: #f97316;
  --red: #ef4444;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --weak: #94a3b8;
  --line: #e2e8f0;
  --panel: #ffffff;
  --page: #f8fafc;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(238, 242, 255, 0.7) 0%, rgba(248, 250, 252, 0) 260px),
    var(--page);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px 92px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 6px 0 10px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 75%, rgba(248, 250, 252, 0));
  backdrop-filter: blur(14px);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid rgba(79, 70, 229, 0.22);
  border-radius: 50%;
  background: #fff;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  inset: 7px;
  border-radius: 50%;
  border: 1px solid rgba(6, 182, 212, 0.45);
}

.brand-mark::after {
  inset: 14px 5px auto auto;
  width: 12px;
  height: 2px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  transform: rotate(-28deg);
  transform-origin: left center;
}

.brand-button strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.brand-button small {
  display: inline-block;
  margin-top: 3px;
  color: var(--weak);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.ghost-icon,
.inline-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.ghost-icon {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.hero-panel,
.input-card,
.loading-card,
.result-card,
.follow-card,
.result-hero,
.metric-grid article {
  border: 1px solid rgba(226, 232, 240, 0.72);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel {
  overflow: hidden;
  padding: 22px 18px 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

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

h1 {
  max-width: 390px;
  margin-bottom: 10px;
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 390px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.radar-preview {
  position: relative;
  min-height: 210px;
  margin: 18px 0 18px;
  border: 1px solid rgba(79, 70, 229, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(238, 242, 255, 0.58), rgba(255, 255, 255, 0.8)),
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.03) 0 1px, transparent 1px 38px),
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.03) 0 1px, transparent 1px 38px);
}

.radar-core {
  position: absolute;
  inset: 42px 0 auto;
  width: 128px;
  height: 128px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(6, 182, 212, 0.28);
}

.radar-core::before,
.radar-core::after,
.radar-core span {
  position: absolute;
  content: "";
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 50%;
}

.radar-core::before {
  inset: 18px;
}

.radar-core::after {
  inset: 38px;
}

.radar-core span {
  inset: -8px;
  animation: pulse 2.4s linear infinite;
}

.radar-core i {
  position: absolute;
  top: 63px;
  left: 64px;
  width: 58px;
  height: 2px;
  border-radius: 999px;
  background: var(--cyan);
  transform-origin: left center;
  animation: sweep 3s linear infinite;
}

.floating-tag {
  position: absolute;
  padding: 8px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.tag-money {
  top: 22px;
  left: 18px;
  color: var(--red);
}

.tag-income {
  top: 44px;
  right: 14px;
  color: var(--orange);
}

.tag-app {
  left: 34px;
  bottom: 28px;
  color: var(--primary);
}

.tag-cost {
  right: 28px;
  bottom: 22px;
  color: var(--cyan);
}

.hero-actions,
.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 22px rgba(79, 70, 229, 0.22);
}

.secondary-button {
  background: var(--primary-soft);
  color: var(--primary);
}

.full {
  width: 100%;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric-grid article {
  min-height: 112px;
  padding: 14px;
  box-shadow: none;
}

.metric-grid article:first-child {
  grid-column: 1 / -1;
}

.metric-grid span {
  display: block;
  margin-bottom: 14px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.metric-grid strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.metric-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.section-heading {
  padding: 12px 2px 8px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading.compact {
  padding-top: 18px;
}

.input-card {
  display: block;
  padding: 12px;
  box-shadow: none;
}

textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}

textarea::placeholder {
  color: var(--weak);
}

.helper-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 2px 0;
}

.inline-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
}

.inline-button.muted {
  color: var(--muted);
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.risk-tag {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
}

.risk-tag.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.form-error {
  min-height: 24px;
  margin: 14px 2px 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.sticky-action {
  position: sticky;
  bottom: 14px;
  z-index: 9;
  padding-top: 12px;
}

.loading-card {
  display: grid;
  place-items: center;
  min-height: 560px;
  padding: 24px;
  text-align: center;
}

.scan-radar {
  position: relative;
  width: 178px;
  height: 178px;
  margin-bottom: 26px;
  border-radius: 50%;
  border: 1px solid rgba(6, 182, 212, 0.28);
  background: radial-gradient(circle, rgba(238, 242, 255, 0.8) 0 24%, rgba(255, 255, 255, 0.8) 25% 100%);
}

.scan-radar::before,
.scan-radar::after,
.scan-radar span {
  position: absolute;
  content: "";
  border-radius: 50%;
  border: 1px solid rgba(79, 70, 229, 0.18);
}

.scan-radar::before {
  inset: 26px;
}

.scan-radar::after {
  inset: 54px;
}

.scan-radar span:first-child {
  inset: -10px;
  animation: pulse 2s linear infinite;
}

.scan-radar span:nth-child(2) {
  inset: -24px;
  animation: pulse 2s linear infinite 0.4s;
}

.scan-radar i {
  position: absolute;
  top: 88px;
  left: 89px;
  width: 80px;
  height: 3px;
  border-radius: 999px;
  background: var(--cyan);
  transform-origin: left center;
  animation: sweep 1.4s linear infinite;
}

.loading-card h2 {
  margin-bottom: 8px;
}

.loading-card p {
  min-height: 24px;
  margin-bottom: 20px;
  color: var(--muted);
}

.progress-track {
  width: min(100%, 280px);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e0f2fe;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width 0.25s ease;
}

.result-hero {
  margin-bottom: 12px;
  padding: 18px;
  color: #fff;
  background: var(--primary);
}

.result-hero[data-tone="green"] {
  background: #16a34a;
}

.result-hero[data-tone="blue"] {
  background: #2563eb;
}

.result-hero[data-tone="orange"] {
  background: #ea580c;
}

.result-hero[data-tone="red"] {
  background: #dc2626;
}

.result-kicker,
.score-line,
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-kicker {
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 800;
}

.result-kicker strong {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
}

.score-line p {
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.score-line h2 {
  margin-bottom: 0;
  font-size: 56px;
  line-height: 1;
}

.score-line small {
  font-size: 18px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  border: 8px solid rgba(255, 255, 255, 0.24);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  font-size: 20px;
  font-weight: 900;
}

.result-summary {
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
}

.result-card,
.follow-card {
  margin-top: 12px;
  padding: 16px;
  box-shadow: none;
}

.card-title {
  margin-bottom: 12px;
}

.card-title h3 {
  margin-bottom: 0;
}

.card-title span {
  color: var(--weak);
  font-size: 12px;
  font-weight: 800;
}

.hit-list {
  display: grid;
  gap: 8px;
}

.hit-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
}

.hit-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--orange);
}

.hit-item strong {
  display: block;
  font-size: 14px;
}

.hit-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.dimension-list {
  display: grid;
  gap: 12px;
}

.dimension-row {
  display: grid;
  gap: 8px;
}

.dimension-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.bar span[data-tone="green"] {
  background: var(--green);
}

.bar span[data-tone="blue"] {
  background: #2563eb;
}

.bar span[data-tone="orange"] {
  background: var(--orange);
}

.bar span[data-tone="red"] {
  background: var(--red);
}

.analysis-text {
  margin-bottom: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
}

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

.check-list li {
  position: relative;
  padding-left: 24px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.check-list li::before {
  position: absolute;
  top: 7px;
  left: 0;
  width: 12px;
  height: 12px;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  content: "";
}

.follow-card {
  border-color: rgba(6, 182, 212, 0.2);
  background: #ecfeff;
}

.follow-card strong {
  display: block;
  margin-bottom: 5px;
}

.follow-card p {
  margin-bottom: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}

.copy-tip {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

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

@keyframes pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.9);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@media (min-width: 420px) {
  .hero-actions,
  .result-actions {
    grid-template-columns: 1fr 1fr;
  }

  .result-actions {
    align-items: stretch;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-inline: 10px;
  }

  .tag-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid article:first-child {
    grid-column: auto;
  }

  .score-line {
    align-items: flex-start;
  }

  .score-line h2 {
    font-size: 48px;
  }

  .score-ring {
    width: 76px;
    height: 76px;
  }
}
