/* 我的片單 — dark playroom theme */
:root {
  --bg: #111214;
  --surface: #1a1c1f;
  --panel: #151719;
  --line: #2d3033;
  --fg: #f2f4ee;
  --muted: #a0a49f;
  --dim: #737b74;
  --accent: #d5f58a;
  --accent-dark: #1f2815;
  --danger: #ff8a7a;
  --radius: 20px;
  --font: Inter, "SF Pro Display", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1240px, 100% - 48px); margin-inline: auto; }
[hidden] { display: none !important; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg);
  font-size: 14px; font-weight: 600; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: #4a4f53; background: #212428; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #12160c; }
.btn.primary:hover { background: #e3fba6; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn svg { width: 16px; height: 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(17, 18, 20, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 28px; min-height: 68px; flex-wrap: wrap; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: #12160c;
  display: grid; place-items: center;
}
.brand-name { display: block; font-weight: 800; letter-spacing: 3px; font-size: 15px; line-height: 1.1; }
.brand-cn { display: block; font-size: 11px; color: var(--muted); letter-spacing: 2px; }
.topnav { display: flex; gap: 22px; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topnav a:hover, .topnav a.active { color: var(--fg); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tiny-pill {
  font-size: 11px; letter-spacing: 1.6px; font-weight: 700;
  color: var(--accent); border: 1px solid #3a4a22; background: var(--accent-dark);
  padding: 6px 12px; border-radius: 999px;
}


.nav-n { font-size: 11px; color: var(--accent); margin-left: 2px; font-variant-numeric: tabular-nums; }
.btn.big { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.big svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn[aria-pressed="true"] { color: var(--accent); border-color: #3a4a22; background: var(--accent-dark); }
.btn[aria-pressed="true"] svg path { fill: currentColor; }
.eyebrow { font-size: 12px; letter-spacing: 3px; color: var(--accent); font-weight: 700; margin-bottom: 10px; }

/* Feature (hero) */
.feature { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); isolation: isolate; }
.feature-bg {
  position: absolute; inset: -40px; z-index: -2;
  background: radial-gradient(90% 80% at 20% 10%, #23291b 0%, var(--bg) 70%) center / cover no-repeat;
  filter: blur(38px) saturate(1.15) brightness(.62); transform: scale(1.1);
}
.feature::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(17,18,20,.88) 0%, rgba(17,18,20,.45) 55%, rgba(17,18,20,.75) 100%),
              linear-gradient(0deg, var(--bg) 0%, transparent 35%);
}
.feature-inner { display: grid; grid-template-columns: minmax(220px, 330px) 1fr; gap: 48px; align-items: center; padding: 48px 0 56px; }
.feature-poster {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; padding: 0;
  border-radius: 22px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); cursor: pointer;
  background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(213,245,138,.08);
  transition: transform .2s;
}
.feature-poster:hover { transform: translateY(-3px) rotate(-.4deg); }
.feature-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature-text { min-width: 0; }
.feature-num { margin-left: 10px; color: var(--muted); letter-spacing: 1.5px; }
.feature-text h1 { margin: 0; font-size: clamp(32px, 5.4vw, 64px); line-height: 1.08; font-weight: 900; letter-spacing: -.5px; overflow-wrap: anywhere; }
.feature-meta { display: flex; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.feature-note { color: var(--muted); font-size: 15px; margin: 18px 0 0; max-width: 520px; }
.feature-note span { color: var(--fg); font-weight: 700; margin-right: 2px; }
.feature-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }

/* Shared poster pieces */
.poster-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px;
  background:
    radial-gradient(circle at 50% 42%, transparent 0 16%, rgba(213,245,138,.08) 16.3% 16.9%, transparent 17.2% 28%, rgba(213,245,138,.05) 28.3% 28.7%, transparent 29% 41%, rgba(255,255,255,.04) 41.3% 41.6%, transparent 42%),
    radial-gradient(120% 90% at 30% 15%, #272c22 0%, #16181a 62%, #0d0e10 100%);
}
.ph-num { position: absolute; right: 12px; top: 4px; font-size: clamp(70px, 9vw, 120px); font-weight: 900; line-height: 1; color: rgba(213,245,138,.12); letter-spacing: -4px; }
.ph-title { position: relative; font-size: 18px; font-weight: 800; color: rgba(242,244,238,.55); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.poster-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.9);
  width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(213,245,138,.94); color: #12160c; opacity: 0; transition: opacity .18s, transform .18s;
  box-shadow: 0 0 0 10px rgba(213,245,138,.16), 0 14px 34px rgba(0,0,0,.5);
}
.poster-play svg { width: 28px; height: 28px; margin-left: 3px; }
.feature-poster .poster-play { opacity: .92; transform: translate(-50%, -50%); width: 84px; height: 84px; }
.feature-poster .poster-play svg { width: 34px; height: 34px; }
.cat-tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  color: var(--accent); background: rgba(31,40,21,.85); border: 1px solid #3a4a22; white-space: nowrap;
}

