@font-face { font-family: "PS2P"; src: url(fonts/press-start-2p-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-display: block; }
@font-face { font-family: "PS2P"; src: url(fonts/press-start-2p-latin-400-normal.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "Onest"; src: url(fonts/onest-cyrillic-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-weight: 100 900; font-display: block; }
@font-face { font-family: "Onest"; src: url(fonts/onest-latin-wght-normal.woff2) format("woff2-variations"); font-weight: 100 900; font-display: block; }

:root {
  --pink: #FF3495;
  --pink-d: #C2186E;
  --lime: #A7FC00;
  --ink: #0B0B0F;
  --ink-2: #16161D;
  --paper: #FFFFFF;
  --grey: #8A8A99;
  --glass: rgba(11, 11, 15, .78);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--paper); }
body {
  font-family: "Onest", system-ui, sans-serif; font-weight: 500;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; overflow: hidden;
  /* пиксельная сетка и розовое свечение за экраном игры */
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(255, 52, 149, .16), transparent 70%),
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--ink);
}
button { font: inherit; color: inherit; cursor: pointer; }
.t2tag { display: inline-block; font-family: "PS2P"; font-weight: 400; background: var(--pink); color: var(--paper); padding: .35em .45em .3em; margin-right: .5em; line-height: 1; vertical-align: .1em; }

/* =========================================================== каркас страницы */
#app { height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 12px 24px; }

#top { width: var(--sw); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#top .brand { display: flex; align-items: center; font-size: 17px; letter-spacing: .01em; }
#top .brand .t2tag { font-size: 12px; }
#top .meta { font-size: 13px; color: var(--grey); }

#frame { position: relative; padding: 6px; background: var(--paper); box-shadow: 10px 10px 0 var(--pink), 0 0 0 2px var(--ink) inset; }
#stage {
  --sw: min(calc(100vw - 72px), calc((100dvh - 150px) * 16 / 9));
  position: relative; width: var(--sw); aspect-ratio: 16 / 9;
  container-type: inline-size; background: #000; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#app { --sw: min(calc(100vw - 72px), calc((100dvh - 150px) * 16 / 9)); }

#foot { width: var(--sw); display: flex; gap: 18px; align-items: center; font-size: 13px; color: #b9b9c6; }
#foot .sep { margin-left: auto; color: #6c6c7c; }
kbd { font-family: "PS2P"; font-size: 9px; border: 2px solid var(--paper); padding: 3px 5px 2px; background: var(--ink-2); color: var(--paper); margin-right: 4px; }

#cv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }

