/* Кастом поверх Tailwind: то, чего сложно достичь утилитами.
   Палитра: небесно-синий + морская бирюза + изумрудные акценты. */

html, body { height: 100%; }
body {
  background-image:
    radial-gradient(at 0% 0%, rgba(75,169,226,0.22) 0px, transparent 55%),
    radial-gradient(at 100% 0%, rgba(45,212,191,0.18) 0px, transparent 55%),
    radial-gradient(at 50% 100%, rgba(127,197,245,0.18) 0px, transparent 60%);
  background-attachment: fixed;
}

/* Скроллбар: тонкий, в тон неба */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(31,110,168,0.25); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(31,110,168,0.45); }
#adminPanel *::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
#adminPanel *::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* ─── Hero-карточка приветствия ───────────────────────────────────────── */
.hero-card {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  padding: 40px 24px 36px;
  text-align: center;
  background:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.18) 0, transparent 45%),
    linear-gradient(160deg, #4ba9e2 0%, #2b8ac8 45%, #195685 100%);
  box-shadow: 0 18px 48px rgba(13,45,71,0.22), inset 0 -1px 0 rgba(255,255,255,0.06);
}
.hero-card::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 60px;
  background: linear-gradient(to top, rgba(34,197,94,0.28), transparent);
  pointer-events: none;
}
.hero-clouds {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120px 40px at 15% 30%, rgba(255,255,255,0.45), transparent 70%),
    radial-gradient(ellipse 80px 28px at 85% 18%, rgba(255,255,255,0.35), transparent 70%),
    radial-gradient(ellipse 150px 50px at 50% 85%, rgba(255,255,255,0.25), transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
.hero-avatar {
  width: 104px; height: 104px;
  margin: 0 auto 18px;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 30px rgba(10,45,71,0.35), 0 0 0 6px rgba(255,255,255,0.22);
  border: 4px solid #fff;
}
.hero-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 28% center;
  display: block;
}

/* Markdown в ответах бота */
.msg-content p { margin: 0 0 .55em; }
.msg-content p:last-child { margin: 0; }
.msg-content strong { font-weight: 600; }
.msg-content em { font-style: italic; }

/* Бабблы */
.bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.55;
  font-size: 14.75px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.bubble.user {
  margin-left: auto;
  background: linear-gradient(135deg, #4ba9e2 0%, #1f6ea8 100%);
  color: #ffffff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 16px rgba(31,110,168,.28);
}
.bubble.bot {
  background: #ffffff;
  color: #0d2d47;
  border: 1px solid #dcf0ff;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 10px rgba(13,45,71,.06);
}
.bubble.thinking {
  font-style: italic;
  color: #195685;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.bubble.thinking .dot {
  width: 6px; height: 6px; border-radius: 999px; background: currentColor;
  animation: bounce 1.2s infinite ease-in-out both;
}
.bubble.thinking .dot:nth-child(2) { animation-delay: -.16s; }
.bubble.thinking .dot:nth-child(3) { animation-delay: -.32s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(.6); opacity: .5; }
  40% { transform: scale(1); opacity: 1; }
}

.bubble.error {
  background: #fdf2f3;
  border-color: #f4c8cd;
  color: #8b1d2a;
}

/* Follow-ups (chip-кнопки) */
.followups { display: flex; flex-wrap: wrap; gap: 8px; max-width: 85%; margin-top: 4px; }
.followup-btn {
  background: #ffffff;
  border: 1px solid #b5dfff;
  color: #195685;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.followup-btn:hover {
  background: #dcf0ff;
  border-color: #4ba9e2;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(31,110,168,.18);
}
.followup-btn::before { content: '💬'; opacity: .7; }

/* Welcome cards */
.welcome-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #dcf0ff;
  border-radius: 20px;
  padding: 18px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: all .25s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}
.welcome-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #4ba9e2, #2dd4bf 60%, #22c55e);
  opacity: .85;
}
.welcome-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(31,110,168,.20);
  border-color: #7fc5f5;
}
.welcome-card .img-wrap {
  width: 60px; height: 60px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #dcf0ff 0%, #7fc5f5 100%);
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(31,110,168,.18);
}
.welcome-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.welcome-card .block-tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #14b8a6;
  font-weight: 700;
}
.welcome-card .q-text {
  font-size: 14.5px;
  font-weight: 500;
  color: #0d2d47;
  line-height: 1.4;
}

