/* Meta Morfeya — Magical Design: Blue, Purple, Gold */

:root {
  --gold-gradient: linear-gradient(to right, #E6C777 0%, #CBAB50 100%);
  --spacing-block: 1rem;
  --spacing-section: 10rem;
  --spacing-title-content: 2rem;
  --bg-page: #B4A7D6;
  --bg-dark: #0a0612;
  --bg-card: rgba(255, 255, 255, 0.9);
  --purple-deep: #1a0a2e;
  --purple-mid: #2d1b4e;
  --purple-light: #4a2c7a;
  --purple-muted: #6f44bd;
  --blue-deep: #0f1729;
  --blue-mid: #1e3a5f;
  --blue-light: #3b5b8c;
  --gold: #c9a227;
  --gold-warm: #8b6914;
  --gold-light: #6b5510;
  --gold-dim: #6b5510;
  --accent-violet: #7c4dff;
  --accent-cyan: #4dd0e1;
  /* Единственный оранжевый акцент в UI */
  --orange-cta: #E66B3D;
  --orange-cta-hover: #D45428;
  --orange-rgb: 230, 107, 61;
  /* Тени под кнопками — нейтральные, не золотые */
  --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-btn-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
  --lilac-light-btn: #D4C4F0;
  --lilac-light-btn-hover: #C4B0E5;
  --text-primary: #2d1b4e;
  --text-secondary: #4a2c7a;
  --text-muted: #5a4078;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Subtle overlay on lavender background */
.stars, .twinkling {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.stars {
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,0.15) 0%, transparent 50%);
}

.twinkling {
  background: transparent;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  background: linear-gradient(180deg, rgba(180,167,214,0.95) 0%, rgba(180,167,214,0) 100%);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

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

.nav {
  display: flex;
  justify-content: flex-end;
  gap: 2rem;
  margin: 0;
}

.nav-link {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.3s, opacity 0.3s;
}

.nav-link:hover {
  color: #fff;
  opacity: 0.85;
}

.nav-btn-ghost {
  padding: 0.6rem 1.25rem;
  border: 2px solid #fff;
  border-radius: 12px;
  background: transparent;
}

.nav-btn-ghost:hover {
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.1);
}

.nav button.nav-btn-ghost {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  margin: 0;
}

.header-burger {
  display: none;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.header-burger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.header--nav-open .header-burger-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.header--nav-open .header-burger-bar:nth-child(2) {
  opacity: 0;
}

.header--nav-open .header-burger-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.logo {
  text-align: center;
}

.logo-name {
  font-family: 'Inter', sans-serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.15em;
  display: block;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* Sections */
main {
  position: relative;
  z-index: 1;
  padding-top: 140px;
}

.section {
  max-width: 1100px;
  margin: 0 auto var(--spacing-section);
  padding: 0 2rem;
}

.section-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--spacing-title-content);
}

.heading-icon-circle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold-warm);
  border-radius: 50%;
  color: var(--gold-warm);
  background: transparent;
  margin-bottom: 0.75rem;
}

.heading-icon-circle svg {
  width: 18px;
  height: 18px;
}

.section-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
  color: var(--purple-deep);
}

/* Hero */
.hero {
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem 2rem 5rem;
  margin-bottom: var(--spacing-section);
  background: radial-gradient(ellipse at center, rgba(124,77,255,0.15) 0%, transparent 70%);
}

.hero-tagline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.4rem;
  border: 1px solid var(--gold);
  border-radius: 2rem;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--text-primary);
  margin-bottom: var(--spacing-block);
}

.hero-tagline-star {
  color: var(--gold);
  font-size: 0.7rem;
}

.hero-title {
  font-family: 'Inter', sans-serif;
  font-size: clamp(3.25rem, 11vw, 5.5rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.hero-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(2.25rem, 6.5vw, 4rem);
  font-weight: 600;
  color: var(--gold);
  margin-bottom: var(--spacing-block);
  line-height: 1.2;
}

.hero-desc {
  max-width: 480px;
  margin: 0 auto var(--spacing-block);
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.6;
}

.hero-buttons {
  display: flex;
  gap: var(--spacing-block);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-block);
}

.btn-primary {
  background: var(--gold-gradient) !important;
  color: var(--bg-dark) !important;
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: 2rem !important;
}

