:root {
  --bg: #14181c;
  --bg-elev: #2c3440;
  --bg-elev-2: #384551;
  --border: #456;
  --border-soft: #2a323b;
  --text: #e9edf0;
  --text-muted: #9ab;
  --text-dim: #678;
  --accent: #00e054;
  --accent-orange: #ff8000;
  --accent-blue: #40bcf4;
  --danger: #ff5252;
  --radius: 4px;
  --container: 1100px;
  --gutter: 1.5rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Shared visual tokens reused across buttons, inputs, and toggles. */
  --transition-base: background .12s ease, border-color .12s ease, color .12s ease;
  --focus-ring: 0 0 0 2px rgba(0, 224, 84, .2);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

html { height: 100%; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.container { flex: 1 0 auto; }
.site-footer { flex-shrink: 0; }

a {
  color: var(--text);
  text-decoration: none;
  transition: color .12s ease;
}
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  margin: 0 0 .6em;
  font-weight: 600;
  line-height: 1.2;
}
h2 { font-size: 1.5rem; }
h3 { font-size: 1rem; }

ul { margin: 0 0 1em; padding-left: 1.2em; }
small { color: var(--text-muted); font-size: .82rem; }
em { color: var(--text-muted); }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 1.5rem 0; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  width: 100%;
  padding: 2rem var(--gutter) 3rem;
}

.site-header {
  background: #0e1216;
  border-bottom: 1px solid var(--border-soft);
}
.site-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: .9rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-footer {
  background: #0e1216;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: .9rem;
}
.site-footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: .9rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

.brand {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: .02em;
}
.brand a { color: var(--text); }
.brand__kino { font-weight: 700; }
.brand__traffic { font-weight: 300; color: var(--text-muted); }

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .9rem;
}
.nav a { color: var(--text-muted); }
.nav a:hover { color: var(--accent); }
.nav__user { color: var(--text-muted); }
.nav__user strong a { color: var(--text); font-weight: 600; }

button, .btn {
  display: inline-block;
  font: inherit;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition-base);
}
button:hover, .btn:hover { background: var(--bg-elev-2); border-color: var(--text-dim); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a1a0e;
  font-weight: 600;
}
.btn--primary:hover {
  background: #00ff66;
  border-color: #00ff66;
  color: #0a1a0e;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn--ghost:hover { color: var(--text); border-color: var(--text-muted); background: transparent; }

.btn--danger {
  background: rgba(255, 82, 82, .12);
  border-color: rgba(255, 82, 82, .5);
  color: var(--danger);
  font-weight: 600;
}
.btn--danger:hover {
  background: rgba(255, 82, 82, .22);
  border-color: var(--danger);
  color: var(--danger);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  font: inherit;
  background: #1f262e;
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: .5rem .65rem;
  border-radius: var(--radius);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
textarea { width: 100%; resize: vertical; }
label { display: inline-block; color: var(--text-muted); }

.form-error {
  background: rgba(255, 82, 82, .08);
  border: 1px solid rgba(255, 82, 82, .35);
  color: var(--danger);
  padding: .6rem .8rem;
  border-radius: var(--radius);
}

.section-label, .container h3 {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: .35rem;
  margin: 1.6rem 0 .6rem;
}

.back-link {
  display: inline-block;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tagline { color: var(--text-muted); margin-top: 0; }

.intro-text {
  text-align: center;
  margin: 0;
}

.intro-text h2 {
  font-size: 2.3rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  color: var(--text);
  font-family: Georgia, Garamond, "Times New Roman", serif;
  letter-spacing: .02em;
}

.search-form {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.search-form__input {
  flex: 1 1 260px;
  min-width: 0;
}

.header-search {
  display: inline-flex;
  align-items: center;
  margin-right: .25rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius);
  transition: var(--transition-base);
}
.header-search.is-open {
  border-color: var(--border);
  background: var(--bg-elev);
}
.header-search.is-open:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.header-search__input {
  display: none;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font: inherit;
}
.header-search.is-open .header-search__input {
  display: inline-block;
  width: 220px;
  padding: 0 .5rem;
}
.header-search__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  transition: var(--transition-base);
}
.header-search__btn:hover {
  background: var(--bg-elev-2);
  border-color: var(--text-dim);
  color: var(--text);
}
.header-search__btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.header-search.is-open .header-search__btn {
  border-color: transparent;
  background: transparent;
}
.header-search.is-open .header-search__btn:hover {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}
.header-search.is-open .header-search__btn:focus-visible {
  box-shadow: none;
  border-color: transparent;
}
.header-search__btn .icon { display: block; }

.nav__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  transition: var(--transition-base);
}
.nav__icon-btn .icon { display: block; }
.nav__icon-btn:hover {
  background: var(--bg-elev-2);
  border-color: var(--text-dim);
  color: var(--text);
}
.nav__icon-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}


