:root {
  --bg: #120e0a;
  --bg-deep: #0a0806;
  --bone: #e8dcc8;
  --bone-dim: #cbbda8;
  --ochre: #c47a2c;
  --ochre-hot: #e0943a;
  --moss: #4a6b3a;
  --ember: #b4421c;
  --stone: #3a3228;
  --ink: #1a1510;
  --shadow: rgba(8, 5, 2, 0.72);
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--bone);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

.topbar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  padding: 1rem 1.1rem;
  pointer-events: none;
}

.topbar__auth {
  display: flex;
  gap: 0.55rem;
  pointer-events: auto;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-btn {
  min-height: 42px;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.auth-btn--ghost {
  border: 1px solid rgba(232, 220, 200, 0.28);
  background: rgba(18, 14, 10, 0.55);
  backdrop-filter: blur(10px);
  color: var(--bone);
}

.auth-btn--solid {
  background: linear-gradient(180deg, var(--ochre-hot), var(--ochre));
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(196, 122, 44, 0.28);
}

.auth-btn:hover,
.auth-btn:focus-visible {
  transform: translateY(-1px);
}

.auth-overlay {
  z-index: 60;
}

.auth-card {
  position: relative;
  width: min(440px, 100%);
  padding: 1.45rem 1.35rem 1.3rem;
  border-radius: 24px;
  border: 1px solid rgba(232, 220, 200, 0.14);
  background:
    radial-gradient(circle at top right, rgba(196, 122, 44, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(58, 50, 40, 0.96), rgba(18, 14, 10, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  text-align: left;
  animation: rise 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-card__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(232, 220, 200, 0.16);
  background: rgba(18, 14, 10, 0.45);
  font-size: 1.2rem;
  line-height: 1;
}

.auth-card__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.7rem;
  padding-right: 2rem;
}

.auth-card__head img {
  width: 48px;
  height: 48px;
  border-radius: 30%;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.auth-card__eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ochre-hot);
}

.auth-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-card__lead {
  margin: 0 0 1.1rem;
  color: var(--bone-dim);
  line-height: 1.45;
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field span {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(232, 220, 200, 0.16);
  background: rgba(10, 8, 6, 0.55);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder {
  color: rgba(232, 220, 200, 0.35);
}

.field input:focus {
  border-color: rgba(224, 148, 58, 0.7);
  box-shadow: 0 0 0 3px rgba(196, 122, 44, 0.18);
}

.field input.is-invalid {
  border-color: rgba(180, 66, 28, 0.85);
}

.auth-form__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--bone-dim);
  font-size: 0.9rem;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ochre);
}

.linkish {
  color: var(--ochre-hot);
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-msg {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.auth-msg.is-error {
  background: rgba(180, 66, 28, 0.18);
  border: 1px solid rgba(180, 66, 28, 0.45);
  color: #f0c2b0;
}

.auth-msg.is-success {
  background: rgba(74, 107, 58, 0.22);
  border: 1px solid rgba(74, 107, 58, 0.55);
  color: #d7e8c8;
}

.auth-submit {
  width: 100%;
  min-height: 50px;
}

.auth-submit.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

img {
  display: block;
  max-width: 100%;
}

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.hero__media video,
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero__shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 8, 6, 0.35) 0%, rgba(10, 8, 6, 0.18) 38%, rgba(10, 8, 6, 0.72) 78%, rgba(10, 8, 6, 0.92) 100%),
    radial-gradient(ellipse at 50% 28%, rgba(196, 122, 44, 0.18), transparent 55%);
}

.hero__inner {
  width: min(920px, calc(100% - 2.5rem));
  padding: 18svh 0 12svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.1rem;
  animation: rise 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.brand__mark {
  width: clamp(72px, 14vw, 108px);
  height: clamp(72px, 14vw, 108px);
  border-radius: 28%;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  animation: pulse-mark 4.5s ease-in-out infinite;
}

.brand__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 5.4rem);
  letter-spacing: 0.04em;
  line-height: 0.92;
  text-transform: uppercase;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

.brand__name span {
  display: block;
  color: var(--ochre-hot);
}

.hero__line {
  margin: 0;
  max-width: 34rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.45;
  color: var(--bone-dim);
  animation: rise 1.2s 0.12s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cta {
  margin-top: clamp(2.5rem, 8svh, 4.5rem);
  min-width: min(280px, 100%);
  padding: 1rem 1.6rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--ochre-hot), var(--ochre));
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow:
    0 0 0 1px rgba(232, 220, 200, 0.18) inset,
    0 16px 40px rgba(196, 122, 44, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  animation: rise 1.25s 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cta:hover,
.cta:focus-visible {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.05);
  box-shadow:
    0 0 0 1px rgba(232, 220, 200, 0.25) inset,
    0 20px 48px rgba(196, 122, 44, 0.45);
}

.cta:active {
  transform: translateY(0) scale(0.99);
}

.hint {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 220, 200, 0.55);
}

