/* GOGO WALK: сцена на весь экран, поверх — несколько круглых кнопок. */
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0620;
  color: #fff;
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#field:active { cursor: grabbing; }

#start {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(11, 6, 32, 0.25), rgba(11, 6, 32, 0.6));
  pointer-events: none;
}
#start[hidden] { display: none; }
#start .card {
  text-align: center;
  pointer-events: auto;
  padding: 24px;
}
.logo {
  margin: 0;
  font-size: clamp(40px, 12vw, 84px);
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}
.logo span { font-weight: 300; }
.logo b { font-weight: 800; color: #b6f36a; margin-left: 0.2em; }
#tagline {
  margin: 10px 0 26px;
  font-size: clamp(15px, 4vw, 20px);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
#start-btn {
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  color: #14210a;
  background: #b6f36a;
  border: 0;
  border-radius: 999px;
  padding: 16px 46px;
  min-height: 56px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
#start-btn:active { transform: scale(0.97); }

#hud { display: none; }
.playing #hud { display: block; }

#hud button {
  position: fixed;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(10, 14, 30, 0.38);
  color: #fff;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  touch-action: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
#hud button:focus-visible, #start-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
#hud button:active { background: rgba(10, 14, 30, 0.6); }

#time {
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  width: 76px !important;
  border-radius: 26px !important;
  font-size: 16px !important;
  font-variant-numeric: tabular-nums;
}
#snd {
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
}
#lie {
  bottom: calc(26px + env(safe-area-inset-bottom));
  right: calc(18px + env(safe-area-inset-right));
}
#walk {
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  margin-left: -42px;
  width: 84px !important;
  height: 84px !important;
  font-size: 36px !important;
}
#walk.on {
  background: rgba(182, 243, 106, 0.8);
  border-color: #fff;
}

/* Ползунок передач над кнопкой «идти»: палец вверх — бег, спринт, ветер. Видна, пока держишь. */
#gears {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom));
  margin-left: -28px;
  width: 56px;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 28px;
  background: rgba(10, 14, 30, 0.45);
  pointer-events: none;
}
#gears[hidden] { display: none; }
#gears i {
  height: 48px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 26px;
  opacity: 0.45;
  transition: transform 0.15s, opacity 0.15s;
}
#gears[data-gear="1"] i:nth-child(1),
#gears[data-gear="2"] i:nth-child(2),
#gears[data-gear="3"] i:nth-child(3) { opacity: 1; transform: scale(1.3); }

#hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(118px + env(safe-area-inset-bottom));
  margin: 0;
  padding: 0 16px;
  text-align: center;
  font-size: 15px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: opacity 1.5s;
}
#hint.gone { opacity: 0; }

#fps {
  position: fixed;
  left: calc(12px + env(safe-area-inset-left));
  top: calc(72px + env(safe-area-inset-top));
  margin: 0;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  font: 12px/1.4 ui-monospace, Consolas, monospace;
  pointer-events: none;
}

/* ---------- кнопки по краям (26.11.2026): меню, звук, свет сверху справа; компас слева внизу ---------- */
#menu-btn {
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
}
#snd { right: calc(74px + env(safe-area-inset-right)); }
#light {
  top: calc(12px + env(safe-area-inset-top));
  right: calc(136px + env(safe-area-inset-right));
}
#light.blink { animation: blink 0.8s ease-in-out 3; }
@keyframes blink {
  50% { background: rgba(255, 214, 110, 0.85); transform: scale(1.12); }
}
#compass-btn {
  bottom: calc(26px + env(safe-area-inset-bottom));
  left: calc(18px + env(safe-area-inset-left));
}
#sleep {
  bottom: calc(90px + env(safe-area-inset-bottom));
  right: calc(18px + env(safe-area-inset-right));
}
#hud button[hidden] { display: none; }
#light[aria-pressed="true"] { border-color: #ffd66e; }

/* Левша: нижние кнопки зеркально. */
.left #lie, .left #sleep { right: auto; left: calc(18px + env(safe-area-inset-left)); }
.left #compass-btn { left: auto; right: calc(18px + env(safe-area-inset-right)); }

/* Созерцание: ничего поверх мира. */
.calm #hud { display: none !important; }

/* ---------- компас в руке и полоска ---------- */
#compass {
  position: fixed;
  left: 50%;
  bottom: calc(120px + env(safe-area-inset-bottom));
  width: 190px;
  height: 190px;
  margin-left: -95px;
  pointer-events: none;
}
#compass[hidden] { display: none; }
#compass .dial {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #f4ead2 0 58%, #d8c9a3 60% 64%, #6b5434 66% 100%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 3px #3e2f1c;
}
#compass .dial b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  margin: -12px 0 0 -15px;
  text-align: center;
  font: 800 18px/24px system-ui, sans-serif;
  color: #3e2f1c;
}
#compass .dial .n { transform: rotate(0deg) translateY(-62px); color: #c0392b; }
#compass .dial .e { transform: rotate(90deg) translateY(-62px); }
#compass .dial .s { transform: rotate(180deg) translateY(-62px); }
#compass .dial .w { transform: rotate(270deg) translateY(-62px); }
#compass .needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 120px;
  margin: -60px 0 0 -5px;
  background: linear-gradient(#c0392b 0 50%, #e8e8e8 50% 100%);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
#compass .home { position: absolute; inset: -24px; font-style: normal; }
#compass .home span {
  position: absolute;
  left: 50%;
  top: 0;
  margin-left: -12px;
  font-size: 22px;
  line-height: 1;
}
#compass .dist {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -34px;
  margin: 0;
  text-align: center;
  font-size: 14px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
