/* ==========================================================================
   1. ПЕРЕМЕННЫЕ И БАЗОВЫЕ СТИЛИ
   ========================================================================== */
:root {
  --brand-red: #E53945;
  --brand-red-dark: #CC2936;
  --brand-red-light: #FCE8EA;
  --turquoise: #2CE5D8;
  --turquoise-soft: rgba(44, 229, 216, 0.2);
  --lime-bgi: #B5F236;
  --blue-mgsu: #163A70;
  --dark-card: #18181A;
  --green-badge-bg: #E5F9EC;
  --green-text: #27AE60;
  --yellow-badge-bg: #FEF5D8;
  --yellow-text: #B9770E;
  --bg-white: #FFFFFF;
  --bg-gray-soft: #F3F4F6;
  --border-gray: #E5E7EB;
  --text-black: #141414;
  --text-gray: #8A8E96;
  --font-main: 'Unbounded', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-pill: 999px;
  --radius-card: 22px;
  --transition-fast: 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-white);
  color: var(--text-black);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.text-red { color: var(--brand-red); }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGreenDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.15; transform: scale(0.8); }
}

/* ==========================================================================
   2. КНОПКИ И СОСТОЯНИЯ
   ========================================================================== */
.pill-btn {
  width: 100%;
  height: 52px;
  border-radius: var(--radius-pill);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1.5px solid transparent;
  user-select: none;
}

.pill-btn:active:not(:disabled) { transform: scale(0.97); }
.btn-arrow { position: absolute; right: 20px; font-size: 20px; }

.btn-white-red { background: var(--bg-white); color: var(--brand-red); }
.btn-outline-white { background: transparent; border-color: rgba(255, 255, 255, 0.85); color: var(--bg-white); }

.role-option-btn { background: var(--bg-white); border-color: var(--brand-red); color: var(--brand-red); }
.role-option-btn.selected,
.role-option-btn:active {
  background: var(--brand-red);
  color: var(--bg-white);
  box-shadow: 0 6px 18px rgba(229, 57, 69, 0.28);
}

.btn-continue { background: var(--bg-white); border-color: #CFCFCF; color: #B0B0B0; }
.btn-continue:not(:disabled),
.btn-continue.active {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: var(--bg-white);
  box-shadow: 0 6px 18px rgba(229, 57, 69, 0.28);
}

.btn-saved-gray {
  background: #E5E7EB;
  border-color: #D5D8DE;
  color: #6B7280;
  box-shadow: none;
  cursor: default;
}

/* Кнопка отправки/сохранения прямо под правилами составления письма */
.wishes-primary-action {
  margin-top: 16px;
}

.btn-back-pill {
  flex: 1;
  height: 52px;
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: var(--bg-white);
  box-shadow: 0 6px 18px rgba(229, 57, 69, 0.28);
}

.btn-back-pill:active {
  background: var(--brand-red-dark);
  border-color: var(--brand-red-dark);
}

.btn-back-icon {
  position: absolute;
  left: 20px;
  font-size: 20px;
}

/* Кнопка корзины справа снизу на экране пожеланий */
.circle-trash-btn {
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 50%;
  background: var(--bg-gray-soft);
  border: 1.5px solid var(--border-gray);
  color: #6B7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.circle-trash-btn:active {
  background: var(--brand-red-light);
  border-color: var(--brand-red);
  color: var(--brand-red);
  transform: scale(0.94);
}

.circle-back-btn {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  background: var(--bg-white);
  border: 1.5px solid var(--brand-red);
  color: var(--brand-red);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.circle-back-btn:active {
  background: var(--brand-red);
  color: var(--bg-white);
  transform: scale(0.94);
}

/* ==========================================================================
   3. ШАПКА (BGI + ТЕХ. ПОДДЕРЖКА) И ЭКРАНЫ WELCOME / РЕГИСТРАЦИИ
   ========================================================================== */
.top-brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}

.bgi-logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.header-support-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #EE5863;
  border: none;
  color: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform var(--transition-fast), background 0.2s;
}

.header-support-btn:active {
  transform: scale(0.92);
  background: #F26A74;
}

