/* ────────────────────────────────────────────────────────────────
   Мисс школы 2026 — оформление мини-аппа.
   Тёмная тема с золотом: фиксированная, не зависит от темы Telegram,
   чтобы «официальный» вид был одинаковым у всех учеников.
   ──────────────────────────────────────────────────────────────── */

:root {
  --bg:            #0b0b0d;
  --surface:       #151518;
  --surface-2:     #1d1d21;
  --stroke:        rgba(255, 255, 255, .07);

  --gold:          #d9b978;
  --gold-bright:   #f3dda6;
  --gold-deep:     #b8914c;
  --gold-grad:     linear-gradient(135deg, #f5e3b3 0%, #d9b978 45%, #b8914c 100%);

  --text:          #f4f2ee;
  --muted:         #97938c;
  --danger:        #e07a6a;
  --ok:            #7bc48f;

  --r-lg: 20px;
  --r-md: 14px;
  --tabbar-h: 62px;

  /* Фон шапки — вынесен в hero.css, грузится асинхронно (не блокирует показ). */

  --serif: 'Georgia', 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

body {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}

b, strong { color: var(--gold-bright); font-weight: 600; }

/* ── Экраны ─────────────────────────────────────────────────────── */

.screen { display: none; animation: fade .22s ease both; }
.screen.active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.pad { padding: 0 16px; }
.stack > * + * { margin-top: 12px; }

/* ── Шапка-герой ────────────────────────────────────────────────── */

.hero {
  position: relative;
  padding: 42px 20px 30px;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(217, 185, 120, .16), transparent 65%),
    linear-gradient(180deg, #23201b 0%, var(--bg) 100%);
}

/* Фото школы: положи webapp/photos/school.jpg — подхватится само. */
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--hero-photo, none) center/cover no-repeat;
  opacity: .28;
  filter: grayscale(.3) contrast(1.05);
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,11,13,.55) 0%, rgba(11,11,13,.8) 55%, var(--bg) 100%);
}
.hero > * { position: relative; z-index: 1; }

.crown { font-size: 34px; line-height: 1; filter: drop-shadow(0 2px 10px rgba(217,185,120,.45)); }

.hero h1 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.02;
  letter-spacing: .04em;
  font-weight: 700;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero h1 .year {
  display: block;
  font-size: 40px;
  color: var(--text);
  background: none;
  -webkit-text-fill-color: var(--text);
}

.hero .kicker {
  margin: 12px 0 0;
  font-size: 11.5px;
  letter-spacing: .22em;
  color: var(--gold);
  text-transform: uppercase;
}
.hero .kicker::before,
.hero .kicker::after { content: ' ✦ '; opacity: .75; }

/* ── Карточки-строки ────────────────────────────────────────────── */

.card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
}
.card .ico { font-size: 26px; flex: none; width: 34px; text-align: center; }
.card .body { min-width: 0; }
.card .body p { margin: 0; }
.card .label { color: var(--muted); font-size: 13.5px; }
.card .value {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: .04em;
  color: var(--gold-bright);
}
.card .sub { color: var(--muted); font-size: 13px; }
.card .lead { font-size: 17px; line-height: 1.35; }

/* ── Заголовок секции ───────────────────────────────────────────── */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 0 12px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .02em;
}
.section-head h2 span { color: var(--gold); }

.link-btn {
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--gold);
  font-size: 13.5px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.link-btn:active { background: var(--surface-2); }

/* ── Кандидатки ─────────────────────────────────────────────────── */

.strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 16px 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip .tile { flex: 0 0 43%; scroll-snap-align: start; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.tile:active { transform: scale(.982); border-color: rgba(217,185,120,.45); }
.tile.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

.tile .photo {
  aspect-ratio: 3 / 4;
  background: linear-gradient(160deg, #2a2620, #17161a);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 34px;
  color: rgba(217,185,120,.55);
}
.tile .num {
  position: absolute;
  top: 10px; left: 10px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(11,11,13,.72);
  border: 1px solid rgba(217,185,120,.5);
  color: var(--gold-bright);
  font-size: 13px;
  backdrop-filter: blur(6px);
}
.tile .meta { padding: 10px 12px 13px; text-align: center; }
.tile .meta .name { font-size: 14.5px; line-height: 1.25; }
.tile .meta .grade { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.tile .meta .count { color: var(--gold); font-size: 13px; margin-top: 6px; }

/* Карточка-строка: удобнее плиток, когда кандидаток мало —
   помещается девиз, и ни одна не выглядит «лишней» в сетке. */
.person {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.person:active { transform: scale(.99); border-color: rgba(217,185,120,.45); }
.person.selected { border-color: var(--gold); }

.person .photo {
  flex: none;
  width: 78px; aspect-ratio: 3 / 4;
  border-radius: 12px;
  background: linear-gradient(160deg, #2a2620, #17161a) center/cover no-repeat;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 22px; color: rgba(217,185,120,.55);
}
.person .info { min-width: 0; flex: 1; }
.person .name { font-size: 16px; }
.person .grade { color: var(--gold); font-size: 12.5px; margin-top: 2px; letter-spacing: .04em; }
.person .motto {
  margin-top: 7px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.35;
}
.person .chev { color: var(--muted); font-size: 20px; flex: none; }
.person .badge-voted { color: var(--gold); font-size: 12.5px; margin-top: 6px; }

/* ── Профиль кандидатки ─────────────────────────────────────────── */

.profile-photo {
  aspect-ratio: 4 / 5;
  margin: 0 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke);
  background: linear-gradient(160deg, #2a2620, #17161a) center/cover no-repeat;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 64px; color: rgba(217,185,120,.5);
}
.profile-name {
  margin: 16px 0 2px;
  font-family: var(--serif);
  font-size: 26px;
}
.profile-grade { color: var(--gold); font-size: 14px; letter-spacing: .06em; }
.quote {
  margin: 14px 0 0;
  padding-left: 14px;
  border-left: 2px solid var(--gold-deep);
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
  color: #ded9d0;
}
.about { margin: 14px 0 0; color: #cdc9c1; font-size: 15px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag {
  font-size: 12.5px;
  color: var(--gold);
  border: 1px solid rgba(217,185,120,.3);
  background: rgba(217,185,120,.07);
  padding: 5px 11px;
  border-radius: 999px;
}

/* ── Кнопки ─────────────────────────────────────────────────────── */

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--gold-grad);
  color: #2a2109;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(217, 185, 120, .18);
}
.cta:active { transform: scale(.99); filter: brightness(.96); }
.cta[disabled] { opacity: .45; box-shadow: none; }

.cta.ghost {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
}
.cta.small { padding: 13px 16px; font-size: 15px; }

.btn-show-code {
  display: block;
  width: 100%;
  margin: 14px 0 4px;
  padding: 11px 16px;
  background: transparent;
  border: 1px solid rgba(217,185,120,.3);
  border-radius: var(--r-md);
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.sticky-cta {
  position: sticky;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 10px);
  padding: 14px 16px 6px;
  background: linear-gradient(180deg, transparent, var(--bg) 42%);
}

/* ── Шаги воронки ───────────────────────────────────────────────── */

.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 16px 16px 4px;
}
.steps .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.16);
}
.steps .dot.done { background: var(--gold-deep); }
.steps .dot.now  { background: var(--gold-bright); box-shadow: 0 0 0 4px rgba(217,185,120,.16); }
.steps .caption { color: var(--muted); font-size: 12.5px; letter-spacing: .04em; margin-left: 6px; }

.screen-title {
  margin: 10px 0 4px;
  font-family: var(--serif);
  font-size: 25px;
  text-align: center;
}
.screen-sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; text-align: center; }

/* ── Информационные блоки ───────────────────────────────────────── */