.auth-card {
  max-width: 380px;
  margin: 1rem auto;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.25rem;
}
.auth-card h2 { margin-top: 0; }
.auth-card form p { margin: 0 0 .8rem; }
.auth-card label { display: block; margin-bottom: .25rem; font-size: .82rem; }
.auth-card input { width: 100%; }
.auth-card__footer { margin-top: 1rem; font-size: .85rem; color: var(--text-muted); }

/* Login gate: chromeless full-viewport shell shown to unauthenticated
   visitors. Reuses .intro-text and .auth-card for the tagline + form. */
.gate-body { min-height: 100vh; }
.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem 1rem;
  box-sizing: border-box;
}
.gate .auth-card { width: 100%; }

.film-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.film-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: .9rem;
}
.film-row__poster {
  width: 80px;
  background: #1a1f24;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 2 / 3;
  display: block;
  text-decoration: none;
  color: inherit;
}
a.film-row__poster:hover,
a.film-row__poster:focus { outline: none; box-shadow: 0 0 0 2px var(--accent, #4ea1ff); }
.film-row__poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.film-row__poster--sm { width: 56px; }
.film-row__poster--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: var(--text-dim);
  text-align: center;
  padding: .25rem;
}
/* h3.film-row__title — match `.container h3` specificity to override the
   global section-label styling that bare <h3>s pick up. */
h3.film-row__title {
  margin: 0 0 .25rem;
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: inherit;
  border-bottom: 0;
  padding-bottom: 0;
}
.film-row__title a { color: var(--text); }
.film-row__title a:hover { color: var(--accent); }
.film-row__year { color: var(--text-muted); font-weight: 400; margin-left: .25rem; }
.film-row__meta { font-size: .82rem; color: var(--text-muted); margin: 0 0 .35rem; }
.film-row__director { font-size: .85rem; color: var(--text-muted); margin: 0 0 .35rem; }
.film-row__tagline { font-style: italic; color: var(--text-muted); margin: 0 0 .35rem; }
.film-row__synopsis { margin: 0; color: var(--text); font-size: .9rem; }

.rating-list {
  list-style: none;
  padding: 0;
  margin: 0 0 .5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.rating-pill {
  background: #1a2026;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: .15rem .65rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.rating-pill a { color: var(--text); }
.rating-pill a:hover { color: var(--accent); }

.film-page {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 1.75rem;
  margin-top: .5rem;
}
.film-page__poster img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}
.film-page__poster-empty {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: .82rem;
  text-align: center;
  padding: 1rem;
}
.film-page__title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 .15rem;
}
.film-page__year { color: var(--text-muted); font-weight: 300; }
.film-page__original {
  color: var(--text-muted);
  font-size: .85rem;
  margin: 0 0 .8rem;
}
.film-page__directed {
  font-size: .9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
.film-page__directed strong { color: var(--text); font-weight: 600; }
.film-page__synopsis {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 0 1rem;
}
.film-page__ratings { margin-bottom: 1rem; }

.person-page {
  display: grid;
  grid-template-columns: 185px 1fr;
  gap: 1.75rem;
  margin-top: .5rem;
}
.person-page__photo img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}
.person-page__photo--empty {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: .82rem;
}
.person-page__name {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 .25rem;
}
.person-page__known { margin: 0 0 .35rem; color: var(--text-muted); font-size: .85rem; }
.person-page__meta-line { margin: 0 0 .8rem; color: var(--text-muted); font-size: .85rem; }
.person-page__bio {
  color: var(--text);
  font-size: .95rem;
  line-height: 1.55;
  margin: 0 0 1rem;
}
.person-page__details { margin: 1rem 0; }
.person-page__details summary {
  cursor: pointer;
  font-weight: 600;
  padding: .35rem 0;
}
.person-page__details h4 {
  margin: 1rem 0 .35rem;
  font-size: .95rem;
  color: var(--text-muted);
}
.film-row__suffix { color: var(--text-muted); font-size: .82rem; margin-left: .25rem; }

.search-expand { margin: .5rem 0 1rem; }
.search-expand > summary {
  cursor: pointer;
  display: inline-block;
  padding: .35rem .75rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border, currentColor);
  border-radius: 999px;
  list-style: none;
  user-select: none;
}
.search-expand > summary::-webkit-details-marker { display: none; }
.search-expand > summary:hover { color: inherit; }
.search-expand > summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.search-expand[open] > summary { margin-bottom: .5rem; }
.search-expand__hide { display: none; }
.search-expand[open] > summary .search-expand__show { display: none; }
.search-expand[open] > summary .search-expand__hide { display: inline; }