.header-support-btn .material-symbols-rounded {
  font-size: 22px;
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 22px 32px;
  animation: fadeSlideUp 0.25s ease;
}

.screen-red { background-color: var(--brand-red); color: var(--bg-white); }
.hero-title { font-size: 34px; font-weight: 800; line-height: 1.15; margin-bottom: 14px; }
.hero-subtext { font-size: 12px; font-weight: 400; line-height: 1.5; opacity: 0.9; max-width: 310px; }

.welcome-illustration-placeholder {
  margin: 44px auto;
  height: 200px;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.welcome-illustration-placeholder .material-symbols-rounded { font-size: 48px; }
.welcome-bottom-actions { display: flex; flex-direction: column; gap: 12px; }

.reg-progress-wrap { padding-top: 4px; margin-bottom: 24px; }
.reg-progress-track { width: 100%; height: 6px; background: #F0F0F2; border-radius: var(--radius-pill); overflow: hidden; }
.reg-progress-fill { height: 100%; background: var(--brand-red); border-radius: var(--radius-pill); transition: width 0.35s ease; }
.reg-progress-fill.step-1 { width: 8px; }
.reg-progress-fill.step-2 { width: 38%; }
.reg-progress-fill.step-3 { width: 72%; }

.reg-slide { display: none; flex: 1; flex-direction: column; justify-content: space-between; animation: fadeSlideUp 0.25s ease; }
.reg-slide.active { display: flex; }
.reg-content-center { margin: auto 0; }
.reg-content-top { margin-top: 8px; }
.reg-heading { font-size: 24px; font-weight: 700; line-height: 1.25; margin-bottom: 22px; }
.role-options-list { display: flex; flex-direction: column; gap: 12px; }
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 7px; }

.form-input {
  width: 100%;
  height: 46px;
  background: #F9F9FB;
  border: 1.2px solid #E4E5EA;
  border-radius: 14px;
  padding: 0 14px;
  font-family: var(--font-main);
  font-size: 12px;
  color: var(--text-black);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus { border-color: var(--brand-red); background: #FFFFFF; }

.custom-select-trigger {
  width: 100%;
  height: 46px;
  background: #F9F9FB;
  border: 1.2px solid #E4E5EA;
  border-radius: 14px;
  padding: 0 14px;
  font-family: var(--font-main);
  font-size: 12px;
  color: var(--text-black);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.custom-select-trigger .placeholder { color: var(--text-gray); }
.form-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.consent-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; cursor: pointer; user-select: none; }
.consent-checkbox {
  width: 24px; height: 24px; min-width: 24px; border-radius: 7px;
  background: #EBEDF0; border: 1.5px solid #D5D8DE; color: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all 0.18s ease; margin-top: 1px;
}
.consent-checkbox .material-symbols-rounded { font-size: 17px; font-weight: 700; }
.consent-checkbox.checked { background: var(--brand-red); border-color: var(--brand-red); color: var(--bg-white); box-shadow: 0 3px 10px rgba(229, 57, 69, 0.28); }
.consent-text { font-size: 10px; line-height: 1.45; color: #555860; }

.textarea-counter-wrap {
  position: relative;
  width: 100%;
}

.wishes-textarea {
  width: 100%;
  height: 185px;
  background: #F9F9FB;
  border: 1.2px solid #E4E5EA;
  border-radius: 18px;
  padding: 14px 16px 30px;
  font-family: var(--font-main);
  font-size: 12px;
  line-height: 1.5;
  resize: none;
  outline: none;
  display: block;
}

.wishes-textarea:focus {
  border-color: var(--brand-red);
  background: #FFF;
}

.char-counter {
  position: absolute;
  right: 14px;
  bottom: 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-gray);
  pointer-events: none;
  user-select: none;
  transition: color 0.18s ease;
}

.char-counter.limit-reached {
  color: var(--brand-red);
  font-weight: 700;
}

.wishes-rules-placeholder {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-gray-soft);
  border-radius: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-gray);
  font-size: 10px;
  line-height: 1.5;
}

.wishes-rules-placeholder .material-symbols-rounded { font-size: 18px; color: #9CA3AF; flex-shrink: 0; margin-top: 1px; }
.reg-bottom-bar { display: flex; gap: 12px; padding-top: 20px; }

/* ==========================================================================
   4. ГЛАВНЫЙ ЭКРАН, ПЛИТКИ ИВЕНТОВ + ГОРИЗОНТАЛЬНЫЕ КАРТОЧКИ НОВОСТЕЙ/ПОМОЩИ
   ========================================================================== */
.tab-page { display: none; min-height: 100vh; padding-bottom: 175px; animation: fadeSlideUp 0.24s ease; }
.tab-page.active { display: block; }

.home-red-top {
  background: var(--brand-red);
  color: var(--bg-white);
  padding: 20px 22px 54px;
}

.home-white-sheet {
  background: var(--bg-white);
  border-radius: 28px 28px 0 0;
  margin-top: -28px;
  padding: 24px 20px;
  min-height: 64vh;
}

.sheet-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-spacer {
  margin-top: 26px;
}

.sheet-subtitle { font-size: 13px; font-weight: 600; color: var(--text-gray); }

.text-link-btn {
  background: none; border: none; font-family: var(--font-main);
  font-size: 12px; font-weight: 600; color: var(--brand-red);
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
}

.text-link-btn .material-symbols-rounded { font-size: 17px; }

/* --- ГОРИЗОНТАЛЬНАЯ ЛЕНТА ПЛИТОК (Новости и Нужна помощь?) --- */
.horizontal-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin: -10px -20px -22px;
  padding: 10px 0 30px 20px;
  /* Симметричные отступы для scroll-snap слева и справа */
  scroll-padding: 0 20px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.horizontal-scroll-row::-webkit-scrollbar {
  display: none;
}

/* Последняя карточка прилипает с правым отступом scroll-padding-right (20px) */
.promo-tile:last-child {
  scroll-snap-align: end;
}

/* Несхлопывающийся спейсер: 12px (gap) + 8px (width) = ровно 20px справа на iOS и Android */
.horizontal-scroll-row::after {
  content: "\00a0";
  display: block;
  flex: 0 0 8px;
  min-width: 8px;
  width: 8px;
  height: 1px;
  visibility: hidden;
}

.promo-tile {
  flex: 0 0 232px;
  height: 162px;
  border-radius: 24px;
  padding: 18px;
  color: var(--bg-white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  scroll-snap-align: start;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast);
  user-select: none;
}

.promo-tile:active {
  transform: scale(0.96);
}

.promo-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
}

/* Вариации цветов карточек по референсу */
.tile-brand-red {
  background: linear-gradient(145deg, var(--brand-red) 0%, #C62834 100%);
  box-shadow: 0 8px 20px rgba(229, 57, 69, 0.25);
}

.tile-dark-bgi {
  background-color: #202124;
  color: var(--bg-white);
  background-image:
    linear-gradient(180deg, rgba(28, 29, 34, 0.9) 22%, rgba(28, 29, 34, 0.45) 100%),
    url("img/curators.webp");
  background-size: cover;
  background-position: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

.tile-blue-mgsu {
  background-color: #163A70;
  background-image:
    linear-gradient(180deg, rgba(22, 58, 112, 0.9) 22%, rgba(22, 58, 112, 0.42) 100%),
    url("img/mgsu-campus.webp");
  background-size: cover;
  background-position: center;
  box-shadow: 0 6px 16px rgba(22, 58, 112, 0.22);
}

.tile-help-dark {
  background: linear-gradient(145deg, #23252A 0%, #141518 100%);
}

.tile-help-blue {
  background: linear-gradient(145deg, #1D4B8F 0%, #122F5C 100%);
}

.promo-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.promo-logo-white {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--bg-white);
}

.promo-logo-lime {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--lime-bgi);
}

.promo-emblem-mgsu {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
}

.promo-emblem-mgsu .material-symbols-rounded {
  font-size: 22px;
}

.promo-tag-soft {
  background: rgba(255, 255, 255, 0.16);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
}

.promo-tile-title {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  z-index: 2;
}

/* --- ПЛИТКИ КАЛЕНДАРЯ ИВЕНТОВ --- */
.page-title { font-size: 19px; font-weight: 600; padding: 24px 20px 18px; }
.events-list { padding: 0 20px; display: flex; flex-direction: column; gap: 16px; }

.event-tile-card {
  background: var(--bg-white);
  border-radius: var(--radius-card);
  border: 1.5px solid #EAECEF;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
  padding: 16px 18px;
  cursor: pointer;
  transition: transform var(--transition-fast);
  user-select: none;
}

.event-tile-card:active { transform: scale(0.98); }
.event-tile-card.tile-closed-warning { background: var(--bg-gray-soft); border-color: #DCDFE6; box-shadow: none; }
.tile-top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }

.tile-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 600; }
.badge-green { background: var(--green-badge-bg); color: var(--green-text); }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-text); display: inline-block; animation: pulseGreenDot 1.8s infinite ease-in-out; }
.badge-yellow-warning { background: var(--yellow-badge-bg); color: var(--yellow-text); }
.badge-yellow-warning .material-symbols-rounded { font-size: 14px; }
/* Синяя панелька обратного отсчета до конца игры (после жеребьевки) */
.badge-blue {
  background: rgba(37, 99, 235, 0.12);
  color: #1D4ED8;
}

