:root {
  --bg: #0f0c17;
  --surface: #1a1527;
  --surface-2: #241d36;
  --border: #2f2747;
  --text: #ece8f5;
  --muted: #a39cba;
  --accent: #ff4d8d;
  --accent-2: #8b5cf6;
  --danger: #ef4444;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.main { flex: 1; padding: 24px 0 48px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15, 12, 23, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand:hover { color: var(--text); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 21px; letter-spacing: 2px; }
.brand-domain { font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.brand .tld { color: var(--accent); }
.admin-tag { font-size: 12px; background: var(--accent-2); color: #fff; padding: 2px 8px; border-radius: 99px; }
.search input {
  width: min(280px, 46vw);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 99px;
  padding: 8px 14px; font: inherit; font-size: 14px;
}
.search input:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.search.big { display: flex; gap: 8px; margin-bottom: 24px; }
.search.big input { width: 100%; max-width: 520px; border-radius: 10px; padding: 10px 14px; font-size: 16px; }
.nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; padding: 6px 12px; border-radius: 99px; color: var(--muted); font-size: 15px; }
.nav a:hover, .nav a.active { background: var(--surface-2); color: var(--text); }

/* ---------- sections & grid ---------- */
.section-title { font-size: 20px; margin: 8px 0 16px; display: flex; align-items: baseline; gap: 12px; }
.section-title a { font-size: 14px; color: var(--muted); font-weight: 400; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-bottom: 32px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: #4a3d6e; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.card-title { font-size: 17px; line-height: 1.45; margin: 0; }
.card-summary { margin: 0; color: #cfc8e2; font-size: 14px; }
.card-source { margin-top: auto; font-size: 12px; color: var(--muted); }

/* ---------- thumbnails ---------- */
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-logo { background: radial-gradient(circle at 50% 40%, #2c2045, #17121f); }
.thumb.is-logo img { object-fit: contain; padding: 14%; opacity: .9; }
.thumb.large { border-radius: var(--radius); margin: 16px 0; }
.thumb .play {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 44px; border-radius: 12px;
  background: rgba(0, 0, 0, .7);
}
.thumb .play::after {
  content: ""; position: absolute; left: 26px; top: 12px;
  border-left: 16px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent;
}
.yt-embed { all: unset; display: block; cursor: pointer; width: 100%; }
.yt-embed:focus-visible { outline: 2px solid var(--accent); }
.yt-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); margin: 16px 0; }

/* ---------- badges & tags ---------- */
.badge { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.badge.cat-exhibition { background: #3b1d33; border-color: #6b2a55; }
.badge.cat-product { background: #1d2b3b; border-color: #2a4f6b; }
.badge.cat-tech { background: #1f2a22; border-color: #2f5a3a; }
.badge.cat-industry { background: #2d2617; border-color: #5c4a1f; }
.badge.cat-law { background: #2e1b1b; border-color: #6b2a2a; }
.badge.cat-video { background: #33191c; border-color: #7a2630; }
.tags { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { font-size: 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 3px 10px; border-radius: 99px; }

/* ---------- story ---------- */
.story { max-width: 760px; margin: 0 auto 40px; }
.story-title { font-size: clamp(24px, 4vw, 34px); line-height: 1.35; margin: 10px 0 6px; }
.story-orig { color: var(--muted); font-size: 14px; margin: 0; }
.story-summary { font-size: 18px; line-height: 1.85; }
.story-source {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.story-note { font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; cursor: pointer;
}
.btn:hover { border-color: var(--accent-2); color: var(--text); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { border-color: #5b2330; color: #fca5a5; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- pager ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 24px; }
.pager a { padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.page-no { color: var(--muted); font-size: 14px; }

/* ---------- events ---------- */
.events { list-style: none; padding: 0; margin: 0 0 32px; display: grid; gap: 12px; }
.event { display: flex; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.event-date { min-width: 120px; font-weight: 700; color: var(--accent); font-size: 15px; }
.event-body p { margin: 6px 0; font-size: 14px; color: #cfc8e2; }
.event-body a { color: var(--accent-2); font-size: 14px; }
.events.compact .event { padding: 10px 14px; }
.events.past .event { opacity: .7; }
.upcoming { margin-bottom: 28px; }

/* ---------- prose ---------- */
.prose { max-width: 760px; margin: 0 auto; }
.prose h1 { font-size: 30px; }
.prose h2 { font-size: 20px; margin-top: 32px; }
.prose a { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: #0b0911; padding: 20px 0 28px; font-size: 13px; color: var(--muted); }
.footer-row { display: flex; gap: 14px; align-items: center; }
.footer-row p { margin: 0; }
.footer-row strong { color: var(--text); }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; }

/* ---------- age gate ---------- */
body.bare .main { display: grid; place-items: center; padding: 32px 0; }
.age-gate {
  max-width: 560px; text-align: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.age-logo { margin: 0 auto 8px; }
.age-site { font-size: 22px; font-weight: 800; letter-spacing: 3px; margin-bottom: 14px; }
.age-site span { display: block; font-size: 13px; font-weight: 400; letter-spacing: .5px; color: var(--muted); }
.age-rating { margin: 0 auto 8px; }
.age-gate h1 { font-size: 26px; margin: 8px 0 12px; }
.age-statement { font-size: 17px; line-height: 1.8; }
.age-statement strong { color: var(--accent); }
.age-actions { display: flex; flex-direction: column; gap: 12px; margin: 24px 0 16px; }
.age-actions .btn { padding: 12px 18px; font-size: 17px; }
.age-note { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- admin ---------- */
.flash { background: #1e2b1f; border: 1px solid #2f5a3a; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.stat-n { font-size: 22px; font-weight: 800; }
.stat-l { font-size: 13px; color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions form { display: flex; gap: 6px; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; margin-bottom: 24px; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; }
.table tr.disabled { opacity: .5; }
.err { color: #fca5a5; }
.editor, .card-form {
  display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 16px;
}
.editor { grid-template-columns: 200px 1fr; }
.editor-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.editor-media img.is-logo { object-fit: contain; padding: 10%; }
.editor-fields { display: grid; gap: 8px; }
.editor-row { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-row > input, .editor-row > select { flex: 1; min-width: 140px; }
.editor input, .editor textarea, .editor select,
.card-form input, .card-form textarea, .card-form select,
.filters input, .filters select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font: inherit; font-size: 14px; width: 100%;
}
.card-form h2 { margin: 0; font-size: 17px; }
.filters { display: flex; gap: 8px; margin-bottom: 16px; }
.filters input, .filters select { width: auto; }

@media (max-width: 640px) {
  .header-row { flex-wrap: wrap; }
  .search { width: 100%; }
  .search input { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .event { flex-direction: column; gap: 4px; }
  .editor { grid-template-columns: 1fr; }
  .footer-row { align-items: flex-start; }
}