.btn-secondary {
  background: transparent !important;
  border: 2px solid var(--gold) !important;
  color: var(--gold-light) !important;
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: 2rem !important;
}

.btn-secondary:hover {
  background: rgba(201,162,39,0.15) !important;
}

.hero-scroll {
  display: inline-block;
  color: var(--text-muted);
  font-size: 1.75rem;
  text-decoration: none;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* About */
.about .section-title-wrap {
  margin-bottom: 0.25rem;
}

.about-layout {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.about-photo {
  flex: 0 0 320px;
  margin-top: -0.5rem;
}

.about-content {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.about-photo-main {
  width: 100%;
  height: auto;
  aspect-ratio: 3/4;
  min-height: 420px;
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--gold-warm);
  border-radius: 12px;
  display: block;
}

.photo-placeholder {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--purple-mid) 0%, var(--blue-deep) 100%);
  border: 1px solid var(--gold-warm);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.photo-placeholder:hover {
  transform: scale(1.02);
  box-shadow: 0 0 30px rgba(201,162,39,0.2);
}

.placeholder-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}


.about-content p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

.about-intro {
  font-size: 1.2rem;
  color: var(--text-primary) !important;
}

.btn-outline {
  background: transparent !important;
  border: 2px solid var(--gold-warm) !important;
  color: var(--gold-light) !important;
  margin-top: 0.5rem;
  border-radius: 2rem !important;
}

.btn-outline:hover {
  background: rgba(197, 164, 126, 0.15) !important;
}

.about-cta {
  color: var(--gold-light) !important;
  font-style: italic;
}

/* About Popup */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.popup-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.popup-overlay[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.popup {
  background: var(--bg-card);
  border: 1px solid var(--gold-warm);
  border-radius: 16px;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: row;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.popup-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.popup-close:hover {
  background: rgba(197, 164, 126, 0.3);
}

.popup-photo {
  flex: 0 0 280px;
  padding: 0;
  overflow: hidden;
  border-radius: 16px 0 0 16px;
  align-self: stretch;
}

.popup-photo .photo-placeholder,
.popup-photo .about-photo-main {
  border-radius: 16px 0 0 16px;
  border: none;
  width: 100%;
  height: 100%;
  min-height: 400px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.popup-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.popup-content p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

/* Services */
.services {
  position: relative;
}

.services-header {
  text-align: center;
  margin-bottom: var(--spacing-title-content);
}

.services-header .heading-icon-circle {
  margin-left: auto;
  margin-right: auto;
}

.services-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--gold-warm);
  margin-bottom: 0.5rem;
  font-family: 'Inter', sans-serif;
}

.services-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.services-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 300;
}

.section-title-wrap .gallery-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(201,162,39,0.3);
}

.section-title-wrap:has(.gallery-title) {
  margin: var(--spacing-section) 0 0.5rem;
}

.gallery-desc {
  text-align: center;
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 300;
  margin: 0 auto var(--spacing-title-content);
  max-width: 560px;
}

.services-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr 1fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
}

.services-gallery .gallery-img {
  width: 100%;
  aspect-ratio: 4/3;
  min-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--gold-warm);
  transition: transform 0.3s, box-shadow 0.3s;
  display: block;
  cursor: pointer;
}

.services-gallery .gallery-img:hover {
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(201,162,39,0.2);
}

