html {
  height: 100%;
  overflow: hidden; /* Prevent page scroll, only allow content scroll */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y; /* Allow vertical scrolling but prevent zoom */
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 24px;
  background-color: #000000;
  color: #ffffff;
  height: 100%;
  overflow: hidden; /* Prevent body scroll */
  position: fixed;
  width: 100%;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

main {
  max-width: 440px;
  margin: 0 auto;
  background: #000000;
  border-radius: 12px;
  padding: 24px 20px 32px;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  overscroll-behavior: contain; /* Prevent scroll chaining */
}

.app-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.app-logo img {
  max-width: 200px;
  width: 60%;
  height: auto;
  display: block;
}

.profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.avatar {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  /* Профильный круг в фирменном цвете вместо системного (бирюзового) */
  background-color: #c9ff00 !important;
  color: #000000 !important;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 600;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-info .name {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  color: #ffffff;
}

.profile-info .username {
  margin: 0;
  color: #9aa0b5;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 0;
}

.actions button {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 500;
  border: 1px solid #ffffff;
  border-radius: 10px;
  cursor: pointer;
  background-color: #ffffff; /* белые кнопки в профиле */
  color: #000000;
  transition: transform 0.1s ease, background 0.1s ease;
  margin: 0;
  margin-bottom: 12px;
  box-sizing: border-box;
}

/* Главная кнопка "Букануть корт" — неоново‑жёлтая */
.actions button[data-action="search"] {
  background-color: #c9ff00;
  border-color: #c9ff00;
  color: #000000;
}

/* Кнопка "Ближайшие корты" — белая, но с жёлтым контуром, чтобы выделялась */
.actions button[data-action="nearby"] {
  border-color: #c9ff00;
}

.actions button[data-action="search"]:active {
  background-color: #b5ea00;
}

.actions button:last-child {
  margin-bottom: 0;
}

.actions button:active {
  transform: scale(0.98);
  background-color: #e6e6e6;
}

.hint {
  margin-top: 24px;
  font-size: 0.9rem;
  color: #8b93a6;
  text-align: center;
}

/* Splash screen */
.splash-screen {
  position: fixed;
  inset: 0;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-image {
  max-width: 260px;
  width: 60%;
  height: auto;
  display: block;
}

.registration {
  margin-bottom: 24px;
}

.registration h2 {
  font-size: 1.3rem;
  margin: 0 0 8px;
  color: #ffffff;
}

.registration .hint {
  margin-top: 0;
  margin-bottom: 20px;
  text-align: left;
  color: #9aa0b5;
}

.form-group {
  margin-bottom: 18px;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #333333;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  background: #111111;
  color: #ffffff;
  transition: border 0.2s ease, background 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
  outline: none;
  border-color: #c9ff00;
  background: #000000;
  box-shadow: 0 0 0 1px #c9ff00;
}

.form-group select {
  cursor: pointer;
  /* Красивый кастомный дропдаун вместо системного */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 40px; /* место под кружок */
}

/* Кружок через псевдоэлемент для select в форме регистрации */
.registration .form-group:has(select)::after,
.registration .form-group:last-child::after {
  content: '';
  position: absolute;
  right: 14px;
  /* Позиционируем по центру select: label (примерно 30px) + половина высоты select (примерно 22px) */
  top: calc(30px + 11px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #c9ff00;
  pointer-events: none;
  z-index: 1;
}

.error {
  color: #d32f2f;
  font-size: 0.9rem;
  margin-top: 12px;
  padding: 10px;
  background: #ffebee;
  border-radius: 8px;
  border-left: 3px solid #d32f2f;
}

.registration form {
  margin-top: 20px;
}

.registration .btn-primary {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: #c9ff00;
  color: #000000;
  transition: transform 0.1s ease, opacity 0.1s ease;
  margin-top: 8px;
}

.registration .btn-primary:hover {
  opacity: 0.9;
}

.registration .btn-primary:active {
  transform: scale(0.98);
  opacity: 0.8;
}

.registration .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.clubs-view {
  margin-bottom: 24px;
}

.clubs-view h2 {
  font-size: 1.3rem;
  margin: 0 0 16px;
  color: #ffffff; /* заголовки Клубы / Клубы - Санкт-Петербург белые */
}

.clubs-city-selection {
  margin-bottom: 20px;
}

.clubs-list {
  margin-bottom: 20px;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  scroll-behavior: smooth;
  will-change: scroll-position; /* Optimize for scrolling */
}

.clubs-view h2 {
  font-size: 1.3rem;
  margin: 0 0 16px;
  color: #ffffff; /* заголовки Клубы / Клубы - Санкт-Петербург белые */
}

.club-card {
  background: #ffffff; /* белые карточки клубов */
  border: 1px solid #d9deed;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.club-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #000000; /* чёрные названия клубов */
  margin-bottom: 8px;
}

.club-metro {
  font-size: 0.95rem;
  color: #495067;
  margin-bottom: 4px;
}

.club-address {
  font-size: 0.9rem;
  color: #636a7a;
}

.nearby-details {
  background: #ffffff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  margin-top: 0; /* Убираем отступ сверху, так как детали заменяют список */
  margin-bottom: 16px;
  display: none; /* Скрыто по умолчанию */
}

.nearby-details h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: #000000;
}

.nearby-details p {
  margin: 2px 0;
  font-size: 0.95rem;
  color: #333333;
}

.nearby-details-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.nearby-details-actions .btn-primary {
  flex: 1;
  background: #c9ff00;
  color: #000000;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.nearby-details-actions .btn-primary:active {
  background: #b5ea00;
}

.nearby-details-actions .btn-secondary {
  flex: 1;
  background: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.nearby-details-actions .btn-secondary:active {
  background: #e6e6e6;
}

.clubs-view .btn-secondary {
  width: 100%;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background-color: #eef1f9;
  color: #495067;
  transition: transform 0.1s ease, background 0.1s ease;
  margin-top: 12px;
}

.clubs-view .btn-secondary:active {
  transform: scale(0.98);
  background-color: #d9deed;
}

.nearby-view {
  display: none;
  margin-top: 24px;
}

.nearby-view h2 {
  font-size: 1.3rem;
  margin: 0 0 8px;
  color: #ffffff;
}

.nearby-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
  flex-wrap: nowrap !important;
}

.nearby-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  border: 1px solid #d9deed;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  width: 100% !important;
  display: block !important;
  text-align: left;
  box-sizing: border-box;
  margin: 0;
  flex-shrink: 0;
}

.nearby-card:active {
  transform: scale(0.98);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.1);
}