/* Красная панелька обратного отсчета в последний день игры (< 24 часов до конца) */
.badge-red-urgent {
  background: var(--brand-red-light);
  color: var(--brand-red);
}

.badge-blue .material-symbols-rounded,
.badge-red-urgent .material-symbols-rounded {
  font-size: 14px;
}

.tile-participants { font-size: 10px; color: var(--text-gray); }
.tile-date { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.tile-meta-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.tile-meta-line { font-size: 11px; color: var(--text-gray); }
.tile-meta-line strong { color: var(--text-black); font-weight: 500; }
.tile-bottom-row { display: flex; justify-content: space-between; align-items: center; }

.player-progress-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-gray-soft); color: #4B5563;
  padding: 6px 12px; border-radius: 10px; font-size: 10px; font-weight: 500;
}

.tile-closed-warning .player-progress-pill { background: #E5E7EB; }
.player-progress-pill .material-symbols-rounded { font-size: 15px; }
.player-progress-pill.done { color: var(--green-text); }

/* ==========================================================================
   5. ПРОФИЛЬ
   ========================================================================== */
.profile-hero-card,
.profile-edit-card {
  margin: 0 20px 16px;
  padding: 18px;
  background: var(--bg-white);
  border: 1.5px solid #EAECEF;
  border-radius: var(--radius-card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.profile-hero-card { display: flex; align-items: center; gap: 16px; }

.profile-avatar {
  width: 70px; height: 70px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--brand-red); transition: border-color 0.2s;
}

.profile-avatar.avatar-admin {
  border-color: var(--turquoise);
  box-shadow: 0 0 0 4px var(--turquoise-soft);
}

.profile-tg-name { font-size: 15px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.profile-id-pill { font-size: 11px; color: var(--text-gray); margin-bottom: 8px; }
.profile-badges-row { display: flex; gap: 6px; }

.profile-role-tag {
  display: inline-block;
  background: var(--brand-red-light);
  color: var(--brand-red);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.profile-role-tag.role-turquoise {
  background: var(--turquoise);
  color: var(--text-black);
  font-weight: 700;
}

.profile-role-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.prof-role-btn {
  height: 40px; border-radius: 12px; border: 1.5px solid var(--border-gray);
  background: var(--bg-white); font-family: var(--font-main); font-size: 10px;
  font-weight: 500; color: var(--text-black); cursor: pointer; transition: all 0.18s;
}
.prof-role-btn.selected { background: var(--brand-red); border-color: var(--brand-red); color: var(--bg-white); }

/* ==========================================================================
   6. HOME BAR И БИРЮЗОВЫЕ КНОПКИ
   ========================================================================== */
.floating-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  z-index: 100;
}

.floating-tools-row { display: flex; gap: 14px; align-items: center; justify-content: center; }

.qr-turquoise-fab {
  pointer-events: auto; width: 56px; height: 56px; border-radius: 50%;
  background: var(--turquoise); color: var(--text-black); border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(44, 229, 216, 0.45); cursor: pointer;
  transition: transform var(--transition-fast);
}

.qr-turquoise-fab .material-symbols-rounded { font-size: 26px; }
.qr-turquoise-fab:active { transform: scale(0.92); }

.homebar-pill {
  pointer-events: auto; background: #F0F0F2; border-radius: var(--radius-pill);
  padding: 6px; display: flex; align-items: center; gap: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
}

.homebar-tab {
  width: 78px; height: 50px; border-radius: var(--radius-pill); border: none;
  background: transparent; color: #B4B4BC; display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all var(--transition-fast);
}

.homebar-tab .material-symbols-rounded { font-size: 26px; }
.homebar-tab.active { background: var(--brand-red); color: var(--bg-white); box-shadow: 0 5px 14px rgba(229, 57, 69, 0.34); }

/* ==========================================================================
   7. МОДАЛЬНЫЕ ОКНА
   ========================================================================== */
.recipient-detail-card { background: #FFF8F8; border: 1.5px dashed var(--brand-red); border-radius: 18px; padding: 16px; margin-bottom: 18px; }
.recipient-card-title { font-size: 11px; color: var(--text-gray); margin-bottom: 6px; }
.recipient-name-large { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.recipient-role-sub { font-size: 11px; color: var(--brand-red); margin-bottom: 12px; }
.recipient-wishes-box { background: var(--bg-white); border-radius: 12px; padding: 12px; font-size: 11px; line-height: 1.5; }
.recipient-wishes-box p { margin-top: 4px; color: #374151; }
.post-draw-qr-actions { display: flex; flex-direction: column; gap: 10px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 300;
}

.modal-sheet {
  background: var(--bg-white); width: 100%; max-width: 360px; max-height: 88vh;
  overflow-y: auto; border-radius: 26px; padding: 22px; text-align: center;
  animation: fadeSlideUp 0.22s ease;
}

.success-icon-circle,
.address-icon-circle {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}

.success-icon-circle { background: var(--green-badge-bg); color: var(--green-text); }
.address-icon-circle { background: var(--brand-red-light); color: var(--brand-red); }
.success-icon-circle .material-symbols-rounded,
.address-icon-circle .material-symbols-rounded { font-size: 34px; }

.institute-sheet { max-width: 380px; text-align: left; }
.sheet-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.icon-close-btn { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--bg-gray-soft); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.institute-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.institute-option-btn {
  height: 44px; border-radius: 12px; border: 1.5px solid var(--border-gray);
  background: var(--bg-white); font-family: var(--font-main); font-size: 12px;
  font-weight: 600; color: var(--text-black); cursor: pointer; transition: all 0.18s;
}
.institute-option-btn.selected, .institute-option-btn:active { background: var(--brand-red); border-color: var(--brand-red); color: var(--bg-white); }

.debug-modal-sheet { max-width: 390px; text-align: left; }
.debug-section { border-top: 1px solid var(--border-gray); padding-top: 12px; margin-top: 12px; }
.debug-section-title { font-size: 11px; font-weight: 700; color: var(--text-gray); margin-bottom: 8px; }
.debug-btn-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.debug-action-btn { background: var(--bg-gray-soft); border: 1px solid var(--border-gray); border-radius: 10px; padding: 8px 10px; font-family: var(--font-main); font-size: 10px; cursor: pointer; }
.debug-label { display: block; font-size: 10px; color: var(--text-gray); margin: 8px 0 4px; }
.debug-input { height: 38px; font-size: 11px; }
.adm-events-list { display: flex; flex-direction: column; gap: 8px; }
.adm-event-row { background: var(--bg-gray-soft); border-radius: 12px; padding: 10px; font-size: 10px; }
.adm-event-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.adm-mini-btn { border: none; background: var(--text-black); color: #FFF; padding: 5px 8px; border-radius: 7px; font-family: var(--font-main); font-size: 9px; cursor: pointer; }
.adm-mini-btn.red { background: var(--brand-red); }

.modal-title { font-size: 16px; font-weight: 700; }
.modal-subtitle { font-size: 11px; color: var(--text-gray); margin: 8px 0 16px; line-height: 1.5; }
.qr-canvas-box {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 0 18px;
  background: transparent;
  border: none;
  margin-bottom: 0;
}
.backup-code-pill { background: var(--bg-gray-soft); padding: 10px; border-radius: 14px; font-size: 10px; display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.backup-code-pill strong { font-size: 18px; letter-spacing: 1.5px; }
.qr-note { font-size: 10px; color: var(--text-gray); margin-bottom: 14px; }
.btn-turquoise-full { background: var(--turquoise); color: var(--text-black); gap: 8px; margin-bottom: 12px; }
.btn-gray-close { background: var(--bg-gray-soft); color: var(--text-black); margin-top: 8px; }
.staff-manual-row { display: flex; gap: 8px; margin-bottom: 12px; }

.save-icon-btn {
  width: 46px; height: 46px; min-width: 46px; border-radius: 14px; border: none;
  background: var(--brand-red); color: #FFF; display: flex; align-items: center;
  justify-content: center; cursor: pointer;
}

.staff-result-box { background: var(--green-badge-bg); border: 2px solid var(--green-text); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.staff-box-num { font-size: 26px; font-weight: 800; color: var(--green-text); margin: 4px 0; }

#snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Пропускает все нажатия и свайпы насквозь */
  z-index: 90;          /* Поверх плиток и шапки, но под HomeBar (100) и модалками (300) */
}

/* Градиент от белого снизу к прозрачному сверху под HomeBar */
.floating-bottom-nav::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 112px;
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.94) 30%,
    rgba(255, 255, 255, 0.62) 60%,
    rgba(255, 255, 255, 0.18) 84%,
    rgba(255, 255, 255, 0) 100%
  );
  z-index: -1;
  pointer-events: none;
}

/* Красная подчеркнутая кнопка "Куда отнести подарок?" / "Где забрать подарок?" */
.event-address-link-btn {
  display: inline-block;
  background: none;
  border: none;
  padding: 4px 0 14px;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-red);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: opacity 0.18s;
}

.event-address-link-btn:active {
  opacity: 0.65;
}

/* Совет по праздничной упаковке над кнопкой "Сдать подарок" */
.wrapping-tip-box {
  background: #FFF9EB;
  border: 1.5px solid #FDE68A;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 10.5px;
  line-height: 1.48;
  color: #78350F;
}

.wrapping-tip-box .material-symbols-rounded {
  font-size: 20px;
  color: #D97706;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Отступ под кнопкой "Сдать подарок" / "Забрать подарок" в нижнем стеке */
.event-bottom-stack .post-draw-qr-actions {
  margin-bottom: 12px;
}

/* Поднимаем кнопку "Куда отнести / Где забрать подарок?" выше над кнопкой "Назад" */
.address-links-center {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 52px;
}

/* Подсказка об отказе от участия под кнопкой отправки письма */
.wishes-cancel-hint {
  margin-top: 12px;
  text-align: center;
  font-size: 10px;
  line-height: 1.48;
  color: var(--text-gray);
  padding: 0 6px;
}

/* Отступ для кнопок "Сдать подарок" и "Забрать подарок" под соответствующими панелями */
.post-draw-inline-btn {
  margin-bottom: 14px;
}

/* Зеленое состояние панели "Твой подопечный в этой игре" после сдачи подарка */
.recipient-detail-card.card-completed {
  background: var(--green-badge-bg);
  border: 1.5px solid rgba(39, 174, 96, 0.35);
}

.recipient-detail-card.card-completed .recipient-role-sub {
  color: var(--green-text);
}

/* Бейдж "Задание выполнено" внизу внутри панели подопечного */
.rec-done-badge {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(39, 174, 96, 0.14);
  color: var(--green-text);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}

.rec-done-badge .material-symbols-rounded {
  font-size: 16px;
}

/* Желтые бейджи прогресса ("Подготовь подарок" и "Ожидаем подарок") */
.player-progress-pill.warning,
.tile-closed-warning .player-progress-pill.warning {
  background: var(--yellow-badge-bg);
  color: var(--yellow-text);
}

/* Заголовки секций в Календаре ивентов ("Вы участвуете" / "Другие ивенты") */
.calendar-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-gray);
  margin-bottom: -4px;
}

.calendar-group-spacer {
  margin-top: 10px;
}

/* Нейтральный бейдж для закрытого ивента (только статус времени) */
.badge-closed-time {
  background: #E5E7EB;
  color: #6B7280;
}

.badge-closed-time .material-symbols-rounded {
  font-size: 14px;
}

/* Зеленый блок статуса ("Подарок ожидает вручения" / "Подарок получен") */
.task-done-status-box {
  background: var(--green-badge-bg);
  border: 1.5px solid rgba(39, 174, 96, 0.28);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.task-done-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green-text);
  font-size: 13px;
  font-weight: 700;
}

.task-done-header .material-symbols-rounded {
  font-size: 20px;
}

/* Серый вариант блока статуса ("Ожидаем подарок") */
.task-done-status-box.status-waiting-gray {
  background: var(--bg-gray-soft);
  border-color: #DCDFE6;
}

.task-done-status-box.status-waiting-gray .task-done-header {
  color: #4B5563;
}

.task-done-subtext {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: #374151;
}

/* НАЙТИ И ЗАМЕНИТЬ: */
#screen-welcome {
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  padding: 18px 22px 24px;
}

#screen-welcome .top-brand-row {
  margin-bottom: 14px;
}