/* Gallery Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid var(--gold-warm);
  box-shadow: 0 0 60px rgba(201,162,39,0.3);
  transform: scale(0.7);
  animation: galleryZoomIn 0.35s ease-out forwards;
}

@keyframes galleryZoomIn {
  to {
    transform: scale(1);
  }
}

.gallery-lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border: 1px solid var(--gold-warm);
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.gallery-lightbox-close:hover {
  background: rgba(197, 164, 126, 0.3);
}

.service-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: var(--spacing-section);
}

.service-card {
  background: rgba(15, 10, 25, 0.9);
  border: 1px solid var(--purple-muted);
  border-radius: 16px;
  padding: 1.75rem;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.service-card:hover {
  border-color: rgba(111, 68, 189, 0.7);
  box-shadow: 0 12px 40px rgba(111, 68, 189, 0.2);
  transform: translateY(-2px);
}

.service-card-featured {
  border: 1px solid var(--gold-warm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(197, 164, 126, 0.15);
}

.service-card-featured .service-number {
  color: var(--gold-warm);
}

.service-card-featured:hover {
  border-color: var(--gold-light);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(197, 164, 126, 0.25);
  transform: translateY(-2px);
}

.service-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.service-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--purple-muted);
  letter-spacing: -0.02em;
}

.service-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold-warm);
  border-radius: 50%;
  color: var(--gold-warm);
  background: transparent;
}

.service-icon svg {
  width: 18px;
  height: 18px;
}

.service-card h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.service-price {
  font-size: 1.1rem;
  color: var(--gold-light);
  margin-bottom: 1rem;
}

.service-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 1rem;
  flex: 1;
}

.service-format {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.btn-service {
  margin-top: auto;
  width: 100%;
  text-align: center;
  border-radius: 2rem !important;
  white-space: nowrap;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--gold-gradient);
  color: var(--bg-dark);
  text-decoration: none;
  border: none;
  border-radius: 2rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-btn);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn-hover);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  border-radius: 1.5rem !important;
}

/* Game Section */
.game-section {
  margin-bottom: var(--spacing-section) !important;
  /* две колонки доска + панель шире стандартного .section */
  max-width: min(2480px, 100%);
}

.game-preview {
  display: flex;
  gap: 3rem;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.game-preview-text {
  flex: 1;
  min-width: 280px;
}

.game-preview-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--gold-warm);
  margin-bottom: 0.5rem;
}

.game-preview-title {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.game-preview-text p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.65;
}

.game-preview-text .btn {
  display: inline-block;
  margin-top: 0.5rem;
}

.game-preview-board-wrap {
  flex: 1;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-preview-board {
  display: grid;
  grid-template-columns: repeat(9, 26px);
  grid-template-rows: repeat(8, 26px);
  gap: 1px;
  width: fit-content;
  margin: 0 auto 1.25rem;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.1) 100%),
    url('assets/cosmic-bg.png');
  background-size: cover;
  background-position: center;
  padding: 36px;
  border-radius: 16px;
  border: 2px solid rgba(139,105,20,0.5);
  box-shadow: 0 4px 30px rgba(45,27,78,0.4);
}

.preview-cell {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 3px;
  padding: 2px;
  font-size: 0.45rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255,255,255,0.2);
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.6);
  box-sizing: border-box;
}

.preview-cell .preview-cell-num {
  font-weight: 600;
  color: rgba(240, 216, 77, 0.5);
  font-size: 0.1rem;
  line-height: 1;
  text-shadow: none;
}

.preview-cell .preview-cell-name {
  font-size: 0.07rem;
  line-height: 1;
  color: rgba(232, 224, 255, 0.5);
  word-break: break-word;
  text-shadow: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.preview-ascent,
.preview-descent,
.preview-reflection {
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255,255,255,0.2);
}

.preview-ascent {
  border-color: rgba(76, 175, 80, 0.7);
}

.preview-descent {
  border-color: rgba(244, 67, 54, 0.6);
}

.game-preview-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-ascent { background: rgba(76, 175, 80, 0.8); }
.legend-descent { background: rgba(244, 67, 54, 0.8); }
.legend-reflection { background: rgba(45, 27, 78, 0.9); }

/* Fullscreen Game Screen */
.game-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  z-index: 999;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.game-screen.is-open {
  opacity: 1;
  visibility: visible;
}

.game-screen[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.game-screen-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: 1px solid var(--gold-warm);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-primary);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.game-screen-close:hover {
  background: rgba(255, 255, 255, 1);
}

.game-screen-layout {
  container-type: inline-size;
  container-name: game-layout;
  display: grid;
  grid-template-columns: minmax(0, min(92vh, 1200px)) minmax(0, min(92vh, 1200px));
  align-items: start;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  box-sizing: border-box;
}

.game-board-area {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  align-self: start;
}

.game-board-area .game-board-wrapper {
  position: relative;
  width: 100%;
  max-width: min(100%, min(92vh, 1200px));
  min-width: 0;
  aspect-ratio: 9/8;
  overflow: hidden;
  border-radius: 16px;
}

