/* ===========================================================================
   afisha · лента — Tinder-style swipe UI для Telegram Mini App.
   Mobile-first, тёмный минимализм, спокойный фон.
   =========================================================================== */

:root {
  --bg:       #0a0a12;
  --bg-2:     #101019;
  --card:     #15151f;
  --ink:      #f1f1f5;
  --ink-dim:  #8b8ba3;
  --line:     rgba(255, 255, 255, .09);
  --line-2:   rgba(255, 255, 255, .16);
  --accent:   #7c6cff;   /* единственный акцент — мягкий фиолетовый */
  --like:     #3ad07f;
  --nope:     #ff5b6b;
  --radius:   26px;
  --shadow:   0 24px 60px rgba(0, 0, 0, .55);
  --font:     'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Unbounded', var(--font);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  position: relative;
  display: flex;
  flex-direction: column;
  padding:
    calc(env(safe-area-inset-top, 0) + 6px)
    env(safe-area-inset-right, 0)
    calc(env(safe-area-inset-bottom, 0) + 6px)
    env(safe-area-inset-left, 0);
  user-select: none;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -.14em; flex: none; }

/* ===================================================== фон ================ */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(130% 90% at 50% -20%, var(--bg-2) 0%, var(--bg) 62%),
    var(--bg);
}
.bg__glow {
  position: absolute;
  width: 72vmax;
  height: 72vmax;
  border-radius: 50%;
  background: var(--accent);
  filter: blur(100px);
  will-change: transform;
}
.bg__glow--1 { top: -28vmax; left: -22vmax; opacity: .20; animation: float1 30s ease-in-out infinite; }
.bg__glow--2 { bottom: -32vmax; right: -24vmax; opacity: .12; animation: float2 38s ease-in-out infinite; }

@keyframes float1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(5vmax, 4vmax); } }
@keyframes float2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-5vmax, -3vmax); } }

/* ===================================================== топбар ============= */
.topbar {
  position: relative;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 18px 4px;
}
.brand { display: flex; align-items: baseline; gap: 9px; line-height: 1; }
.brand__mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 25px;
  letter-spacing: -.5px;
  color: var(--ink);
}
.brand__sub {
  font-family: var(--font);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
}
.counter {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.counter b { color: var(--ink); font-weight: 700; }

/* ===================================================== фильтры ============ */
.filters {
  position: relative;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 6px 0 4px;
}
.filters[hidden] { display: none; }

.chiprow {
  display: flex;
  gap: 8px;
  padding: 0 14px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  touch-action: pan-x;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-padding: 14px;
}
.chiprow::-webkit-scrollbar { display: none; }

.fchip {
  flex: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .1s ease;
}
.fchip:active { transform: scale(.95); }
.fchip.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ===================================================== сцена карт ========= */
.stage {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.card {
  position: absolute;
  width: min(92vw, 420px);
  height: min(68vh, 600px);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow), 0 0 0 1px var(--line) inset;
  will-change: transform;
  transform-origin: center center;
  cursor: grab;
  touch-action: none;
}
.card:active { cursor: grabbing; }

.card__img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-2);
}

.card__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 10, 18, 0) 38%, rgba(10, 10, 18, .55) 64%, rgba(10, 10, 18, .96) 100%);
}

.card__noimg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .35);
  background: radial-gradient(120% 120% at 50% 20%, #20203a, var(--bg-2) 72%);
}
.card__noimg .ic { font-size: 84px; }

.card__body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.card__city {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--ink);
  background: rgba(255, 255, 255, .12);
  border: 1px solid var(--line-2);
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.card__title {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -.3px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .6);
}
.card__artist {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.card__meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-dim);
}
.card__meta span { display: flex; align-items: center; gap: 9px; }
.card__meta .ic { font-size: 15px; color: var(--ink-dim); }
.card__price {
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.card__price .ic { font-size: 16px; color: var(--ink-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.chip {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
}

/* штампы LIKE / NOPE */
.stamp {
  position: absolute;
  top: 30px;
  padding: 7px 16px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
  border: 3px solid;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  text-transform: uppercase;
}
.stamp--like { left: 22px;  color: var(--like); border-color: var(--like); transform: rotate(-16deg); }
.stamp--nope { right: 22px; color: var(--nope); border-color: var(--nope); transform: rotate(16deg); }

/* подсказки-вспышки по краям */
.hint {
  position: absolute;
  top: 0; bottom: 0;
  width: 40%;
  z-index: 1;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.hint--left  { left: 0;  color: var(--nope); background: linear-gradient(90deg, rgba(255, 91, 107, .18), transparent); }
.hint--right { right: 0; color: var(--like); background: linear-gradient(270deg, rgba(58, 208, 127, .18), transparent); }

/* ===================================================== кнопки ============= */
.actions {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 14px 0 8px;
}
.actions[hidden] { display: none; }
.fab {
  border: 1px solid var(--line-2);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, .04);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform .12s ease, border-color .2s ease, color .2s ease, background .2s ease;
}
.fab:active { transform: scale(.88); }
.fab--skip { width: 62px; height: 62px; font-size: 26px; color: var(--ink-dim); }
.fab--info { width: 52px; height: 52px; font-size: 21px; color: var(--ink-dim); }
.fab--like { width: 62px; height: 62px; font-size: 26px; color: var(--like); }
.fab--skip:active { color: var(--nope); border-color: var(--nope); }
.fab--info:active { color: var(--ink); border-color: var(--line-2); }
.fab--like:active { color: var(--like); border-color: var(--like); }

/* ===================================================== экраны ============= */
.screen {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 32px;
  background: radial-gradient(120% 120% at 50% 0%, var(--bg-2), var(--bg) 70%);
}
.screen[hidden] { display: none; }
.screen h2 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.screen p  { margin: 0; max-width: 320px; color: var(--ink-dim); font-weight: 500; line-height: 1.55; }
.screen__icon { color: var(--accent); }
.screen__icon svg { width: 52px; height: 52px; }

.spinner {
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .1);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  cursor: pointer;
  transition: transform .12s ease, filter .2s ease;
}
.btn-ghost:active { transform: scale(.95); filter: brightness(1.08); }

/* ===================================================== тост =============== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0) + 94px);
  transform: translate(-50%, 160%);
  z-index: 9;
  max-width: calc(100vw - 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(21, 21, 31, .96);
  border: 1px solid var(--line-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  opacity: 0;
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.25), opacity .35s ease;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* улёт карточки — строго по горизонтали */
.card.fly-left  { transition: transform .42s ease; transform: translate(-150%, 0) rotate(-20deg) !important; }
.card.fly-right { transition: transform .42s ease; transform: translate( 150%, 0) rotate( 20deg) !important; }

@media (prefers-reduced-motion: reduce) {
  .bg__glow, .spinner { animation: none; }
}
