:root {
  --bg: #0a0a0a;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f2f5f7;
  --muted: #8b95a0;
  --turq: #00f0d0;
  --gold: #ffc94d;
  --red: #ff4d5e;
  --green: #3dff8c;
  --radius: 22px;
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; }
h1, h2 { font-family: var(--display); letter-spacing: -0.01em; margin: 0; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ───────── фон ───────── */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(90px); opacity: .22; }
.blob-a { background: var(--turq); top: -35vmax; left: -30vmax; animation: float 18s ease-in-out infinite alternate; }
.blob-b { background: var(--gold); bottom: -40vmax; right: -35vmax; opacity: .14; animation: float 22s ease-in-out infinite alternate-reverse; }
.bg-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
@keyframes float { to { transform: translate(8vmax, 6vmax) scale(1.08); } }

/* ───────── каркас ───────── */
#app {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + 24px);
}
.screen { display: none; animation: enter .35s ease both; }
.screen.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.card { border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.section-title { font-family: var(--display); font-size: 15px; font-weight: 700; margin: 22px 4px 12px; }
.screen-title { font-size: 22px; margin: 6px 4px 18px; }

.brand { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: .08em; }
.brand span { color: var(--turq); text-shadow: 0 0 18px rgba(0, 240, 208, .6); }
.brand-lg { font-size: 26px; margin-top: 22px; }
.grad {
  background: linear-gradient(100deg, var(--turq), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ───────── кнопки ───────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 0 20px;
  border: 0; border-radius: 16px; cursor: pointer;
  font-weight: 700; font-size: 16px; letter-spacing: .01em;
  transition: transform .12s ease, opacity .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary {
  color: #001a16;
  background: linear-gradient(100deg, #00f0d0, #2de0ff);
  box-shadow: 0 8px 30px -8px rgba(0, 240, 208, .65), inset 0 1px 0 rgba(255,255,255,.4);
}
.btn.gold {
  color: #241800;
  background: linear-gradient(100deg, #ffd76a, #ffb432);
  box-shadow: 0 8px 30px -6px rgba(255, 190, 60, .6), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn.ghost { background: var(--glass-strong); border: 1px solid var(--border); }
.btn.sm { width: auto; min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 12px; }
.btn.xs { width: auto; min-height: 30px; font-size: 12px; padding: 0 10px; border-radius: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--glass); cursor: pointer;
}

/* ───────── загрузка ───────── */
#screen-loading.active { display: grid; place-items: center; min-height: 80vh; }
.loader { display: grid; place-items: center; }
.loader-ring {
  width: 72px; height: 72px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.08); border-top-color: var(--turq); border-right-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-card { text-align: center; margin-top: 18vh; }
.center-card h2 { font-size: 20px; margin: 10px 0; }
.big-icon { font-size: 44px; }

/* ───────── главный ───────── */
.topbar { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 16px; }
.profile { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 52px; height: 52px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 20px;
  background: linear-gradient(135deg, rgba(0,240,208,.35), rgba(255,201,77,.35)) center/cover;
  box-shadow: 0 0 0 2px rgba(0,240,208,.5), 0 0 24px rgba(0,240,208,.25);
}
.profile-text { flex: 1; min-width: 0; }
.profile-name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-sub { font-size: 13px; }
.profile-stat { text-align: right; }
.stat-value { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--gold); }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.hero { text-align: center; padding: 22px 18px; overflow: hidden; }
.hero-visual { display: grid; place-items: center; margin-bottom: 10px; }
.hero-face { width: 132px; height: 132px; filter: drop-shadow(0 0 18px rgba(0,240,208,.35)); }
.spin-slow { transform-origin: 60px 60px; animation: spin 24s linear infinite; }
.scanbar { animation: scanbar 2.6s ease-in-out infinite; filter: drop-shadow(0 0 4px #00f0d0); }
@keyframes scanbar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(80px); } }
.hero h1 { font-size: clamp(21px, 6.4vw, 26px); line-height: 1.2; margin-bottom: 8px; }
.hero p { margin: 0 0 16px; font-size: 13.5px; }
.balance-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left; padding: 12px 14px; margin-bottom: 14px;
  border-radius: 16px; background: rgba(0,0,0,.25); border: 1px solid var(--border);
}
.label { font-size: 12px; color: var(--muted); }
.balance-value { font-family: var(--display); font-weight: 800; font-size: 26px; color: var(--turq); }
.sub-gate { border-radius: 16px; padding: 12px; margin-bottom: 14px; }
.sub-gate p { margin: 0 0 10px; font-size: 14px; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.history { display: grid; gap: 10px; }
.history-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 18px; cursor: pointer; transition: transform .12s;
}
.history-item:active { transform: scale(.98); }
.h-score { font-family: var(--display); font-weight: 800; font-size: 20px; min-width: 48px; }
.h-main { flex: 1; min-width: 0; }
.h-tier { font-weight: 700; }
.h-date { font-size: 12px; color: var(--muted); }
.h-lock { font-size: 18px; }
.empty { text-align: center; color: var(--muted); padding: 22px; border-radius: 18px; }
.disclaimer { font-size: 11.5px; color: #5d666f; text-align: center; margin: 24px 8px 0; }

/* ───────── загрузка фото ───────── */
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 16px; background: var(--glass); border: 1px solid var(--border); margin-bottom: 14px; }
.seg button { flex: 1; min-height: 42px; border: 0; border-radius: 12px; background: transparent; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: rgba(0,240,208,.14); color: var(--turq); box-shadow: inset 0 0 0 1px rgba(0,240,208,.4); }

.drop {
  position: relative; display: grid; place-items: center;
  min-height: 230px; border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; cursor: pointer;
  border-style: dashed; border-color: rgba(0,240,208,.35);
}
.drop-sm { min-height: 130px; border-color: rgba(255,201,77,.3); }
.drop-empty { text-align: center; padding: 18px; }
.drop-icon { font-size: 34px; margin-bottom: 6px; }
.drop-title { font-weight: 700; font-size: 16px; }
.drop-sub { font-size: 12.5px; color: var(--muted); }
.drop-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop.filled { border-style: solid; }
.drop-badge {
  position: absolute; right: 10px; bottom: 10px; padding: 5px 10px; font-size: 12px; font-weight: 600;
  border-radius: 999px; background: rgba(0,0,0,.6); border: 1px solid var(--border);
}
.tips { border-radius: 18px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; }
.tips summary { cursor: pointer; font-weight: 600; color: var(--gold); }
.tips ul { margin: 10px 0 2px; padding-left: 18px; color: #c4ccd3; }
.tips li { margin-bottom: 6px; }
.hint { text-align: center; font-size: 12.5px; margin: 10px 0 0; }

/* ───────── сканирование ───────── */
.scan-frame {
  position: relative; border-radius: var(--radius); overflow: hidden; margin: 6px 0 22px;
  aspect-ratio: 3 / 4; background: #050505; box-shadow: 0 0 0 1px rgba(0,240,208,.25), 0 0 60px -10px rgba(0,240,208,.35);
}
.scan-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.7) brightness(.8); }
.scan-mesh {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(0,240,208,.55) 1px, transparent 1.6px);
  background-size: 14px 14px; mix-blend-mode: screen; opacity: .45;
  mask-image: radial-gradient(ellipse 45% 55% at 50% 45%, #000 40%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 45% 55% at 50% 45%, #000 40%, transparent 75%);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .15; } }
.scan-line {
  position: absolute; left: 0; right: 0; height: 90px; top: -90px;
  background: linear-gradient(180deg, transparent, rgba(0,240,208,.28) 70%, rgba(0,240,208,.95) 98%, transparent);
  animation: sweep 2.2s cubic-bezier(.45,.05,.55,.95) infinite;
}
@keyframes sweep { to { top: 100%; } }
.corner { position: absolute; width: 28px; height: 28px; border: 3px solid var(--turq); filter: drop-shadow(0 0 6px var(--turq)); }
.corner.tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.corner.tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.corner.bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.corner.br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.scan-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.scan-steps li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--border); color: var(--muted); transition: all .3s;
}
.scan-steps li::before {
  content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18);
}
.scan-steps li.active { color: var(--text); border-color: rgba(0,240,208,.35); }
.scan-steps li.active::before { border-color: var(--turq); border-top-color: transparent; animation: spin .8s linear infinite; }
.scan-steps li.done { color: var(--text); }
.scan-steps li.done::before { content: "✓"; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #001a16; background: var(--turq); border-color: var(--turq); }

/* ───────── результат ───────── */
.score-card { text-align: center; padding-top: 24px; }
.score-ring { position: relative; width: min(210px, 62vw); margin: 0 auto 12px; }
.score-ring svg { width: 100%; display: block; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.07); stroke-width: 12; }
.ring-fg {
  fill: none; stroke: url(#rg); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 540.35; stroke-dashoffset: 540.35;
  transition: stroke-dashoffset 1.4s cubic-bezier(.2,.8,.2,1);
  filter: drop-shadow(0 0 8px rgba(0,240,208,.6));
}
.score-center { position: absolute; inset: 0; display: grid; place-content: center; }
.score-value { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 14vw, 58px); line-height: 1; }
.score-max { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tier-badge {
  display: inline-block; padding: 8px 18px; border-radius: 999px; margin-bottom: 8px;
  font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid currentColor; box-shadow: 0 0 24px -4px currentColor, inset 0 0 18px -6px currentColor;
}
.tier-desc { margin: 0 0 18px; font-size: 13.5px; }
.raw-line { margin: -10px 0 16px; font-size: 12px; line-height: 1.45; }
.raw-line b { color: var(--text); font-weight: 700; }
.psl { position: relative; padding-top: 6px; }
.psl-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; }
.psl-bar i { display: block; height: 100%; opacity: .85; }
.psl-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 6px; }
.psl-marker {
  position: absolute; top: 0; width: 4px; height: 22px; margin-left: -2px; border-radius: 4px;
  background: #fff; box-shadow: 0 0 12px #fff; left: 0; transition: left 1.4s cubic-bezier(.2,.8,.2,1);
}