.game-board-area .game-board {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.game-controls-panel {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  margin: 0;
  color: var(--purple-deep);
  box-shadow: 0 4px 24px rgba(45,27,78,0.12);
  min-height: 0;
  align-self: start;
  /* та же высота, что у доски: (ширина колонки − половина gap) × 8/9 */
  height: calc((100cqw - 1rem) / 2 * 8 / 9);
  max-height: calc((100cqw - 1rem) / 2 * 8 / 9);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.game-panel-description {
  flex-shrink: 0;
}

.game-panel-title {
  font-size: clamp(1.2rem, 0.85rem + 2.1vw, 2.7rem);
  font-weight: 400;
  color: var(--purple-deep);
  margin: 0 0 0.5rem 0;
  line-height: 1.22;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  hyphens: auto;
}

.game-panel-subtitle {
  font-size: clamp(0.88rem, 0.82rem + 0.45vw, 1.02rem);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.game-panel-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.game-panel-buttons .btn {
  flex: 1;
  min-width: 160px;
  margin-top: 0;
  padding: 1.2rem 1.5rem;
  font-size: 1.15rem;
}

/* Focus Popup */
.focus-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(180,167,214,0.9);
  backdrop-filter: blur(8px);
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.focus-popup-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.focus-popup-overlay[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.focus-popup {
  background: var(--bg-card);
  border: 1px solid var(--gold-warm);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: min(720px, 92vw);
  width: 100%;
}

.focus-popup h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.5rem;
  color: var(--purple-deep);
  margin-bottom: 1rem;
}

.focus-popup-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.focus-popup textarea {
  width: 100%;
  min-height: 300px;
  padding: 1rem;
  background: #e8e8e8;
  border: 1px solid #b8b8b8;
  border-radius: 8px;
  color: var(--purple-deep);
  font-family: inherit;
  resize: vertical;
  margin-bottom: 1.25rem;
}

.focus-popup textarea:focus {
  border-color: var(--orange-cta);
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--orange-rgb), 0.25);
}

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

.focus-popup .btn {
  width: 100%;
  border-radius: 2rem !important;
}

.game-setup {
  display: flex;
  flex-direction: column;
}

.game-controls .player-name-heading {
  font-family: 'Inter', sans-serif;
  font-size: 3rem;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.65rem 0;
  color: var(--purple-deep);
}

@media (max-width: 600px) {
  .game-controls .player-name-heading {
    font-size: clamp(2rem, 9vw, 2.75rem);
  }
}

.player-intention-block {
  margin-bottom: 1rem;
}

.player-intention-details {
  border-radius: 8px;
}

.player-intention-summary {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 0.15rem 0;
}

.player-intention-summary::-webkit-details-marker {
  display: none;
}

.player-intention-summary::before {
  content: '▸';
  display: inline-block;
  font-size: 0.75rem;
  color: var(--purple-muted);
  transition: transform 0.15s ease;
}

.player-intention-details[open] .player-intention-summary::before {
  transform: rotate(90deg);
}

.player-intention-details .player-intention-summary + textarea {
  margin-top: 0.4rem;
}

.player-intention-block textarea {
  width: 100%;
  min-height: 72px;
  padding: 0.65rem 0.75rem;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  box-shadow: none;
  color: var(--purple-deep);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  line-height: 1.45;
}

.player-intention-block textarea:focus {
  outline: none;
  box-shadow: none;
}

.player-intention-block textarea:focus-visible {
  outline: 2px solid rgba(var(--orange-rgb), 0.55);
  outline-offset: 2px;
}

.game-setup h3, .game-controls h3:not(.player-name-heading) {
  font-family: 'Inter', sans-serif;
  color: var(--purple-deep);
  margin-bottom: 1rem;
}

.game-setup-controls {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
}

.players-setup {
  margin-bottom: 1rem;
}

.game-setup .game-panel-description {
  margin-bottom: 1rem;
}

.game-setup .game-panel-buttons {
  margin-top: 1rem;
  margin-bottom: 0;
}

.players-setup,
.game-panel-buttons {
  width: 100%;
}

.players-setup label, .question-block label {
  display: block;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

#gameMode {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid rgba(45,27,78,0.25);
  border-radius: 8px;
  color: var(--purple-deep);
}

#playerQuestion {
  width: 100%;
  min-height: 80px;
  padding: 0.75rem;
  background: var(--purple-mid);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 4px;
  color: var(--text-primary);
  resize: vertical;
  margin-bottom: 1rem;
}

