html { -webkit-font-smoothing: antialiased; box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
body { margin: 0; background: var(--color-night); color: var(--color-snow); font-family: var(--font-sans); }
::selection { background: var(--color-red); color: var(--color-snow); }
@page { size: A4 portrait; margin: 6mm; }

.stage { position: relative; min-height: 100vh; }
.ambient-layer { pointer-events: none; position: fixed; inset: 0; z-index: 20; overflow: hidden; }
.wrap { position: relative; z-index: 30; width: min(760px, calc(100% - 24px)); margin: 0 auto; padding-bottom: 56px; }

/* Верхняя навигация (Конструктор / Зал Славы) */
.topbar {
  position: relative; z-index: 35; display: flex; justify-content: space-between; align-items: center;
  gap: 10px; width: min(760px, calc(100% - 24px)); margin: 0 auto; padding: 14px 0;
}
.top-tabs { display: flex; gap: 8px; }
.tab-btn {
  padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(18, 6, 8, 0.75); color: var(--color-cream); font-family: var(--font-display);
  font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase;
}
.tab-btn.active { background: var(--color-gold); color: var(--color-ink); border-color: var(--color-gold); font-weight: 700; }
.vip-badge {
  padding: 7px 12px; border-radius: 999px; background: linear-gradient(90deg, #b8860b, var(--color-gold));
  color: var(--color-ink); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; border: 0;
}

/* Главный баннер */
.hero {
  position: relative; min-height: 480px; margin: 0 -12px; border-radius: 18px 18px 0 0;
  overflow: hidden; display: flex; align-items: flex-end;
  background-image: var(--hero-image); background-size: cover; background-position: center 18%;
}
.hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--color-night) 0%, rgba(18, 6, 8, 0.78) 25%, rgba(18, 6, 8, 0.15) 60%, rgba(18, 6, 8, 0.45) 100%);
}
.hero-copy { position: relative; z-index: 1; padding: 28px 22px 64px; }
.kicker { margin: 0 0 10px; color: var(--color-gold); font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.hero-title { margin: 0; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; line-height: 0.92; }
.hero-title small { display: block; margin-bottom: 6px; font-size: clamp(18px, 3vw, 26px); letter-spacing: 0.12em; font-weight: 600; }
.hero-title span { display: block; font-size: clamp(40px, 8vw, 72px); text-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.hero-title span i { font-style: normal; color: var(--color-red); }
.lede { max-width: 36rem; margin: 14px 0 0; color: var(--color-cream); font-size: 15px; line-height: 1.45; }

/* Фон страницы результата */
.result-sky {
  position: fixed; inset: 0; z-index: 0; background-color: var(--color-night);
  background-image: var(--read-image); background-position: center 18%; background-size: cover;
}
.result-sky::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(18, 6, 8, 0.25) 0%, rgba(18, 6, 8, 0.82) 48%, var(--color-night) 100%);
}