.nearby-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: #000000;
  margin: 0 0 4px;
}

.nearby-card-meta {
  font-size: 0.9rem;
  color: #495067;
  margin: 0 0 2px;
}

.nearby-card-distance {
  font-size: 0.9rem;
  font-weight: 500;
  color: #000000;
  margin-top: 4px;
}

.nearby-view #nearbyBack {
  width: 100%;
  margin-top: 16px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
}

.nearby-view #nearbyBack:active {
  background: #e6e6e6;
  transform: scale(0.98);
}

/* Games view (Мои брони) */
.games-view {
  margin-bottom: 24px;
}

.games-view h2 {
  font-size: 1.3rem;
  margin: 0 0 16px;
  color: #ffffff;
}

.games-list {
  margin-bottom: 20px;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  will-change: scroll-position;
}

.game-card {
  background: #111111;
  border: 1px solid #c9ff00;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(201, 255, 0, 0.1);
}

.game-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

.game-card-club {
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffffff;
  flex: 1;
}

.game-status {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-status.status-confirmed {
  background: #c9ff00;
  color: #000000;
}

.game-status.status-rejected {
  background: #ef4444;
  color: #ffffff;
}

.game-status.status-pending {
  background: #f59e0b;
  color: #000000;
}

.game-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-card-field {
  font-size: 0.95rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-field-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.game-label {
  font-weight: 500;
  color: #c9ff00;
  min-width: 100px;
}

.game-value {
  color: #ffffff;
  flex: 1;
}

.games-view .btn-secondary {
  width: 100%;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background-color: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
  transition: transform 0.1s ease, background 0.1s ease;
  margin-top: 12px;
}

.games-view .btn-secondary:active {
  transform: scale(0.98);
  background-color: #e6e6e6;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.dialog-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.dialog {
  width: min(420px, 100%);
  background: #050505;
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.9);
}

.dialog h2 {
  font-size: 1.2rem;
  margin: 0 0 16px;
  color: #ffffff;
}

.form-grid {
  display: grid;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: #ffffff;
  gap: 6px;
}

input[type="date"],
input[type="time"],
select,
input[type="text"] {
  border: 1px solid #333333;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 1rem;
  background: #111111;
  color: #ffffff;
  transition: border 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #c9ff00;
  background: #151515;
}

.dialog-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.dialog-actions button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-secondary {
  background: #181818;
  color: #f0f0f0;
}

.btn-primary {
  background: #c9ff00;
  color: #ffffff; /* жёлтая кнопка с белым текстом */
}

.dialog-backdrop .dialog {
  animation: dialog-in 0.2s ease;
}

@keyframes dialog-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.wizard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wizard-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.wizard-subtitle {
  margin: 0;
  color: #9aa0b5;
  font-size: 0.95rem;
}

.wizard-step-counter {
  margin: 0;
  color: #9aa0b5;
  font-size: 0.85rem;
  font-weight: 500;
}

.wizard-progress {
  width: 100%;
  height: 4px;
  background: #222222;
  border-radius: 999px;
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  width: 0;
  background: #c9ff00;
  transition: width 0.3s ease;
}

.wizard-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.wizard-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 0;
}

