:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101820;
  color: #f7f3e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(56, 189, 248, 0.22), transparent 28%),
    linear-gradient(135deg, #101820 0%, #172334 48%, #0d151d 100%);
}

button,
a {
  font: inherit;
}

.game-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar,
.bottom-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(247, 243, 232, 0.08);
  border: 1px solid rgba(247, 243, 232, 0.16);
  border-radius: 8px;
  padding: 14px;
  backdrop-filter: blur(10px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.logo-mark {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f7f3e8;
  color: #101820;
  font-weight: 950;
  box-shadow: 0 0 22px rgba(52, 211, 153, 0.35);
}

.eyebrow {
  margin: 0 0 2px;
  color: #38bdf8;
  font-size: 0.76rem;
  text-transform: uppercase;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.28rem, 2.4vw, 2rem);
  line-height: 1.05;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(76px, 1fr));
  gap: 10px;
  width: min(720px, 100%);
}

.stat {
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(16, 24, 32, 0.72);
  border: 1px solid rgba(247, 243, 232, 0.13);
}

.stat span,
.panel-kicker,
.lane-button small,
.bottom-strip span {
  display: block;
  color: #b9c7d6;
  font-size: 0.76rem;
  font-weight: 750;
}

.stat strong {
  display: block;
  margin-top: 3px;
  font-size: 1.28rem;
}

.stage-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 16px;
  min-height: 0;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  min-height: 560px;
  border-radius: 8px;
  background: #101820;
  border: 1px solid rgba(247, 243, 232, 0.16);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-section {
  border-radius: 8px;
  background: rgba(247, 243, 232, 0.09);
  border: 1px solid rgba(247, 243, 232, 0.16);
  padding: 14px;
}

.panel-section.compact h2 {
  margin-top: 3px;
  font-size: 1.45rem;
}

.lane-meter {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.lane-meter span {
  height: 12px;
  border-radius: 999px;
  background: rgba(247, 243, 232, 0.22);
}

.lane-meter span.active {
  background: #34d399;
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.8);
}

.lane-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lane-button,
.primary-button,
.secondary-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: #f7f3e8;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.lane-button {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 12px 8px;
  background: #162233;
  border: 1px solid rgba(247, 243, 232, 0.14);
}

.lane-button:hover,
.lane-button.active,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.lane-button:first-child.active,
.lane-button:first-child:hover {
  border-color: #38bdf8;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.25);
}

.lane-button:last-child.active,
.lane-button:last-child:hover {
  border-color: #ff5d8f;
  box-shadow: 0 0 18px rgba(255, 93, 143, 0.25);
}

.lane-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f7f3e8;
  color: #101820;
  font-weight: 950;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.controls .primary-button {
  grid-column: 1 / -1;
}

.primary-button {
  background: #34d399;
  color: #101820;
  font-weight: 950;
}

.secondary-button {
  background: #1b2a3a;
  border: 1px solid rgba(247, 243, 232, 0.18);
  font-weight: 850;
}

.text-block {
  line-height: 1.5;
  color: #d5deea;
  font-size: 0.94rem;
}

.bottom-strip strong {
  display: block;
  margin-bottom: 3px;
}

.bottom-strip a {
  flex: 0 0 auto;
  color: #101820;
  background: #fbbf24;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 900;
}

.platform-crazygames .external-tool-link,
.platform-yandex .external-tool-link {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 9, 14, 0.62);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(460px, 100%);
  border-radius: 8px;
  background: #f7f3e8;
  color: #101820;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.modal-card h2 {
  font-size: 1.7rem;
}

.modal-card p {
  margin-top: 8px;
  color: #374151;
  line-height: 1.5;
}

.modal-stats {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.modal-stats div {
  border-radius: 8px;
  background: #e7dece;
  padding: 10px;
}

.modal-stats span {
  display: block;
  color: #596171;
  font-size: 0.75rem;
  font-weight: 800;
}

.modal-stats strong {
  display: block;
  margin-top: 2px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .secondary-button {
  color: #f7f3e8;
}

@media (max-width: 920px) {
  .topbar,
  .bottom-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .stat-grid {
    width: 100%;
  }

  .stage-wrap {
    grid-template-columns: 1fr;
  }

  #gameCanvas {
    height: auto;
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .text-block,
  .controls {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .game-shell {
    padding: 10px;
    gap: 10px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .logo-mark {
    width: 46px;
    height: 46px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .lane-controls,
  .modal-actions {
    grid-template-columns: 1fr 1fr;
  }

  .modal-stats {
    grid-template-columns: 1fr;
  }

  .bottom-strip a {
    text-align: center;
  }
}