.log-add {
  margin-bottom: 1rem;
}

.movie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.movie-actions .rating-widget { flex-basis: 100%; }
.movie-actions .log-add { margin-bottom: 0; }
.movie-actions__form { margin: 0; }

.cast-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .35rem .9rem;
}
.cast-grid li {
  font-size: .85rem;
  padding: .25rem 0;
}
.cast-grid li strong { color: var(--text); font-weight: 500; }
.cast-grid .character { color: var(--text-muted); font-size: .78rem; display: block; }

.crew-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .35rem 1rem;
  margin: 0;
  font-size: .9rem;
}
.crew-dl dt {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .72rem;
  padding-top: .15rem;
}
.crew-dl dd { margin: 0; color: var(--text); }

.log-entry {
  border-bottom: 1px solid var(--border-soft);
  padding: 0 .75rem .85rem;
  margin-bottom: .85rem;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: .35rem .8rem;
  align-items: baseline;
}
.log-entry .film-row__poster {
  grid-row: 1 / span 3;
  align-self: start;
}
.log-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.log-entry__title { font-weight: 600; }
.log-entry__title a { color: var(--text); }
.log-entry__title a:hover { color: var(--accent); }
.log-entry__year { color: var(--text-muted); font-weight: 400; margin-left: .15rem; }
.log-entry__by { color: var(--text-muted); font-weight: 400; font-size: .85rem; margin-left: .25rem; }
.log-entry__by a { color: var(--text-muted); }
.log-entry__by a:hover { color: var(--accent); }
.log-entry__rating { color: var(--accent); font-weight: 600; white-space: nowrap; margin-right: .4rem; }
.log-entry__rating--low { color: #e5484d; }
.log-entry__rating--mid { color: #f5c518; }
.log-entry__rating--high { color: var(--accent); }
.log-entry__date {
  grid-column: 2 / -1;
  color: var(--text-muted);
  font-size: .8rem;
}
.log-entry__notes {
  grid-column: 2 / -1;
  color: var(--text-muted);
  font-size: .85rem;
  padding-top: .4rem;
  margin: .25rem 0 0;
}
.log-entry__delete {
  margin: 0;
  grid-column: 3 / 4;
  grid-row: 1 / 2;
  justify-self: end;
}
.log-entry__delete-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--danger);
  padding: .2rem .35rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.log-entry__delete-btn:hover {
  background: rgba(255, 82, 82, .12);
  border-color: rgba(255, 82, 82, .4);
  color: var(--danger);
}

.profile__joined { color: var(--text-muted); font-size: .82rem; margin-top: -.25rem; margin-bottom: 1rem; }
.profile__meta {
  color: var(--text-muted);
  font-size: .82rem;
  margin: .25rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.profile__meta-item { display: inline-flex; align-items: center; gap: .25rem; }
.profile__meta-label { font-weight: 600; }
.profile__meta-sep { color: var(--border-soft); }
.profile__meta a { color: inherit; }
.profile__online { display: inline-flex; align-items: center; gap: .35em; }
.profile__online-dot { display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 0 2px rgba(46, 204, 113, .25); }
.profile__identity { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.profile__flag { font-size: 1.05rem; line-height: 1; }
.profile__gender { font-style: italic; }
.profile__header { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: .25rem; }
.profile__header h2 { margin: 0; }
.profile__follow-form { margin: 0; }
.follow-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.follow-list__item { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--border-soft); }
.follow-list__name { font-weight: 600; }
.follow-list__meta { color: var(--text-muted); font-size: .82rem; margin-left: auto; }
.settings__account { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.profile__edit-link { font-size: .85rem; }

/* Admin user-management page */
.nav__admin-link { font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.admin-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.admin-row { background: var(--bg-elev); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: .75rem 1rem; }
.admin-row__head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; margin-bottom: .5rem; }
.admin-row__email { color: var(--text-muted); font-size: .9rem; }
.admin-row__meta { color: var(--text-muted); font-size: .8rem; margin-left: auto; }
.admin-row__actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.admin-row__form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 0; }
.admin-row__form input[type="text"], .admin-row__form input[type="password"] { padding: .25rem .4rem; }
.admin-create { display: grid; grid-template-columns: max-content 1fr; gap: .5rem .75rem; align-items: center; max-width: 32rem; margin: 0 0 1.5rem; }
.admin-create label { font-size: .9rem; }
.admin-create input[type="text"], .admin-create input[type="email"], .admin-create input[type="password"] { padding: .35rem .5rem; }
.admin-create__admin-flag { grid-column: 1 / -1; display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
.admin-create button[type="submit"] { grid-column: 1 / -1; justify-self: start; }
.admin-row__self { color: var(--text-muted); font-size: .85rem; font-style: italic; }
.admin-badge { background: var(--accent, #c43b6e); color: #fff; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: .1rem .4rem; border-radius: .25rem; }

.profile__stats {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: 1rem;
}
.profile__stats-totals { margin: 0 0 .75rem; }
.profile__stats-totals strong { font-weight: 600; }
.rating-histogram {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: .35rem;
  align-items: end;
}
.rating-histogram__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  min-width: 0;
}
.rating-histogram__bar-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 80px;
}
.rating-histogram__bar {
  display: block;
  width: 100%;
  min-height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transition: height .2s ease;
}
.rating-histogram__label {
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1;
}
.rating-histogram__item > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  width: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: 3px;
}
.rating-histogram__item > a:hover .rating-histogram__bar,
.rating-histogram__item > a:focus-visible .rating-histogram__bar {
  background: var(--accent-strong, var(--accent));
  filter: brightness(1.15);
}
.rating-histogram__item > a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ratings-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .85rem;
  margin: 0 0 1rem;
  font-size: .9rem;
}
.ratings-sort__label {
  color: var(--text-muted);
}
.ratings-sort__link {
  text-decoration: none;
  color: inherit;
  padding: .15rem .35rem;
  border-radius: 3px;
}
.ratings-sort__link:hover { text-decoration: underline; }
.ratings-sort__link--active {
  font-weight: 600;
  color: var(--accent);
}

.favourites-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
}
.favourite-card {
  position: relative;
  width: 110px;
  flex: 0 0 auto;
}
.favourite-card__link {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #1a1f24;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: transform .12s ease, border-color .12s ease;
}
.favourite-card__link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.favourite-card__link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.favourite-card__link > .favourite-card__no-poster { border-radius: inherit; overflow: hidden; }

