:root {
  --bg: #eef1f7;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #5b6cff;
  --accent-soft: #e9ecff;
  --green: #16a34a;
  --amber: #b45309;
  --red: #dc2626;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a21;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --line: #262b36;
    --accent: #8b98ff;
    --accent-soft: #1e2440;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 26px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  padding: 0 0 4px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-dot {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #9b6bff);
  box-shadow: 0 6px 14px rgba(91, 108, 255, 0.35);
}
.brand-title { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.status-chip {
  font-size: 12px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 7px 10px; border-radius: 999px;
  white-space: nowrap;
}

.screen { flex: 1; padding: 4px 16px calc(170px + env(safe-area-inset-bottom)); }

h1 { font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; margin: 10px 0 6px; }
h2 { font-size: 18px; margin: 22px 0 10px; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}

.hero {
  background: linear-gradient(140deg, #5b6cff 0%, #7a5cff 55%, #9b6bff 100%);
  color: #fff; border: 0;
  padding: 22px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; width: 180px; height: 180px; right: -60px; bottom: -90px;
  border-radius: 50%; background: rgba(255,255,255,0.12);
}
.hero h1 { margin: 0 0 8px; font-size: 24px; }
.hero .muted { color: rgba(255,255,255,0.78); }
.hero-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.hero-pill {
  font-size: 12px; font-weight: 600; padding: 7px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.18); color: #fff;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; } }

.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 14px; text-align: left; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 8px; min-height: 108px;
  position: relative;
}
.tile:active { transform: scale(0.99); }
.tile.disabled { opacity: 0.55; }
.tile-title { font-weight: 650; font-size: 15px; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile-ico { font-size: 22px; }
.badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.badge.dark { background: rgba(255,255,255,0.18); color: #fff; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 14px 16px;
  border-radius: 16px; border: 0; background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 650; cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); }
.btn.small { min-height: 42px; font-size: 14px; padding: 10px 12px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

.progress-wrap { margin: 8px 0 4px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.25s ease; }

.step-head { margin: 14px 0 10px; }
.step-title { font-size: 24px; font-weight: 720; letter-spacing: -0.02em; margin: 0 0 6px; }
.step-hint { color: var(--muted); font-size: 14px; }

.image-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 8px; margin: 12px 0; overflow: hidden;
}
.image-card img { width: 100%; max-height: 240px; object-fit: contain; display: block; border-radius: 12px; }

.field {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 4px 14px; margin-top: 6px;
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field input {
  flex: 1; border: 0; outline: 0; background: transparent; color: var(--text);
  font-size: 24px; font-weight: 650; padding: 12px 0; min-width: 0;
  font-variant-numeric: tabular-nums;
}
.field input::placeholder { color: var(--muted); font-size: 16px; font-weight: 500; }
.field input.email { font-size: 16px; font-weight: 500; padding: 14px 0; }
.field .unit { color: var(--muted); font-size: 14px; }
.range { font-size: 12px; color: var(--muted); margin: 8px 2px 0; }
.error { color: var(--red); font-size: 13px; margin: 8px 2px 0; min-height: 18px; }

.choice { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.choice-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 14px; text-align: left; cursor: pointer; color: var(--text);
}
.choice-card:active { border-color: var(--accent); background: var(--accent-soft); }
.choice-title { font-weight: 650; }
.choice-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.actions {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100%); z-index: 30;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 76%, color-mix(in srgb, var(--bg) 60%, transparent));
}
.step-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.link-btn { border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 8px 2px; cursor: pointer; }
.link-btn.danger { color: var(--red); }

.summary-group { margin: 16px 0; }
.summary-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 6px 4px; }
.summary-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 8px; text-align: left; cursor: pointer; color: var(--text);
}
.summary-label { flex: 1; font-size: 14px; }
.summary-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.summary-unit { color: var(--muted); font-size: 12px; margin-left: 3px; }
.edit-ico { color: var(--muted); font-size: 14px; margin-left: 2px; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 14px; padding: 12px 14px; font-size: 13px; margin: 12px 0;
}
.notice.warn { background: color-mix(in srgb, var(--amber) 12%, transparent); color: var(--amber); }

.result-icon {
  width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green);
  font-size: 36px; margin: 14px auto 10px;
}

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px;
}
.num {
  width: 30px; height: 30px; border-radius: 10px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px;
  flex: 0 0 auto;
}
.list-title { font-weight: 620; font-size: 14px; }
.list-sub { font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 50;
  max-width: min(92vw, 460px); background: #111827; color: #fff;
  padding: 12px 16px; border-radius: 14px; font-size: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.center { text-align: center; }
.auth-wrap { padding-top: 10vh; }
.auth-logo {
  width: 84px; height: 84px; border-radius: 26px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--accent), #9b6bff);
  box-shadow: 0 16px 40px rgba(91, 108, 255, 0.35);
}
pre.preview {
  background: #0b1020; color: #dbe3ff; border-radius: 14px; padding: 14px;
  overflow: auto; font-size: 11px; line-height: 1.5; max-height: 260px;
}

.settings-option {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 14px; margin-bottom: 8px; cursor: pointer; color: var(--text); width: 100%;
  text-align: left;
}
.settings-option.active { border-color: var(--accent); background: var(--accent-soft); }
.settings-option .check { color: var(--accent); font-weight: 700; }

.plans { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }

.plan {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 20px;
  padding: 18px; text-align: left; color: var(--text); cursor: pointer;
  box-shadow: var(--shadow);
}
.plan.active { border-color: var(--accent); background: var(--accent-soft); }
.plan:disabled { opacity: 0.6; cursor: not-allowed; }
.plan-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.plan-title { font-size: 19px; font-weight: 700; }
.plan-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.plan-price { font-size: 26px; font-weight: 750; white-space: nowrap; letter-spacing: -0.02em; }
.plan-price span { font-size: 15px; font-weight: 600; color: var(--muted); }
.plan-features { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.plan-features span {
  font-size: 12px; padding: 5px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--accent);
}
.plan-cta {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  text-align: center; font-weight: 650; color: var(--accent);
}
