/* Тема всегда тёмная, независимо от темы Telegram: афиши на светлом фоне выглядят
   грязно, а половина оформления построена на полупрозрачном белом поверх тёмного. */
:root {
  color-scheme: dark;
  --bg: #0e1116;
  --card: #171b23;
  --text: #eef1f6;
  --dim: #8b93a3;
  --accent: #e0b64a;
  --accent-text: #1a1408;
  --line: rgba(255, 255, 255, .09);
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(96px + var(--safe-b));
  overscroll-behavior-y: none;
}

h1 { font-size: 21px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ шапка */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: 12px 16px 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.who { display: flex; }
.who .ava {
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--card) center/cover;
  border: 2px solid var(--bg);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--dim);
  margin-left: -8px;
}
.who .ava:first-child { margin-left: 0; }
.who .ava.me { color: var(--accent-text); background-color: var(--accent); }

.tabs { display: flex; gap: 6px; margin-top: 10px; }
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 10px; border-radius: 11px;
  font-size: 13.5px; font-weight: 600; color: var(--dim);
  background: var(--card); transition: color .15s, background .15s;
}
.tab b {
  font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
  background: rgba(255, 255, 255, .08); color: inherit;
}
.tab.is-on { color: var(--text); background: color-mix(in srgb, var(--accent) 22%, var(--card)); }
.tab.is-on b { background: var(--accent); color: var(--accent-text); }

/* ------------------------------------------------------------------ сетка */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  padding: 14px 16px;
}
@media (min-width: 620px) { .grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); } }

.card {
  position: relative; display: block; width: 100%; padding: 0; text-align: left;
  border-radius: var(--radius); overflow: hidden; background: var(--card);
  aspect-ratio: 2 / 3;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  transition: transform .16s ease;
  animation: pop .28s ease both;
}
.card:active { transform: scale(.965); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .noposter {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(155deg, #2a3040, #171b23);
  font-size: 15px; font-weight: 700; text-align: center; line-height: 1.3;
  color: rgba(255, 255, 255, .82);
}
.card .shade {
  position: absolute; inset: auto 0 0 0; padding: 26px 10px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, .92) 12%, rgba(0, 0, 0, .55) 55%, transparent);
}
.card .t { font-size: 13.5px; font-weight: 650; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .y { font-size: 11.5px; color: rgba(255, 255, 255, .62); margin-top: 2px; }
.card.seen img { filter: saturate(.55) brightness(.72); }

.badge {
  position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(6px);
  color: #fff; border: 1px solid rgba(255, 255, 255, .25);
}
.badge.mine { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.pin { position: absolute; top: 7px; right: 8px; font-size: 14px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.7)); }

.stars-mini { display: flex; gap: 4px; margin-top: 6px; }
.stars-mini span {
  font-size: 10.5px; font-weight: 700; padding: 1.5px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, .14); color: #fff;
}
.stars-mini span.mine { background: var(--accent); color: var(--accent-text); }

/* -------------------------------------------------------------- пустой вид */
.empty { text-align: center; padding: 64px 40px; color: var(--dim); }
.empty-art { font-size: 46px; margin-bottom: 12px; opacity: .85; }

/* --------------------------------------------------------------------- FAB */
.fab {
  position: fixed; right: 18px; bottom: calc(20px + var(--safe-b)); z-index: 30;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center;
  box-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .16s;
}
.fab:active { transform: scale(.9); }

/* ------------------------------------------------------------------ шторки */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }

.sheet-body {
  position: absolute; inset: auto 0 0 0;
  max-height: 92vh; display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  animation: up .26s cubic-bezier(.22, 1, .36, 1);
}
.sheet-body.tall { height: 92vh; }
@keyframes up { from { transform: translateY(100%); } }

.grabber { width: 38px; height: 4px; border-radius: 4px; background: var(--line); margin: 9px auto 4px; flex: none; }

