@font-face {
  font-family: "Brusnika";
  src: url("../fonts/Brusnika.otf") format("opentype");
  font-display: swap;
}

:root {
  --paper: #e7c99a;
  --paper-light: #f5e2bc;
  --ink: #281c15;
  --night: #14110e;
  --gold: #e0ad5d;
}

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

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--paper-light);
  background: var(--night);
  font-family: "Brusnika", "Trebuchet MS", sans-serif;
  font-size: 17px;
}

.page-background,
.page-shade {
  position: fixed;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
}

.page-background {
  object-fit: cover;
  image-rendering: pixelated;
  filter: blur(7px) saturate(0.68);
  transform: scale(1.05);
}

.page-shade {
  z-index: -1;
  background:
    radial-gradient(circle at center, rgba(24, 38, 28, 0.2), rgba(12, 10, 8, 0.82) 72%),
    rgba(14, 12, 10, 0.38);
}

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

a {
  text-decoration: none;
}

button {
  cursor: pointer;
}

.play-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 66px;
  padding: 9px max(18px, calc((100vw - 1180px) / 2));
  background: rgba(16, 13, 10, 0.9);
  border-bottom: 1px solid rgba(224, 173, 93, 0.38);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.back-link,
.brand,
.header-actions,
.language-switch {
  display: flex;
  align-items: center;
}

.back-link {
  justify-self: start;
  gap: 8px;
  color: rgba(245, 226, 188, 0.7);
}

.back-link span:first-child {
  color: var(--gold);
  font-size: 25px;
}

.brand {
  gap: 9px;
  font-size: 22px;
  font-weight: 700;
}

.brand img {
  border: 2px solid #8e623f;
  border-radius: 9px;
}

.header-actions {
  justify-self: end;
  gap: 10px;
}

.language-switch {
  min-height: 38px;
  padding: 7px 11px;
  background: rgba(20, 16, 13, 0.56);
  border: 1px solid rgba(231, 190, 120, 0.4);
  border-radius: 5px;
}

.language-switch {
  gap: 4px;
  color: rgba(245, 226, 188, 0.4);
}

.language-switch .is-active {
  color: var(--gold);
}

.back-link:hover,
.back-link:focus-visible {
  color: #fff4dc;
  border-color: rgba(231, 190, 120, 0.75);
}

.play-main {
  display: flex;
  align-items: center;
  flex-direction: column;
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
  padding: clamp(26px, 5vh, 54px) 0 30px;
}

.play-heading {
  margin-bottom: clamp(20px, 4vh, 38px);
  text-align: center;
}

.play-heading p {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.play-heading h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1;
  text-shadow: 0 5px 18px rgba(0, 0, 0, 0.4);
}

.phone {
  display: grid;
  grid-template-columns: 43px minmax(0, 932px) 43px;
  width: min(1024px, calc(100vw - 38px), calc((100vh - 210px) * 2.3814));
  padding: 11px 12px;
  background:
    linear-gradient(145deg, #343338, #131316 48%, #29282d),
    #1c1b1f;
  border: 2px solid #55545a;
  border-radius: 39px;
  box-shadow:
    inset 0 0 0 2px #09090a,
    inset 0 0 0 4px rgba(255, 255, 255, 0.05),
    0 34px 90px rgba(0, 0, 0, 0.58);
}

.phone__screen {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 932 / 430;
  background: #151425;
  border: 2px solid #050506;
  border-radius: 15px;
  box-shadow: 0 0 0 1px #48464b;
}

.phone__screen iframe {
  width: 100%;
  height: 100%;
  background: #151425;
  border: 0;
}

.phone__rail {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 11px;
}

.phone__camera {
  width: 10px;
  height: 10px;
  background: radial-gradient(circle at 40% 40%, #435b67, #08090b 58%);
  border: 2px solid #060608;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #46454a;
}

.phone__sensor {
  width: 5px;
  height: 5px;
  background: #08080a;
  border-radius: 50%;
}

.phone__speaker {
  width: 5px;
  height: 48px;
  background: repeating-linear-gradient(to bottom, #050506 0 3px, #36353a 3px 5px);
  border: 1px solid #08080a;
  border-radius: 5px;
}

.game-loading,
.game-error {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--paper-light);
  background:
    radial-gradient(circle at center, rgba(51, 78, 57, 0.42), transparent 48%),
    #11100d;
  text-align: center;
  transition: opacity 220ms ease;
}

.game-loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.game-loading img {
  width: clamp(48px, 8vw, 76px);
  margin-bottom: 10px;
  border: 2px solid #8c613f;
  border-radius: 12px;
}

.game-loading strong {
  font-size: clamp(18px, 3vw, 28px);
}

.game-loading > span {
  width: min(240px, 48%);
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  background: #070605;
  border: 1px solid #755037;
}

.game-loading i {
  display: block;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg, #3d6045, #dfa957, #3d6045);
  animation: loading 1.15s ease-in-out infinite;
}

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

.game-error b {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 9px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid #765038;
  border-radius: 7px;
  font-size: 28px;
  place-items: center;
}

.game-error strong {
  font-size: clamp(20px, 3vw, 30px);
}

.game-error p {
  margin: 7px 16px 0;
  color: rgba(245, 226, 188, 0.62);
}

.play-hint {
  max-width: 760px;
  margin: 25px 0 0;
  color: rgba(245, 226, 188, 0.56);
  text-align: center;
}

.rotate-hint {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #100d0b;
  text-align: center;
}

.rotate-hint span {
  color: var(--gold);
  font-size: 68px;
}

.rotate-hint p {
  margin: 8px 0 0;
  font-size: 29px;
}

@keyframes loading {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(265%);
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .play-header {
    min-height: 54px;
    padding-block: 5px;
  }

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

  .play-main {
    padding-top: 15px;
  }

  .play-heading,
  .play-hint {
    display: none;
  }

  .phone {
    width: min(1024px, calc(100vw - 20px), calc((100vh - 85px) * 2.3814));
  }
}

@media (max-width: 760px) {
  .play-header {
    min-height: 54px;
    padding-inline: 10px;
  }

  .brand span,
  .back-link span:last-child,
  .language-switch {
    display: none;
  }

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

  .play-heading {
    display: none;
  }

  .play-main {
    width: 100%;
    padding: 7px 5px 0;
  }

  .phone {
    grid-template-columns: 22px minmax(0, 1fr) 22px;
    width: 100%;
    padding: 5px;
    border-radius: 22px;
  }

  .phone__screen {
    border-radius: 10px;
  }

  .phone__speaker {
    height: 30px;
  }

  .play-hint {
    display: none;
  }
}

@media (orientation: portrait) and (max-width: 760px) {
  .rotate-hint {
    display: flex;
  }
}

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