/* Debug panel */
.kv {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 3px 0;
}
.kv .k { color: #7fc5f5; }
.kv .v { color: #dcf0ff; text-align: right; word-break: break-word; }

.debug-section {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 12px;
}
.debug-section h4 {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #7fc5f5;
  margin: 0 0 8px;
  font-weight: 700;
}

.chunk {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
  color: #dcf0ff;
  font-size: 11px;
  line-height: 1.5;
}
.chunk-meta {
  color: #7fc5f5;
  font-size: 10.5px;
  margin-bottom: 4px;
  font-family: 'Inter', sans-serif;
}

.callrow {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 3px 10px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  font-size: 11px;
}
.callrow:last-child { border-bottom: none; }
.callrow .agent { color: #fbbf24; font-weight: 700; }

/* Tiny utilities */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 999px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Табы: Темы / Карта / Календарь ─────────────────────────────────── */
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: #195685;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.tab-btn:hover { background: #dcf0ff; }
.tab-btn.tab-active {
  background: linear-gradient(135deg, #4ba9e2 0%, #1f6ea8 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(31,110,168,.32);
}
.tab-icon { font-size: 14px; line-height: 1; }

/* ─── Карта: Leaflet customization ───────────────────────────────────── */
.ct-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}
.ct-pin {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(13,45,71,.30);
  display: block;
  transition: transform .15s ease;
}
.ct-marker:hover .ct-pin { transform: scale(1.2); }

/* Leaflet popup — в морскую палитру */
.ct-popup .leaflet-popup-content-wrapper {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #dcf0ff;
  box-shadow: 0 14px 32px rgba(31,110,168,.22);
  padding: 0;
}
.ct-popup .leaflet-popup-content {
  margin: 0;
  padding: 14px 16px 14px;
  min-width: 240px;
}
.ct-popup .leaflet-popup-tip { background: #ffffff; border: 1px solid #dcf0ff; }

.map-popup .mp-head { margin-bottom: 6px; }
.map-popup .mp-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: #0d2d47;
  line-height: 1.15;
}
.map-popup .mp-name-ct {
  font-size: 12.5px;
  color: #14b8a6;
  font-style: italic;
  margin-top: 2px;
}
.map-popup .mp-period {
  font-size: 11px;
  color: #195685;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 6px 0 8px;
  font-weight: 600;
}
.map-popup .mp-short {
  font-size: 13.5px;
  color: #144265;
  line-height: 1.5;
  margin-bottom: 12px;
}
.map-popup .mp-ask {
  width: 100%;
  padding: 9px 12px;
  background: linear-gradient(135deg, #4ba9e2 0%, #1f6ea8 100%);
  color: #fff;
  border: 0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.map-popup .mp-ask:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31,110,168,.35);
}

/* Легенда карты */
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid #dcf0ff;
  border-radius: 999px;
  color: #195685;
  font-weight: 500;
}
.legend-chip [class^="dot-"] {
  width: 10px; height: 10px; border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.dot-cap { background: #f59e0b; }
.dot-for { background: #1f6ea8; }
.dot-arc { background: #14b8a6; }
.dot-cty { background: #22c55e; }

/* ─── Календарь ──────────────────────────────────────────────────────── */
.cal-today {
  position: relative;
  border-radius: 20px;
  padding: 22px 22px;
  overflow: hidden;
}
.cal-today-featured {
  background: linear-gradient(135deg, #4ba9e2 0%, #195685 55%, #0f9488 100%);
  color: #f2f9ff;
  cursor: pointer;
  transition: all .2s ease;
  border: 0;
  width: 100%;
  text-align: left;
  display: block;
  box-shadow: 0 10px 28px rgba(31,110,168,.28);
}
.cal-today-featured:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(31,110,168,.38);
}
.cal-today-empty {
  background: #ffffff;
  border: 1px dashed #7fc5f5;
  color: #195685;
}
.cal-today .ct-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .90;
  font-weight: 700;
  margin-bottom: 4px;
}
.cal-today .ct-date {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 6px;
}
.cal-today .ct-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 2px;
}
.cal-today .ct-ct {
  font-size: 13px;
  font-style: italic;
  opacity: .85;
  margin-bottom: 8px;
}
.cal-today .ct-text {
  font-size: 14px;
  line-height: 1.55;
  opacity: .97;
}
.cal-today-featured .ct-cta {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: .95;
}

/* Карточки праздников */
.cal-card {
  position: relative;
  text-align: left;
  background: #ffffff;
  border: 1px solid #dcf0ff;
  border-radius: 18px;
  padding: 16px;
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(31,110,168,.18);
  border-color: #7fc5f5;
}
.cal-card .cc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.cal-card .cc-date {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #14b8a6;
  font-weight: 700;
}
.cal-card .cc-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcf0ff;
  color: #195685;
  text-transform: lowercase;
  font-weight: 600;
}
.cal-card .cc-tag-spring   { background: #dff3e4; color: #15803d; }
.cal-card .cc-tag-autumn   { background: #fef3c7; color: #b45309; }
.cal-card .cc-tag-religion { background: #e0f2fe; color: #1f6ea8; }
.cal-card .cc-tag-memory   { background: #fee2e2; color: #991b1b; }
.cal-card .cc-tag-national { background: #ccfbf1; color: #0f766e; }
.cal-card .cc-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  color: #0d2d47;
  line-height: 1.2;
}
.cal-card .cc-ct {
  font-size: 12px;
  color: #14b8a6;
  font-style: italic;
  margin-bottom: 2px;
}
.cal-card .cc-short {
  font-size: 13px;
  line-height: 1.5;
  color: #144265;
}

/* Исторические события — timeline-стиль */
.cal-event {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  background: #ffffff;
  border: 1px solid #dcf0ff;
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all .2s ease;
  width: 100%;
}
.cal-event:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(31,110,168,.18);
  border-color: #7fc5f5;
}
.cal-event .ce-year {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: #2b8ac8;
  line-height: 1;
  align-self: center;
  border-right: 1px solid #dcf0ff;
  padding-right: 16px;
}
.cal-event .ce-body { min-width: 0; }
.cal-event .ce-date {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #14b8a6;
  font-weight: 700;
  margin-bottom: 3px;
}
.cal-event .ce-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: #0d2d47;
  margin-bottom: 4px;
}
.cal-event .ce-short {
  font-size: 13px;
  line-height: 1.5;
  color: #144265;
}

/* ─── Открытка ───────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.postcard-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.photo-drop {
  display: block;
  cursor: pointer;
  user-select: none;
}
.pd-preview {
  position: relative;
  border: 2px dashed #7fc5f5;
  border-radius: 20px;
  background: #ffffff;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all .2s ease;
}
.photo-drop:hover .pd-preview {
  border-color: #2b8ac8;
  background: #f2f9ff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(31,110,168,.15);
}
.pd-preview.has-photo {
  border-style: solid;
  border-color: #4ba9e2;
  padding: 0;
  min-height: 280px;
}
.pd-placeholder {
  text-align: center;
  padding: 28px 20px;
  color: #195685;
}
.pd-icon {
  width: 42px; height: 42px;
  margin: 0 auto 10px;
  color: #2b8ac8;
  display: block;
}
.pd-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: #0d2d47;
  margin-bottom: 4px;
}
.pd-hint {
  font-size: 12.5px;
  color: #195685;
  opacity: .85;
}
.pd-img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}
.pc-change-photo {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: #ffffff;
  color: #195685;
  border: 1px solid #b5dfff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 2px 6px rgba(31, 110, 168, .08);
}
.pc-change-photo:hover {
  background: #dcf0ff;
  border-color: #4ba9e2;
  transform: translateY(-1px);
}
.pd-preview.shake {
  animation: shakeX .45s ease;
  border-color: #c14a55;
}
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Поля формы */
.pc-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px) {
  .pc-fields { grid-template-columns: 1fr 1fr; }
}
.pc-field { display: flex; flex-direction: column; gap: 6px; }
.pc-field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #195685;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pc-optional {
  text-transform: none;
  letter-spacing: 0;
  font-size: 10.5px;
  font-weight: 500;
  color: #14b8a6;
  opacity: .85;
  padding: 2px 7px;
  background: #ccfbf1;
  border-radius: 999px;
}
.pc-field input {
  background: #ffffff;
  border: 1px solid #dcf0ff;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14.5px;
  color: #0d2d47;
  outline: none;
  transition: all .15s ease;
}
.pc-field input:focus {
  border-color: #4ba9e2;
  box-shadow: 0 0 0 3px rgba(75,169,226,.18);
}

/* Кнопка «Создать» */
.pc-generate {
  margin-top: 4px;
  padding: 14px 22px;
  background: linear-gradient(135deg, #2dd4bf 0%, #1f6ea8 100%);
  color: #ffffff;
  border: 0;
  border-radius: 14px;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 6px 16px rgba(31,110,168,.28);
}
.pc-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(31,110,168,.38);
}
.pc-generate:disabled {
  opacity: .7;
  cursor: wait;
}

/* Результат */
.postcard-result {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid #dcf0ff;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.pr-preview {
  background: #ffffff;
  border: 1px solid #dcf0ff;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 10px 24px rgba(31,110,168,.15);
}
.pr-img {
  display: block;
  width: 100%;
  height: auto;
}
.pr-error {
  padding: 18px;
  color: #8b1d2a;
  font-size: 13.5px;
  background: #fdf2f3;
}
.pr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pr-btn {
  flex: 1 1 0;
  min-width: 130px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .15s ease;
}
.pr-primary {
  background: linear-gradient(135deg, #4ba9e2 0%, #1f6ea8 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(31,110,168,.28);
}
.pr-primary:hover {
  background: linear-gradient(135deg, #2b8ac8 0%, #195685 100%);
  transform: translateY(-1px);
}
.pr-secondary {
  background: #ffffff;
  color: #195685;
  border: 1px solid #b5dfff;
}
.pr-secondary:hover {
  background: #dcf0ff;
  border-color: #4ba9e2;
}
.pr-accent {
  background: linear-gradient(135deg, #2dd4bf 0%, #14b8a6 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(20, 184, 166, .32);
  flex: 1 1 100%;
}
.pr-accent:hover:not(:disabled) {
  background: linear-gradient(135deg, #14b8a6 0%, #0f9488 100%);
  transform: translateY(-1px);
}
.pr-accent:disabled {
  opacity: .7;
  cursor: wait;
  transform: none;
}

/* ─── Квест ──────────────────────────────────────────────────────────── */
.quest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 14px;
}
.quest-back {
  font-size: 14px;
  color: #195685;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.quest-back:hover { background: #dcf0ff; }
.quest-counter {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: #0d2d47;
  background: #fff;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid #dcf0ff;
  box-shadow: 0 2px 8px rgba(13,45,71,.08);
}
.quest-counter #questCount { color: #14b8a6; }

.quest-progress {
  height: 6px;
  background: #dcf0ff;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 20px;
}
.quest-bar {
  height: 100%;
  background: linear-gradient(90deg, #4ba9e2 0%, #2dd4bf 60%, #22c55e 100%);
  border-radius: 999px;
  transition: width .5s ease;
}

.quest-card {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(13,45,71,.18);
  border: 1px solid #dcf0ff;
}
.quest-badge {
  position: absolute;
  top: 14px; right: 14px;
  width: 48px; height: 48px;
  border-radius: 999px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 6px 18px rgba(13,45,71,.25);
  z-index: 2;
}
.quest-img {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, #4ba9e2 0%, #1f6ea8 100%);
}
.quest-img::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 60px;
  background: linear-gradient(to top, #ffffff, transparent);
}
.quest-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.quest-body {
  padding: 18px 22px 22px;
}
.quest-step-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #14b8a6;
  font-weight: 700;
  margin-bottom: 6px;
}
.quest-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: #0d2d47;
  line-height: 1.15;
  margin-bottom: 10px;
}
.quest-hint {
  font-size: 15.5px;
  line-height: 1.55;
  color: #144265;
  margin-bottom: 10px;
}
.quest-meta {
  display: inline-block;
  font-size: 12.5px;
  color: #195685;
  background: #f2f9ff;
  border: 1px solid #b5dfff;
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 14px;
}
.quest-fact {
  background: linear-gradient(135deg, #f2f9ff 0%, #ccfbf1 100%);
  border-left: 3px solid #14b8a6;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #0d2d47;
  margin-bottom: 18px;
  font-style: italic;
}
.quest-done {
  width: 100%;
  padding: 14px 22px;
  background: linear-gradient(135deg, #22c55e 0%, #14b8a6 100%);
  color: #ffffff;
  border: 0;
  border-radius: 14px;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 6px 16px rgba(20,184,166,.35);
}
.quest-done:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(20,184,166,.45);
}
.quest-done:disabled { opacity: .65; cursor: not-allowed; }
.quest-qr-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #195685;
  opacity: .75;
  text-align: center;
}

/* Финал */
.quest-finale {
  background: linear-gradient(160deg, #4ba9e2 0%, #2b8ac8 45%, #0f9488 100%);
  border-radius: 24px;
  padding: 40px 28px 32px;
  text-align: center;
  color: #fff;
  box-shadow: 0 20px 56px rgba(13,45,71,.35);
  position: relative;
  overflow: hidden;
}
.quest-finale::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.25), transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.18), transparent 30%);
  pointer-events: none;
}
.qf-confetti {
  font-size: 64px;
  margin-bottom: 12px;
  animation: qf-bounce 1.6s ease-in-out infinite;
}
@keyframes qf-bounce {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-8px) rotate(6deg); }
}
.qf-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 34px;
  font-weight: 600;
  margin-bottom: 6px;
  position: relative;
}
.qf-subtitle {
  font-size: 14px;
  opacity: .9;
  margin-bottom: 16px;
  position: relative;
}
.qf-message {
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 24px;
  opacity: .96;
  position: relative;
}
.quest-finale .quest-done {
  background: #ffffff;
  color: #0f9488;
  box-shadow: 0 8px 22px rgba(0,0,0,.15);
}
.quest-finale .quest-done:hover { background: #f2f9ff; color: #0d7a68; }
.quest-finale .quest-done.qf-secondary {
  background: rgba(255,255,255,.14);
  color: #fff;
  backdrop-filter: blur(6px);
  box-shadow: none;
  margin-top: 10px;
}
.quest-finale .quest-done.qf-secondary:hover { background: rgba(255,255,255,.22); color: #fff; }

.qf-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: rgba(255,255,255,.16);
  border-radius: 999px;
  margin-bottom: 14px;
  position: relative;
  backdrop-filter: blur(6px);
}
.qf-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,.3);
  border: 2px solid rgba(255,255,255,.7);
}
.qf-username {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: .01em;
}

