/* Квесты по Москве — светлая голубая тема, mobile-first */

:root {
  --bg: #eef6ff;
  --bg-2: #e2efff;
  --card: #ffffff;
  --ink: #0d2b47;
  --ink-2: #3c5f83;
  --muted: #6d8aa8;
  --line: #d5e6f8;
  --primary: #2f80ed;
  --primary-dark: #1b63c7;
  --primary-soft: #dbeaff;
  --accent: #56ccf2;
  --ok: #1f9d61;
  --ok-soft: #e2f7ec;
  --err: #e2544c;
  --err-soft: #fdecea;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(28, 78, 140, .08);
  --shadow-sm: 0 2px 10px rgba(28, 78, 140, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
  font-size: 16px;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── шапка ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar__in {
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; }
.logo:hover { text-decoration: none; }
.logo__mark { font-size: 22px; }
.logo__text { font-size: 16px; letter-spacing: -.2px; white-space: nowrap; }

.topnav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topnav a { color: var(--ink-2); }
.topnav__out { color: var(--muted) !important; }
.topnav__cta {
  background: var(--primary);
  color: #fff !important;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(47, 128, 237, .25);
}
.topnav__cta:hover { background: var(--primary-dark); text-decoration: none; }

/* ── контейнер ─────────────────────────────────────────────────────── */
.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}
.page--narrow { max-width: 900px; }

/* ── герой ─────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #2f80ed 0%, #56ccf2 100%);
  color: #fff;
  border-radius: 24px;
  padding: 26px 22px;
  margin-bottom: 22px;
  box-shadow: 0 12px 30px rgba(47, 128, 237, .22);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, .16);
  border-radius: 50%;
}
.hero h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.2; letter-spacing: -.5px; }
.hero p { margin: 0; opacity: .92; font-size: 15px; max-width: 46ch; }

/* ── сетка карточек ────────────────────────────────────────────────── */
.cards { display: grid; gap: 16px; grid-template-columns: 1fr; }

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
  border: 1px solid rgba(255, 255, 255, .8);
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(28, 78, 140, .14); text-decoration: none; }

.card__cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #cfe6ff, #eaf5ff);
  overflow: hidden;
}
.card__cover img { width: 100%; height: 100%; object-fit: cover; }
.card__cover--empty { display: grid; place-items: center; }
.card__cover-emoji { font-size: 44px; opacity: .55; }
.card__badge { position: absolute; left: 12px; top: 12px; }
.card__city {
  position: absolute; right: 12px; top: 12px;
  background: rgba(13, 43, 71, .78); color: #fff;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .2px;
  backdrop-filter: blur(4px);
}