/* Speech-bubble tooltip shown above an element on hover/focus. */
[data-tooltip] { position: relative; }
/* Ensure tooltips render above transformed siblings (e.g. lifted favourite cards). */
:has(> [data-tooltip]) { isolation: isolate; }
[data-tooltip]::after,
[data-tooltip]::before {
  position: absolute;
  left: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity .08s ease-out, transform .08s ease-out;
  z-index: 10;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  background: var(--bg-elev, #1a1f24);
  color: var(--text, #fff);
  border: 1px solid var(--border-soft, #333);
  border-radius: 6px;
  padding: .35rem .6rem;
  font-size: .8rem;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 20rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
[data-tooltip]::before {
  content: '';
  bottom: calc(100% + 2px);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--border-soft, #333);
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::after,
[data-tooltip]:focus-visible::before,
[data-tooltip]:focus-within::after,
[data-tooltip]:focus-within::before {
  opacity: 1;
  transform: translate(-50%, 0);
}
.favourite-card__no-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: .4rem;
  font-size: .78rem;
  color: var(--text-dim);
  text-align: center;
}
.favourite-card__caption {
  display: block;
  margin-top: .35rem;
  font-size: .78rem;
  color: var(--text-dim);
  text-align: center;
  word-break: break-word;
  line-height: 1.25;
}
.favourite-card__delete {
  position: absolute;
  top: .25rem;
  right: .25rem;
  margin: 0;
}
.favourite-card__delete-btn {
  background: rgba(20, 24, 28, .8);
  border: 1px solid rgba(255, 82, 82, .4);
  color: var(--danger);
  padding: .2rem .3rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.favourite-card__delete-btn:hover {
  background: rgba(255, 82, 82, .22);
  border-color: var(--danger);
  color: var(--danger);
}

.favourites-list.is-reorderable .favourite-card {
  cursor: grab;
}
.favourites-list.is-reorderable .favourite-card:active {
  cursor: grabbing;
}
.favourites-list.is-reorderable .favourite-card.is-dragging {
  opacity: .4;
}

.user-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.user-list li {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: .5rem .8rem;
}

dialog.log-dialog {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
dialog.log-dialog::backdrop { background: rgba(0, 0, 0, .65); }
dialog.log-dialog form p { margin: 0 0 .75rem; }
dialog.log-dialog label { display: block; font-size: .82rem; margin-bottom: .25rem; }
dialog.log-dialog input[type="date"],
dialog.log-dialog input[type="number"],
dialog.log-dialog textarea { width: 100%; }
dialog.log-dialog .dialog-actions { display: flex; gap: .5rem; justify-content: flex-end; }

@media (max-width: 720px) {
  .film-page { grid-template-columns: 1fr; }
  .film-page__poster { max-width: 220px; margin: 0 auto; }
  .person-page { grid-template-columns: 1fr; }
  .person-page__photo { max-width: 185px; margin: 0 auto; }
  .cast-grid { grid-template-columns: 1fr 1fr; }
  .site-header__inner { gap: .75rem; }
  .film-row { grid-template-columns: 64px 1fr; }
  .film-row__poster { width: 64px; }
  .favourite-card { width: 90px; }
  .header-search.is-open .header-search__input {
    width: 140px;
  }
}

/* ---------- Rating widget ---------- */
.rating-widget {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .35rem .55rem;
}
.rating-widget__label { color: var(--text-muted); font-size: .8rem; }
.rating-widget__stars { display: inline-flex; gap: 1px; }
.rating-widget__value { color: var(--text-muted); font-size: .85rem; }
.rating-widget--low .rating-widget__value { color: #e5484d; font-weight: 600; }
.rating-widget--mid .rating-widget__value { color: #f5c518; font-weight: 600; }
.rating-widget--high .rating-widget__value { color: var(--accent); font-weight: 600; }
.rating-widget[aria-busy="true"] { opacity: .6; }

.rating-star {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0 1px;
  margin: 0;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .12s ease, transform .12s ease;
}
.rating-star:hover,
.rating-star:focus-visible { transform: scale(1.1); outline: none; }
.rating-star:focus-visible { color: var(--accent); }
.rating-star--filled { color: #f5c518; }
.rating-star--empty { color: var(--text-muted); opacity: .55; }
.rating-star--preview { color: #f5c518; opacity: .85; }

.rating-widget__clear {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0 .25rem;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.rating-widget__clear:hover { color: #e5484d; }