#addPlayer,
#startGame {
  width: 100%;
  margin-top: 1rem;
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: 12px !important;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.game-panel-buttons #addPlayer,
.game-panel-buttons #startGame {
  width: auto;
  margin-top: 0;
}

.btn-primary-panel {
  background: var(--orange-cta) !important;
  border: none !important;
  color: #fff !important;
}

.btn-primary-panel:hover {
  background: var(--orange-cta-hover) !important;
  color: #fff !important;
}

.btn-secondary-panel {
  background: var(--lilac-light-btn) !important;
  border: none !important;
  color: #fff !important;
}

.btn-secondary-panel:hover {
  background: var(--lilac-light-btn-hover) !important;
  color: #fff !important;
}

.btn-add-player {
  background: var(--lilac-light-btn) !important;
  border: none !important;
  color: #fff !important;
}

.btn-add-player:hover {
  background: var(--lilac-light-btn-hover) !important;
  color: #fff !important;
}

.player-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.player-name-input {
  flex: 1;
  padding: 0.5rem;
  background: var(--lilac-light-btn);
  border: 1px solid var(--purple-muted);
  border-radius: 8px;
  color: var(--purple-deep);
}

.btn-remove {
  background: var(--lilac-light-btn);
  color: #fff;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.2s;
}

.btn-remove:hover {
  background: var(--lilac-light-btn-hover);
  color: #fff;
}

.game-controls .btn {
  width: 100%;
  margin-top: 1rem;
  border-radius: 2rem !important;
}

.player-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.player-view-tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.45rem 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--purple-deep);
  background: rgba(var(--orange-rgb), 0.12);
  border: 1px solid rgba(var(--orange-rgb), 0.45);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}

.player-view-tab:hover {
  background: rgba(var(--orange-rgb), 0.22);
  border-color: var(--orange-cta);
}

.player-view-tab.is-active {
  background: var(--orange-cta);
  color: #fff;
  border-color: var(--orange-cta-hover);
  box-shadow: 0 2px 8px rgba(var(--orange-rgb), 0.4);
}

.game-turn-line {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.dice-container {
  margin: 1rem 0 1rem;
  perspective: 400px;
}

.dice {
  width: 140px;
  height: 140px;
  background: transparent;
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s;
  margin: 0 auto 1.25rem;
  box-shadow: 0 2px 10px rgba(45, 27, 78, 0.12);
  position: relative;
  overflow: hidden;
}

.dice:hover:not(.dice-disabled) {
  transform: scale(1.05);
}

.dice.dice-disabled {
  cursor: wait;
  pointer-events: none;
}

.dice.rolling {
  animation: diceRoll 0.5s ease-out;
}

@keyframes diceRoll {
  0% { transform: rotateX(0) rotateY(0) rotateZ(0); }
  33% { transform: rotateX(180deg) rotateY(120deg) rotateZ(90deg); }
  66% { transform: rotateX(360deg) rotateY(240deg) rotateZ(180deg); }
  100% { transform: rotateX(540deg) rotateY(360deg) rotateZ(270deg); }
}

.dice-question {
  position: absolute;
  font-size: 3.5rem;
  font-weight: 700;
  color: #666666;
  opacity: 0.8;
  pointer-events: none;
}

.dice[data-value] {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(45, 27, 78, 0.12);
}

/* Грани кубика — PNG с белым полем */
.dice-face-sprite {
  display: none;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  border-radius: inherit;
}

.dice[data-value="1"] .dice-face-sprite { background-image: url('assets/dice-1.png'); }
.dice[data-value="2"] .dice-face-sprite { background-image: url('assets/dice-2.png'); }
.dice[data-value="3"] .dice-face-sprite { background-image: url('assets/dice-3.png'); }
.dice[data-value="4"] .dice-face-sprite { background-image: url('assets/dice-4.png'); }
/* грани 2 и 4: растянуть PNG на всю грань кубика */
.dice[data-value="2"] .dice-face-sprite,
.dice[data-value="4"] .dice-face-sprite {
  background-size: 100% 100%;
  background-position: center center;
}
.dice[data-value="5"] .dice-face-sprite { background-image: url('assets/dice-5.png'); }
.dice[data-value="6"] .dice-face-sprite { background-image: url('assets/dice-6.png'); }

.dice[data-value] .dice-question { display: none; }
.dice[data-value] .dice-face-sprite { display: block; }
.dice:not([data-value]) .dice-face-sprite { display: none; }

.game-status {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.cell-interpretation {
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(45,27,78,0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  min-height: 80px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.game-history {
  margin-top: 1rem;
  max-height: min(50vh, 420px);
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
  -webkit-overflow-scrolling: touch;
}

.game-history-row {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(45, 27, 78, 0.08);
}

.game-history-row:last-child {
  border-bottom: none;
}

.game-history-line {
  line-height: 1.45;
}

.game-history-details {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.game-history-summary {
  cursor: pointer;
  color: var(--purple-muted);
  font-weight: 500;
  list-style: none;
}

.game-history-summary::-webkit-details-marker {
  display: none;
}

.game-history-summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s ease;
}

.game-history-details[open] .game-history-summary::before {
  transform: rotate(90deg);
}

.cell-interpretation-head {
  margin-bottom: 0.5rem;
}

.cell-interpretation-head strong {
  font-size: 1.05rem;
  color: var(--purple-deep);
}

.cell-interpretation-body .cell-desc-short {
  margin: 0 0 0.5rem 0;
  line-height: 1.5;
}

.cell-desc-details {
  margin: 0.25rem 0 0 0;
  border-radius: 6px;
  background: rgba(45, 27, 78, 0.04);
}

.cell-desc-summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--purple-muted);
  padding: 0.35rem 0.5rem;
  list-style: none;
}

.cell-desc-summary::-webkit-details-marker {
  display: none;
}

.cell-desc-summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s ease;
}

.cell-desc-details[open] .cell-desc-summary::before {
  transform: rotate(90deg);
}

.cell-desc-long {
  padding: 0 0.5rem 0.65rem 0.5rem;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary);
  border-top: 1px solid rgba(45, 27, 78, 0.08);
}

