/* Общие стили всех страниц: тема, шапка, кнопки, постеры, карточка фильма, окна. */
:root {
  --bg: #121418;
  --bg-2: #171a1f;
  --panel: #1c1f26;
  --panel-2: #232731;
  --panel-3: #2b303b;
  --border: #2a2f39;
  --border-2: #3a404c;
  --text: #eceef2;
  --muted: #979eab;
  --dim: #68707d;
  --accent: #2f7cf6;
  --accent-hover: #4b8ff8;
  --accent-soft: rgba(47, 124, 246, .16);
  --violet: #7c5cf6;
  --gold: #f5c04a;
  --good: #3bb33b;
  --mid: #8a909b;
  --bad: #e5484d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .5);
  --header-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(80, 90, 140, .18), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 14px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; }
svg { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* --- шапка ---------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px;
  background: rgba(18, 20, 24, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: 0 6px 20px rgba(80, 100, 246, .35);
}
.nav { display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 9px;
  color: var(--muted); font-weight: 600; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav a:hover { color: var(--text); }
.nav a.active { background: var(--accent); color: #fff; }
.top-spacer { flex: 1; }

/* --- кнопки и поля -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text);
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: #ff8e91; }
.btn.danger:hover { background: rgba(229, 72, 77, .14); border-color: rgba(229, 72, 77, .4); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }

.input {
  height: 38px; width: 100%; padding: 0 12px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--dim); }
select.input { padding-right: 8px; cursor: pointer; }

.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.seg button {
  height: 30px; min-width: 32px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 12.5px;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-3); color: var(--text); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-2); border-radius: 999px;
  background: var(--panel); color: var(--muted); font-weight: 600; font-size: 13px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { color: var(--text); border-color: var(--dim); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip small { color: var(--dim); font-weight: 600; }
.chip.on small { color: #9cc0ff; }

/* --- метки фильма --------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border-radius: 5px; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  background: var(--accent); color: #fff;
}
.rate {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 8px; border-radius: 6px;
  font-weight: 800; font-size: 13px; color: #fff; background: var(--mid);
}
.rate small { font-size: 10px; font-weight: 700; opacity: .8; letter-spacing: .04em; }
.rate.good { background: var(--good); }
.rate.bad { background: var(--bad); }
.rate.imdb { background: #f5c518; color: #121212; }
.genres { display: flex; flex-wrap: wrap; gap: 5px; }
.genres span {
  padding: 3px 9px; border-radius: 999px;
  background: var(--panel-3); color: #c4c9d3; font-size: 12px; font-weight: 600;
}
.meta { color: var(--muted); font-size: 12.5px; }

/* --- постер --------------------------------------------------------------- */
.poster { width: 100%; height: 100%; object-fit: cover; background: var(--panel-3); }
.poster-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center; padding: 10%;
  text-align: center; font-weight: 800; line-height: 1.15; color: rgba(255, 255, 255, .88);
  background:
    radial-gradient(120% 80% at 20% 0%, hsl(var(--h) 55% 38%), transparent 70%),
    linear-gradient(160deg, hsl(var(--h) 45% 24%), hsl(calc(var(--h) + 40) 40% 12%));
  overflow: hidden; word-break: break-word;
}

/* --- всплывающая карточка фильма ----------------------------------------- */
.hovercard {
  position: fixed; z-index: 400;
  width: 360px; padding: 14px;
  display: grid; grid-template-columns: 104px 1fr; gap: 14px;
  background: rgba(30, 33, 41, .97); backdrop-filter: blur(10px);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.hovercard .hc-poster { width: 104px; aspect-ratio: 2 / 3; border-radius: 9px; overflow: hidden; font-size: 11px; }
.hovercard .hc-body { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.hovercard .hc-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.hovercard .hc-actions .btn { flex: 1; }
.hovercard .hc-move { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; padding-top: 10px; border-top: 1px solid var(--border); }
.hovercard .hc-move > span { width: 100%; color: var(--dim); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.hovercard .hc-move button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: 7px;
  border: 1px solid var(--border-2); background: var(--panel-2); font-size: 12px; font-weight: 600;
}
.hovercard .hc-move button:hover { border-color: var(--dim); background: var(--panel-3); }
.hovercard .hc-move button.on { border-color: var(--accent); background: var(--accent-soft); }
.hovercard .hc-move i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.hovercard .hc-move kbd { color: var(--dim); font: 700 10.5px/1 inherit; }

.film-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.film-title { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.film-orig { color: var(--muted); font-size: 12.5px; margin-top: -3px; }
.film-rates { display: flex; gap: 6px; }

/* --- окна ----------------------------------------------------------------- */
.backdrop {
  position: fixed; inset: 0; z-index: 500;
  display: grid; place-items: center; padding: 24px;
  background: rgba(6, 7, 9, .76); backdrop-filter: blur(6px);
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  width: min(520px, 100%); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 18px;
  box-shadow: var(--shadow); overflow: hidden;
  animation: pop .16s ease-out;
}
.dialog.wide { width: min(1000px, 100%); }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.dialog-head h2 { margin: 0; flex: 1; font-size: 17px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-body { padding: 4px 18px 18px; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
.dialog-text { color: #c9ced8; margin: 0; }

.player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center; color: var(--muted);
  background: radial-gradient(60% 60% at 50% 40%, #1d2230, #0b0c0f);
}
.player-empty b { color: var(--text); font-size: 16px; }
.player-links { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.player-links a { color: #8fb6ff; font-weight: 600; }
.player-links a:hover { text-decoration: underline; }

/* --- уведомления ---------------------------------------------------------- */
.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 600; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 10px 10px 16px; min-height: 44px;
  background: #2a2f3a; border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: var(--shadow); font-weight: 600; font-size: 13.5px;
  animation: pop .16s ease-out;
}
.toast:not(:has(button)) { padding-right: 16px; }
.toast button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; }

/* --- состояния страницы --------------------------------------------------- */
.fatal {
  max-width: 560px; margin: 12vh auto; padding: 28px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px; text-align: center;
}
.fatal h2 { margin: 0 0 8px; }
.fatal p { color: var(--muted); margin: 0; }
.loading { display: grid; place-items: center; height: 50vh; color: var(--dim); }

.kbd-hint { color: var(--dim); font-size: 12px; }
.kbd-hint kbd {
  display: inline-block; min-width: 20px; padding: 1px 5px; margin: 0 1px;
  border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px;
  background: var(--panel-2); color: var(--muted); font: 700 11px/1.4 inherit; text-align: center;
}

@media (max-width: 720px) {
  .top { padding: 0 12px; gap: 12px; }
  .brand [data-site-title] { display: none; }
  .nav a { padding: 7px 10px; }
  .hovercard { width: min(360px, calc(100vw - 16px)); }
}