.note {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: rgba(217,185,120,.06);
  border: 1px solid rgba(217,185,120,.18);
  font-size: 14.5px;
  color: #ddd8cf;
}
.note .em { margin-right: 7px; }
.note a { color: var(--gold-bright); text-decoration: underline; text-underline-offset: 3px; }
.note.warn {
  background: rgba(224,122,106,.07);
  border-color: rgba(224,122,106,.25);
}

.checklist { margin: 0; padding: 0; list-style: none; }
.checklist li {
  display: flex; gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--stroke);
  font-size: 14.5px;
  color: #cdc9c1;
}
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { content: '✓'; color: var(--gold); flex: none; }

.rules { counter-reset: r; }
.rules .rule { padding: 15px 0; border-bottom: 1px solid var(--stroke); }
.rules .rule:last-child { border-bottom: 0; }
.rules .rule h3 {
  counter-increment: r;
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 600;
}
.rules .rule h3::before {
  content: counter(r);
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; margin-right: 9px;
  border-radius: 50%;
  border: 1px solid rgba(217,185,120,.4);
  color: var(--gold);
  font-size: 12px;
}
.rules .rule p { margin: 0 0 0 31px; color: var(--muted); font-size: 14px; }

/* ── Итог ───────────────────────────────────────────────────────── */

.seal {
  width: 84px; height: 84px;
  margin: 6px auto 0;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 38px;
  background: radial-gradient(circle at 30% 25%, rgba(217,185,120,.3), rgba(217,185,120,.06));
  border: 1px solid rgba(217,185,120,.45);
  animation: pop .4s cubic-bezier(.2,1.4,.5,1) both;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

.ticket {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px dashed rgba(217,185,120,.45);
  background: rgba(217,185,120,.05);
  text-align: center;
}
.ticket .label { color: var(--muted); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; }
.ticket .code { font-family: var(--serif); font-size: 30px; color: var(--gold-bright); letter-spacing: .06em; }

/* ── Ввод кода подтверждения ───────────────────────────────────── */

.code-boxes {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 22px 0 0;
}
.code-box {
  width: 52px;
  height: 62px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 26px;
  color: var(--gold-bright);
  transition: border-color .15s ease;
}
.code-box.filled { border-color: var(--gold); }
.code-box.error  { border-color: var(--danger); animation: shake .3s ease; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.code-error {
  margin: 10px 0 0;
  text-align: center;
  color: var(--danger);
  font-size: 13.5px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 280px;
  margin: 26px auto 0;
}
.key {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-family: var(--serif);
  font-size: 22px;
  cursor: pointer;
}
.key:active { background: var(--surface-2); border-color: rgba(217,185,120,.4); }
.key-ghost  { background: none; border: none; color: var(--muted); font-size: 18px; }

/* ── Пароль облачной 2FA ───────────────────────────────────────── */

.text-input {
  width: 100%;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  font-family: inherit;
  box-sizing: border-box;
}
.text-input::placeholder { color: var(--muted); }
.text-input:focus { outline: none; border-color: var(--gold); }
.text-input.error { border-color: var(--danger); animation: shake .3s ease; }

/* ── Нижний таб-бар ─────────────────────────────────────────────── */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(13, 13, 15, .92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--stroke);
  z-index: 20;
}
.tabbar button {
  border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  cursor: pointer;
}
.tabbar button .ic { font-size: 19px; line-height: 1; filter: grayscale(1) opacity(.65); }
.tabbar button.active { color: var(--gold); }
.tabbar button.active .ic { filter: none; }
.tabbar.hidden { display: none; }

/* Воронка занимает весь экран: таб-бар прячется, чтобы с шага выбора
   нельзя было случайно «выпасть» и потерять контекст. */
body.focus-mode { padding-bottom: 24px; }
body.focus-mode .sticky-cta { bottom: 0; }

.footnote {
  margin: 22px 0 8px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.5;
}
.footnote a { color: var(--gold); text-decoration: none; }
