/* Film Forge — dark poster grid
   Plain CSS, no frameworks. Colors live in the variables below. */

:root {
  --bg:          #0c0e0c;
  --bg-raised:   #131713;
  --surface:     #181d18;
  --surface-2:   #202620;
  --border:      #2a342a;
  --border-soft: #1f261f;
  --text:        #e9eee9;
  --text-dim:    #a3aea3;
  --text-faint:  #7b877b;
  --accent:      #3ddc3d;
  --accent-ink:  #07140a;
  --accent-soft: rgba(61, 220, 61, 0.14);
  --star:        #f5c518;
  --danger:      #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.14);
  --radius:      10px;
  --radius-lg:   16px;
  --shadow:      0 10px 30px rgba(0, 0, 0, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 48px);
}

img { display: block; max-width: 100%; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

/* Keyboard focus is always visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  z-index: 100;
}
.skip-link:focus { top: 10px; }

/* ---------- Header ---------- */

.site-header {
  background: linear-gradient(180deg, #121612 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo {
  width: 150px;
  height: 40px;
  image-rendering: pixelated;
  border-radius: 4px;
}
.version {
  color: var(--text-faint);
  font-size: 13px;
}
.site-meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}
.site-meta .sep { margin: 0 6px; color: var(--text-faint); }
#totalCount { color: var(--text); font-weight: 600; }

/* ---------- Controls ---------- */

.controls {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  display: grid;
  gap: 14px;
}

.search-row {
  display: flex;
  gap: 10px;
}
.search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 38px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px; /* 16px stops iPhones zooming in on focus */
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { display: none; }

.clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  font-size: 20px;
}

/* Buttons */

