:root {
  --maroon-950: #210208;
  --maroon-900: #36050d;
  --maroon-800: #510817;
  --maroon-700: #760d20;
  --red-600: #d51f35;
  --red-500: #ef3349;
  --gold-500: #f5b92f;
  --gold-300: #ffdc76;
  --white: #fffdfb;
  --ink: #22050b;
  --muted: #8f6a72;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 28px 80px rgba(26, 0, 6, 0.38);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--white);
  background:
    radial-gradient(circle at 50% 0%, rgba(213, 31, 53, 0.24), transparent 35rem),
    linear-gradient(155deg, var(--maroon-950), #120105 58%, #29030b);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none !important;
  filter: none !important;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold-300);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.16;
  pointer-events: none;
}

.ambient-one {
  top: 10rem;
  left: -8rem;
  background: var(--red-500);
}

.ambient-two {
  right: -7rem;
  bottom: 4rem;
  background: var(--gold-500);
}

.site-header,
main,
footer {
  width: min(1480px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  min-height: 74px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  color: var(--white);
  text-decoration: none;
  font-size: 1.35rem;
  font-style: italic;
  letter-spacing: -0.06em;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
}

.brand img {
  object-fit: contain;
}

.brand b {
  color: var(--gold-500);
}

.main-nav {
  display: flex;
  gap: 8px;
}

.main-nav a {
  padding: 11px 15px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
  transition: color 180ms ease, background 180ms ease;
}

.main-nav a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.contact-button,
.primary-button,
.secondary-button,
.flight-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 850;
  transition: transform 150ms ease, filter 150ms ease, background 150ms ease;
}

.contact-button:hover,
.primary-button:hover,
.secondary-button:hover,
.flight-button:hover,
.icon-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.contact-button:active,
.primary-button:active,
.secondary-button:active,
.flight-button:active,
.icon-button:active {
  transform: translateY(0) scale(0.98);
}

.contact-button {
  padding: 0 17px;
  font-size: 0.9rem;
}

.contact-button--ghost {
  color: white;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 118, 0.4);
}

.contact-button--light,
.contact-button--white {
  color: var(--maroon-700);
  background: var(--white);
}

.contact-button--telegram {
  color: white;
  background: linear-gradient(135deg, #319be8, #1679c1);
}

.game-section {
  padding: 28px 0 34px;
}

.game-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 16px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--gold-300);
  font-size: 0.79rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.eyebrow span {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
}

.eyebrow--small {
  margin: 0;
  font-size: 0.7rem;
}

.game-heading h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 3.9rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
  text-transform: uppercase;
}

.game-heading h1 em {
  color: var(--gold-500);
  font-style: normal;
}

.game-heading p:not(.eyebrow) {
  max-width: 680px;
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 1rem;
}

.control-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.84rem;
  white-space: nowrap;
}

kbd {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom-width: 3px;
  border-radius: 9px;
  color: white;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: stretch;
}

.play-card,
.mission-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.play-card {
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(118, 13, 32, 0.82), rgba(31, 2, 9, 0.96));
}

.scorebar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(17, 0, 5, 0.45);
}

.score-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.score-item--center {
  align-items: center;
}

.score-item--right {
  align-items: flex-end;
}

.score-item span {
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.13em;
}

.score-item strong {
  color: white;
  font-size: 1.36rem;
  font-variant-numeric: tabular-nums;
}

#lives-value {
  color: var(--red-500);
  letter-spacing: 0.12em;
}

.canvas-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #3d0715;
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  background: radial-gradient(circle at center, rgba(118, 13, 32, 0.46), rgba(22, 1, 6, 0.88));
  backdrop-filter: blur(4px);
}

.game-overlay[hidden] {
  display: none;
}

.game-overlay img {
  margin-bottom: 5px;
  object-fit: contain;
  filter: drop-shadow(0 9px 18px rgba(0, 0, 0, 0.4));
}

.overlay-kicker {
  margin: 0 0 4px;
  color: var(--gold-300);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.17em;
}

.game-overlay h2,
.claim-dialog h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.game-overlay > p:not(.overlay-kicker):not(.claim-code) {
  max-width: 470px;
  margin: 12px auto 20px;
  color: rgba(255, 255, 255, 0.78);
}