/* =========================================================== панель сверху */
#hud { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 1.2cqw; padding: 1.3cqw 1.5cqw; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-bar { margin: 0 auto; display: flex; align-items: stretch; background: var(--glass); border: .3cqw solid var(--paper); box-shadow: .5cqw .5cqw 0 rgba(0,0,0,.45); }
.logo { font-family: "PS2P"; font-size: 1.9cqw; background: var(--pink); color: var(--paper); padding: .8cqw 1cqw .7cqw; display: flex; align-items: center; }
.hud-stat { display: flex; align-items: center; gap: .6cqw; padding: .4cqw 1.3cqw; border-left: .3cqw solid rgba(255,255,255,.18); white-space: nowrap; font-size: 1.7cqw; }
.hud-stat b { font-family: "PS2P"; font-weight: 400; font-size: 1.7cqw; color: var(--lime); }
.hud-stat small { color: #d4d4de; font-size: 1.55cqw; }
.ico { width: 1.5cqw; height: 1.5cqw; display: inline-block; }
.ico-gb { background: var(--pink); clip-path: polygon(50% 0, 100% 60%, 80% 100%, 20% 100%, 0 60%); }
.ico-min { background: var(--lime); clip-path: polygon(0 20%, 100% 20%, 100% 75%, 40% 75%, 20% 100%, 20% 75%, 0 75%); }
.hud-btn { background: var(--glass); border: .3cqw solid var(--paper); padding: .7cqw 1.3cqw; font-size: 1.75cqw; font-weight: 700; line-height: 1.1; box-shadow: .5cqw .5cqw 0 rgba(0,0,0,.45); }
.hud-btn.sq { padding: .7cqw 1.1cqw; }
.hud-btn:hover { background: var(--pink); }
#hud-map[hidden] { display: inline-block !important; visibility: hidden; }
#hud-sound.off { opacity: .5; text-decoration: line-through; }

/* =========================================================== метки на карте */
#pins { position: absolute; inset: 0; }
.pin { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: .3cqw; background: none; border: 0; padding: 0; }
.pin .flag { display: flex; align-items: center; gap: .9cqw; background: var(--ink); border: .3cqw solid var(--paper); padding: .6cqw 1.1cqw .6cqw .6cqw; text-align: left; box-shadow: .5cqw .5cqw 0 var(--pink); transition: transform .12s steps(2); }
.pin .num { font-family: "PS2P"; font-size: 1.5cqw; background: var(--pink); padding: .6cqw .6cqw .5cqw; }
.pin .name { font-size: 1.75cqw; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.pin .name small { display: block; font-weight: 500; font-size: 1.35cqw; color: #ffc4e0; }
.pin .stem { width: 2cqw; height: 1.6cqw; background: var(--paper); clip-path: polygon(0 0, 100% 0, 50% 100%); animation: bob 1.2s steps(2) infinite; }
.pin:hover .flag, .pin:focus-visible .flag { transform: translateY(-.4cqw); background: var(--pink-d); }
.pin.done .flag { box-shadow: .5cqw .5cqw 0 var(--lime); }
.pin.done .num { background: var(--lime); color: var(--ink); }
.pin.done .stem { background: var(--lime); animation: none; }
@keyframes bob { 50% { transform: translateY(-.5cqw); } }

/* =========================================================== подсказка «поговорить» */
#hint { position: absolute; left: 50%; bottom: 2.4cqw; transform: translateX(-50%); background: var(--ink); border: .3cqw solid var(--lime); padding: .7cqw 1.5cqw; font-size: 1.8cqw; font-weight: 600; white-space: nowrap; box-shadow: .5cqw .5cqw 0 rgba(0,0,0,.5); }

/* =========================================================== диалог */
#dialog { position: absolute; left: 4cqw; right: 4cqw; top: 9cqw; display: flex; gap: 1.8cqw; align-items: flex-start; background: rgba(11,11,15,.94); border: .4cqw solid var(--paper); box-shadow: .8cqw .8cqw 0 var(--pink); padding: 1.6cqw 4cqw 1.6cqw 1.6cqw; cursor: pointer; }
#dlg-face { flex: none; width: 7.2cqw; height: auto; aspect-ratio: 40 / 52; image-rendering: pixelated; background: linear-gradient(var(--ink-2), #24242f); border: .3cqw solid rgba(255,255,255,.3); }
.dlg-body { flex: 1; min-width: 0; }
#dlg-who { display: inline-block; background: var(--pink); color: var(--paper); padding: .35cqw .9cqw; font-weight: 700; font-size: 1.65cqw; margin-bottom: .8cqw; }
#dlg-who.t2 { background: var(--paper); color: var(--ink); }
#dlg-who.t2::before { content: "t2"; font-family: "PS2P"; font-size: 1.2cqw; background: var(--pink); color: var(--paper); padding: .2cqw .4cqw; margin-right: .7cqw; vertical-align: .1cqw; }
#dlg-text { font-size: 2.35cqw; line-height: 1.38; min-height: 6.5cqw; }
#dlg-next { position: absolute; right: 1.6cqw; bottom: 1.1cqw; color: var(--lime); font-size: 1.6cqw; animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* =========================================================== карточки поверх игры */
#overlay { position: absolute; inset: 0; background: rgba(5,5,8,.62); display: flex; align-items: center; justify-content: center; padding: 3cqw; z-index: 5; }
#overlay.title { justify-content: flex-start; background: linear-gradient(90deg, rgba(5,5,8,.8) 0%, rgba(5,5,8,.45) 55%, rgba(5,5,8,0) 80%); padding-left: 5cqw; }
#overlay.title #card { max-width: 54cqw; }
#card { width: 100%; max-width: 84cqw; max-height: 100%; overflow: auto; background: var(--ink); border: .4cqw solid var(--paper); box-shadow: .9cqw .9cqw 0 var(--pink); padding: 2.4cqw 2.8cqw; font-size: 1.95cqw; line-height: 1.42; scrollbar-width: thin; }
#card h1, #card h2 { font-family: "PS2P"; font-weight: 400; margin: 0 0 1.4cqw; line-height: 1.35; }
#card h1 { font-size: 2.7cqw; }
#card h2 { font-size: 2.1cqw; color: var(--pink); }
#card p { margin: 0 0 1.1cqw; color: #e6e6ee; }
#card .kicker { font-family: "PS2P"; font-size: 1.15cqw; color: var(--lime); margin-bottom: 1.3cqw; letter-spacing: .06em; }
#card .row { display: flex; gap: 1.3cqw; flex-wrap: wrap; margin-top: 1.6cqw; }
#card .t2tag { font-size: 1.5cqw; }
.btn { background: var(--pink); color: var(--paper); border: .35cqw solid var(--paper); padding: .9cqw 2.4cqw; font-weight: 800; font-size: 2.05cqw; box-shadow: .5cqw .5cqw 0 var(--paper); }
.btn:hover { transform: translate(-.15cqw, -.15cqw); box-shadow: .65cqw .65cqw 0 var(--paper); }
.btn:active { transform: translate(.3cqw, .3cqw); box-shadow: 0 0 0 var(--paper); }
.btn.ghost { background: var(--ink); }

.solve { display: grid; grid-template-columns: 1fr auto 1.55fr; gap: 1.3cqw; align-items: stretch; margin: 1.2cqw 0; font-size: 1.7cqw; line-height: 1.35; }
.solve .fear, .solve .fix { border: .3cqw solid var(--grey); padding: 1.2cqw 1.4cqw; }
.solve .fear { color: #cfcfdb; background: rgba(255,255,255,.03); }
.solve .fear b { color: var(--paper); font-weight: 700; }
.solve .fix { border-color: var(--pink); background: rgba(255,52,149,.09); }
.solve .fix ul { margin: .5cqw 0 0; padding-left: 2.2cqw; }
.solve .fix li { margin-bottom: .45cqw; }
.solve .fix li::marker { content: "■  "; color: var(--lime); font-size: .8em; }
.solve .mood { float: right; width: 8.5cqw; image-rendering: pixelated; margin: 0 0 .4cqw 1cqw; }
.solve .arrow { align-self: center; font-family: "PS2P"; font-size: 2.6cqw; color: var(--lime); }
.solve .lbl { font-family: "PS2P"; font-size: 1.1cqw; display: block; margin-bottom: .8cqw; color: var(--grey); }
.solve .fix .lbl { color: var(--pink); }
#card .solve + p { font-size: 1.7cqw; color: #c9c9d6; }

.reward { display: flex; gap: 1.2cqw; flex-wrap: wrap; align-items: center; }
.reward .chip { font-family: "PS2P"; font-size: 1.7cqw; background: var(--paper); color: var(--ink); padding: .9cqw 1.3cqw .8cqw; animation: pop .5s steps(4) both; }
.reward .chip.min { background: var(--lime); }
.reward .chip:nth-child(2) { animation-delay: .25s; }
.reward small { color: var(--grey); font-size: 1.5cqw; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.howto { display: flex; gap: 1.6cqw; flex-wrap: wrap; font-size: 1.65cqw; color: #c9c9d6; margin-top: 1.2cqw; }
.howto kbd { font-size: 1.05cqw; border-width: .25cqw; padding: .3cqw .5cqw .2cqw; }

.big-stats { display: flex; gap: 2cqw; margin: 1.6cqw 0; }
.big-stats div { flex: 1; border: .35cqw solid var(--pink); padding: 1.5cqw; text-align: center; background: rgba(255,52,149,.08); }
.big-stats b { display: block; font-family: "PS2P"; font-weight: 400; font-size: 3.4cqw; color: var(--lime); margin-bottom: .7cqw; }

#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .5em; font-size: 2.4cqw; font-weight: 700; background: var(--ink); z-index: 9; }
#loading .t2tag { font-size: 1.8cqw; }

/* =========================================================== сенсорные кнопки — поверх игры */
#pad { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 max(3cqw, env(safe-area-inset-right), 14px) max(2.6cqw, 12px) max(3cqw, env(safe-area-inset-left), 14px); pointer-events: none; z-index: 4; }
#pad .pad-dir { display: flex; gap: max(2.4cqw, 14px); }
#pad button { pointer-events: auto; width: max(15cqw, 84px); height: max(15cqw, 84px); border-radius: 50%; background: rgba(11,11,15,.22); border: 4px solid rgba(255,255,255,.75); color: rgba(255,255,255,.95); text-shadow: 0 2px 0 rgba(0,0,0,.6); font-family: "PS2P"; font-size: max(3.2cqw, 22px); touch-action: none; }
#pad button.act { width: max(17cqw, 96px); height: max(17cqw, 96px); font-size: max(3cqw, 20px); background: rgba(255,52,149,.45); border-color: rgba(255,255,255,.85); }
#pad button.down { transform: scale(.92); background: rgba(255,52,149,.95); }
@media (hover: hover) and (pointer: fine) { #pad { display: none !important; } }

/* =========================================================== просьба повернуть телефон */
#rotate { display: none; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: inherit; }
#rotate h2 { margin: 18px 0 0; font-family: "PS2P"; font-weight: 400; font-size: 17px; line-height: 1.4; }
#rotate p { margin: 0; max-width: 300px; font-size: 16px; line-height: 1.45; color: #d4d4de; }
.rot-brand { position: absolute; bottom: 28px; display: flex; align-items: center; font-weight: 700; font-size: 15px; }
.rot-brand .t2tag { font-size: 11px; }
.rot-phone { width: 74px; height: 126px; border: 5px solid var(--paper); border-radius: 12px; position: relative; box-shadow: 8px 8px 0 var(--pink); animation: turn 2.4s ease-in-out infinite; }
.rot-phone span { position: absolute; inset: 9px 6px; background: linear-gradient(160deg, var(--pink), var(--pink-d)); }
.rot-phone::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 14px; height: 3px; margin-left: -7px; background: var(--paper); }
@keyframes turn { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }

/* Телефон вертикально — игру прячем, просим повернуть */
@media (orientation: portrait) and (max-width: 900px) {
  #rotate { display: flex; }
  #app { display: none; }
}

/* Телефон горизонтально и невысокие окна: игра на весь экран, без шапки и рамки */
@media (orientation: landscape) and (max-height: 560px), (orientation: landscape) and (pointer: coarse) and (max-height: 820px) {
  #app { --sw: min(100vw, calc(100dvh * 16 / 9)); padding: 0; gap: 0; background: #000; }
  #stage { --sw: min(100vw, calc(100dvh * 16 / 9)); }
  #top, #foot { display: none; }
  #frame { padding: 0; box-shadow: none; background: none; }
  /* на маленьком экране не даём тексту стать мельче читаемого */
  #dlg-text { font-size: max(2.35cqw, 14px); }
  #dlg-who { font-size: max(1.65cqw, 11px); }
  #card { font-size: max(1.95cqw, 13px); }
  #card .solve, #card .solve + p { font-size: max(1.7cqw, 11.5px); }
  .btn { font-size: max(2.05cqw, 14px); }
  #hint { font-size: max(1.8cqw, 12px); bottom: auto; top: 8.5cqw; }
  .hud-stat, .hud-btn { font-size: max(1.75cqw, 11px); }
  .hud-stat small { font-size: max(1.55cqw, 10px); }
  .pin .name { font-size: max(1.75cqw, 11px); }
  .pin .name small { font-size: max(1.35cqw, 9px); }
  .howto { display: none; }
  /* карточки плотнее, чтобы кнопки всегда были видны без прокрутки */
  #overlay { padding: 1.4cqw; }
  #card { padding: 1.5cqw 2.2cqw; line-height: 1.32; }
  #card h1, #card h2 { margin-bottom: .8cqw; }
  #card .kicker { margin-bottom: .8cqw; }
  #card .row { margin-top: 1cqw; }
  .solve { margin: .6cqw 0; gap: 1cqw; line-height: 1.28; }
  .solve .fear, .solve .fix { padding: .8cqw 1.1cqw; }
  .solve .fix li { margin-bottom: .2cqw; }
  .solve .mood { width: 6.5cqw; }
  #card .solve + p { margin-bottom: .7cqw; }
  .btn { padding: .6cqw 2cqw; min-height: 44px; min-width: 120px; }
  /* крупнее всё, во что тычут пальцем */
  .hud-btn { min-height: 40px; min-width: 44px; padding: 6px 12px; font-size: max(1.75cqw, 14px); }
  .pin .flag { padding: 7px 12px 7px 7px; }
  .pin .num { font-size: max(1.5cqw, 12px); padding: 7px 7px 6px; }
  .pin .name { font-size: max(1.75cqw, 13px); }
  .pin .name small { font-size: max(1.35cqw, 10px); }
}