.photo-card { padding: 8px; }
.photo-wrap { position: relative; border-radius: 16px; overflow: hidden; background: #050505; min-height: 240px; }
.photo-wrap img { display: block; width: 100%; height: auto; transition: opacity .25s; }
.photo-wrap.loading img { opacity: .35; }
.photo-spinner {
  display: none; position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--turq); animation: spin .8s linear infinite;
}
.photo-wrap.loading .photo-spinner { display: block; }
.photo-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 4px; font-size: 13px; color: var(--muted); }

.warning {
  display: flex; gap: 10px; padding: 11px 14px; margin-bottom: 8px; border-radius: 14px; font-size: 13px;
  background: rgba(255, 201, 77, .07); border: 1px solid rgba(255, 201, 77, .25); color: #f3dca0;
}

.metrics { display: grid; gap: 10px; padding-bottom: 8px; }
.metric {
  position: relative; border-radius: 18px; padding: 14px 16px; cursor: pointer; overflow: hidden;
  transition: transform .12s, border-color .2s, box-shadow .2s;
}
.metric:active { transform: scale(.985); }
.metric.active { border-color: rgba(0,240,208,.6); box-shadow: 0 0 0 1px rgba(0,240,208,.35), 0 0 30px -10px rgba(0,240,208,.6); }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-tag { font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 2px 7px; border-radius: 999px; color: var(--turq); border: 1px solid rgba(0,240,208,.4); }
.m-score { font-family: var(--display); font-weight: 800; font-size: 18px; white-space: nowrap; }
.m-score small { font: 600 11px var(--font); color: var(--muted); }
.m-body { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 0 10px; }
.m-value { font-family: var(--display); font-weight: 700; font-size: 22px; }
.m-ideal { font-size: 12.5px; color: var(--muted); text-align: right; }
.m-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.m-bar i { display: block; height: 100%; border-radius: inherit; transition: width 1s ease; }
.m-verdict { font-size: 12.5px; margin-top: 8px; color: #c4ccd3; }
.m-desc { font-size: 12px; color: var(--muted); margin-top: 6px; }

.metric.locked .m-body, .metric.locked .m-bar, .metric.locked .m-verdict, .metric.locked .m-score {
  filter: blur(7px); user-select: none; pointer-events: none;
}
.m-lock {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 18px;
  background: rgba(10,10,10,.75); border: 1px solid rgba(255,201,77,.45); box-shadow: 0 0 20px -4px rgba(255,201,77,.5);
}
.metric.unlocked-now { animation: reveal .9s ease both; }
@keyframes reveal { from { box-shadow: 0 0 0 2px var(--gold), 0 0 40px var(--gold); } }

.unlock-bar {
  position: sticky; bottom: calc(var(--safe-bottom) + 12px); z-index: 5; margin-top: 14px;
  padding: 10px; border-radius: 22px; background: rgba(10,10,10,.6);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,201,77,.25);
}