.wizard-loading.visible {
  display: flex;
}

.spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 6px solid #333333;        /* тёмный фон колеса */
  border-top-color: #c9ff00;        /* яркий сектор загрузки */
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.wizard-loading-text {
  font-size: 1rem;
  color: #ffffff; /* "Ищем доступные слоты..." — белый текст */
  text-align: center;
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

.wizard-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
}

.wizard-section {
  margin-top: 24px;
}

.wizard-section .wizard-label {
  margin-bottom: 10px;
}

.wizard-checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-top: 0;
  padding: 0;
  background: transparent;
  border: none;
  width: 100%;
}

.wizard-checkbox-label:hover {
  background: transparent;
  border: none;
}

.wizard-checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #c9ff00;
  flex-shrink: 0;
  margin: 0;
  order: 1;
}

.wizard-checkbox-label span {
  font-size: 0.95rem;
  color: #ffffff;
  user-select: none;
  order: 2;
  flex: 1;
}

.option-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

/* For clubs city selection, use single column layout */
.clubs-city-selection .option-grid {
  grid-template-columns: 1fr;
  max-height: none;
}

.option-chip {
  border: 1px solid #444444;
  border-radius: 12px;
  padding: 12px 16px;
  background: #111111;
  color: #f5f5f5;
  text-align: center;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease, border 0.2s ease, color 0.2s ease;
}

.option-chip.active {
  background: #c9ff00;
  border-color: #c9ff00;
  color: #000000;
}

.option-chip:active {
  transform: scale(0.97);
}

.wizard-actions {
  display: flex;
  gap: 12px;
}

.wizard-actions button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.wizard-actions .btn-secondary {
  /* "Назад" в мастере — белая кнопка */
  background: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
}

.wizard-actions .btn-primary {
  /* "Далее" в мастере — неоново‑жёлтая кнопка */
  background: #c9ff00;
  color: #000000; /* чёрный текст для кнопки \"Далее\" */
  border: none;
}

.wizard-actions button:disabled {
  opacity: 0.6;
  cursor: default;
}

.wizard-cancel {
  margin-top: -4px;
  background: none;
  border: none;
  color: #8b93a6;
  font-size: 0.95rem;
  cursor: pointer;
  align-self: center;
}

.wizard-cancel:hover {
  color: #495067;
}

.wizard-hint {
  margin-top: 8px;
  color: #8b93a6;
  font-size: 0.9rem;
}

.wizard-result {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.wizard-result.visible {
  display: flex;
}

.wizard.has-result .wizard-body,
.wizard.has-result .wizard-actions {
  display: none;
}

.wizard-result-media {
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
  display: none; /* Hidden by default, shown only when image is available */
  justify-content: center;
}

.wizard-result-media img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.wizard-result-info {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #e4e7ff; /* светлый текст на чёрном фоне */
}

.wizard-result-info b {
  color: #ffffff; /* метки "Город:", "Клуб:" и т.п. белые */
}

.wizard-result-actions {
  display: flex;
  gap: 12px;
}

.wizard-result-actions .btn-primary,
.wizard-result-actions .btn-secondary {
  flex: 1;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 12px 16px;
  cursor: pointer;
}

.wizard-result-actions .btn-primary {
  /* Кнопка "Забронировать" — неоново‑жёлтая с белым текстом */
  background: #c9ff00;
  color: #000000;
}

.wizard-result-actions .btn-secondary {
  background: #eef1f9;
  color: #495067;
}

.wizard-error {
  display: none;
  margin: 12px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: #ffe7e7;
  color: #c53030;
  font-size: 0.95rem;
  line-height: 1.4;
}

.wizard-error.visible {
  display: block;
}

.wizard-error-screen {
  display: none;
  padding: 40px 20px;
  text-align: center;
}

.wizard-error-screen.visible {
  display: block;
}

.wizard-error-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.wizard-error-message {
  font-size: 1rem;
  line-height: 1.5;
  color: #c53030;
  background: #ffe7e7;
  padding: 16px 20px;
  border-radius: 10px;
  border: 1px solid #feb2b2;
  max-width: 100%;
  margin: 0;
}

.wizard-error-screen .btn-primary {
  min-width: 200px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #2ea6ff, #246bff);
  color: #ffffff;
  cursor: pointer;
}

