:root {
  --bg-dark: #0d1117;
  --bg-main: #0d1117;
  --bg-card: #161b22;
  --border: #30363d;
  --accent: #ff9a00;
  --text-main: #e6edf3;
  --text-dim: #8b949e;
  --error: #ff4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
  /* Глобальный стиль скроллбара */
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 148, 158, 0.5) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: rgba(139, 148, 158, 0.5);
  border-radius: 10px;
}

/* Блокировка скролла фона при открытых модалках — устраняет прыжки на мобильных */
html.no-scroll,
body.no-scroll {
  overflow: hidden !important;
  height: 100% !important;
  -webkit-overflow-scrolling: auto !important;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(139, 148, 158, 0.8);
}

html { background: var(--bg-main); }
body {
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* app-frame: Anti-Scroll — фиксация без паразитного скролла */
.app-frame {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--bg-main);
}

@media (min-width: 481px) {
  body { background: radial-gradient(circle at center, #1c2128 0%, var(--bg-dark) 100%); }
  .app-frame {
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  }
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.flex-sb { display: flex; justify-content: space-between; align-items: center; width: 100%; }

/* HEADER */
/* Изоляция интерфейса во время игры через класс game-active */
body.game-active .main-header,
body.game-active .main-footer,
body.game-active .nav-controls,
body.game-active .burger-menu {
  display: none !important;
}

body.game-active {
  overflow: hidden !important;
}

.main-header {
  height: 54px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.main-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  width: 100%;
  padding-left: 20px;
}

.logo { display: flex; align-items: center; flex-shrink: 0; margin-right: 16px; }
.logo h1 { font-size: 18px; font-weight: 700; line-height: 1.2; letter-spacing: -0.5px; }
.logo-iqgo { display: block; color: #ff9a00; line-height: 1.15; }
.logo-quiz { display: block; color: #FFFFFF; line-height: 1.15; }

.nav-controls { display: flex; align-items: center; gap: 8px; }
.nav-controls .btn-outline { min-width: 80px; }

/* Burger menu */
.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 4px;
  margin-left: 12px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  color: var(--accent);
  transition: 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.burger-btn:hover { filter: brightness(1.1); }
.burger-btn:active { transform: translateY(1px); }
.burger-btn[aria-expanded="true"] { background: rgba(255, 154, 0, 0.15); }
.burger-line {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: 0.3s ease;
}
.burger-menu {
  position: fixed;
  top: 54px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 2000;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.burger-menu.is-open {
  visibility: visible;
  opacity: 1;
}
.burger-menu-inner {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  width: 260px;
  max-width: 85vw;
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 55px 0 20px;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}
/* Крестик закрытия (X): база 40px; в полноэкранных слоях — 44px hit area, fixed, safe-area */
.close-icon-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  z-index: 10;
  outline: none;
  text-decoration: none;
  transition: color 0.2s ease;
}
.close-icon-x:hover { color: var(--text-main); }
.close-icon-x::before,
.close-icon-x::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 2px;
  margin-left: -12px;
  margin-top: -1px;
  background: currentColor;
  border-radius: 1px;
  transition: background 0.2s ease;
}
.close-icon-x::before { transform: rotate(45deg); }
.close-icon-x::after { transform: rotate(-45deg); }
.close-icon-x:active { opacity: 0.85; }

/* Полноэкранные слои: кнопка закрытия fixed, 44px hit area, учёт safe-area */
.fullscreen-layer .close-icon-x,
.rating-fullscreen .close-icon-x {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  z-index: 3001;
}
.burger-menu-inner .close-icon-x {
  position: absolute;
  top: 12px;
  right: 12px;
}
.page-main .close-icon-x {
  position: absolute;
  top: 12px;
  right: 12px;
}
button.close-icon-x { border: none; font: inherit; }
.burger-link {
  display: block;
  padding: 12px 20px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  transition: 0.2s ease;
}
.burger-link:hover { background: rgba(255, 154, 0, 0.1); color: var(--accent); }

/* HERO */
.hero {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 0;
}
.hero .container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.hero h2 {
  font-size: 42px;
  margin: 0 0 8px 0;
  text-shadow: 0 4px 10px rgba(0,0,0,0.5);
  white-space: nowrap;
}
.hero p {
  color: var(--text-dim);
  font-size: 18px;
  margin: 0 0 12px 0;
  white-space: nowrap;
}

#app-views { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#app-views .view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#app-views .view[hidden] { display: none !important; }
.view--game .app-frame--game { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view-final-hero .container { max-width: 1200px; margin: 0 auto; width: 100%; }

.hero__session-saved {
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  letter-spacing: 0.02em;
}

/* BUTTONS */
.btn {
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  transition: 0.3s ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 38px;
  border: none;
  padding: 0 20px;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); filter: brightness(0.9); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  transition: 0.3s ease;
}
.btn-outline:hover { filter: brightness(1.1); }
.btn-outline:active { transform: translateY(1px); filter: brightness(0.9); }

.btn-main {
  background: var(--accent);
  color: var(--bg-dark);
  width: 220px;
  font-size: 17px;
  margin-top: 12px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(255,154,0,0.2);
  transition: 0.3s ease;
}

.btn-main:hover { filter: brightness(1.1); }
.btn-main:active { transform: translateY(1px); filter: brightness(0.9); }

.btn-step-next { background: var(--accent); color: var(--bg-dark); width: 140px; height: 45px; transition: 0.3s ease; }
.btn-step-next:hover { filter: brightness(1.1); }
.btn-step-next:active { transform: translateY(1px); filter: brightness(0.9); }

.btn-back { background: #21262d; border: 1px solid var(--border); color: var(--text-dim); width: 140px; height: 45px; transition: 0.3s ease; }
.btn-back:hover { filter: brightness(1.1); }
.btn-back:active { transform: translateY(1px); filter: brightness(0.9); }

.btn-orange { background: var(--accent); color: var(--bg-dark); transition: 0.3s ease; }
.btn-orange:hover { filter: brightness(1.1); }
.btn-orange:active { transform: translateY(1px); filter: brightness(0.9); }

.btn-row { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }

/* Убираем рамки фокуса и тап-подсветку для всех интерактивных элементов */
button,
a {
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

/* Единый полноэкранный стандарт: слой на весь экран */
.fullscreen-layer {
  display: none;
  flex-direction: column;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 3000;
  background: var(--bg-main);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.fullscreen-layer-inner {
  flex: 1 0 auto;
  padding: calc(56px + env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
  min-height: 100%;
  box-sizing: border-box;
}
.fullscreen-layer-inner--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}
.auth-form-wrap {
  width: 90%;
  max-width: 380px;
  text-align: center;
}

/* FORMS */
input {
  width: 100%;
  padding: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
  outline: none;
  margin-top: 5px;
}
input:focus, textarea:focus { border-color: var(--accent); }

textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
  outline: none;
  margin-top: 5px;
  resize: vertical;
  font-family: inherit;
}

.form-group { margin-bottom: 16px; }
.form-group .auth-label { margin-bottom: 5px; }

/* Контактная форма */
.contact-form {
  width: 100%;
  max-width: 100%;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
}
.contact-form .form-group { margin-bottom: 20px; }
.contact-form input,
.contact-form textarea {
  width: 100%;
  height: 48px;
  min-height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  font-size: 16px;
  outline: none;
  margin-top: 5px;
  box-sizing: border-box;
}
.contact-form textarea {
  height: auto;
  min-height: 120px;
  resize: vertical;
}
.contact-form .btn-main {
  display: flex;
  margin: 24px auto 0;
  margin-left: auto;
  margin-right: auto;
}

.error-msg {
  color: var(--error);
  font-size: 12px;
  min-height: 25px;
  text-align: left;
  padding: 5px 0;
  opacity: 0;
}

/* SUMMARY */
.summary {
  background: var(--bg-dark);
  padding: 15px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  margin-bottom: 15px;
  text-align: left;
}
.sum-item span {
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: bold;
  display: block;
}
.modal-footer {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-dim);
}
#auth-toggle { color: var(--accent); cursor: pointer; font-weight: bold; }
#agreement-block { margin-top: 12px; color: #888; font-size: 11.5px; text-align: center; }
#agreement-block a { color: var(--accent); text-decoration: none; font-weight: bold; }

/* FOOTER */
.main-footer {
  flex-shrink: 0;
  padding: 6px 12px 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

/* Рейтинг: полноэкранный раздел (тот же стандарт по размеру) */
.rating-fullscreen {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  background: var(--bg-main);
  z-index: 3000;
  overflow-y: auto;
  overflow-x: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  will-change: transform;
}
.rating-fullscreen[aria-hidden="false"] { display: block; }
.rating-fullscreen-inner {
  padding: calc(56px + env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
  min-height: 100%;
  box-sizing: border-box;
}
.rating-sticky-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-main);
  z-index: 2;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.rating-fullscreen-title {
  color: var(--accent);
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 700;
}
.rating-info-line {
  margin: 0 0 16px 0;
  font-size: 14px;
  font-style: italic;
  color: var(--text-dim);
}
.rating-content {
  min-height: 80px;
  padding-right: 12px;
  box-sizing: border-box;
}
.rating-loading {
  color: var(--text-dim);
  text-align: center;
  padding: 24px 0;
  margin: 0;
}

/* Skeleton Loaders для рейтинга */
.skeleton-row {
  height: 34px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-cell {
  padding: 8px 6px;
  position: relative;
  overflow: hidden;
}

.skeleton-shimmer {
  display: inline-block;
  width: 100%;
  height: 16px;
  background: linear-gradient(
    90deg,
    rgba(139, 148, 158, 0.2) 0%,
    rgba(139, 148, 158, 0.4) 50%,
    rgba(139, 148, 158, 0.2) 100%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
/* Таблица рейтинга: 4 колонки, 100% сумма ширин, Ник не схлопывается */
#modal-rating .rating-table,
.rating-table {
  width: 100%;
  table-layout: fixed !important;
  background: var(--bg-dark);
  color: var(--text-main);
  border-collapse: collapse;
  font-size: 14px;
}
.rating-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.rating-table th {
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-weight: 600;
  margin: 0;
  padding: 10px 6px;
  box-sizing: border-box;
}
.rating-table td {
  border-bottom: 1px solid var(--border);
  margin: 0;
  padding: 8px 6px;
  box-sizing: border-box;
}
/* №: 12% — заголовок и данные влево */
.rating-table th:nth-child(1),
.rating-table td.leader-rank {
  width: 12%;
  text-align: left !important;
  padding-left: 8px;
  padding-right: 4px;
}
/* Ник: 40% — влево, зазор после № (padding-left: 8px), защита от переполнения */
.rating-table th:nth-child(2),
.rating-table td.leader-nick {
  width: 40%;
  text-align: left !important;
  padding-left: 8px;
  padding-right: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Баллы: 30% — заголовок центр, данные вправо */
.rating-table th:nth-child(3) {
  width: 30%;
  text-align: center !important;
  padding-left: 4px;
  padding-right: 10px;
}
.rating-table td.leader-score {
  width: 30%;
  text-align: right !important;
  padding-right: 10px !important;
  padding-left: 4px;
}
/* Сессии: 18% — заголовок и данные по центру колонки */
.rating-table th:nth-child(4) {
  width: 18%;
  text-align: center !important;
  padding-left: 4px;
  padding-right: 10px;
}
.rating-table td.leader-sessions {
  width: 18%;
  text-align: center !important;
  padding-left: 4px;
  padding-right: 4px;
}
/* Баллы: везде бирюзовый #00CED1 */
.rating-table td.leader-score { font-weight: 600; color: #00CED1; }
/* ТОП-3: высота 50px, bold; статусный цвет только Место и Никнейм */
.rating-table tbody tr.rank-gold,
.rating-table tbody tr.rank-silver,
.rating-table tbody tr.rank-bronze {
  height: 50px;
  font-weight: bold;
}
.rating-table tbody tr.rank-gold .leader-rank,
.rating-table tbody tr.rank-gold .leader-nick { color: #FFD700; }
.rating-table tbody tr.rank-silver .leader-rank,
.rating-table tbody tr.rank-silver .leader-nick { color: #C0C0C0; }
.rating-table tbody tr.rank-bronze .leader-rank,
.rating-table tbody tr.rank-bronze .leader-nick { color: #909000; }
/* Места 4–100: высота 34px, зебра */
.rating-table tbody tr:not(.rank-gold):not(.rank-silver):not(.rank-bronze) {
  height: 34px;
}
.rating-table tbody tr:nth-child(n+4):nth-child(odd) td { background: var(--bg-dark); }
.rating-table tbody tr:nth-child(n+4):nth-child(even) td { background: rgba(22, 27, 34, 0.55); }
.rating-table tbody tr:hover td { background: rgba(22, 27, 34, 0.7) !important; }
.leader-row .leader-rank { font-weight: 700; color: var(--text-dim); }
.leader-row .leader-sessions { color: var(--text-dim); }

/* Mobile < 375px: font-size таблицы 0.85rem, сетка 12/40/30/18% сохраняется */
@media (max-width: 375px) {
  .rating-table { font-size: 0.85rem; }
  .rating-info-line { font-size: 0.85rem; }
}
@media (max-width: 320px) {
  .rating-table { font-size: 0.85rem; }
  .rating-info-line { font-size: 0.85rem; }
}

/* Модалки: текст, подписи */
.modal-text { text-align: left; font-size: 14px; color: var(--text-main); line-height: 1.6; }
.modal-text p { margin-bottom: 20px; }
.modal-text p:last-child { margin-bottom: 0; }
.modal-text a { color: var(--accent); text-decoration: none; }
.modal-text a:hover { text-decoration: underline; }

/* Full-screen контентные страницы (rules, terms, privacy-policy, contact) */
/* Перекрывают весь экран, включая хедер с кнопками, чтобы исключить переходы из разделов меню */
/* Оптимальный вариант: fixed контейнер, скролл работает напрямую на нем */
.app-frame > .page-main {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-main);
  z-index: 2500;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.app-frame > .page-main--scroll {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 80px 24px 40px 24px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  /* Ускоряем рендеринг скролла на мобильных - создаем GPU слой */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  /* Гарантируем, что элемент может скроллиться */
  display: block;
}
.app-frame > .page-main--contact {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.page-main h1 {
  margin-bottom: 20px;
  font-size: 1.5rem;
  color: #9ca3af;
}
.page-main .modal-text strong { color: var(--accent); }
.auth-label { text-align: left; color: #ff9800; font-size: 13px; margin-bottom: 5px; font-weight: bold; }
.btn-modal-bottom { width: 100%; height: 45px; margin-top: 20px; }

/* Темная тема для таблиц результатов */
table {
  background: var(--bg-dark);
  color: var(--text-main);
  border-collapse: collapse;
  width: 100%;
}
table th {
  background: var(--bg-card);
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
table td {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
}
table tr:hover td {
  background: rgba(22, 27, 34, 0.5);
}


/* ANIMATIONS */
.shake { animation: shake 0.4s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Десктоп: контентные страницы */
@media (min-width: 800px) {
  .app-frame > .page-main--scroll {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    text-align: justify;
  }
  .page-main--contact .contact-form { max-width: 700px; }
  .rating-fullscreen-inner { max-width: 700px; margin-left: auto; margin-right: auto; }
}

/* ПК-версия */
@media (min-width: 1024px) {
  .main-header { height: 56px; }
  .burger-menu { top: 56px; }
  .main-header .container { max-width: 1200px; margin: 0 auto; padding-left: 20px; }
  .hero .container { max-width: 1200px; margin: 0 auto; }
  .logo h1 { font-size: 18px; }
  .btn-outline { height: 32px; padding: 0 12px; font-size: 12px; }
  .hero h2 { font-size: 36px; white-space: nowrap; margin-left: auto; margin-right: auto; }
  .btn-main { width: 220px; height: 48px; font-size: 17px; }
}

/* ПЛАНШЕТНЫЙ ДИАПАЗОН */
@media (min-width: 481px) and (max-width: 1023px) {
  .hero h2 {
    white-space: normal;
    font-size: 28px;
    margin: 0 0 10px 0;
    line-height: 1.25;
  }
  .hero p {
    white-space: normal;
    font-size: 16px;
    margin: 0 0 14px 0;
    line-height: 1.4;
  }
}

/* МОБИЛЬНАЯ АДАПТАЦИЯ */
@media (max-width: 768px) {
  .container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .main-header .container { padding-left: max(15px, env(safe-area-inset-left)); }
  .main-header { height: 54px; }
  .logo h1 { font-size: 18px; font-weight: 700; }
  .nav-controls { display: flex; align-items: center; gap: 6px; }
  .btn-outline { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
  .hero h2 { font-size: 24px; margin: 0 0 6px 0; padding: 0 10px; }
  .hero p { font-size: 15px; margin: 0 0 8px 0; }
  .btn-main { margin-top: 8px; width: 220px; height: 45px; font-size: 16px; }
}

@media (max-width: 480px) {
  .btn-outline { height: 28px; padding: 0 10px; font-size: 12px; }
  .burger-btn { height: 28px; margin-left: 0; }
  .main-footer { padding: 6px 12px 8px; }
  .nav-controls { gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
  .nav-controls .btn-outline { min-width: 80px; }
  .hero {
    padding: 4px 0;
  }
  .hero .container {
    padding-top: 0;
    padding-bottom: 0;
  }
  .hero h2 {
    font-size: 20px;
    white-space: nowrap;
    margin: 0 0 4px 0;
    padding: 0 8px;
  }
  .hero p {
    font-size: 14px;
    white-space: nowrap;
    margin: 0 0 6px 0;
    line-height: 1.2;
  }
  .btn-main {
    margin-top: 2px;
    width: 200px;
    height: 45px;
  }
}

@media (max-width: 400px) {
  .hero h2 { font-size: 18px; white-space: nowrap; }
  .hero p { font-size: 12px; white-space: nowrap; }
  .btn-main { width: 200px; font-size: 15px; }
  .nav-controls { gap: 6px; }
  .nav-controls .btn-outline { min-width: 72px; }
  .burger-btn { margin-left: 0; }
}
@media (max-width: 320px) {
  .nav-controls .btn-outline { min-width: 68px; padding: 0 8px; }
  .main-header .container { padding-left: 10px; padding-right: 10px; }
}

/* Landscape: оптимизация отступов полноэкранных слоёв */
@media (orientation: landscape) and (max-height: 500px) {
  .main-header { height: 48px; }
  .burger-menu { top: 48px; }
  .logo h1 { font-size: 18px; }
  .btn-outline { height: 28px; padding: 0 10px; font-size: 12px; }
  .main-footer { padding: 6px 12px 8px; }
  .fullscreen-layer-inner {
    padding-top: calc(48px + env(safe-area-inset-top));
    padding-bottom: 24px;
  }
  .rating-fullscreen-inner {
    padding-top: calc(48px + env(safe-area-inset-top));
    padding-bottom: 24px;
  }
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 280px;
  max-width: 400px;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  border-radius: 50%;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-main);
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.toast-close:hover {
  color: var(--text-main);
}

.toast-success {
  border-left: 3px solid #66bb6a;
}

.toast-success .toast-icon {
  background: rgba(102, 187, 106, 0.2);
  color: #66bb6a;
}

.toast-error {
  border-left: 3px solid var(--error);
}

.toast-error .toast-icon {
  background: rgba(255, 68, 68, 0.2);
  color: var(--error);
}

.toast-warning {
  border-left: 3px solid #ff9800;
}

.toast-warning .toast-icon {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
}

.toast-info {
  border-left: 3px solid var(--accent);
}

.toast-info .toast-icon {
  background: rgba(255, 154, 0, 0.2);
  color: var(--accent);
}

/* Loading States */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 154, 0, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 16px;
  color: var(--text-main);
  font-size: 14px;
  text-align: center;
}

.button-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.button-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: inherit;
  border-radius: inherit;
}

@media (max-width: 480px) {
  #toast-container {
    top: 60px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
  
  .toast {
    min-width: auto;
    max-width: none;
  }
}