.game {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  background:
    radial-gradient(circle at top, rgba(74, 107, 58, 0.18), transparent 40%),
    linear-gradient(180deg, #1a1510, #0a0806);
}

.game.is-open {
  display: flex;
  animation: fade-in 0.35s ease both;
}

.game__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(232, 220, 200, 0.08);
  background: rgba(18, 14, 10, 0.88);
  backdrop-filter: blur(10px);
}

.game__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.game__brand img {
  width: 36px;
  height: 36px;
  border-radius: 30%;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.stat {
  min-width: 84px;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(232, 220, 200, 0.12);
  border-radius: 12px;
  background: rgba(58, 50, 40, 0.45);
}

.stat small {
  display: block;
  color: var(--bone-dim);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat strong {
  font-family: var(--font-display);
  font-size: 1rem;
}

.game__close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(232, 220, 200, 0.16);
  background: rgba(58, 50, 40, 0.5);
  font-size: 1.2rem;
  line-height: 1;
}

.game__stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 0.75rem;
  min-height: 0;
}

#game-canvas {
  width: min(100%, 920px);
  height: auto;
  max-height: calc(100svh - 170px);
  border-radius: 18px;
  border: 1px solid rgba(232, 220, 200, 0.1);
  background: #1d1812;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  touch-action: none;
}

.game__log {
  margin: 0;
  padding: 0.7rem 1rem 1rem;
  min-height: 3.2rem;
  text-align: center;
  color: var(--bone-dim);
  font-size: 0.95rem;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 1rem;
  background: rgba(8, 5, 2, 0.72);
  backdrop-filter: blur(6px);
}

.overlay.is-open {
  display: grid;
  animation: fade-in 0.25s ease both;
}

.panel {
  width: min(420px, 100%);
  padding: 1.4rem 1.3rem 1.2rem;
  border-radius: 22px;
  border: 1px solid rgba(232, 220, 200, 0.14);
  background:
    linear-gradient(180deg, rgba(58, 50, 40, 0.92), rgba(26, 21, 16, 0.96));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.panel h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel p {
  margin: 0 0 1.1rem;
  color: var(--bone-dim);
  line-height: 1.45;
}

.panel__actions {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  min-width: 120px;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.btn--primary {
  background: linear-gradient(180deg, var(--ochre-hot), var(--ochre));
  color: var(--ink);
}

.btn--ghost {
  border: 1px solid rgba(232, 220, 200, 0.2);
  background: rgba(18, 14, 10, 0.5);
}

.btn--danger {
  background: linear-gradient(180deg, #d4572c, var(--ember));
  color: var(--bone);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse-mark {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0.75rem;
  }

  .auth-btn {
    min-height: 38px;
    padding: 0.55rem 0.8rem;
    font-size: 0.74rem;
  }

  .game__top {
    flex-wrap: wrap;
  }

  .stats {
    width: 100%;
    order: 3;
  }

  #game-canvas {
    max-height: calc(100svh - 220px);
  }
}