.primary-button,
.secondary-button {
  min-width: 170px;
  padding: 0 22px;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--red-500), #a70d27);
  box-shadow: 0 10px 30px rgba(213, 31, 53, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.secondary-button {
  color: var(--maroon-800);
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
}

.result-score {
  margin: 12px 0 0;
  color: var(--gold-300);
  font-size: clamp(2.8rem, 8vw, 5.6rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.08em;
}

.result-score small {
  font-size: 1rem;
  letter-spacing: 0;
}

.claim-code {
  margin: -4px 0 18px;
  padding: 8px 13px;
  border: 1px dashed rgba(255, 220, 118, 0.6);
  border-radius: 10px;
  color: var(--gold-300);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.86rem;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.flash {
  position: absolute;
  inset: 0;
  border: 6px solid transparent;
  pointer-events: none;
}

.flash.is-active {
  animation: hit-flash 420ms ease;
}

@keyframes hit-flash {
  0%, 100% { border-color: transparent; background: transparent; }
  35% { border-color: rgba(255, 45, 65, 0.94); background: rgba(255, 45, 65, 0.12); }
}

.play-controls {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}

.flight-button {
  min-width: 150px;
  padding: 0 22px;
  color: var(--maroon-900);
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  box-shadow: 0 7px 22px rgba(245, 185, 47, 0.2);
}

.icon-button {
  width: 46px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.icon-button.is-off {
  color: rgba(255, 255, 255, 0.42);
}

#game-status {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
  text-align: right;
}

.mission-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: linear-gradient(160deg, rgba(255, 253, 251, 0.98), rgba(247, 233, 229, 0.96));
  color: var(--ink);
}

.mission-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mission-card__top .eyebrow {
  color: var(--maroon-700);
}

.mission-card__top > strong {
  color: var(--maroon-700);
  font-size: 1.2rem;
}

.progress-track {
  height: 12px;
  margin-top: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4cbc9;
  box-shadow: inset 0 2px 5px rgba(44, 1, 10, 0.12);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red-500), var(--gold-500));
  box-shadow: 0 0 16px rgba(213, 31, 53, 0.38);
  transition: width 220ms ease;
}

.progress-copy {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.best-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  padding: 14px;
  border: 1px solid rgba(118, 13, 32, 0.12);
  border-radius: 16px;
  background: white;
}

.best-card span {
  color: var(--maroon-700);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.best-card strong {
  grid-row: 1 / 3;
  grid-column: 2;
  color: var(--maroon-700);
  font-size: 2rem;
}

.best-card small {
  color: var(--muted);
  font-size: 0.68rem;
}

.reward-list {
  margin-top: 22px;
}

.reward-list h2,
.how-to h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

.reward-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-top: 1px solid rgba(118, 13, 32, 0.1);
}

.reward-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #b76e34, #75401c);
  box-shadow: 0 6px 12px rgba(61, 9, 20, 0.15);
}

.reward-icon--silver {
  color: #5b626b;
  background: linear-gradient(145deg, #fff, #adb4bd);
}

.reward-icon--gold {
  color: var(--maroon-700);
  background: linear-gradient(145deg, var(--gold-300), #e99a18);
}

.reward-icon img {
  width: 30px;
  height: 28px;
  object-fit: contain;
}

.reward-row div {
  display: flex;
  flex-direction: column;
}

.reward-row strong {
  color: var(--maroon-800);
  font-size: 0.83rem;
}

.reward-row small {
  color: var(--muted);
  font-size: 0.73rem;
}

.how-to {
  margin-top: auto;
  padding-top: 22px;
}

.how-to ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-to li {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  color: #6d4c54;
  font-size: 0.76rem;
  line-height: 1.35;
}

.how-to li span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: white;
  background: var(--maroon-700);
  font-weight: 900;
}

.claim-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 10px;
  padding: 28px 32px;
  border: 1px solid rgba(255, 220, 118, 0.28);
  border-radius: 24px;
  background:
    linear-gradient(110deg, rgba(118, 13, 32, 0.96), rgba(213, 31, 53, 0.75)),
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.13), transparent 20rem);
  box-shadow: var(--shadow);
}