.cell-move-note {
  margin: 0.65rem 0 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

.cell-intention-context {
  margin: 0.65rem 0 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

/* Game Board */
.game-board {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: clamp(1px, 0.4vw, 3px);
  background-image: url('assets/cosmic-bg.png');
  background-size: cover;
  background-position: center;
  padding: clamp(4px, 2vw, 12px);
  border-radius: 16px;
  border: 2px solid rgba(139,105,20,0.5);
  box-shadow: 0 4px 30px rgba(45,27,78,0.4);
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.game-board-area .game-pieces {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.game-board-area .game-pieces .piece {
  width: 24px;
  height: 24px;
}


.game-board .cell {
  aspect-ratio: 1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  padding: clamp(2px, 1.2vw, 6px) clamp(3px, 1.5vw, 8px);
  position: relative;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  transition: box-shadow 0.3s, background 0.3s;
  overflow: hidden;
  box-sizing: border-box;
}

.game-board .cell:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 10px rgba(124,77,255,0.5);
}

.game-board .cell.arrow-cell,
.game-board .cell.snake-cell {
  background: transparent;
}

.cell.current {
  box-shadow: 0 0 15px var(--gold);
  border-color: var(--gold);
}

.cell-num {
  font-weight: 600;
  color: #fff;
  font-size: clamp(0.42rem, 2.5vw, 0.9rem);
  font-family: 'Inter', sans-serif;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-pieces {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.piece {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid white;
  transition: all 0.5s ease;
  z-index: 10;
}

.piece-0 { background: var(--gold); }
.piece-1 { background: var(--accent-cyan); }
.piece-2 { background: var(--accent-violet); }
.piece-3 { background: #e91e63; }

.piece.piece--viewing {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 0 12px rgba(var(--orange-rgb), 0.55);
  z-index: 12;
}

/* Contact */
/* FAQ Section */
.faq-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
}

.faq-label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--gold-warm);
  margin-bottom: 0.5rem;
}

.faq-title {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.faq-cta {
  background: rgba(45, 27, 78, 0.6);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 12px;
  padding: 1.5rem;
}

.faq-cta p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  background: rgba(20, 12, 35, 0.8);
  border: 1px solid rgba(201,162,39,0.25);
  border-radius: 8px;
  overflow: hidden;
}

.faq-question {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-primary);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--gold-warm);
  flex-shrink: 0;
}

.faq-item[open] .faq-question::after {
  content: '−';
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.faq-item[open] .faq-question {
  border-bottom: 1px solid rgba(201,162,39,0.2);
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .faq-layout {
    grid-template-columns: 1fr;
  }
}

.contact {
  text-align: center;
}

.contact-text {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.contact-placeholder a {
  color: var(--gold);
  text-decoration: none;
}

.contact-placeholder a:hover {
  text-decoration: underline;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid rgba(45,27,78,0.2);
}

/* Responsive */
@media (max-width: 900px) {
  .section.about {
    padding-left: 0;
    padding-right: 0;
  }

  .section.about .section-title-wrap {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .about-layout {
    flex-direction: column;
    align-items: stretch;
    max-width: none;
  }

  .about-photo {
    flex: none;
    width: 100%;
    max-width: none;
    margin-top: 0;
    min-height: 100vh;
  }

  .about-photo-main {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    object-fit: cover;
    object-position: center top;
    border-radius: 0;
  }

  .about-content {
    padding: 0 2rem 2rem;
  }

  .service-cards {
    grid-template-columns: 1fr;
  }

  .game-preview {
    flex-direction: column;
    text-align: center;
  }

  .game-preview-text {
    order: 1;
  }


  .game-preview-board-wrap {
    order: 2;
    width: 100%;
  }

  .game-screen-layout {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    padding: 1.5rem 1rem;
    gap: 0.4rem;
    container-type: normal;
  }

  .header {
    padding: 0.75rem 1rem;
    flex-wrap: nowrap;
  }

  .header-burger {
    display: flex;
    margin-left: auto;
  }

  .header .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem 1.25rem 1.25rem;
    margin: 0;
    background: rgba(180, 167, 214, 0.98);
    backdrop-filter: blur(12px);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 12px 32px rgba(45, 27, 78, 0.15);
    z-index: 2;
  }

  .header--nav-open .nav {
    display: flex;
  }

  .header .nav .nav-btn-ghost {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }

  .logo-img {
    height: 30px;
  }

  .nav-link {
    font-size: 0.8rem;
  }

  .game-controls-panel {
    flex: none;
    width: 100%;
    padding-bottom: 0.85rem;
    height: auto;
    max-height: none;
    overflow-x: visible;
    overflow-y: visible;
  }

  .game-board-area {
    margin-top: 0;
  }

  .game-board-area .game-board-wrapper {
    max-width: 100%;
  }

  .game-board-area .game-board {
    max-width: 100%;
  }
  
  .game-sidebar {
    flex: 1 1 100%;
  }
  
  .game-board {
    max-width: 100%;
  }

  .game-panel-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .game-panel-buttons .btn {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  .game-panel-buttons #addPlayer,
  .game-panel-buttons #startGame {
    width: 100%;
  }
  
  .cell {
    font-size: 0.5rem;
  }
  
  .cell-name,
  .preview-cell-name {
    display: none;
  }
}

@media (max-width: 600px) {
  .game-screen-layout {
    gap: 0.3rem;
    padding: 1.25rem 0.75rem;
  }

  .game-controls-panel {
    padding-bottom: 0.65rem;
  }
  
  .section.about {
    padding-left: 0;
    padding-right: 0;
  }

  .section.about .section-title-wrap {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .about-layout {
    flex-direction: column;
    align-items: stretch;
  }
  
  .about-photo {
    flex: none;
    width: 100%;
    max-width: none;
  }

  .about-photo-main {
    height: 100vh;
    min-height: 100vh;
  }
  
  .services-gallery {
    grid-template-columns: 1fr 1fr 2fr 1fr 1fr;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    min-width: min-content;
  }
  .services-gallery .gallery-img {
    min-width: 80px;
  }
  .services-gallery .gallery-img:nth-child(3) {
    min-width: 160px;
  }
  
  .popup {
    max-width: 100%;
    margin: 1rem;
    flex-direction: column;
  }
  .popup-photo {
    flex: none;
    width: 100%;
    max-height: 280px;
  }
  .popup-photo .about-photo-main {
    min-height: 200px;
    border-radius: 16px 16px 0 0;
  }
}