#screen-welcome .hero-title {
  margin-bottom: 8px;
}

.welcome-bg-photo {
  display: block;
  width: 138%;
  max-width: 560px;
  max-height: 43dvh;
  object-fit: contain;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin: -18px 0 -10px;
  filter:
    drop-shadow(0 0 28px rgba(255, 255, 255, 0.55))
    drop-shadow(0 14px 36px rgba(255, 255, 255, 0.35));
}

.event-bottom-stack {
  display: flex;
  flex-direction: column;
  padding-top: 14px;
}

.event-address-link-btn {
  display: inline-block;
  background: none;
  border: none;
  padding: 6px 12px;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-red);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: opacity 0.18s;
}

.event-address-link-btn:active {
  opacity: 0.65;
}

.event-bottom-stack .reg-bottom-bar {
  padding-top: 0;
}

.help-tile {
  flex: 0 0 182px;
  height: 146px;
  background: #F6F7F9;
  border: 1.5px solid #EAECEF;
  border-radius: 22px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color 0.2s, background 0.2s;
  user-select: none;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.04);
}

.help-tile:last-child {
  scroll-snap-align: end;
}

.help-tile:active {
  transform: scale(0.96);
  background: #EFEFF3;
}

.help-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.help-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-icon-badge .material-symbols-rounded {
  font-size: 21px;
}