.btn, .icon-btn, .chip {
  font: inherit;
  cursor: pointer;
  color: var(--text);
}
.btn {
  min-height: 44px;
  padding: 0 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: #283028; border-color: #3a493a; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #55e955; border-color: #55e955; }

.btn-quiet { background: transparent; color: var(--text-dim); }
.btn-danger { background: var(--danger-soft); border-color: rgba(229, 72, 77, 0.5); color: #ff8d90; }
.btn-danger:hover { background: rgba(229, 72, 77, 0.28); border-color: var(--danger); }

.icon-btn {
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--text-faint);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Quick views */

.quick-views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  min-height: 36px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-dim);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { color: var(--text); border-color: #3a493a; }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* Filters */

.filter-toggle { display: none; justify-content: space-between; width: 100%; }
.filter-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.filter-toggle .chev { transition: transform 0.15s; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.field { display: grid; gap: 4px; }
.field span { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.field select {
  height: 40px;
  min-width: 130px;
  padding: 0 32px 0 12px;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 15px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a3aea3' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* Edit key */

.editkey {
  margin-left: auto;
  position: relative;
}
.editkey summary {
  list-style: none;
  cursor: pointer;
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 15px;
}
.editkey summary::-webkit-details-marker { display: none; }
.editkey[open] summary { border-color: var(--accent); color: var(--text); }
.key-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-faint);
}
.key-dot.on { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.editkey-panel {
  position: absolute;
  right: 0;
  top: 46px;
  z-index: 20;
  width: min(300px, calc(100vw - 32px));
  padding: 14px;
  display: grid;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.editkey-panel label { font-size: 14px; color: var(--text-dim); }
.editkey-panel input {
  height: 40px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}
.editkey-panel input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { margin: 0; font-size: 13px; color: var(--text-faint); }

/* ---------- Results + pager ---------- */

.results-bar {
  margin: 22px 0 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
}
.results-text { margin: 0; color: var(--text-dim); font-size: 14px; }
.results-text strong { color: var(--text); }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.pager .btn { min-height: 38px; padding: 0 14px; font-size: 14px; }
.pager .page-label { color: var(--text-dim); font-size: 14px; padding: 0 6px; white-space: nowrap; }
.pager select {
  height: 38px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
}
.pager-bottom { justify-content: center; margin-top: 28px; }

/* ---------- Poster grid ---------- */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 14px;
  transition: opacity 0.15s;
}
.grid[aria-busy="true"] { opacity: 0.55; }

.card-btn {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}
.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-btn:hover .poster,
.card-btn:focus-visible .poster {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--accent-soft);
}
.card-btn:focus-visible { outline: none; }

.poster-fallback {
  width: 100%;
  height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  background: linear-gradient(160deg, #1d261d 0%, #121712 100%);
  color: var(--text-dim);
  font-weight: 700;
  line-height: 1.25;
}
.poster-fallback .reel { font-size: 34px; opacity: 0.55; }
.poster-fallback .name { font-size: 14px; overflow-wrap: anywhere; }

.badge-watched {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  background: rgba(7, 20, 10, 0.85);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}
.badge-rating {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--star);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.card-info { padding: 8px 2px 0; }
.card-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-sub { margin-top: 2px; font-size: 13px; color: var(--text-faint); }

/* Loading placeholders */
.skeleton .poster { background: linear-gradient(110deg, #151a15 30%, #1d241d 50%, #151a15 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton .bar { height: 12px; margin-top: 10px; width: 80%; border-radius: 6px; background: #151a15; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Empty / error message */
.message {
  margin: 40px auto;
  max-width: 460px;
  padding: 28px 24px;
  text-align: center;
  background: var(--bg-raised);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-dim);
}
.message strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.message .btn { margin-top: 14px; }

/* ---------- Detail dialog ---------- */

.detail {
  width: min(940px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.detail::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(3px); }
.detail[open] { animation: pop 0.18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.dialog-close {
  position: sticky;
  top: 10px;
  float: right;
  margin: 10px 10px 0 0;
  width: 40px;
  height: 40px;
  font-size: 26px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2;
}

.detail-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 22px 20px 24px;
}
.detail-poster {
  width: min(220px, 60%);
  margin: 0 auto;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { min-width: 0; }
.detail h2 { margin: 0 0 6px; font-size: 26px; line-height: 1.2; padding-right: 36px; }
.detail-meta { margin: 0 0 12px; color: var(--text-dim); font-size: 15px; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.pill {
  display: inline-block;
  padding: 1px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
}
.pill a { color: inherit; text-decoration: none; }
.pill a:hover { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag {
  padding: 3px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.detail-section { margin-top: 14px; }
.detail-section h3 {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.detail-section p { margin: 0; color: var(--text); max-width: 62ch; }

.detail-actions {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  display: grid;
  gap: 14px;
}
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.action-danger { padding-top: 4px; }

.watch-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.watch-icon {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 5px;
  position: relative;
}
.watch-btn[aria-pressed="true"] .watch-icon { background: var(--accent); border-color: var(--accent); }
.watch-btn[aria-pressed="true"] .watch-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  width: 5px;
  height: 10px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.rating { display: inline-flex; gap: 2px; }
.star-btn {
  width: 40px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 30px;
  line-height: 1;
  color: #4a544a;
  cursor: pointer;
  transition: color 0.12s, transform 0.12s;
}
.star-btn.on { color: var(--star); }
.star-btn:hover { transform: scale(1.15); color: var(--star); }
.star-btn.preview { color: var(--star); }

.detail-status { margin: 12px 0 0; min-height: 22px; font-size: 14px; color: var(--text-faint); }
.detail-status.error { color: #ff8d90; }
.detail-status.ok { color: var(--accent); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(env(safe-area-inset-bottom, 0px), 20px);
  transform: translate(-50%, 16px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  background: #242c24;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); }


/* ---------- Grid / list switch ---------- */

.view-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.view-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  background: transparent;
  color: var(--text-dim);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button[aria-pressed="true"] { background: var(--accent); color: #07110a; font-weight: 650; }
.view-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the extra list-only bits stay hidden in grid mode */
.row-status, .card-genre { display: none; }

/* List layout: one compact row per movie */
.grid.list { display: flex; flex-direction: column; gap: 8px; }
.grid.list .card-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px 8px 8px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s;
}
.grid.list .card-btn:hover,
.grid.list .card-btn:focus-visible { background: var(--surface-2, #1a211a); border-color: var(--accent); }
.grid.list .poster { width: 48px; flex: none; border-radius: 6px; }
.grid.list .card-btn:hover .poster,
.grid.list .card-btn:focus-visible .poster { transform: none; box-shadow: none; }
.grid.list .poster-fallback .reel { font-size: 16px; }
.grid.list .poster-fallback .name { display: none; }
.grid.list .badge-watched, .grid.list .badge-rating { display: none; }
.grid.list .card-info { flex: 1 1 auto; min-width: 0; padding: 0; }
.grid.list .card-title { font-size: 15px; -webkit-line-clamp: 1; line-clamp: 1; }
.grid.list .card-genre {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid.list .row-status {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: 84px;
  font-size: 13px;
}
.grid.list .row-watched { color: var(--accent); font-weight: 600; }
.grid.list .row-stars { color: var(--star); letter-spacing: 1px; font-size: 14px; }
.grid.list .skeleton { display: flex; align-items: center; gap: 14px; padding: 8px; }
.grid.list .skeleton .poster { width: 48px; flex: none; }
.grid.list .skeleton .bar { margin: 0; flex: 1; }

/* ---------- Larger screens ---------- */

@media (min-width: 640px) {
  .wrap { padding-left: 24px; padding-right: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px 18px; }
  .detail-body { grid-template-columns: 240px 1fr; gap: 28px; padding: 28px 28px 30px; }
  .detail-poster { width: 100%; margin: 0; }
  .detail h2 { font-size: 30px; }
}

@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

/* ---------- Small phones ---------- */

@media (max-width: 520px) {
  .search-row { flex-wrap: wrap; }
  .search-row .btn { flex: 1 1 100%; }
  .filter-toggle { display: flex; }
  .filter-row { display: none; }
  .filter-row.open { display: flex; }
  .filter-row .field { flex: 1 1 calc(50% - 6px); }
  .filter-row .field select { width: 100%; min-width: 0; }
  .editkey { margin-left: 0; width: 100%; }
  .editkey summary { width: 100%; }
  .editkey-panel { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
  .quick-views { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .quick-views::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
  .results-bar { flex-direction: column; align-items: flex-start; }
  .view-toggle { align-self: stretch; }
  .view-toggle button { flex: 1; justify-content: center; }
  .grid.list .row-status { min-width: 0; }
  .grid.list .row-watched { font-size: 0; }
  .grid.list .row-watched::before { content: '✓'; font-size: 15px; }
  .pager { width: 100%; justify-content: space-between; }
  .pg-extra { display: none; }
  .btn-danger { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- login ---------- */
.logout-form { margin: 0 0 0 auto; }
.login-page { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 28px 16px 24px; }
.login-banner { width: 100%; text-align: center; }
.login-banner img { display: inline-block; width: min(460px, 92%); height: auto; border-radius: 6px; }
.login-page .login-card { margin: auto; }
body:has(.login-page) { padding-bottom: 0; }
.login-card {
  width: 100%; max-width: 360px; background: var(--surface, #141814);
  border: 1px solid var(--border, #263026); border-radius: 14px; padding: 28px 24px;
}
.login-card img { display: block; margin: 0 auto 20px; height: auto; max-width: 150px; }
.login-card h1 { font-size: 1.1rem; margin: 0 0 16px; text-align: center; font-weight: 600; }
.login-card label { display: block; font-size: .85rem; margin: 12px 0 6px; opacity: .85; }
.login-card input[type=text], .login-card input[type=password] {
  width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; font-size: 16px;
  color: inherit; background: var(--bg, #0c0e0c); border: 1px solid var(--border, #263026); border-radius: 8px;
}
.login-card input:focus { outline: 2px solid var(--accent, #3ddc3d); outline-offset: 1px; }
.login-card .btn-primary { width: 100%; margin-top: 18px; padding: 11px; }
.login-error { background: rgba(255,90,90,.12); border: 1px solid rgba(255,90,90,.4); color: #ff9a9a;
  padding: 9px 12px; border-radius: 8px; font-size: .9rem; margin-bottom: 4px; }
.login-note { background: rgba(61,220,61,.12); border: 1px solid rgba(61,220,61,.4); color: #8be98b;
  padding: 9px 12px; border-radius: 8px; font-size: .9rem; margin-bottom: 4px; }
.login-link { display: block; margin-top: 14px; text-align: center; font-size: .9rem; }
.editions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.editions li { font-size: 14px; line-height: 1.4; color: var(--text-dim); word-break: break-word; }
.editions strong { color: var(--text); }
a.btn { text-decoration: none; }
/* trailer player */
.trailer { width: min(900px, calc(100% - 16px)); padding: 0; margin: auto; background: #000; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.trailer::backdrop { background: rgba(0, 0, 0, 0.85); }
.trailer .dialog-close { position: absolute; top: 4px; right: 4px; float: none; margin: 0; }
.trailer-box { aspect-ratio: 16 / 9; width: 100%; margin-top: 48px; background: #000; }
.trailer-box iframe { width: 100%; height: 100%; border: 0; display: block; }
.trailer-foot { margin: 0; padding: 10px 14px; font-size: 14px; text-align: center; background: var(--surface); }
/* ---------- needs-review flag ---------- */
.badge-review {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  background: rgba(194, 65, 12, 0.92);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pill-review { background: #c2410c; border-color: #c2410c; color: #fff; }
.grid.list .badge-review { display: none; }
.grid.list .row-review { color: #fb923c; font-weight: 600; }
@media (max-width: 520px) {
  .grid.list .row-review { font-size: 0; }
  .grid.list .row-review::before { content: '⚑'; font-size: 15px; }
}
/* ---------- review button on cards ---------- */
.card { position: relative; }
.card-review {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  min-height: 30px; padding: 0 10px;
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  color: #fff; background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px;
  backdrop-filter: blur(4px);
}
.card-review:hover { border-color: #fb923c; }
.card-review.on { background: rgba(194, 65, 12, 0.95); border-color: #fb923c; }
.grid.list .card-review { top: 50%; right: 120px; transform: translateY(-50%); }
@media (max-width: 520px) { .grid.list .card-review { right: 56px; } }

/* ---------- flag dialog ---------- */
.flag-dlg {
  width: min(440px, calc(100% - 24px));
  margin: auto;
  padding: 22px 22px 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.flag-dlg::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(3px); }
.flag-dlg h2 { margin: 0 0 2px; font-size: 20px; }
.flag-title { margin: 0 0 14px; color: var(--text-dim); font-size: 14px; }
.flag-label { display: block; margin: 12px 0 4px; font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.flag-dlg select, .flag-dlg textarea {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;
}
.flag-dlg select {
  height: 44px;
  padding-right: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a3aea3' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.flag-dlg textarea { resize: vertical; min-height: 84px; }
.flag-dlg select:focus, .flag-dlg textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.flag-error { margin: 10px 0 0; color: #ff8d90; font-size: 14px; }
.flag-actions { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* on a mouse, the Flag button appears when you hover a card; on touch it is always there */
@media (hover: hover) {
  .card-review:not(.on) { opacity: 0; transition: opacity 0.15s; }
  .card:hover .card-review, .card-review:focus-visible { opacity: 1; }
}