/* taqueria-menu — Такерия (Иркутск), цифровое меню по QR-коду.
   Дизайн-система: тёплая палитра oklch, мобильно-первый, тактильный стиль.
   Все цвета в OKLCH — предсказуемое отображение на разных экранах.
   Нет загружаемых шрифтов — только system-ui (скорость важнее кастомизации).
   Полная дизайн-спецификация: DESIGN.md */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-heading: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;

  --bg: oklch(0.985 0.003 85);
  --surface: oklch(1 0 0);
  --surface-hover: oklch(0.975 0.003 85);
  --surface-nav: oklch(0.985 0.003 85 / 0.88);
  --primary: oklch(0.47 0.14 33);
  --primary-hover: oklch(0.39 0.14 31);
  --primary-light: oklch(0.92 0.025 42);
  --primary-ultra-light: oklch(0.96 0.008 48);
  --text: oklch(0.17 0.003 80);
  --text-secondary: oklch(0.42 0.005 80);
  --text-muted: oklch(0.58 0.005 80);
  --border: oklch(0.88 0.005 80);
  --border-light: oklch(0.93 0.003 80);
  --like: oklch(0.50 0.18 22);
  --like-active: oklch(0.44 0.19 20);

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.5rem;

  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.04);
  --shadow-md: 0 2px 12px oklch(0 0 0 / 0.05);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 3.5rem;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ── */
.header {
  padding: var(--space-3xl) var(--space-lg) var(--space-xl);
  text-align: center;
}

.header-title {
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.header-tagline {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ── Category Navigation ── */
.category-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  padding: var(--space-sm) 0;
}

.category-nav-inner {
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 var(--space-lg);
}

@media (min-width: 640px) {
  .category-nav-inner {
    justify-content: center;
  }
}

.category-nav-inner::-webkit-scrollbar { display: none; }

.category-pill {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.01em;
}

.category-pill:hover {
  background: var(--primary-ultra-light);
  color: var(--primary);
}

.category-pill.active {
  background: var(--text);
  color: var(--surface);
}

/* ── Main Content ── */
.main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-3xl);
}

/* ── Category Section ── */
.category-section {
  padding-top: var(--space-3xl);
}

.category-heading {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-lg);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.category-heading .count {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  margin-left: var(--space-sm);
}

/* ── Card Grid ── */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Dish Card ── */
.dish-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.dish-card:hover {
  border-color: var(--border);
}

.dish-card.expanded {
  box-shadow: var(--shadow-md);
}

.dish-summary {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.dish-summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
  border-radius: var(--radius-lg);
}

.dish-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, var(--primary-ultra-light), var(--primary-light));
  flex-shrink: 0;
}

.dish-info {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
}

.dish-name {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}

.dish-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.dish-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-sm);
}

.dish-price {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0.25rem 0.6rem 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
  min-width: 32px;
}

.like-btn:hover {
  border-color: var(--like);
  color: var(--like);
}

.like-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.like-btn.liked {
  color: var(--like-active);
  border-color: var(--like-active);
  background: oklch(0.44 0.19 20 / 0.06);
}

.like-btn .heart {
  font-size: 1em;
  line-height: 1;
  transition: transform 0.15s ease;
}

.like-btn.liked .heart {
  transform: scale(1.12);
}

.like-count {
  font-variant-numeric: tabular-nums;
}

/* ── Accordion Details ── */
.dish-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.dish-card.expanded .dish-details {
  grid-template-rows: 1fr;
}

.dish-details-inner {
  overflow: hidden;
}

.dish-details-content {
  padding: 0 var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.dish-details-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0 var(--space-md);
}