.claim-strip h2 {
  margin: 3px 0 2px;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
}

.claim-strip p:not(.eyebrow) {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.claim-strip__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.fair-play {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.82rem;
  text-align: center;
}

.fair-play strong {
  color: rgba(255, 255, 255, 0.78);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 100px;
  border-top: 1px solid var(--line);
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.78rem;
}

.brand--footer {
  font-size: 1rem;
}

.claim-dialog {
  width: min(480px, calc(100% - 32px));
  padding: 34px;
  border: 1px solid rgba(255, 220, 118, 0.36);
  border-radius: 26px;
  color: white;
  background:
    radial-gradient(circle at 50% 0%, rgba(213, 31, 53, 0.35), transparent 20rem),
    var(--maroon-950);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.claim-dialog::backdrop {
  background: rgba(16, 0, 4, 0.78);
  backdrop-filter: blur(6px);
}

.claim-dialog img {
  object-fit: contain;
}

.claim-dialog > p:not(.overlay-kicker) {
  color: rgba(255, 255, 255, 0.7);
}

.claim-dialog output {
  display: block;
  margin: 18px 0;
  padding: 15px;
  border: 1px dashed var(--gold-500);
  border-radius: 12px;
  color: var(--gold-300);
  background: rgba(0, 0, 0, 0.22);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.claim-dialog small {
  display: block;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.46);
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: rgba(255, 255, 255, 0.09);
  cursor: pointer;
  font-size: 1.4rem;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(390px, calc(100% - 40px));
  padding: 13px 16px;
  border: 1px solid rgba(255, 220, 118, 0.35);
  border-radius: 12px;
  color: white;
  background: rgba(44, 3, 13, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    display: none;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .mission-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 28px;
  }

  .mission-card__top,
  .progress-track,
  .progress-copy {
    grid-column: 1 / -1;
  }

  .progress-track {
    margin-top: -8px;
  }

  .progress-copy {
    margin-top: -18px;
  }

  .reward-list,
  .how-to {
    margin-top: 0;
    padding-top: 0;
  }
}

@media (max-width: 720px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1480px);
  }

  .site-header {
    min-height: 72px;
  }

  .brand {
    font-size: 1.02rem;
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

  .header-actions .contact-button--ghost {
    display: none;
  }

  .header-actions .contact-button {
    min-height: 42px;
    padding: 0 12px;
    font-size: 0.78rem;
  }

  .game-section {
    padding-top: 30px;
  }

  .game-heading {
    display: block;
  }

  .control-hint {
    display: none;
  }

  .game-heading p:not(.eyebrow) {
    font-size: 0.9rem;
  }

  .play-card,
  .mission-card {
    border-radius: 20px;
  }

  .scorebar {
    padding: 11px 14px;
  }

  .score-item strong {
    font-size: 1.05rem;
  }

  .game-overlay {
    padding: 16px;
  }

  .game-overlay img {
    width: 56px;
    height: 56px;
  }

  .game-overlay h2 {
    font-size: 1.4rem;
  }

  .game-overlay > p:not(.overlay-kicker):not(.claim-code) {
    margin: 7px auto 12px;
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .primary-button,
  .secondary-button {
    min-width: 130px;
    min-height: 40px;
    padding: 0 15px;
    font-size: 0.78rem;
  }

  .result-score {
    margin-top: 6px;
    font-size: 2.7rem;
  }

  .claim-code {
    margin-bottom: 10px;
    padding: 5px 9px;
    font-size: 0.7rem;
  }

  .play-controls {
    grid-template-columns: 1fr auto auto;
    padding: 10px;
  }

  .flight-button {
    min-width: 0;
  }

  #game-status {
    display: none;
  }

  .mission-card {
    display: block;
    padding: 20px;
  }

  .best-card,
  .reward-list,
  .how-to {
    margin-top: 18px;
  }

  .progress-track {
    margin-top: 14px;
  }

  .progress-copy {
    margin-top: 8px;
  }

  .claim-strip {
    display: block;
    padding: 24px;
  }

  .claim-strip__actions {
    display: grid;
    margin-top: 18px;
  }

  .fair-play {
    display: block;
  }

  .fair-play strong {
    display: block;
    margin-bottom: 4px;
  }

  footer {
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