.badge-accent-red {
  background: var(--brand-red-light);
  color: var(--brand-red);
}

.badge-accent-blue {
  background: rgba(22, 58, 112, 0.12);
  color: #163A70;
}

.badge-accent-dark {
  background: #E5E7EB;
  color: var(--text-black);
}

.help-arrow-icon {
  font-size: 19px;
  color: #A0A4AE;
}

.help-tile-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-black);
  margin-bottom: 4px;
}

.help-tile-sub {
  font-size: 9.5px;
  color: var(--text-gray);
  line-height: 1.3;
}

.qr-modal-sheet {
  padding: 22px 20px;
}

.styled-qr-svg {
  width: 100%;
  max-width: 252px;
  height: auto;
  display: block;
}

.backup-code-btn {
  width: 100%;
  background: var(--bg-gray-soft);
  border: none;
  border-radius: 16px;
  padding: 13px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-main);
  color: var(--text-black);
  cursor: pointer;
  transition: transform var(--transition-fast), background 0.18s;
}

.backup-code-btn:active {
  transform: scale(0.98);
  background: #E5E7EB;
}

.backup-code-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.backup-code-info span {
  font-size: 10px;
  color: var(--text-gray);
}

.backup-code-info strong {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 2px;
}

.backup-copy-icon {
  font-size: 22px;
  color: #6B7280;
  transition: color 0.18s;
}