/* ───────── toast ───────── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 24px); z-index: 50;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px;
  background: rgba(20, 22, 26, .92); border: 1px solid var(--border); font-size: 14px; text-align: center;
  transition: all .3s cubic-bezier(.2,.8,.2,1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255,77,94,.5); }

.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

@media (max-width: 360px) {
  #app { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; }
  .m-value { font-size: 19px; }
  .balance-value { font-size: 22px; }
  .tier-badge { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ───────── проверка точек ───────── */
.pts-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 20px; }
.pts-sub { font-size: 13px; margin: 0 4px 10px; }
.pts-stage {
  position: relative; border-radius: 18px; overflow: hidden; min-height: 200px; background: #050505;
  box-shadow: 0 0 0 1px rgba(0,240,208,.22), 0 0 40px -12px rgba(0,240,208,.35);
}
.pts-stage canvas { display: block; width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.pts-stage.loading .photo-spinner { display: block; }
.pts-chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.pts-chips::-webkit-scrollbar { display: none; }
.pt-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 5px 5px 10px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--glass);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.pt-chip.on { border-color: rgba(0,240,208,.6); background: rgba(0,240,208,.12); color: var(--turq); }
.pt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--turq); flex: none; }
.pt-chip.edited .pt-dot { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.pt-chip .q {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: 12px; font-weight: 800; color: #0a0a0a; background: rgba(255,255,255,.8);
}
.q-btn {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%;
  font: 800 14px var(--font); color: #001a16; background: var(--turq); cursor: pointer;
  box-shadow: 0 0 14px -2px rgba(0,240,208,.7);
}
.pts-help { font-size: 12px; margin: 8px 4px 10px; line-height: 1.4; }
.pts-actions { display: flex; gap: 8px; }
.pts-actions .btn { min-height: 50px; font-size: 15px; padding: 0 12px; }
.pts-actions .btn.ghost { flex: 0 0 38%; }

/* ───────── нижняя панель (подсказка) ───────── */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.62); animation: fade .2s ease both; }
.sheet-panel {
  position: relative; width: 100%; max-width: 520px; text-align: center;
  padding: 10px 18px calc(var(--safe-bottom) + 18px); border-radius: 24px 24px 0 0;
  background: rgba(16,18,22,.96); border: 1px solid var(--border); border-bottom: 0;
  animation: sheet-up .3s cubic-bezier(.2,.8,.2,1) both;
}
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.2); margin: 0 auto 8px; }
.hint-figure svg { display: block; width: min(190px, 52vw); height: auto; margin: 0 auto 6px; }
.sheet-panel h3 { font-family: var(--display); font-size: 17px; margin: 4px 0 6px; }
.sheet-panel p { font-size: 14px; margin: 0 0 14px; }
.hl-pulse { animation: hl-pulse 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes hl-pulse { 50% { opacity: .35; transform: scale(1.4); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 360px) {
  .pts-title { font-size: 18px; }
  .pts-sub { font-size: 12px; }
  .pts-actions .btn { min-height: 46px; font-size: 14px; }
}

/* ───────── вкладки и блоки ───────── */
.tabs {
  position: sticky; top: calc(var(--safe-top) + 4px); z-index: 6;
  display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 8px 16px;
  background: linear-gradient(180deg, rgba(10,10,10,.92) 70%, rgba(10,10,10,0));
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--glass); font-size: 13.5px; font-weight: 600; color: #c4ccd3; cursor: pointer; white-space: nowrap;
}
.tab.on { background: var(--text); color: #0a0a0a; border-color: var(--text); }

.blocks { display: grid; gap: 10px; }
.block-card { display: block; width: 100%; text-align: left; border-radius: 18px; padding: 14px 16px; }
.block-main { display: block; width: 100%; padding: 0; margin: 0; border: 0; background: none; color: inherit;
  text-align: left; cursor: pointer; transition: transform .12s; }
.block-main:active { transform: scale(.985); }
.block-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.block-top > div:first-child { flex: 1; min-width: 0; }
.block-title { font-weight: 700; font-size: 16px; }
.block-title.big { font-family: var(--display); font-size: 19px; }
.block-sub { font-size: 12.5px; color: var(--muted); }
.block-desc { font-size: 13px; margin: 0; }
.bscore { font-family: var(--display); font-weight: 800; font-size: 20px; white-space: nowrap; }
.bscore.locked { font-size: 15px; color: var(--muted); }
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.block-head { padding: 16px; }
.block-head .block-top { margin-bottom: 8px; }

.sw-grid { display: grid; gap: 10px; margin-top: 14px; }
.sw { padding: 14px 16px; margin: 0; }
.sw-title { font-family: var(--display); font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.sw-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0; border: 0;
  border-top: 1px solid var(--border); background: none; text-align: left; cursor: pointer;
}
.sw-row:first-of-type { border-top: 0; }
.sw-score { min-width: 38px; padding: 3px 0; border-radius: 8px; text-align: center; font-weight: 800; font-size: 12.5px; color: #0a0a0a; }
.sw-name { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; }
.sw-val { font-size: 12.5px; white-space: nowrap; }
.sw-empty { font-size: 13px; margin: 4px 0 0; }

.group-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 18px 6px 8px;
}
.mlist { padding: 4px 14px; margin-bottom: 4px; }
.mrow {
  display: block; width: 100%; padding: 12px 0; border: 0; border-top: 1px solid var(--border);
  background: none; text-align: left; cursor: pointer;
}
.mrow:first-child { border-top: 0; }
.mrow-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mrow-title { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.mrow-val { font-size: 12.5px; white-space: nowrap; }
.mrow-score { font-family: var(--display); font-weight: 800; font-size: 15px; min-width: 30px; text-align: right; }
.mrow-lock { font-size: 13px; }
.mrow.locked .mrow-val, .mrow.locked .mrow-score { filter: blur(4px); }
.mrow-note { font-size: 12px; }
.mrow.excluded .mrow-score { font-size: 12px; font-weight: 600; color: var(--muted); }
.mrow.excluded .mrow-note { color: var(--gold); opacity: .85; }
.md-excluded { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }

/* полоска «замер vs эталон» */
.mscale { position: relative; height: 6px; border-radius: 999px; background: rgba(255,255,255,.07); }
.mscale .band { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: rgba(61,255,140,.35); }
.mscale .mark {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  border: 2px solid #0a0a0a; box-shadow: 0 0 10px currentColor;
}
.mscale.locked { filter: blur(3px); opacity: .6; }
.mscale.big { height: 8px; margin: 34px 0 30px; }
.mscale.big .mark { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
.mscale .mark-label {
  position: absolute; bottom: 16px; transform: translateX(-50%); padding: 3px 8px; border-radius: 8px;
  font-size: 12px; font-weight: 700; color: #0a0a0a; white-space: nowrap;
}
.mscale .band-label {
  position: absolute; top: 14px; transform: translateX(-50%); font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--green); white-space: nowrap;
}
.mscale .edge { position: absolute; top: 14px; font-size: 11px; color: var(--muted); }
.mscale .edge.l { left: 0; }
.mscale .edge.r { right: 0; }

/* карточка метрики */
.metric-panel { max-height: 92vh; overflow-y: auto; text-align: left; -webkit-overflow-scrolling: touch; }
.md-photo { position: relative; border-radius: 16px; overflow: hidden; background: #050505; margin-bottom: 12px; min-height: 120px; }
.md-photo img { display: block; width: 100%; height: auto; }
.md-photo.loading .photo-spinner { display: block; }
.md-kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.metric-panel h3 { font-size: 22px; margin: 4px 0 4px; text-align: left; }
.md-verdict { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.md-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.md-card {
  padding: 10px 10px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--border);
  border-left-width: 3px; min-width: 0;
}
.md-card span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.md-card b { display: block; margin-top: 6px; font-family: var(--display); font-size: clamp(13px, 3.9vw, 17px); line-height: 1.25; overflow-wrap: anywhere; }
.md-text { margin-top: 4px; }
.md-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 12px; }
.md-text p { margin: 6px 0 0; font-size: 14px; text-align: left; }
.md-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.md-nav .btn { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
#md-unlock { margin-top: 4px; }
@media (max-width: 360px) {
  .md-card b { font-size: 13.5px; }
  .tab { padding: 8px 11px; font-size: 12.5px; }
  .tabs { margin: 0 -12px 14px; padding: 8px 12px; }      /* поля страницы на узких экранах — 12px */
}

/* ───────── пример идеального фото ───────── */
.guide { display: flex; gap: 14px; align-items: center; border-radius: 18px; padding: 12px 14px; margin-bottom: 14px; }
.guide-art { flex: 0 0 auto; width: 96px; }
.guide-art svg { display: block; width: 100%; height: auto; }
.guide-body { min-width: 0; }
.guide-title { font-weight: 700; font-size: 14px; color: var(--gold); margin-bottom: 6px; }
.guide-list { list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: #c4ccd3; }
.guide-list li { display: flex; align-items: center; gap: 7px; padding: 2px 6px; margin: 0 -6px; border-radius: 8px; line-height: 1.3; }
.guide-list i { font-style: normal; width: 18px; text-align: center; flex: 0 0 auto; }
.guide-list li.on { background: rgba(255, 201, 77, .14); color: var(--text); font-weight: 600; }
.guide-list li.on i { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.g-line { fill: none; stroke: rgba(242, 245, 247, .82); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.g-soft { fill: none; stroke: rgba(242, 245, 247, .35); stroke-width: 1.4; stroke-dasharray: 3 4; }
.g-ok { fill: none; stroke: var(--turq); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.g-fill { fill: rgba(0, 240, 208, .07); }
.g-pupil { fill: var(--turq); }
.g-ray { stroke: var(--gold); stroke-width: 2; stroke-linecap: round; opacity: .85; }
.guide-art[data-hint] .g-part { opacity: .35; transition: opacity .2s; }
.guide-art[data-hint="head"] .g-head, .guide-art[data-hint="eyes"] .g-eyes,
.guide-art[data-hint="expression"] .g-mouth, .guide-art[data-hint="light"] .g-light,
.guide-art[data-hint="hair"] .g-hair, .guide-art[data-hint="sharp"] .g-sharp { opacity: 1; filter: drop-shadow(0 0 4px var(--gold)); }
.guide-art[data-hint="head"] .g-head .g-ok, .guide-art[data-hint="eyes"] .g-eyes .g-ok,
.guide-art[data-hint="expression"] .g-mouth .g-ok, .guide-art[data-hint="hair"] .g-hair .g-ok { stroke: var(--gold); }
.guide-sheet { text-align: center; }
.guide-lead { margin: 0 0 12px; font-size: 14px; color: #dfe5ea; }
.guide-lead.error { color: var(--gold); font-weight: 600; }
.guide-big { display: flex; gap: 16px; align-items: center; justify-content: center; text-align: left; margin-bottom: 16px; }
.guide-big .guide-art { width: 120px; }
.guide-close { display: block; margin: 8px auto 0; }
@media (max-width: 360px) {
  .guide { padding: 10px 12px; gap: 10px; }
  .guide-art { width: 78px; }
  .guide-big { flex-direction: column; gap: 10px; }
  .guide-big .guide-art { width: 110px; }
}

/* ───────── проверка кадра и доп. фото ───────── */
.precheck { display: flex; gap: 8px; align-items: flex-start; margin: -6px 0 12px; padding: 9px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.35; background: var(--glass-strong); border: 1px solid var(--border); }
.precheck b { font-size: 15px; line-height: 1.2; flex: 0 0 auto; }
.precheck.ok { color: var(--green); }
.precheck.fail { color: var(--gold); border-color: rgba(255, 201, 77, .35); }
.precheck .pc-link { margin-left: auto; flex: 0 0 auto; color: var(--turq); font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }
.more-btn { display: flex; flex-direction: column; gap: 2px; min-height: 52px; margin-bottom: 14px; }
.more-btn span { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.extra-fronts { display: flex; gap: 10px; margin-bottom: 12px; }
.xthumb { position: relative; flex: 1 1 0; max-width: 120px; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); background: var(--glass); }
.xthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xthumb.fail img { opacity: .45; }
.xthumb .xstate { position: absolute; left: 6px; bottom: 6px; right: 6px; font-size: 11px; line-height: 1.25; padding: 3px 6px;
  border-radius: 8px; background: rgba(0, 0, 0, .7); }
.xthumb.fail .xstate { color: var(--gold); }
.xthumb.ok .xstate { color: var(--green); }
.xthumb .xdel { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .65); cursor: pointer; font-size: 14px; line-height: 26px; padding: 0; }

/* ───────── сходство с типажами ───────── */
.arch-card { padding: 14px 16px; }
.arch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.arch-head .sw-title { margin: 0; }
.arch-sub { font-size: 12px; }
.arch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.arch-row:first-child { border-top: 0; }
.arch-name { font-weight: 600; font-size: 14px; min-width: 0; }
.arch-name small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.arch-sim { font-family: var(--display); font-weight: 800; font-size: 15px; align-self: center; color: var(--turq); }
.arch-bar { grid-column: 1 / -1; height: 5px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.arch-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--turq), var(--gold)); }
.arch-note { margin: 10px 0 0; font-size: 12.5px; color: #c4ccd3; line-height: 1.45; }
.arch-note b { color: var(--gold); }
.photo-bar { flex-wrap: wrap; }
.warn-btn { display: flex; margin-top: 8px; }

/* ───────── совет по метрике ───────── */
.md-tip { margin: 14px 0 4px; border-radius: 14px; background: var(--glass-strong); border: 1px solid var(--border);
  border-left: 3px solid var(--turq); overflow: hidden; }
.md-tip.normal { border-left-color: var(--gold); }
.md-tip.bad { border-left-color: var(--red); }
.md-tip summary { display: flex; align-items: center; gap: 8px; padding: 11px 12px; cursor: pointer; list-style: none;
  font-weight: 700; font-size: 14px; }
.md-tip summary::-webkit-details-marker { display: none; }
.md-tip summary em { font-style: normal; font-weight: 600; font-size: 12px; color: var(--muted); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-tip .md-tip-chev { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 600; color: var(--turq);
  flex: 0 0 auto; }
.md-tip[open] .md-tip-chev { font-size: 0; }
.md-tip[open] .md-tip-chev::after { content: "Скрыть"; font-size: 12px; }
.md-tip p { margin: 0; padding: 0 12px 12px; font-size: 13.5px; line-height: 1.5; color: #dfe5ea; overflow-wrap: anywhere; }
.md-tip .md-tip-note { font-size: 11px; color: var(--muted); padding-top: 0; }

/* ───────── «Почему такой балл?» ───────── */
.why { margin-top: 10px; border-top: 1px solid var(--border); }
.why summary { display: flex; align-items: center; gap: 8px; padding: 10px 0 2px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 700; color: var(--turq); }
.why summary::-webkit-details-marker { display: none; }
.why-chev { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); }
.why[open] .why-chev { font-size: 0; }
.why[open] .why-chev::after { content: "Скрыть"; font-size: 12px; }
.why p { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: #dfe5ea; overflow-wrap: anywhere; }
.why .why-head { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--text); }
.why-title { margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--text); }
.why-list { list-style: none; margin: 6px 0 0; padding: 0; }
.why-list li { border-top: 1px solid var(--border); }
.why-list li:first-child { border-top: 0; }
.why-metric { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 0; border: 0; background: none;
  color: inherit; text-align: left; cursor: pointer; font-size: 13px; }
.why-name { flex: 1; min-width: 0; }
.why-score { font-family: var(--display); font-weight: 800; font-size: 14px; flex: 0 0 auto; }
.why .why-tip { margin: 0 0 8px; font-size: 12.5px; color: #c4ccd3; }
.why .why-note { color: var(--gold); font-size: 12.5px; }
.why .why-scale { color: var(--muted); font-size: 11.5px; }
#why-total .why { text-align: left; margin: 0 0 14px; }
.block-head .why { margin-top: 12px; }
