/* ==========================================================================
   reel-taste/styles.css — 深色電影感，和封面同一組色（navy → teal）
   ========================================================================== */
:root {
  --bg: #070b12;
  --bg2: #0b1220;
  --panel: #0f1826;
  --panel2: #131f31;
  --border: #1e2d42;
  --border2: #2a3d57;
  --text: #e6edf6;
  --muted: #8fa3bd;
  --dim: #64758c;
  --teal: #40e0d0;
  --teal-dim: #1b6d67;
  --amber: #f0b429;
  --red: #e5534b;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(64, 224, 208, .10), transparent 60%),
    radial-gradient(900px 480px at 88% 0%, rgba(240, 180, 41, .07), transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC",
               -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.7;
  min-height: 100vh;
}

code {
  background: rgba(64, 224, 208, .09);
  border: 1px solid rgba(64, 224, 208, .18);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: .88em;
  color: #9ff0e7;
  font-family: Consolas, "Cascadia Mono", monospace;
}

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 22px;
  padding: 12px 26px;
  background: rgba(7, 11, 18, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--teal), #1b8f86);
  color: #04110f; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; font-weight: 700; line-height: 1.25; }
.brand-text small { font-weight: 500; font-size: 11.5px; color: var(--dim); }

.tabs { display: flex; gap: 4px; margin-left: 10px; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13.5px; font-family: inherit; white-space: nowrap;
  transition: .18s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.tab.is-active {
  color: #04110f; background: var(--teal); font-weight: 700;
}

.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

.ghost-btn {
  background: transparent; border: 1px solid var(--border2); color: var(--muted);
  padding: 6px 13px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-family: inherit;
}
.ghost-btn:hover { color: var(--text); border-color: var(--teal-dim); }

/* ---------------- layout ---------------- */
.page { max-width: 1180px; margin: 0 auto; padding: 34px 26px 90px; }

.panel { display: none; animation: fade .28s ease; }
.panel.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { margin: 6px 0 28px; }
.hero.compact { margin-bottom: 20px; }
.eyebrow {
  margin: 0 0 10px; font-size: 11.5px; letter-spacing: .18em;
  color: var(--teal); font-weight: 700; text-transform: uppercase;
}
.hero h1 {
  margin: 0 0 12px; font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.25; letter-spacing: -.5px;
}
.hero-copy { margin: 0; color: var(--muted); max-width: 68ch; }

/* ---------------- cards ---------------- */
.grid-2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }

.card {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(15, 24, 38, .72) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-title { margin: 0 0 6px; font-size: 16px; letter-spacing: .2px; }
.card-hint { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }

/* ---------------- drop zone ---------------- */
.drop {
  border: 1.5px dashed var(--border2);
  border-radius: 12px;
  padding: 24px 18px;
  text-align: center;
  background: rgba(64, 224, 208, .025);
  transition: .18s;
}
.drop.is-over { border-color: var(--teal); background: rgba(64, 224, 208, .09); }
.drop-title { margin: 0 0 4px; font-weight: 700; }
.drop-hint { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }

.or {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0; color: var(--dim); font-size: 12px;
}
.or::before, .or::after { content: ""; height: 1px; flex: 1; background: var(--border); }

textarea, input[type="text"], input[type="number"], input[type="password"], select {
  width: 100%;
  background: #060a11;
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
}
textarea { resize: vertical; font-family: Consolas, "Cascadia Mono", monospace; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--teal-dim); box-shadow: 0 0 0 3px rgba(64, 224, 208, .1); }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------------- buttons ---------------- */
.btn {
  background: var(--panel2); border: 1px solid var(--border2); color: var(--text);
  padding: 9px 18px; border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  transition: .16s;
}
.btn:hover { border-color: var(--teal-dim); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary {
  background: linear-gradient(145deg, var(--teal), #199b90);
  border-color: transparent; color: #04110f;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.danger:hover { border-color: var(--red); color: #ff9b95; }

.status { margin: 12px 0 0; font-size: 13px; color: var(--muted); min-height: 1.3em; }
.status.ok { color: var(--teal); }
.status.warn { color: var(--amber); }
.status.err { color: #ff9b95; }

/* ---------------- howto list ---------------- */
.howto { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.howto li {
  padding: 12px 14px;
  background: rgba(255, 255, 255, .022);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
}
.howto strong { display: block; margin-bottom: 3px; color: var(--teal); font-size: 13px; letter-spacing: .3px; }
.howto span { color: var(--muted); }
.howto .muted { color: var(--dim); }

.note {
  margin: 14px 0 0; padding: 12px 14px;
  border-left: 3px solid var(--amber);
  background: rgba(240, 180, 41, .07);
  border-radius: 0 8px 8px 0;
  font-size: 13px; color: #d9c9a0;
}

/* ---------------- manual entry ---------------- */
.manual-row {
  display: grid; grid-template-columns: 1fr 110px 100px auto; gap: 8px;
}
.chips { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel2); border: 1px solid var(--border2);
  border-radius: 999px; padding: 5px 8px 5px 13px; font-size: 12.5px;
}
.chips .pill-type { color: var(--dim); font-size: 11px; }
.chips .pill-rate { color: var(--amber); font-weight: 700; }
.chips button {
  background: none; border: none; color: var(--dim); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 3px;
}
.chips button:hover { color: var(--red); }

/* ---------------- taste page ---------------- */
.taste-body { display: grid; gap: 18px; }
.taste-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 4px; }
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.stat b { display: block; font-size: 22px; line-height: 1.2; color: var(--teal); }
.stat span { font-size: 12px; color: var(--dim); }

.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 52px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .lbl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 9px; background: #060a11; border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--teal-dim), var(--teal));
  transition: width .5s cubic-bezier(.2, .8, .3, 1);
}
.bar-row .val { text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; font-size: 12px; }

.ctx-list { display: grid; gap: 8px; }
.ctx-item {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 12px; background: rgba(255, 255, 255, .022);
  border: 1px solid var(--border); border-radius: 9px; font-size: 13px;
}
.ctx-item .w { color: var(--teal); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------------- feed ---------------- */
.feed-controls {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 20px;
  background: rgba(15, 24, 38, .7); border: 1px solid var(--border);
  border-radius: 12px;
}
.seg { display: inline-flex; background: #060a11; border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 6px 14px; border-radius: 7px; font-family: inherit; font-size: 13px;
}
.seg-btn.is-active { background: var(--border2); color: var(--text); font-weight: 600; }
.ctl { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.ctl select { width: auto; padding: 6px 9px; font-size: 12.5px; }
.feed-controls .btn-primary { margin-left: auto; }

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  align-items: start;
}

.tile {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: .2s;
  display: flex; flex-direction: column;
}
.tile:hover { border-color: var(--teal-dim); transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, .5); }

.tile-poster {
  position: relative; aspect-ratio: 2 / 3; max-height: 240px;
  background: #060a11;
  display: grid; place-items: center; overflow: hidden;
}
.tile-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-poster .noimg {
  font-size: 30px; font-weight: 800; color: rgba(160, 220, 255, .26);
  letter-spacing: 1px; text-align: center; padding: 8px;
  width: 100%; height: 100%;
  display: grid; place-items: center;
}
.tile-rank {
  position: absolute; top: 8px; left: 8px;
  background: rgba(4, 12, 20, .82); border: 1px solid var(--border2);
  color: var(--teal); font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; backdrop-filter: blur(4px);
}
.tile-dismiss {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(4, 12, 20, .82); border: 1px solid var(--border2);
  color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
  display: grid; place-items: center; opacity: 0; transition: .15s;
}
.tile:hover .tile-dismiss { opacity: 1; }
.tile-dismiss:hover { color: var(--red); border-color: var(--red); }

.tile-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tile-title { font-weight: 700; font-size: 14px; line-height: 1.35; }
.tile-meta { font-size: 11.5px; color: var(--dim); display: flex; gap: 7px; flex-wrap: wrap; }
.tile-why {
  margin-top: 6px; padding-top: 7px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--teal); line-height: 1.5;
}
.tile-why b { color: #9ff0e7; font-weight: 600; }

.empty {
  grid-column: 1 / -1; text-align: center; color: var(--dim);
  padding: 50px 20px; border: 1px dashed var(--border2); border-radius: 12px;
}

.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border2);
  border-top-color: var(--teal); border-radius: 50%;
  display: inline-block; vertical-align: -3px; margin-right: 8px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- dialog ---------------- */
.dlg {
  border: 1px solid var(--border2); border-radius: 14px;
  background: var(--panel); color: var(--text);
  padding: 0; max-width: 520px; width: calc(100% - 32px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
}
.dlg::backdrop { background: rgba(2, 6, 12, .72); backdrop-filter: blur(3px); }
.dlg-form { padding: 22px 24px; }
.dlg-form h2 { margin: 0 0 10px; font-size: 17px; }
.field { display: block; margin: 14px 0; }
.field span { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.src-status { margin: 6px 0 0; font-size: 12.5px; color: var(--dim); }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .grid-2, .taste-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .tabs { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .page { padding: 22px 16px 70px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .manual-row { grid-template-columns: 1fr 1fr; }
  .feed { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .feed-controls .btn-primary { margin-left: 0; }
}

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