:root {
  --bg: #0d0912;
  --panel: #1a1124;
  --panel-2: #24182f;
  --line: #3a2848;
  --text: #f6eef8;
  --muted: #b5a3c0;
  --accent: #ff6f91;
  --accent-2: #ffb347;
  --tint: var(--accent);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(1200px 700px at 50% -10%, #2c1838 0%, transparent 60%),
    var(--bg);
}

[hidden] { display: none !important; }

#app { height: 100dvh; display: flex; flex-direction: column; }

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }

h1, h2 { margin: 0; letter-spacing: 0.01em; }
a { color: var(--muted); }

.btn {
  font: 600 16px/1 var(--font);
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 13px 22px;
  cursor: pointer;
  transition: transform 0.12s, background 0.2s, border-color 0.2s;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn--main {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  color: #1a0b14;
  box-shadow: 0 6px 24px -6px var(--accent);
}
.btn--ghost { background: transparent; }
.btn--small { padding: 8px 12px; font-size: 13px; }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.buttons--col { flex-direction: column; align-items: stretch; }

/* титул */
#title { align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }
.title__box { max-width: 520px; }
.badge {
  display: inline-block;
  margin: 0 0 18px;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.logo {
  font-size: clamp(44px, 12vw, 84px);
  line-height: 0.92;
  font-weight: 900;
  text-transform: uppercase;
}
.logo span {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { color: var(--muted); font-size: 18px; line-height: 1.5; margin: 22px 0 28px; }
.help { color: var(--muted); font-size: 13px; margin-top: 28px; line-height: 1.6; }
.back { font-size: 13px; }

/* шапка экранов */
.bar { display: flex; align-items: center; gap: 12px; padding: 16px; position: sticky; top: 0; background: var(--bg); z-index: 2; }

/* выбор героини */
.roster, .shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  padding: 0 16px 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}
.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
  aspect-ratio: 2 / 3;
  transition: transform 0.18s, border-color 0.2s;
}
.card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--tint); }
.card:disabled { cursor: default; opacity: 0.55; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card--veiled img { filter: blur(14px) saturate(0.6) brightness(0.55); transform: scale(1.15); }
.card__info {
  position: absolute;
  inset: auto 0 0 0;
  padding: 36px 12px 12px;
  background: linear-gradient(transparent, rgba(8, 4, 12, 0.92));
}
.card__name { font-weight: 800; font-size: 18px; }
.card__meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card__lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 34px;
}
.card .stars { margin: 6px 0 0; font-size: 16px; }

/* интро */
#intro { align-items: center; justify-content: center; padding: 20px 16px; }
.intro { display: flex; gap: 28px; align-items: center; max-width: 820px; }
.intro__img {
  width: 260px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  filter: blur(12px) brightness(0.6) saturate(0.7);
  border: 1px solid var(--line);
  clip-path: inset(0 round var(--radius));
  flex-shrink: 0;
}
.intro__species { color: var(--tint); text-transform: uppercase; letter-spacing: 0.12em; font-size: 13px; font-weight: 700; margin: 0 0 4px; }
.intro h2 { font-size: 40px; font-weight: 900; }
blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--tint);
  background: var(--panel);
  border-radius: 0 10px 10px 0;
  font-size: 17px;
  line-height: 1.5;
  font-style: italic;
}
.trait { color: var(--muted); line-height: 1.5; margin: 0 0 22px; }
.intro .buttons { justify-content: flex-start; }

/* игра */
.screen--play { overflow: hidden; }
.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 9, 18, 0.9);
}
.hud__name { font-weight: 800; color: var(--tint); white-space: nowrap; }
.hud__lives { color: var(--accent); letter-spacing: 2px; white-space: nowrap; }
.hud__share { font-weight: 800; min-width: 44px; text-align: right; }
.hud__score { color: var(--muted); min-width: 56px; text-align: right; }
.meter { position: relative; flex: 1; height: 10px; border-radius: 99px; background: var(--panel-2); overflow: hidden; min-width: 60px; }
.meter__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--tint), var(--accent-2)); transition: width 0.35s ease-out; }
.meter__goal { position: absolute; top: 0; bottom: 0; left: 80%; width: 2px; background: #fff; opacity: 0.8; }

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#canvas { display: block; border-radius: 6px; box-shadow: 0 0 0 1px var(--line), 0 20px 60px -20px var(--tint); }

.stick {
  position: fixed;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  pointer-events: none;
  z-index: 5;
}
.stick span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transition: transform 0.08s;
}
.stick[data-dir="up"] span { transform: translateY(-24px); }
.stick[data-dir="down"] span { transform: translateY(24px); }
.stick[data-dir="left"] span { transform: translateX(-24px); }
.stick[data-dir="right"] span { transform: translateX(24px); }

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 4, 12, 0.72);
  backdrop-filter: blur(4px);
  z-index: 10;
  padding: 16px;
}
.overlay--bottom { place-items: end center; background: transparent; backdrop-filter: none; pointer-events: none; }
.overlay--bottom .panel { pointer-events: auto; animation: rise 0.45s ease-out; }
.panel {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 30px 80px -20px #000;
}
.panel h2 { font-size: 28px; font-weight: 900; margin-bottom: 4px; }
.panel blockquote { text-align: left; }
.stars { font-size: 30px; letter-spacing: 6px; color: var(--accent-2); margin: 10px 0; }
.stars .off { color: var(--line); }
.stats { color: var(--muted); font-variant-numeric: tabular-nums; margin: 0 0 18px; }

@keyframes rise { from { transform: translateY(30px); opacity: 0; } }

/* галерея */
.empty { color: var(--muted); padding: 24px 16px; text-align: center; grid-column: 1 / -1; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(5, 2, 8, 0.96);
  display: grid;
  place-items: center;
  padding: 16px;
}
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer__close { position: absolute; top: 12px; right: 12px; }

@media (max-width: 640px) {
  .intro { flex-direction: column; text-align: center; gap: 16px; }
  .intro__img { width: 150px; }
  .intro h2 { font-size: 32px; }
  .intro .buttons { justify-content: center; }
  blockquote { text-align: left; }
  .hud { gap: 8px; padding: 8px 10px; font-size: 14px; }
  .hud__score { display: none; }
  .roster, .shelf { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* проверка возраста */
#age { align-items: center; justify-content: center; padding: 24px 16px; }
.age { max-width: 440px; }
.age__step { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 10px; }
.age__text { font-size: 19px; line-height: 1.5; margin: 0 0 22px; }
a.btn { text-decoration: none; text-align: center; }
.btn:disabled { opacity: 0.5; cursor: default; }