.qf-prize {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 20px;
  padding: 18px 18px 16px;
  margin-bottom: 22px;
  backdrop-filter: blur(8px);
  position: relative;
  text-align: left;
}
.qf-prize-icon {
  font-size: 28px;
  margin-bottom: 6px;
}
.qf-prize-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.qf-prize-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(255,255,255,.94);
}
.quest-restart {
  margin-top: 10px;
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 13px;
  cursor: pointer;
  opacity: .85;
  text-decoration: underline;
  padding: 6px;
}
.quest-restart:hover { opacity: 1; }

/* Требование отсканить QR */
.quest-need-scan {
  background: #ffffff;
  border: 1px dashed #7fc5f5;
  border-radius: 20px;
  padding: 28px 22px;
  text-align: center;
  margin-top: 18px;
}
.qns-emoji { font-size: 48px; margin-bottom: 10px; }
.quest-need-scan h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: #0d2d47;
  margin-bottom: 8px;
}
.quest-need-scan p {
  font-size: 13.5px;
  line-height: 1.55;
  color: #195685;
  margin-bottom: 18px;
}
.quest-need-scan .quest-restart { color: #1f6ea8; text-decoration: none; border: 1px solid #b5dfff; border-radius: 999px; padding: 8px 18px; background: #fff; }
.quest-need-scan .quest-restart:hover { background: #dcf0ff; }

/* ─── Blocked overlay ─────────────────────────────────────────────────── */
#blockedOverlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#blockedOverlay .bo-backdrop {
  position: absolute; inset: 0;
  background: rgba(13,45,71,0.55);
  backdrop-filter: blur(6px);
}
#blockedOverlay .bo-card {
  position: relative;
  max-width: 440px;
  width: 100%;
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 28px 28px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(13,45,71,0.35);
  border: 1px solid #dcf0ff;
  animation: bo-pop .22s ease-out both;
}
@keyframes bo-pop {
  0% { opacity: 0; transform: translateY(16px) scale(.98); }
  100% { opacity: 1; transform: none; }
}
#blockedOverlay .bo-emoji {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 14px;
}
#blockedOverlay .bo-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  color: #0d2d47;
  margin-bottom: 10px;
  line-height: 1.2;
}
#blockedOverlay .bo-text {
  font-size: 14.5px;
  line-height: 1.55;
  color: #195685;
  margin-bottom: 22px;
}
#blockedOverlay .bo-text b { color: #0d2d47; font-weight: 600; }
#blockedOverlay .bo-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#blockedOverlay .bo-btn {
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  transition: all .15s ease;
}
#blockedOverlay .bo-btn:disabled { opacity: .65; cursor: wait; }
#blockedOverlay .bo-primary {
  background: linear-gradient(135deg, #4ba9e2 0%, #1f6ea8 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(31,110,168,.28);
}
#blockedOverlay .bo-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(31,110,168,.35);
}
#blockedOverlay .bo-secondary {
  background: #f2f9ff;
  color: #195685;
  border: 1px solid #b5dfff;
}
#blockedOverlay .bo-secondary:hover:not(:disabled) {
  background: #dcf0ff;
  border-color: #4ba9e2;
}