#strip {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  width: min(40vw, 420px);
  height: 30px;
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}
#strip[hidden] { display: none; }
#strip span {
  position: absolute;
  left: -14px;
  top: 0;
  width: 28px;
  text-align: center;
  font: 700 17px/28px system-ui, sans-serif;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
#strip span.minor { font-size: 12px; font-weight: 500; }
#strip span.tree { font-size: 16px; }

/* ---------- шторки 3D, завеса переходов ---------- */
#blind {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, #000 78%);
  display: none;
}
.stereo #blind { display: block; }
#veil {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: #000;
  opacity: 0;
}
#veil[hidden] { display: none; }
#veil.dark { animation: veil-in 1.6s ease forwards; }
#veil.hole {
  background: radial-gradient(circle at center, #000 0 12%, #1b0b3a 30%, #3b1d78 50%, #0b0620 75%);
  animation: veil-in 0.9s ease forwards, swirl 2.6s ease-in forwards;
}
#veil.lift { animation: veil-out 2.2s ease forwards; }
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes veil-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes swirl {
  from { transform: scale(2.4) rotate(0deg); filter: blur(4px); }
  to { transform: scale(1) rotate(540deg); filter: blur(0); }
}

/* ---------- окна: меню, громкость, памятка, дневник ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 8, 18, 0.45);
  -webkit-user-select: text;
  user-select: text;
}
.sheet[hidden] { display: none; }
.sheet-card {
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 20px;
  background: rgba(16, 22, 38, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.sheet header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px 20px;
  background: rgba(16, 22, 38, 0.98);
}
.sheet h2 { margin: 0; font-size: 20px; }
.sheet .x {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.sheet-body { padding: 0 20px 20px; }
.sheet h3 {
  margin: 18px 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9fb3c8;
}
.sheet .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.sheet .row > span { flex: 1; }
.sheet input[type="range"] { width: 48%; accent-color: #b6f36a; }
.sheet input[type="checkbox"] { width: 22px; height: 22px; accent-color: #b6f36a; }
.sheet select {
  max-width: 58%;
  font: inherit;
  font-size: 15px;
  color: #fff;
  background: #222b44;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
}
.sheet .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.sheet .act, .sheet .btn {
  display: block;
  font: inherit;
  font-size: 15px;
  text-align: left;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 11px 12px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}
.sheet .act:hover, .sheet .btn:hover { background: rgba(255, 255, 255, 0.14); }
.sheet .btn { margin-top: 8px; text-align: center; background: #b6f36a; color: #14210a; font-weight: 700; border: 0; }
.sheet .btn:hover { background: #c6f98a; }
.sheet .btn.ghost { background: transparent; color: #fff; font-weight: 500; border: 1px solid rgba(255, 255, 255, 0.25); }
.sheet .about p { margin: 0 0 6px; color: #d6deea; }

/* Громкость у кнопки 🔊 — маленькое окошко сверху справа. */
.sheet.pop { place-items: start end; background: transparent; padding: calc(72px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 0 12px; }
.sheet.pop .sheet-card { width: min(340px, 100%); }
.sheet .row.vol input { width: 55%; }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: #d6deea; }
kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font: 13px/1.5 ui-monospace, Consolas, monospace;
}
.north { margin: 0; padding-left: 18px; color: #d6deea; }
.north li { margin: 4px 0; }

/* Дневник. */
.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 4px 0 0; }
.stats dt { color: #9fb3c8; }
.stats dd { margin: 0; }
.share, .moments { list-style: none; margin: 0; padding: 0; }
.share li, .moments li { display: flex; align-items: center; gap: 10px; min-height: 36px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.share li span, .moments li span { flex: 1; }
.moments li small { color: #9fb3c8; }
.moments li.sad span { color: #b9c6e0; }
.moments .btn { margin: 4px 0; padding: 6px 12px; min-height: 0; }
.sheet canvas.map { display: block; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 6px auto 0; border-radius: 12px; }
.sheet .none { color: #9fb3c8; }

#toast {
  position: fixed;
  left: 50%;
  top: calc(76px + env(safe-area-inset-top));
  z-index: 25;
  max-width: min(90vw, 520px);
  margin: 0;
  padding: 9px 16px;
  transform: translate(-50%, -8px);
  border-radius: 999px;
  background: rgba(10, 14, 30, 0.72);
  font-size: 15px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
  overflow-wrap: anywhere;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  #hint { transition: none; }
  #veil.hole { animation: veil-in 0.9s ease forwards; }
  #light.blink { animation: none; }
}