.backup-code-btn.copied .backup-copy-icon {
  color: var(--green-text);
}

/* ==========================================================================
   9. ОБНОВЛЕННЫЕ СТАТУСЫ ПЛИТОК, НИЖНИЕ СТРОКИ ДЕЙСТВИЙ И ЗАГОЛОВКИ КАЛЕНДАРЯ
   ========================================================================== */

/* Верхняя панель статуса: общие размеры иконок */
.tile-badge .material-symbols-rounded {
  font-size: 14px;
}

/* Ярко-оранжевый статус (последние 24 часа до конца регистрации) */
.badge-orange {
  background: #FFF0DF;
  color: #EA580C;
}

/* Ярко-желтый статус ("Выполни задание" с иконкой error) */
.badge-yellow-bright {
  background: #FEF3C7;
  color: #D97706;
}

/* Серый статус ("Ожидаем подарок" с часами и "Завершен" без иконки) */
.badge-gray-status {
  background: #ECEEF2;
  color: #6B7280;
}

/* Нижняя строка действия в плитке: без серой подложки, крупнее, стрелка у правого края */
.tile-action-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding-top: 6px;
  color: #6B7280;
}

.tile-action-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
}

.tile-action-left .material-symbols-rounded {
  font-size: 19px;
  color: #6B7280;
}