/* Toolbar */
.toolbar-wrap { position: sticky; top: 68px; z-index: 15; background: rgba(17,18,20,.9); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); padding: 14px 0 12px; scroll-margin-top: 68px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.tab svg { width: 15px; height: 15px; }
.tab.active { background: var(--fg); color: #111214; }
.tab-count { font-size: 12px; opacity: .7; }
.search-box {
  flex-direction: row; font-weight: 400; position: relative; display: flex; align-items: center; gap: 8px;
  width: min(420px, 100%); height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--dim);
}
.search-box:focus-within { border-color: #4f5a3a; }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--fg); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
.chips { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 13px; border-radius: 999px; flex: none;
  border: 1px solid var(--line); color: var(--muted); font-size: 13px; text-decoration: none;
}
.chip:hover { color: var(--accent); border-color: #3a4a22; background: var(--accent-dark); }
.chip-no { font-size: 11px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.chip .n { opacity: .6; font-variant-numeric: tabular-nums; }

.fav-hint { display: flex; align-items: center; gap: 8px; margin: 22px 0 0; color: var(--muted); font-size: 13px; padding: 10px 14px; border: 1px dashed #3a4a22; border-radius: 14px; background: rgba(31,40,21,.35); }
.fav-hint svg { width: 16px; height: 16px; color: var(--accent); }

/* Shelves */
.shelf { padding: 44px 0 8px; scroll-margin-top: 150px; }
.shelf + .shelf { border-top: 1px solid var(--line); margin-top: 28px; }
.shelf-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 22px; }
.shelf-no { font-size: clamp(48px, 7vw, 76px); font-weight: 900; line-height: .85; color: var(--accent); letter-spacing: -3px; font-variant-numeric: tabular-nums; }
.shelf-titles { display: flex; flex-direction: column; min-width: 0; }
.shelf-kicker { font-size: 11px; letter-spacing: 2.6px; color: var(--dim); font-weight: 700; }
.shelf-title { margin: 2px 0 0; font-size: clamp(24px, 3vw, 34px); font-weight: 900; line-height: 1.1; }
.shelf-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-dark); border: 1px solid #3a4a22; padding: 3px 12px; border-radius: 999px; white-space: nowrap; }

.film-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 26px 22px; }
.film {
  position: relative; border-radius: 22px; background: var(--panel); border: 1px solid var(--line);
  overflow: hidden; transition: transform .2s, border-color .2s, box-shadow .2s;
}
.film:hover, .film:focus-within { transform: translateY(-4px); border-color: #4a5338; box-shadow: 0 22px 50px rgba(0,0,0,.5); }
.film.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, 0 22px 50px rgba(0,0,0,.45); }
.film-link { display: block; text-decoration: none; color: inherit; outline-offset: -3px; }
.film-poster { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: #0d0e10; }
.film-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.film:hover .film-poster img { transform: scale(1.045); }
.film-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, transparent 22%, transparent 62%, rgba(13,14,16,.9) 100%); pointer-events: none; }
.film:hover .poster-play, .film-link:focus-visible .poster-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.film-no {
  position: absolute; left: 14px; top: 14px; font-size: 12px; font-weight: 800; letter-spacing: 1.5px;
  color: #12160c; background: var(--accent); padding: 3px 9px; border-radius: 8px; font-variant-numeric: tabular-nums;
}
.film-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.film-title { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.film-notes { margin: 0; font-size: 12px; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fav-btn {
  position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18); background: rgba(17,18,20,.7); backdrop-filter: blur(6px); color: var(--fg);
  display: grid; place-items: center; cursor: pointer; transition: transform .15s;
}
.fav-btn:hover { transform: scale(1.08); }
.fav-btn svg { width: 19px; height: 19px; }
.fav-btn[aria-pressed="true"] { color: #12160c; background: var(--accent); border-color: var(--accent); }
.fav-btn[aria-pressed="true"] svg path { fill: currentColor; }
.film-tools { position: absolute; right: 12px; bottom: 14px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.film:hover .film-tools, .film:focus-within .film-tools { opacity: 1; }
.tool-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.tool-btn svg { width: 15px; height: 15px; }
.tool-btn:hover { color: var(--fg); border-color: #4a4f53; }
.tool-btn.del:hover { color: var(--danger); }
.film-body { padding-right: 90px; }

/* Entry shelf: landscape cards */
.shelf-entry .film-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.shelf-entry .film-poster { aspect-ratio: 16 / 9; }
.shelf-entry .ph-num { font-size: 80px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 48px 16px; margin-top: 28px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty svg { width: 28px; height: 28px; color: var(--dim); }
.empty strong { color: var(--fg); font-size: 16px; }
.bottom-note { display: flex; gap: 8px; align-items: center; margin-top: 40px; color: var(--dim); font-size: 12px; }
.bottom-note svg { width: 15px; height: 15px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 0 30px; flex-wrap: wrap; }
.footer-logo { font-weight: 800; letter-spacing: 2.5px; font-size: 13px; }
.footer-sub { font-weight: 400; letter-spacing: .2px; color: var(--dim); margin-left: 8px; }
.footer-actions { display: flex; align-items: center; gap: 14px; color: var(--dim); font-size: 12px; }
.footer-actions button { border: 0; background: transparent; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--fg); color: #111214; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Dialog + forms */
dialog {
  width: min(520px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--fg);
}
dialog::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(3px); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dialog-head h2 { margin: 0; font-size: 20px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
input:not([type="search"]), textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 15px; font-weight: 400;
}
input:not([type="search"]):focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
.hint { margin: 0; font-size: 12px; color: var(--dim); }
.form-error { margin: 0; color: var(--danger); font-size: 13px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* Auth pages (login / setup) */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 18px;
  background: radial-gradient(90% 70% at 50% 0%, #1d2116 0%, var(--bg) 60%);
}
.auth-card {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.auth-card .brand { margin-bottom: 26px; }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; }
.auth-card .tagline { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn.primary { width: 100%; justify-content: center; height: 44px; font-size: 15px; }
.auth-foot { margin-top: 20px; font-size: 12px; color: var(--dim); text-align: center; }

/* Responsive */
@media (hover: none) {
  .film-tools { opacity: 1; }
  .poster-play { opacity: .85; transform: translate(-50%, -50%) scale(.8); }
}
@media (max-width: 900px) {
  .feature-inner { grid-template-columns: 200px 1fr; gap: 28px; padding: 32px 0 40px; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px); }
  .topbar-inner { gap: 12px; }
  .topnav { order: 3; width: 100%; gap: 18px; }
  .top-right { gap: 8px; }
  .tiny-pill { display: none; }
  .toolbar-wrap { position: static; }
  .feature-inner { grid-template-columns: 1fr; gap: 22px; padding: 24px 0 32px; }
  .feature-poster { width: min(260px, 70%); margin-inline: auto; }
  .feature-text { text-align: center; }
  .feature-meta, .feature-actions { justify-content: center; }
  .feature-note { margin-inline: auto; }
  .btn.big { height: 42px; padding: 0 16px; font-size: 14px; }
  .search-box { width: 100%; }
  .shelf { padding-top: 32px; scroll-margin-top: 80px; }
  .film-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .shelf-entry .film-grid { grid-template-columns: 1fr; }
  .film { border-radius: 16px; }
  .film-body { padding: 10px 12px 14px; padding-right: 12px; }
  .film-title { font-size: 15px; }
  .film-tools { position: static; opacity: 1; padding: 0 12px 12px; }
  .fav-btn { width: 34px; height: 34px; right: 8px; top: 8px; }
  .film-no { left: 8px; top: 8px; font-size: 11px; }
  .poster-play { width: 52px; height: 52px; }
}
@media (max-width: 360px) {
  .film-grid { grid-template-columns: 1fr; }
}

.shelf-featured .shelf-title { letter-spacing: 0.04em; }

/* pages-readonly: this deploy is a snapshot; catalog edits happen on the box then redeploy */
#add-btn { display: none !important; }