.dish-long-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Nutrition ── */
.nutrition {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.nutrition-item {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.nutrition-item strong {
  color: var(--text);
  font-weight: 600;
}

.nutrition-sep {
  color: var(--border);
}

.nutrition-label {
  color: var(--text-muted);
  font-size: 0.65rem;
}

/* ── List Items (Tequila / Mezcal) ── */
.list-group {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.list-card {
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
}

.list-card:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.list-card:last-child {
  border-bottom: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.list-card:first-child:last-child {
  border-radius: var(--radius-lg);
}

.list-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-md);
  cursor: pointer;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.list-row:hover {
  background: var(--surface-hover);
}

.list-row:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.list-row-content {
  flex: 1;
  min-width: 0;
}

.list-item-name {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.list-item-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.15em;
}

.list-item-price {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.list-row-footer {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.list-card .dish-details-content {
  padding: var(--space-md);
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}

.footer {
  border-top: 1px solid var(--border-light);
  padding: var(--space-2xl) var(--space-lg);
  margin-top: var(--space-2xl);
}

.footer-inner {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xl);
  justify-content: space-between;
}

.footer-col {
  min-width: 10rem;
}

.footer-name {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.footer-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.15em;
}

.footer-col p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.footer-legal {
  max-width: 48rem;
  margin: var(--space-lg) auto 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}

.footer-legal a {
  color: var(--text-muted);
  text-decoration: underline;
}

.footer-legal a:hover {
  color: var(--text-primary);
}

/* ── Back to Top ── */
.back-to-top {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  box-shadow: 0 2px 10px oklch(0 0 0 / 0.08);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 200;
  -webkit-tap-highlight-color: transparent;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--text);
  opacity: 0.85;
}

.back-to-top:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* ── Info Banner (состав блюд) ── */
.banner-block {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-lg);
  margin-top: var(--space-xl);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.banner-block-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  line-height: 1.6;
}

.banner-block-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.banner-block-text p {
  margin-bottom: var(--space-sm);
}

.banner-block-text p:last-child {
  margin-bottom: 0;
}

.banner-block-signoff {
  font-weight: 600;
  color: var(--primary);
}

/* ── Soup Banner ── */
.soup-banner {
  margin-top: var(--space-3xl);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  aspect-ratio: 1200 / 681;
}

/* ── Patio Block ── */
.patio-block {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.patio-block.expanded {
  border-color: var(--border);
}

.patio-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}

.patio-summary:hover,
.patio-summary:focus-visible {
  background: var(--surface-hover);
}

.patio-summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
  border-radius: var(--radius-lg);
}

.patio-summary-content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  min-width: 0;
}

.patio-summary-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1.3;
}

.patio-summary-text {
  min-width: 0;
}

.patio-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0;
}

.patio-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.25rem;
}

.patio-chevron {
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.patio-block.expanded .patio-chevron {
  transform: rotate(90deg);
}

.patio-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.patio-block.expanded .patio-details {
  grid-template-rows: 1fr;
}

.patio-details-inner {
  overflow: hidden;
}

.patio-details-inner {
  padding: 0 var(--space-lg) var(--space-lg);
}

.patio-section {
  margin-bottom: var(--space-lg);
}

.patio-section:last-of-type {
  margin-bottom: var(--space-md);
}

.patio-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

.patio-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.patio-list li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 0.35rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.patio-list li::before {
  content: '•';
  position: absolute;
  left: 0.25rem;
  color: var(--primary-light);
  font-weight: 700;
}

.patio-signoff {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  line-height: 1.6;
  text-align: center;
  margin-top: var(--space-sm);
}

/* ── Other Bars Block ── */
.other-bars-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: -0.5rem;
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

.other-bars-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 640px) {
  .other-bars-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.other-bar-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.other-bar-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.other-bar-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.other-bar-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.other-bar-btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--surface);
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  margin-top: var(--space-sm);
}

.other-bar-btn:hover {
  background: var(--primary-hover);
}

.other-bar-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Print ── */
@media print {
  .category-nav, .back-to-top, .like-btn, .hero-auth, .user-bar, .toast { display: none; }
  .dish-card, .list-card { break-inside: avoid; }
  .dish-details { grid-template-rows: 1fr !important; }
  body { background: #fff; }
}

/* ── Auth Widget ── */
.hero-auth {
  max-width: 48rem; margin: 0 auto; padding: var(--space-xl) var(--space-lg);
  text-align: center;
}
.hero-auth-title { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-sm); }
.hero-auth-desc { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-md); }
#heroWidget { display: inline-flex; }

/* ── User Bar ── */
.user-bar {
  max-width: 48rem; margin: 0 auto; padding: var(--space-sm) var(--space-lg);
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-sm);
  font-size: var(--text-sm); color: var(--text-secondary);
}
.user-bar-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.user-bar-name { font-weight: 500; }
.user-bar-logout { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: var(--text-xs); text-decoration: underline; }

/* ── Feedback Section ── */
.feedback-section {
  max-width: 48rem;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}

.feedback-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.feedback-title {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
}

.feedback-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.feedback-emoji-row {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-sm);
}

.feedback-emoji-btn {
  font-size: 2.5rem;
  width: 4rem;
  height: 4rem;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  line-height: 1;
}

.feedback-emoji-btn:hover {
  border-color: var(--primary);
  transform: scale(1.08);
  background: var(--primary-ultra-light);
}

.feedback-emoji-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.feedback-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
}

.feedback-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.feedback-checkbox:hover {
  border-color: var(--border);
  background: var(--surface-hover);
}

