:root {
  --board-bg: #0c0f14;
  --board-panel: #14181f;
  --board-cell: #1b2028;
  --board-cell-top: #222833;
  --board-amber: #ffc74d;
  --board-amber-dim: #b8862f;
  --board-ink: #e8ecf2;
}

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

html {
  min-width: 20rem;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--board-bg);
}

.locations-page {
  --tool-nav-foreground: var(--board-ink);
  --tool-nav-background: rgba(12, 15, 20, 0.9);
  --tool-nav-border: rgba(232, 236, 242, 0.28);
  --tool-nav-focus: var(--board-amber);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 199, 77, 0.08), transparent 34rem),
    var(--board-bg);
  color: var(--board-ink);
  font-family: "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
}

.locations-shell {
  display: grid;
  width: min(100% - 2rem, 62rem);
  min-height: 100vh;
  margin-inline: auto;
  padding: clamp(5.5rem, 10vh, 8rem) 0 max(2rem, env(safe-area-inset-bottom));
  align-content: center;
  justify-items: center;
  gap: clamp(1.5rem, 4vh, 2.75rem);
  text-align: center;
}

.locations-header {
  margin: 0;
}

.locations-kicker {
  margin: 0 0 0.4rem;
  color: var(--board-amber);
  font-size: clamp(0.85rem, 2.2vw, 1.05rem);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.locations-title {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 3.1rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

/* Табло */
.board-wrap {
  display: grid;
  justify-items: center;
  gap: clamp(1rem, 3vh, 1.75rem);
  width: 100%;
}

.board {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem 0.75rem;
  width: 100%;
  max-width: 54rem;
  padding: clamp(1rem, 3.5vw, 2rem);
  border: 0.16rem solid rgba(232, 236, 242, 0.12);
  border-radius: 0.6rem;
  background: linear-gradient(180deg, var(--board-panel), #0d1117);
  box-shadow:
    inset 0 0 0 0.35rem rgba(0, 0, 0, 0.35),
    0 1.4rem 3rem rgba(0, 0, 0, 0.45);
  perspective: 60rem;
}

.board__word {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.22rem;
}

.board__cell {
  --card-flip-half-duration: 42ms;
  position: relative;
  min-width: clamp(1.5rem, 5.6vw, 2.5rem);
  height: clamp(2.3rem, 8vw, 3.6rem);
  border-radius: 0.28rem;
  box-shadow:
    0 0.08rem 0 rgba(255, 255, 255, 0.12),
    0 0.2rem 0 #07090c,
    0 0.35rem 0.55rem rgba(0, 0, 0, 0.55);
  perspective: 10rem;
  transform-style: preserve-3d;
}

/* Щель и две боковые оси делают карточку похожей на физическую створку. */
.board__cell::after {
  position: absolute;
  z-index: 8;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 0.12rem 50%, rgba(5, 6, 8, 0.42) 0 0.09rem, rgba(88, 96, 107, 0.18) 0.1rem 0.13rem, transparent 0.14rem),
    radial-gradient(circle at calc(100% - 0.12rem) 50%, rgba(5, 6, 8, 0.42) 0 0.09rem, rgba(88, 96, 107, 0.18) 0.1rem 0.13rem, transparent 0.14rem),
    linear-gradient(
      to bottom,
      transparent calc(50% - 0.035rem),
      rgba(0, 0, 0, 0.28) calc(50% - 0.035rem),
      rgba(0, 0, 0, 0.28) calc(50% + 0.035rem),
      transparent calc(50% + 0.035rem)
    );
  content: "";
  pointer-events: none;
}

.board__panel {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  background: var(--board-cell);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform;
}

.board__panel--top,
.board__panel--flap-top {
  top: 0;
  border-radius: 0.28rem 0.28rem 0.08rem 0.08rem;
  background: linear-gradient(180deg, #272e39, var(--board-cell-top));
  transform-origin: center bottom;
}

.board__panel--bottom,
.board__panel--flap-bottom {
  bottom: 0;
  border-radius: 0.08rem 0.08rem 0.28rem 0.28rem;
  background: linear-gradient(180deg, #181d24, #12161c);
  transform-origin: center top;
}

.board__panel--top,
.board__panel--bottom {
  z-index: 1;
}

.board__panel--flap-top {
  z-index: 4;
}

.board__panel--flap-bottom {
  z-index: 3;
  visibility: hidden;
  transform: rotateX(90deg);
}

.board__glyph {
  position: absolute;
  left: 0;
  display: grid;
  width: 100%;
  height: 200%;
  place-items: center;
  color: var(--board-amber);
  font-family: "Courier New", "SF Mono", ui-monospace, monospace;
  font-size: clamp(1.25rem, 4.4vw, 2rem);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 0 0.5rem rgba(255, 199, 77, 0.35);
}

.board__panel--top .board__glyph,
.board__panel--flap-top .board__glyph {
  top: 0;
}

.board__panel--bottom .board__glyph,
.board__panel--flap-bottom .board__glyph {
  bottom: 0;
}

.board__cell.is-flipping .board__panel--flap-top {
  animation: split-flap-top var(--card-flip-half-duration)
    cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
}

.board__cell.is-flipping .board__panel--flap-bottom {
  visibility: visible;
  animation: split-flap-bottom var(--card-flip-half-duration)
    cubic-bezier(0.22, 0.61, 0.36, 1) var(--card-flip-half-duration) both;
}

@keyframes split-flap-top {
  from {
    filter: brightness(1);
    transform: rotateX(0deg);
  }

  to {
    filter: brightness(0.38);
    transform: rotateX(-90deg);
  }
}

@keyframes split-flap-bottom {
  from {
    box-shadow: 0 -0.7rem 0.8rem rgba(0, 0, 0, 0.58);
    filter: brightness(0.42);
    transform: rotateX(90deg);
  }

  to {
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    filter: brightness(1);
    transform: rotateX(0deg);
  }
}

.board-counter {
  margin: 0;
  color: var(--board-amber-dim);
  font-size: clamp(0.95rem, 2.6vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

/* Кнопка */
.board-button {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: clamp(3.5rem, 8vw, 4.4rem);
  padding: 0 clamp(1.6rem, 5vw, 2.6rem);
  border: 0.16rem solid var(--board-amber);
  border-radius: 0.5rem;
  background: var(--board-amber);
  color: #221803;
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(1.15rem, 3.6vw, 1.6rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  touch-action: manipulation;
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

.board-button__mark {
  font-size: 1.3em;
  line-height: 1;
}

.board-button:active {
  transform: translateY(0.15rem);
}

.board-button:focus-visible {
  outline: 0.24rem solid var(--board-ink);
  outline-offset: 0.3rem;
}

.board-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

@media (hover: hover) {
  .board-button:hover {
    background: #ffd677;
    box-shadow: 0 0.6rem 1.4rem rgba(255, 199, 77, 0.35);
    transform: translateY(-0.12rem);
  }
}

.board-hint {
  margin: 0;
  color: rgba(232, 236, 242, 0.55);
  font-size: clamp(0.8rem, 2.2vw, 0.95rem);
}

.noscript-message {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 10;
  margin: 0;
  padding: 1rem;
  border-radius: 0.4rem;
  background: var(--board-amber);
  color: #221803;
  font-weight: 800;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 30rem) {
  .board {
    gap: 0.4rem 0.55rem;
    padding: 0.9rem;
  }

  .board__cell {
    min-width: 1.75rem;
    height: 2.4rem;
  }

  .board__glyph {
    font-size: 1.3rem;
  }

  .board__word {
    gap: 0.16rem;
  }
}

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