/*
 * Deliberately dark only, matching the 公告看板 that this sits alongside.
 * Taiwanese market convention: red is up, so red reads as emphasis, never alarm.
 */
:root {
  --bg: #0a0e13;
  --bg-raised: #121821;
  --bg-sunk: #0d131a;
  --line: #1f2a37;
  --line-soft: #17212c;
  --ink: #e7edf4;
  --ink-dim: #9fb0c3;
  --ink-faint: #6b7f94;
  --red: #ff5a4d;
  --amber: #f5b544;
  --green: #35c88a;
  --blue: #58a6ff;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

/* ---------- header ---------- */

.top {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #101722, var(--bg));
}

.top-inner,
.tabs,
.filters,
main,
.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.top-inner {
  padding-top: 34px;
  padding-bottom: 26px;
}

h1 {
  margin: 0 0 8px;
  font-size: 27px;
  letter-spacing: 0.5px;
}

.lede {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-dim);
  font-size: 14px;
}

.lede strong {
  color: var(--ink);
  font-weight: 600;
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 18px;
}

.count b {
  display: block;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.count span {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 1px;
}

.count.live b {
  color: var(--red);
}

/* ---------- tabs & filters ---------- */

.tabs {
  display: flex;
  gap: 4px;
  padding-top: 16px;
  border-bottom: 1px solid var(--line);
}

.tab {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-on {
  color: var(--ink);
  border-bottom-color: var(--red);
  background: var(--bg-raised);
}

.pill {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--line);
  color: var(--ink-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-label {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 1px;
  margin-right: 2px;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-sunk);
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover {
  border-color: #2c3b4d;
  color: var(--ink);
}

.chip.is-on {
  background: rgba(255, 90, 77, 0.12);
  border-color: rgba(255, 90, 77, 0.5);
  color: #ffb4ad;
}

main {
  padding-bottom: 60px;
}

/* ---------- timeline ---------- */

.tl {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
}

.tl-scroll {
  overflow-x: auto;
}

.tl-grid {
  min-width: 760px;
  position: relative;
}

.tl-head {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunk);
  position: sticky;
  top: 0;
  z-index: 2;
}

.tl-head .tl-name {
  flex: 0 0 260px;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 1px;
}

.tl-months {
  flex: 1;
  display: flex;
  position: relative;
}

.tl-month {
  flex: 1;
  padding: 9px 0;
  text-align: center;
  font-size: 11px;
  color: var(--ink-faint);
  border-left: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}

.tl-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line-soft);
}

.tl-row:last-child {
  border-bottom: 0;
}

.tl-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.tl-name {
  flex: 0 0 260px;
  padding: 10px 14px;
  border-right: 1px solid var(--line-soft);
  min-width: 0;
}

.tl-name a {
  display: block;
  font-size: 13.5px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-name a:hover {
  text-decoration: underline;
}

.tl-name small {
  display: block;
  font-size: 11px;
  color: var(--ink-faint);
}

.tl-track {
  flex: 1;
  position: relative;
  margin: 10px 0;
}

.tl-bar {
  position: absolute;
  top: 0;
  height: 22px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #08111a;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  min-width: 26px;
}

.tl-bar.ended {
  opacity: 0.42;
}

.tl-bar.upcoming {
  opacity: 0.75;
}

.tl-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red);
  z-index: 1;
  pointer-events: none;
}

.tl-today::after {
  content: "今天";
  position: absolute;
  top: 4px;
  left: 5px;
  font-size: 10px;
  color: var(--red);
  letter-spacing: 1px;
}

.tl-body {
  position: relative;
}

.tl-guides {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
}

.tl-guide {
  flex: 1;
  border-left: 1px solid var(--line-soft);
}

/* ---------- cards ---------- */

.broker-block {
  margin-top: 26px;
}

.broker-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.broker-head h2 {
  margin: 0;
  font-size: 16px;
}

.broker-head .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  align-self: center;
}

.broker-head .n {
  font-size: 12px;
  color: var(--ink-faint);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-top: 3px solid var(--line);
}

.card-pic {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 6;
  object-fit: cover;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--line-soft);
}

.card-body {
  padding: 13px 15px 15px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

.card h3 a {
  text-decoration: none;
}

.card h3 a:hover {
  text-decoration: underline;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  background: var(--bg-sunk);
}

.tag.status-active {
  color: #07130d;
  background: var(--green);
  border-color: var(--green);
  font-weight: 600;
}

.tag.status-upcoming {
  color: #150f02;
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 600;
}

.tag.status-ended {
  color: var(--ink-faint);
}

.tag.status-unknown {
  color: var(--amber);
  border-color: rgba(245, 181, 68, 0.45);
}

.tag.value {
  color: #ffb4ad;
  border-color: rgba(255, 90, 77, 0.45);
  background: rgba(255, 90, 77, 0.1);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.period {
  font-size: 13px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

.period .raw {
  color: var(--ink-faint);
  font-size: 12px;
}

.note {
  font-size: 12.5px;
  color: var(--amber);
  background: rgba(245, 181, 68, 0.08);
  border: 1px solid rgba(245, 181, 68, 0.25);
  border-radius: 6px;
  padding: 7px 10px;
  line-height: 1.5;
}

/* A campaign the broker is still promoting but whose period reads as over —
   a contradiction the reader should see, not a detail. */
.note.warn {
  color: #ffb4ad;
  background: rgba(255, 90, 77, 0.1);
  border-color: rgba(255, 90, 77, 0.4);
}

.card-foot {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.card-foot a {
  color: var(--blue);
  text-decoration: none;
}

.card-foot a:hover {
  text-decoration: underline;
}

.empty {
  margin-top: 14px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-faint);
  font-size: 13.5px;
}

/* ---------- pending ---------- */

.pending-intro {
  margin: 22px 0 4px;
  color: var(--ink-dim);
  font-size: 14px;
  max-width: 70ch;
}

.pending-intro code {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  padding-bottom: 44px;
  color: var(--ink-faint);
  font-size: 12.5px;
}

.foot p {
  margin: 0 0 8px;
  max-width: 78ch;
}

.foot .warn {
  color: #7d6a4a;
}

.stale {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 6px;
  color: #ffb4ad;
  background: rgba(255, 90, 77, 0.1);
  border: 1px solid rgba(255, 90, 77, 0.4);
  font-size: 13px;
}

@media (max-width: 720px) {
  .tl-name,
  .tl-head .tl-name {
    flex-basis: 150px;
  }
  h1 {
    font-size: 22px;
  }
}