.tile-action-arrow {
  font-size: 19px;
  color: #9CA3AF;
  flex-shrink: 0;
}

/* Заголовок секции "Ты участвуешь" (зеленый с анимированным кружком слева) */
.calendar-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-gray);
  margin-bottom: -4px;
}

.calendar-group-title.group-participating {
  color: var(--green-text);
}

.calendar-group-title.group-participating .pulse-dot {
  width: 8px;
  height: 8px;
}

.calendar-group-spacer {
  margin-top: 12px;
}

/* ==========================================================================
   10. МОДАЛЬНОЕ ОКНО ПРИЕМА/ВЫДАЧИ: КНОПКА SEARCH И СВАЙП-СЛАЙДЕР
   ========================================================================== */

/* Бирюзовая кнопка поиска рядом с полем ввода 8-значного кода */
.staff-search-btn {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 14px;
  border: none;
  background: var(--turquoise);
  color: var(--text-black);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(44, 229, 216, 0.35);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.staff-search-btn:active {
  transform: scale(0.94);
}

.staff-search-btn .material-symbols-rounded {
  font-size: 22px;
}

/* Новая панель результата после сканирования */
.staff-result-panel {
  text-align: center;
  animation: fadeSlideUp 0.22s ease;
}

.staff-result-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-black);
  margin-bottom: 10px;
}