.feedback-checkbox input[type="checkbox"] {
  accent-color: var(--primary);
  width: 1rem;
  height: 1rem;
}

.feedback-textarea {
  width: 100%;
  max-width: 28rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  resize: none;
  line-height: 1.5;
  transition: border-color 0.15s ease;
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.feedback-textarea::placeholder {
  color: var(--text-muted);
}

.feedback-action-btn {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--surface);
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
  display: inline-block;
}

.feedback-action-btn:hover {
  background: var(--primary-hover);
}

.feedback-action-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.feedback-secondary-btn {
  background: none;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.feedback-secondary-btn:hover {
  background: var(--primary-ultra-light);
}

.feedback-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 22rem;
}

.feedback-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: fb-spin 0.7s linear infinite;
}

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

.feedback-cert-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.feedback-dismiss {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  text-decoration: underline;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}

.feedback-dismiss:hover {
  color: var(--text-secondary);
}

.feedback-cert-btn {
  font-size: var(--text-base);
  padding: 0.85rem 2rem;
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: var(--space-xl); left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--text); color: var(--surface); padding: 12px 24px; border-radius: var(--radius-md);
  font-size: var(--text-sm); z-index: 999; opacity: 0; transition: all 0.3s ease;
  pointer-events: none; white-space: nowrap;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

.hidden { display: none !important; }

/* ── 2048 Game ── */
.game-section .category-heading {
  cursor: default;
}

.game-section .game-content {
  max-width: 400px;
  margin: 0 auto;
}

.game-auth-block {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
}

.game-auth-block p {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.game-auth-block .auth-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* ── Game header ── */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 350px;
  margin: 0 auto var(--space-md);
  gap: var(--space-sm);
}

.game-scores {
  display: flex;
  gap: var(--space-sm);
}

.game-score-box {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  text-align: center;
  min-width: 65px;
  box-shadow: var(--shadow-sm);
}

.game-score-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-score-value {
  font-size: 1.2rem;
  color: var(--primary);
  font-weight: 700;
}

.game-actions {
  display: flex;
  gap: 0.35rem;
}

.game-btn {
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
}

.game-btn:hover {
  opacity: 0.85;
}

.game-btn:active {
  opacity: 0.7;
}

.game-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Game board ── */
.game-container {
  position: relative;
  background: #bbada0;
  border-radius: var(--radius-sm);
  margin: 0 auto var(--space-md);
  width: var(--game-size, 350px);
  height: var(--game-size, 350px);
  padding: var(--game-pad, 12px);
}

.game-grid-bg {
  display: grid;
  grid-template-columns: repeat(4, var(--game-cell, 78px));
  grid-template-rows: repeat(4, var(--game-cell, 78px));
  gap: var(--game-gap, 8px);
}

.game-cell {
  width: var(--game-cell, 78px);
  height: var(--game-cell, 78px);
  background: rgba(238, 228, 218, 0.35);
  border-radius: 6px;
}

.game-tile-container {
  position: absolute;
  top: var(--game-pad, 12px);
  left: var(--game-pad, 12px);
  width: var(--game-inner, 326px);
  height: var(--game-inner, 326px);
  pointer-events: none;
}

.game-tile {
  position: absolute;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  transition: transform 0.12s ease-in-out;
  z-index: 10;
}

.game-tile.new {
  animation: game-pop 0.15s ease-out;
}

.game-tile.merged {
  animation: game-merge 0.15s ease-out;
  z-index: 20;
}

@keyframes game-pop {
  0% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.5); }
  100% { opacity: 1; transform: translate(var(--tx), var(--ty)) scale(1); }
}

@keyframes game-merge {
  0% { transform: translate(var(--tx), var(--ty)) scale(1); }
  50% { transform: translate(var(--tx), var(--ty)) scale(1.15); }
  100% { transform: translate(var(--tx), var(--ty)) scale(1); }
}

