:root {
  --bg: #0e0f12;
  --panel: #181a1f;
  --panel-2: #23262d;
  --text: #ececf1;
  --muted: #9aa0ac;
  --accent: #ffb81c;              /* the yellow-orange of the LNGlive logo */
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- background logo ---------- */
.bg-logo {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url("assets/lng-logo.webp") center / min(62vmin, 560px) no-repeat;
  opacity: .12;
}
.hero, .bar, main { position: relative; z-index: 1; }

/* ---------- banner ---------- */
.hero { max-width: 1280px; margin: 0 auto; padding: 16px 16px 4px; text-align: center; }
.banner-wrap { display: flex; flex-direction: column; align-items: flex-end; }
.banner { width: 100%; }
.banner { margin: 0; }
/* Height is 70% of the original picture (squashed, not cropped). The top and bottom fade into the
   page: transparent at 0% -> fully visible at 20% ... fully visible until 80% -> transparent at 100%. */
.banner img {
  display: block; width: 100%; height: auto; max-height: 252px;
  aspect-ratio: 1902 / 420; object-fit: fill;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 20%, #000 80%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, #000 20%, #000 80%, transparent 100%);
}
.credit {
  margin: 6px 12px 0 0;
  padding: 6px 12px; font-size: .8rem; line-height: 1.3; color: #fff; text-decoration: none;
  background: rgba(14, 15, 18, .74); border: 1px solid rgba(255, 255, 255, .24); border-radius: 8px;
  backdrop-filter: blur(6px);
}
.credit:hover, .credit:focus-visible { color: var(--accent); border-color: var(--accent); }
.credit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { margin: 6px 0 0; font-size: 1.5rem; font-weight: 800; letter-spacing: .04em; }
.sub { margin: 2px 0 10px; color: var(--muted); font-size: .9rem; }

/* ---------- controls (stay at the top while scrolling) ---------- */
.bar {
  position: sticky; top: 0; z-index: 5; padding: 10px 16px;
  background: rgba(14, 15, 18, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.controls { display: flex; gap: 8px; flex-wrap: wrap; max-width: 1280px; margin: 0 auto; }
.search { flex: 1 1 240px; }
input[type="search"], select, .btn {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--panel-2); border-radius: var(--radius);
  font: inherit;
}
.select { flex: 0 1 210px; min-width: 0; }
.select-wide { flex: 1 1 220px; }
select { text-overflow: ellipsis; }
.btn { width: auto; cursor: pointer; }
.btn:hover, select:hover { border-color: #3a3e48; }
input:focus-visible, select:focus-visible, .btn:focus-visible, .act:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- results ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 8px 16px 48px; }
.count { margin: 8px 2px; color: var(--muted); font-size: .85rem; }
.grid { position: relative; }          /* cards are placed by app.js (virtual grid), see layout.js */
.card {
  position: absolute; top: 0; left: 0; margin: 0; overflow: hidden;
  background: var(--panel); border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .05);
  transition: border-color .15s;
}
.card:focus-within, .card:hover { border-color: var(--accent); }
.card img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  background: var(--panel-2);
}
.card figcaption {
  display: grid; align-content: start; gap: 2px; height: 64px;     /* = CAPTION in layout.js */
  padding: 8px 12px 0; font-size: .95rem;
}
.card figcaption span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .line { color: var(--text); font-weight: 600; }               /* the quote is the point of the card */
.card .from { color: var(--muted); font-size: .75rem; font-weight: 400; opacity: .85; }
.actions {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 6px;
  opacity: 0; transition: opacity .15s;
}
.card:hover .actions, .card:focus-within .actions { opacity: 1; }
@media (hover: none) { .actions { opacity: 1; } }       /* touch screens have no hover */
.act {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: rgba(14, 15, 18, .82); color: var(--text);
  border: 1px solid rgba(255, 255, 255, .15); border-radius: 10px;
  cursor: pointer; backdrop-filter: blur(4px);
}
.act:hover { background: rgba(255, 184, 28, .22); border-color: var(--accent); color: var(--accent); }
.act svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.empty { text-align: center; color: var(--muted); padding: 48px 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 10; transform: translate(-50%, 20px);
  padding: 10px 18px; background: #07080a; color: var(--text);
  border: 1px solid var(--accent); border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .hero { padding: 10px 10px 2px; }
  .credit { margin-right: 8px; padding: 5px 9px; font-size: .72rem; }
  h1 { font-size: 1.25rem; }
  .bar { padding: 8px 10px; }
  .search { flex-basis: 100%; }            /* search gets its own row ... */
  .select { flex: 1 1 100%; }               /* ... uploader gets a full row ... */
  .select-wide { flex: 1 1 0; }              /* ... episode and sort share the last one */
  .btn { flex: 0 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .actions, .toast, .card { transition: none; }
}