/* Лист документа */
.sheet {
  position: relative; margin-top: -32px; background-color: var(--color-cream);
  background-image: radial-gradient(rgba(90, 60, 30, 0.07) 0.7px, transparent 0.8px), linear-gradient(165deg, #fffaf0 0%, #f4e6c8 100%);
  background-size: 8px 8px, 100% 100%; color: var(--color-ink);
  border-radius: 6px 6px 18px 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.result-wrap .sheet { margin-top: 8px; }
.sheet-bar { height: 7px; background: linear-gradient(90deg, var(--color-red-deep), var(--color-red) 40%, var(--color-gold)); border-radius: 6px 6px 0 0; }
.sheet-frame { margin: 14px; padding: 16px 16px 18px; border: 2px solid var(--color-ink); position: relative; }
.sheet-frame::after { content: ""; position: absolute; inset: 4px; border: 1px solid var(--color-ink); pointer-events: none; }

/* VIP оформление бланка (Золотое тиснение) */
.sheet.is-vip {
  background-image: radial-gradient(rgba(224, 177, 90, 0.14) 0.8px, transparent 0.9px), linear-gradient(165deg, #fffdf5 0%, #f7e6bd 100%);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 0 2px var(--color-gold);
}
.sheet.is-vip .sheet-frame { border-color: #9e6b14; }
.sheet.is-vip .sheet-frame::after { border-color: #c9942c; }
.vip-ribbon {
  display: inline-block; margin-bottom: 8px; padding: 3px 10px; border-radius: 4px;
  background: linear-gradient(90deg, #8c6214, #d4a038, #8c6214); color: #fff;
  font-family: var(--font-display); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
}

.secret-row { display: flex; justify-content: space-between; gap: 12px; color: var(--color-red-deep); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.doc-head { text-align: center; border-bottom: 2px solid var(--color-ink); padding: 8px 8px 14px; margin-bottom: 16px; }
.mark { display: inline-flex; align-items: center; gap: 8px; color: var(--color-red-deep); margin-bottom: 6px; }
.doc-title { margin: 0; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; font-size: clamp(22px, 4vw, 30px); line-height: 1.05; }
.doc-sub { margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--color-muted); }
.case-no { display: inline-block; margin-top: 12px; background: var(--color-ink); color: var(--color-cream); padding: 6px 14px; font-family: var(--font-display); letter-spacing: 0.08em; font-size: 14px; }

.section { margin-top: 18px; }
.section-title {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin: 0 0 12px; padding: 8px 10px; background: var(--color-cream-2);
  border-left: 4px solid var(--color-red); font-family: var(--font-display);
  font-size: 15px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.counter { color: var(--color-red-deep); font-variant-numeric: tabular-nums; white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); }
.control {
  width: 100%; border: 1px solid var(--color-line); background: rgba(255, 255, 255, 0.8);
  color: var(--color-ink); border-radius: 8px; padding: 11px 12px; font: inherit; font-size: 14px; outline: none;
}
.control:focus { border-color: var(--color-red); background: #fff; box-shadow: 0 0 0 3px rgba(211, 18, 26, 0.15); }

.upload { display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 8px; border: 1px dashed var(--color-line); border-radius: 8px; background: rgba(255, 255, 255, 0.5); }
.thumb { width: 52px; height: 64px; flex: none; border: 1px solid var(--color-ink); background: var(--color-cream-2); display: grid; place-items: center; overflow: hidden; color: var(--color-red-deep); }
.thumb img { width: 100%; height: 100%; object-fit: cover; filter: sepia(0.2) contrast(1.05); }
.file { font: inherit; font-size: 12px; max-width: 100%; }
.hint { margin-top: 4px; font-size: 11px; color: var(--color-muted); }

.traits { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trait {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px;
  border: 1px solid var(--color-line); background: rgba(255, 255, 255, 0.6);
  text-align: left; color: inherit; font: inherit; transition: 150ms ease;
}
.trait:hover { background: #fff; }
.trait.on { background: #fff6e8; border-color: var(--color-red); box-shadow: inset 0 0 0 1px var(--color-red); }
.trait.vip-trait { border-color: #c9942c; background: rgba(255, 248, 230, 0.85); }
.trait.vip-trait.on { border-color: #9e6b14; box-shadow: inset 0 0 0 1px #9e6b14; }
.box { width: 18px; height: 18px; margin-top: 2px; flex: none; border-radius: 4px; border: 1.5px solid var(--color-muted); display: grid; place-items: center; background: #fff; }
.trait.on .box { background: var(--color-red); border-color: var(--color-red); color: var(--color-snow); }
.trait-title { display: block; font-weight: 800; font-size: 14px; line-height: 1.25; }
.trait-desc { display: block; margin-top: 3px; font-size: 12px; line-height: 1.35; color: var(--color-muted); }
.weight-pill { display: inline-block; margin-top: 5px; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 4px; background: var(--color-cream-2); color: var(--color-red-deep); }

/* Ручной выбор статей (VIP Режим редактора) */
.manual-box { margin-top: 10px; padding: 10px; border-radius: 8px; background: rgba(255,255,255,0.75); border: 1px solid var(--color-line); }
.manual-select { width: 100%; margin-top: 6px; padding: 8px; border-radius: 6px; border: 1px solid var(--color-line); font: inherit; font-size: 12px; background: #fff; }

.custom-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.custom-row { display: flex; gap: 8px; }
.btn-mini { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--color-line); background: var(--color-cream-2); font-size: 12px; font-weight: 700; color: var(--color-ink); }

.mystery { display: flex; gap: 10px; margin-top: 12px; padding: 12px; border: 1px dashed var(--color-line); background: rgba(255, 255, 255, 0.45); border-radius: 10px; font-size: 13px; line-height: 1.45; }
.mystery p { margin: 0; }
.mystery svg { flex: none; color: var(--color-red-deep); margin-top: 2px; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px;
  padding: 12px 16px; border: 0; border-radius: 999px; font-family: var(--font-display);
  font-size: 15px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; transition: 120ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #ef2a30, var(--color-red-deep)); color: var(--color-snow); box-shadow: 0 10px 24px rgba(211, 18, 26, 0.35); }
.sheet .btn-primary { margin-top: 16px; }
.btn-gold { background: var(--color-ink); color: var(--color-gold); }
.btn-tg { background: #229ED9; color: #fff; }
.btn-ghost { background: var(--color-cream); color: var(--color-ink); border: 1px solid var(--color-line); }
/* Результат и Ачивка */
.suspect { display: flex; gap: 14px; align-items: flex-start; padding: 12px; margin-bottom: 14px; border: 1px dashed var(--color-line); background: rgba(255, 255, 255, 0.45); }
.polaroid {
position: relative; width: 104px; height: 128px; flex: none; border: 2px solid var(--color-ink);
background: var(--color-cream-2); transform: rotate(-2deg); box-shadow: 3px 4px 0 rgba(28, 18, 16, 0.12);
display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
gap: 4px; padding: 8px; font-size: 10px; font-weight: 800; overflow: hidden;
}
.clip { position: absolute; top: -10px; right: 10px; color: var(--color-muted); z-index: 2; }
.polaroid img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: sepia(0.22) contrast(1.05); }
.facts { flex: 1; min-width: 0; font-size: 14px; line-height: 1.45; }
.facts p { margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px dotted var(--color-line); }
.facts strong { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); }
.ach-box {
display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 14px;
border-radius: 8px; background: linear-gradient(90deg, rgba(224,177,90,0.22), rgba(211,18,26,0.08));
border: 1px solid #c9942c;
}
.ach-icon { font-size: 26px; flex: none; }
.ach-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; text-transform: uppercase; color: var(--color-red-deep); }
.ach-desc { font-size: 12px; color: var(--color-ink); margin-top: 2px; }
.offenses { list-style: none; margin: 0 0 12px; padding: 0; }
.offense { position: relative; margin: 0 0 10px; padding-left: 22px; font-size: 14px; line-height: 1.4; }
.tick { position: absolute; left: 0; top: 2px; color: var(--color-red); }
.article-tag { display: block; color: var(--color-red-deep); font-weight: 800; font-size: 13px; margin-bottom: 2px; }
.verdict { position: relative; display: flex; flex-direction: column; border: 2px solid var(--color-ink); background: rgba(255, 255, 255, 0.6); padding: 14px; margin-top: 8px; }
.verdict p { margin: 0; font-size: 14px; line-height: 1.45; font-weight: 700; }
.stamp {
align-self: flex-end; margin-top: 12px; border: 4px double var(--color-red); color: var(--color-red);
background: rgba(247, 239, 220, 0.92); font-family: var(--font-display); font-weight: 700;
text-transform: uppercase; letter-spacing: 0.06em; font-size: 20px; line-height: 1;
padding: 7px 12px; border-radius: 8px; transform: rotate(-7deg);
}
.stamp small { display: block; margin-top: 3px; font-size: 9px; letter-spacing: 0.08em; text-align: center; }
.signoff { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 20px; padding-top: 10px; border-top: 1px solid var(--color-ink); font-size: 13px; }
.sign-col { max-width: 65%; }
.hand { margin-top: 4px; color: var(--color-red-deep); font-family: var(--font-display); font-style: italic; font-size: 20px; }
.fine { margin-top: 6px; font-size: 11px; color: var(--color-muted); line-height: 1.35; }
.watermark { margin-top: 10px; text-align: center; font-size: 11px; color: var(--color-muted); border-top: 1px dashed var(--color-line); padding-top: 6px; }
.seal { width: 92px; height: 92px; flex: none; transform: rotate(8deg); }
/* Панель действий на странице результата */
.share-panel {
margin-top: 16px; padding: 14px; border-radius: 16px; background: rgba(18, 6, 8, 0.9);
border: 1px solid rgba(224, 177, 90, 0.3); display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.share-panel .wide { grid-column: 1 / -1; }
.link-copy-row { display: flex; gap: 8px; grid-column: 1 / -1; }
.link-input { flex: 1; padding: 10px 12px; border-radius: 999px; border: 1px solid var(--color-gold); background: rgba(255,255,255,0.1); color: #fff; font-size: 13px; }
/* Зал Славы (Рейтинг) */
.lb-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.lb-table th { text-align: left; padding: 8px; border-bottom: 2px solid var(--color-ink); font-size: 11px; text-transform: uppercase; color: var(--color-muted); }
.lb-table td { padding: 10px 8px; border-bottom: 1px dashed var(--color-line); }
.lb-rank { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--color-red-deep); }
/* Модальное окно оплаты (Тарифы) */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.78); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(560px, 100%); background: var(--color-cream); color: var(--color-ink); border-radius: 16px; padding: 20px; border: 2px solid var(--color-gold); box-shadow: 0 24px 60px rgba(0,0,0,0.6); max-height: 90vh; overflow-y: auto; }
.tariffs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.tariff-box { border: 2px solid var(--color-line); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; justify-content: space-between; }
.tariff-box.featured { border-color: var(--color-red); background: #fff9ed; }
.tariff-price { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--color-red-deep); margin: 6px 0; }
.tariff-list { padding-left: 16px; font-size: 12px; line-height: 1.45; margin: 8px 0 14px; color: var(--color-ink); }
@media (max-width: 640px) {
.hero { min-height: 400px; }
.grid-2, .traits, .share-panel, .tariffs-grid { grid-template-columns: 1fr; }
.suspect { flex-direction: column; align-items: center; }
.facts { width: 100%; }
.sheet-frame { margin: 10px; padding: 12px 10px 16px; }
}
@media print {
.no-print, .topbar, .share-panel { display: none !important; }
body, .stage { background: white !important; }
.wrap { width: 100%; padding: 0; margin: 0; }
.sheet { margin: 0; box-shadow: none; border-radius: 0; }
.sheet-frame { margin: 0; padding: 8px; }
.doc-title { font-size: 18px; }
.facts, .offense, .verdict p { font-size: 11px; line-height: 1.28; }
.seal { width: 72px; height: 72px; }
* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