.game-tile-2 { background: #eee4da; color: #776e65; }
.game-tile-4 { background: #ede0c8; color: #776e65; }
.game-tile-8 { background: #f2b179; color: #f9f6f2; }
.game-tile-16 { background: #f59563; color: #f9f6f2; }
.game-tile-32 { background: #f67c5f; color: #f9f6f2; }
.game-tile-64 { background: #f65e3b; color: #f9f6f2; }
.game-tile-128 { background: #edcf72; color: #f9f6f2; font-size: 1.6rem; }
.game-tile-256 { background: #edcc61; color: #f9f6f2; font-size: 1.6rem; }
.game-tile-512 { background: #edc850; color: #f9f6f2; font-size: 1.6rem; }
.game-tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 1.4rem; }
.game-tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 1.4rem; animation: game-glow 1s ease-in-out infinite alternate; }

@keyframes game-glow {
  from { box-shadow: 0 0 10px #edc22e; }
  to { box-shadow: 0 0 25px #edc22e; }
}

/* ── Controls ── */
.game-controls {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 8px;
  margin: 0 auto var(--space-lg);
  justify-content: center;
}

.game-control-btn {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.game-control-btn:hover {
  background: var(--primary-hover);
}

.game-control-btn:active {
  transform: scale(0.95);
  background: #6b3510;
}

.game-control-up { grid-area: up; }
.game-control-down { grid-area: down; }
.game-control-left { grid-area: left; }
.game-control-right { grid-area: right; }

/* ── Leaderboard ── */
.game-leaderboard {
  max-width: 350px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  box-shadow: var(--shadow-sm);
}

.game-leaderboard-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
  padding: 0 0.3rem;
}

.game-leaderboard-list {
  max-height: 300px;
  overflow-y: auto;
}

.game-leaderboard-row {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.4rem;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  font-size: var(--text-xs);
  gap: 6px;
}

.game-leaderboard-row .rank {
  width: 20px;
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
}

.game-leaderboard-row .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.game-leaderboard-row .lb-score {
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.game-leaderboard-row .lb-tile {
  flex-shrink: 0;
  font-size: 0.9rem;
}

.game-leaderboard-row.is-me {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.game-leaderboard-row.is-me .name {
  font-weight: 700;
}

.game-leaderboard-row.gold { background: #fef3c7; }
.game-leaderboard-row.silver { background: #f1f5f9; }
.game-leaderboard-row.bronze { background: #fef9c3; }

.game-leaderboard-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  padding: var(--space-md) 0;
}

.game-player-label {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.game-player-label b {
  color: var(--primary);
}

/* ── Game overlay ── */
.game-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.game-overlay.active {
  display: flex;
}

.game-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  max-width: 280px;
  width: 90%;
}

.game-modal-emoji {
  font-size: 3.5rem;
  margin-bottom: var(--space-sm);
}

.game-modal h3 {
  font-size: var(--text-xl);
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.game-modal p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.game-prize-block {
  background: #fef3c7;
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.game-prize-block .prize-icon {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.game-prize-block .prize-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 3px;
}

.game-prize-block .prize-note {
  font-size: var(--text-xs);
  color: #92400e;
}

.prize-link-btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.5rem;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.prize-link-btn:hover {
  opacity: 0.9;
}

/* ── Instructions modal ── */
.game-instruction-chain {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: var(--space-sm);
  font-size: 1.3rem;
}

.game-instruction-rules {
  text-align: left;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.7;
  padding-left: var(--space-md);
}

.game-instruction-rules li {
  margin-bottom: 3px;
}

/* ── Responsive game ── */
@media (max-width: 380px) {
  .game-tile { font-size: 1.6rem; }
  .game-tile-128, .game-tile-256, .game-tile-512 { font-size: 1.3rem; }
  .game-tile-1024, .game-tile-2048 { font-size: 1.2rem; }
  .game-control-btn { width: 50px; height: 50px; font-size: 1.1rem; }
}

/* ── Hero Block (Пиньята) ── */
.hero-block {
  margin-top: var(--space-xl);
  margin-bottom: 0;
}

.hero-card {
  display: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border-light);
}
.hero-card.hero-current {
  display: block;
}

.hero-summary {
  position: relative;
  width: 100%;
  aspect-ratio: 1200/680;
}

.hero-summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
  border-radius: var(--radius-lg);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.hero-card-content {
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.hero-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin: 0;
  flex-shrink: 0;
}

.card-header-end {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.hero-chevron {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
  line-height: 1;
  margin-left: var(--space-xs);
}

.hero-card.expanded .hero-chevron {
  transform: rotate(180deg);
}

.hero-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.hero-card.expanded .hero-details {
  max-height: 2000px;
}

.hero-details-inner {
  padding: 0 var(--space-md) var(--space-md);
  background: var(--surface);
}

.hero-desc, .hero-instruction {
  margin: 0.5rem 0;
  color: var(--text);
}

.hero-desc p {
  margin-bottom: 0.75rem;
}

.hero-price {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0.5rem 0;
}

/* ── Hero Navigation ── */
.hero-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.hero-arrow {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
}
.hero-arrow:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.hero-arrow:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.hero-dots {
  display: flex;
  gap: var(--space-xs);
}

.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  padding: 0;
}
.hero-dot:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.hero-dot-active {
  background: var(--primary);
}

.hero-single .hero-nav {
  display: none;
}