.staff-result-text {
  font-size: 11px;
  line-height: 1.5;
  color: #4B5563;
  margin-bottom: 10px;
}

.staff-result-panel .staff-box-num {
  display: inline-block;
  background: var(--bg-gray-soft);
  border: 2px solid var(--turquoise);
  border-radius: 18px;
  padding: 12px 28px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text-black);
  margin: 4px 0 14px;
}

.staff-confirm-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-black);
  margin: 12px 0 10px;
}

/* Трек бирюзового слайдера подтверждения */
.swipe-slider-track {
  position: relative;
  width: 100%;
  height: 56px;
  border-radius: var(--radius-pill);
  background: #E8ECEF;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none; /* Блокирует перехват жеста скроллом/закрытием Telegram */
  user-select: none;
  -webkit-user-select: none;
}

/* Заполняющаяся шкала (как шкала здоровья) */
.swipe-slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 52px;
  background: linear-gradient(90deg, #1FD6C9 0%, var(--turquoise) 100%);
  border-radius: var(--radius-pill);
  pointer-events: none;
}

.swipe-slider-hint {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 600;
  color: #6B7280;
  padding-left: 26px;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* Бирюзовый ползунок с черной стрелкой вправо */
.swipe-slider-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--turquoise);
  color: var(--text-black);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 2;
}

.swipe-slider-thumb:active {
  cursor: grabbing;
}

.swipe-slider-thumb .material-symbols-rounded {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-black);
}

/* Плавный возврат, если не дотянули до конца */
.swipe-slider-animating {
  transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
              width 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}