.card__body { padding: 14px 16px 16px; }
.card__title { margin: 0 0 6px; font-size: 18px; letter-spacing: -.3px; }
.card__text { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; }
.card__meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ── бейджи ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.badge--upcoming { background: rgba(255, 255, 255, .92); color: #0f6cbb; }
.badge--active   { background: #1f9d61; color: #fff; }
.badge--finished { background: rgba(13, 43, 71, .72); color: #fff; }
.badge--draft    { background: #eef2f7; color: #5b6b7c; }

/* ── панели ────────────────────────────────────────────────────────── */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.panel--flat { box-shadow: var(--shadow-sm); }
.panel h2 { margin: 0 0 12px; font-size: 19px; letter-spacing: -.3px; }
.panel h3 { margin: 18px 0 10px; font-size: 16px; }
.panel p { margin: 0 0 12px; color: var(--ink-2); }

.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

/* ── кнопки ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(47, 128, 237, .24);
  transition: background .15s ease, transform .1s ease;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--wide { width: 100%; }
.btn--ghost {
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: none;
}
.btn--ghost:hover { background: #cfe3ff; color: var(--primary-dark); }
.btn--vk { background: #0077ff; box-shadow: 0 6px 16px rgba(0, 119, 255, .3); }
.btn--vk:hover { background: #0066db; }
.btn--sm { min-height: 38px; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn--danger { background: var(--err); box-shadow: none; }
.btn--danger:hover { background: #c9453d; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── формы ─────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="search"], input[type="password"], input[type="datetime-local"], input[type="number"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfdff;
  font: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(47, 128, 237, .12);
  background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
input[type="file"] { font-size: 14px; }

/* ── уведомления ───────────────────────────────────────────────────── */
.notice {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.notice--ok { background: var(--ok-soft); color: #146b43; border: 1px solid #bfe9d3; }
.notice--err { background: var(--err-soft); color: #a5342e; border: 1px solid #f7cfcb; }
.notice--info { background: var(--primary-soft); color: #14538f; border: 1px solid #c8defa; }

/* ── экран квеста ──────────────────────────────────────────────────── */
.quest-head {
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  background: var(--card);
}
.quest-head__cover { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #cfe6ff, #eaf5ff); }
.quest-head__cover img { width: 100%; height: 100%; object-fit: cover; }
.quest-head__body { padding: 18px; }
.quest-head__body h1 { margin: 6px 0 10px; font-size: 23px; letter-spacing: -.4px; }
.quest-head__body p { margin: 0 0 12px; color: var(--ink-2); }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }

.timerbar {
  position: sticky;
  top: 56px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.timerbar__time { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; color: var(--primary-dark); letter-spacing: .5px; }
.timerbar__label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.timerbar__progress { font-size: 14px; color: var(--ink-2); font-weight: 600; }

.riddle { font-size: 17px; line-height: 1.65; color: var(--ink); }
.riddle-image { border-radius: var(--radius-sm); margin: 0 0 14px; overflow: hidden; }

/* ── подсказки и пропуск ───────────────────────────────────────────── */
.points-now {
  background: var(--primary-soft);
  color: #14538f;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.hints { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
.hints__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
}
.hint-form { margin-bottom: 8px; }
.hint-btn {
  width: 100%;
  text-align: left;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px dashed #b9d6f6;
  background: #f7fbff;
  color: var(--primary-dark);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.hint-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.skip-form .btn--ghost { border: 1.5px solid var(--line); box-shadow: none; }
.hint-row {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 8px;
}
.hint-row--open { background: #fff8e6; border: 1px solid #f2dfae; color: #6b4e00; }
.hint-row--empty { background: #f6f8fa; border: 1px dashed var(--line); color: var(--muted); }
.hint-row__label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; opacity: .8; }
.skip-form { margin-top: 0; }

.answer-form { margin-top: 16px; }
.answer-form input[type="text"] { font-size: 17px; padding: 14px 16px; }
.answer-form .btn { margin-top: 12px; }

.feedback { border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 14px; }
.feedback--ok { background: var(--ok-soft); border: 1px solid #bfe9d3; }
.feedback--err { background: var(--err-soft); border: 1px solid #f7cfcb; }
.feedback strong { display: block; margin-bottom: 2px; }
.feedback__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.feedback__head strong { margin: 0; }
.feedback__note { margin-top: 4px; }
.feedback__total {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .75);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  white-space: nowrap;
}
.feedback__total strong { display: inline; font-size: 15px; }

/* ── таблица результатов ───────────────────────────────────────────── */
.results { width: 100%; border-collapse: collapse; font-size: 14px; }
.results th, .results td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
.results th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.results td.num, .results th.num { text-align: right; font-variant-numeric: tabular-nums; }
.results tr:last-child td { border-bottom: 0; }
.results tr.me td { background: #f2f8ff; font-weight: 600; }
.place { font-weight: 700; color: var(--primary-dark); }
.place--1 { color: #d99b00; }
.place--2 { color: #8a9bad; }
.place--3 { color: #b87333; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty__emoji { font-size: 40px; display: block; margin-bottom: 10px; opacity: .7; }

/* ── список шагов в админке ────────────────────────────────────────── */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: 0; }
.steps__num {
  flex: 0 0 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.steps__body { flex: 1; min-width: 0; }
.steps__text { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.steps__actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .steps__actions { width: 100%; }
  .steps__actions .btn, .steps__actions .inline-form { flex: 1 1 140px; }
  .steps__actions .inline-form .btn { width: 100%; }
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }
.row--tight > * { flex: 0 1 auto; }

.inline-form { display: inline; }

/* ── админка ───────────────────────────────────────────────────────── */
body.admin .page { max-width: 980px; }
body.admin textarea { min-height: 130px; }
.adminbar {
  background: #0d2b47;
  color: #cfe3ff;
  font-size: 13px;
}
.adminbar__in {
  max-width: 1140px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.adminbar a { color: #9ecbff; }

/* ── подтверждение ответа ──────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(13, 43, 71, .55);
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal__box {
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(13, 43, 71, .3);
}
.modal__title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.modal__answer {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
  margin-bottom: 12px;
}
.modal__hint { font-size: 14px; color: var(--ink-2); margin-bottom: 18px; }
.modal__actions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.modal__actions .btn { margin: 0; }
body.modal-open { overflow: hidden; }

/* карточка результата ответа */
.modal--result .modal__box--result { text-align: center; }
.result-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
}
.modal--ok .result-icon { background: var(--ok-soft); color: var(--ok); }
.modal--err .result-icon { background: var(--err-soft); color: var(--err); }
.result-title { font-size: 22px; font-weight: 800; letter-spacing: .06em; margin-bottom: 6px; }
.modal--ok .result-title { color: var(--ok); }
.modal--err .result-title { color: var(--err); }
.result-points { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.result-total { font-size: 14px; color: var(--muted); margin-bottom: 20px; }

@media (min-width: 640px) {
  .modal { align-items: center; }
}

/* ── подвал ────────────────────────────────────────────────────────── */
.foot { margin-top: 40px; padding: 28px 16px 36px; background: rgba(255,255,255,.55); border-top: 1px solid var(--line); }
.foot__in {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  grid-template-columns: 1fr;
}
.foot__col h4 { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); }
.foot__col p { margin: 0 0 6px; }
.foot__links { display: flex; gap: 14px; flex-wrap: wrap; }

/* ── «как это работает» ────────────────────────────────────────────── */
.how { display: grid; gap: 14px; margin-top: 4px; }
.how__item { display: flex; gap: 12px; align-items: flex-start; }
.how__num {
  flex: 0 0 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.how__item p { margin: 0; }

/* ── шапка квеста с обложкой ───────────────────────────────────────── */
.quest-hero {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 240px;
  max-height: 520px;
  display: flex;
  align-items: flex-end;
  background: #0d2b47;
  margin-bottom: 18px;
  box-shadow: 0 12px 34px rgba(47, 128, 237, .2);
}
.quest-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.quest-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  pointer-events: none;
}
.quest-hero__overlay {
  position: relative;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  color: #fff;
  background: linear-gradient(180deg, rgba(13, 43, 71, .45) 0%, rgba(13, 43, 71, 0) 30%, rgba(13, 43, 71, 0) 55%, rgba(13, 43, 71, .72) 100%);
}
.quest-hero__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.quest-hero__city {
  margin-left: auto;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff; padding: 4px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; letter-spacing: .2px;
  backdrop-filter: blur(4px);
}
.quest-hero__overlay h1 { margin: 8px 0 6px; font-size: 24px; line-height: 1.2; letter-spacing: -.4px; }
.quest-hero__overlay p { margin: 0; opacity: .92; font-size: 15px; max-width: 60ch; }
.quest-hero .badge { position: static; }
.quest-hero .meta-row { color: rgba(255, 255, 255, .9); margin: 0; text-shadow: 0 1px 3px rgba(13, 43, 71, .5); }

/* заголовок и лид в блоке описания */
.quest-title { margin: 0 0 10px; font-size: 24px; line-height: 1.2; letter-spacing: -.4px; }
.quest-lead { color: var(--ink-2); font-size: 15px; margin: 0 0 16px; }
.quest-desc { color: var(--ink-2); }
.quest-desc p { margin: 0 0 12px; }

/* «Как играть» внутри основной колонки квеста — в один столбец */
.quest-main .how { grid-template-columns: 1fr; }

/* ── сетка страницы квеста с правой колонкой ───────────────────────── */
.quest-layout { display: grid; gap: 18px; align-items: start; }
.quest-side .panel { position: static; }
.side-list { display: grid; gap: 10px; margin: 0 0 14px; }
.side-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.side-row span:first-child { color: var(--muted); }
.side-row span:last-child { font-weight: 600; text-align: right; }

.meta-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.meta-cell {
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}
.meta-cell b { display: block; font-size: 16px; color: var(--ink); }

/* ── игровой экран ─────────────────────────────────────────────────── */
.play-wrap { max-width: 100%; margin: 0 auto; }
@media (min-width: 900px) {
  body.is-playing .page { max-width: 880px; }
}

@media (max-width: 480px) {
  .logo__text { font-size: 14px; }
  .logo__mark { font-size: 19px; }
  .topnav { gap: 10px; font-size: 13px; }
  .topnav__cta { padding: 7px 12px; }
}

/* ── планшет и десктоп ─────────────────────────────────────────────── */
@media (min-width: 640px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .hero { padding: 32px 30px; }
  .hero h1 { font-size: 30px; }
  .page { padding: 24px 20px 50px; }
  .quest-hero { min-height: 300px; }
  .quest-hero__overlay { padding: 22px 26px; }
  .quest-title { font-size: 27px; }
  .quest-lead { font-size: 16px; }
  .how { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
  .foot__in { grid-template-columns: 1.4fr 1fr 1fr; }
}

@media (min-width: 900px) {
  .hero { padding: 40px 38px; }
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 17px; }
  .card__title { font-size: 19px; }
  .panel { padding: 22px; }
  .riddle { font-size: 18px; }
  .play-wrap { max-width: 860px; }
  .results th, .results td { padding: 13px 12px; }
}

@media (min-width: 1024px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .quest-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .quest-side { position: sticky; top: 84px; }
  .quest-hero { min-height: 300px; }
  .quest-title { font-size: 30px; }
}

@media (min-width: 1280px) {
  .page { padding: 28px 24px 60px; }
  .hero h1 { font-size: 42px; }
  .quest-hero { min-height: 330px; }
}