.search-row { display: flex; align-items: center; gap: 8px; padding: 6px 14px 10px; flex: none; }
.search-ico { position: absolute; margin-left: 11px; color: var(--dim); pointer-events: none; }
#q {
  flex: 1; padding: 11px 12px 11px 36px; border-radius: 12px;
  background: var(--card); border: 1px solid transparent; outline: none;
}
#q:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.ghost { color: var(--accent); font-size: 14.5px; font-weight: 600; padding: 6px 2px; }

.results { overflow-y: auto; padding: 0 10px 18px; -webkit-overflow-scrolling: touch; }
.res {
  display: flex; gap: 12px; width: 100%; text-align: left;
  padding: 9px 8px; border-radius: 14px; align-items: center;
}
.res:active { background: var(--card); }
.res img, .res .ph {
  width: 50px; height: 74px; flex: none; border-radius: 8px; object-fit: cover;
  background: var(--card);
}
.res .ph { display: grid; place-items: center; font-size: 20px; }
.res-t { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.res-m { font-size: 12.5px; color: var(--dim); margin-top: 3px; }
.res-d { font-size: 12px; color: var(--dim); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .8; }
.res.added { opacity: .42; }

.hint { padding: 26px 22px; text-align: center; color: var(--dim); font-size: 13.5px; line-height: 1.5; }
.spinner { width: 20px; height: 20px; margin: 26px auto; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------- карточка фильма */
#movie-content { overflow-y: auto; padding-bottom: 26px; -webkit-overflow-scrolling: touch; }

.hero { position: relative; padding: 4px 18px 16px; display: flex; gap: 15px; }
.hero-bg {
  position: absolute; inset: -40px 0 auto 0; height: 210px; z-index: 0;
  background: var(--bg) center/cover; filter: blur(28px) saturate(1.3); opacity: .38;
  mask-image: linear-gradient(to bottom, #000 20%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 20%, transparent);
}
.hero > * { position: relative; z-index: 1; }
.hero img, .hero .ph {
  width: 104px; flex: none; aspect-ratio: 2/3; border-radius: 12px; object-fit: cover;
  background: var(--card); box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.hero .ph { display: grid; place-items: center; font-size: 30px; }
.hero h2 { font-size: 19px; line-height: 1.25; margin: 2px 0 5px; letter-spacing: -.015em; }
.hero .orig { font-size: 12.5px; color: var(--dim); margin-bottom: 7px; }
.meta { font-size: 12.5px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.kp { color: #f2c94c; font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 14px; }
.chip { font-size: 11.5px; padding: 4px 10px; border-radius: 20px; background: var(--card); color: var(--dim); }

.desc { padding: 0 18px 18px; font-size: 14px; line-height: 1.5; color: color-mix(in srgb, var(--text) 82%, transparent); }

.block { margin: 0 18px 12px; background: var(--card); border-radius: 14px; padding: 12px 14px; }
.block-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 700; margin-bottom: 9px; }

.rate-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.rate-who { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.rate-who .ava { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.1) center/cover; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; flex: none; }
.rate-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stars { display: flex; gap: 2px; flex: none; }
.star { font-size: 19px; line-height: 1; padding: 2px; color: rgba(255, 255, 255, .18); transition: transform .12s, color .12s; }
.star.on { color: #f2c94c; }
.star:active { transform: scale(1.25); }
.stars.locked .star { pointer-events: none; }

textarea.field, input.field {
  width: 100%; background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; outline: none; resize: none;
}
input.field:focus, textarea.field:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

.actions { display: flex; flex-direction: column; gap: 9px; padding: 4px 18px 0; }
.btn {
  width: 100%; padding: 13px; border-radius: 13px; font-size: 15px; font-weight: 650;
  background: var(--card); transition: transform .12s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.danger { color: #ff6b6b; }

/* ------------------------------------------------------------------- тост */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translateX(-50%);
  z-index: 80; max-width: 82vw;
  padding: 10px 16px; border-radius: 20px; font-size: 13.5px; font-weight: 500;
  background: rgba(20, 22, 28, .96); color: #fff;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .5);
  animation: toast .25s cubic-bezier(.2, 1.3, .5, 1);
}
@keyframes toast { from { opacity: 0; transform: translate(-50%, 14px); } }
