/* 中国火车图鉴 — light theme, clean cards */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #647080;
  --line: #e3e7ee;
  --brand: #c22a35;
  --brand-soft: #fdf0f0;
  --gold-bg: #fff3d6;
  --gold-ink: #8a5a00;
  --blue-bg: #e8f0fe;
  --blue-ink: #1d4e8f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 8px 24px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 18px; }
a { color: var(--brand); }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.brand small { font-size: 12px; font-weight: 500; color: var(--muted); }
.tabs { display: flex; gap: 6px; background: #eef0f4; border-radius: 999px; padding: 4px; }
.tabs a {
  padding: 7px 16px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-size: 14px; font-weight: 600; transition: all .15s;
}
.tabs a.active { background: var(--brand); color: #fff; }
.tabs a:hover:not(.active) { color: var(--ink); }

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

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0 14px; }
.search-box { flex: 1 1 260px; position: relative; }
.search-box input {
  width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; background: var(--card); color: var(--ink); outline: none;
}
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-box::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .55; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 13.5px; font-weight: 600;
  cursor: pointer; user-select: none; transition: all .12s;
}
.chip:hover { color: var(--ink); border-color: #c9d1dc; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.count-line { color: var(--muted); font-size: 13px; margin: 0 0 14px 2px; }
.count-line b { color: var(--brand); }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 18px; padding-bottom: 40px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(16,24,40,.12); }
.card .img-wrap { position: relative; aspect-ratio: 16/10; background: #eef1f5; overflow: hidden; }
.card .img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .img-wrap .ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center; color: #9aa6b5; font-size: 13px;
}
.card .img-wrap .ph span:first-child { font-size: 34px; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card h3 { margin: 0; font-size: 16px; letter-spacing: .3px; }
.card .aliases { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  background: var(--gold-bg); color: var(--gold-ink); font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.badge.blue { background: var(--blue-bg); color: var(--blue-ink); }
.card .meta { color: var(--muted); font-size: 12.5px; }
.card .desc { color: #3c4756; font-size: 13px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.no-result { text-align: center; color: var(--muted); padding: 50px 0; }

/* modal */
.modal {
  position: fixed; inset: 0; background: rgba(12,16,22,.5); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--card); border-radius: 18px; max-width: 760px; width: 100%;
  max-height: 88vh; overflow: auto; box-shadow: 0 24px 80px rgba(0,0,0,.3);
}
.modal-card img.big { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #eef1f5; }
.modal-body { padding: 18px 22px 22px; }
.modal-body h2 { margin: 0 0 4px; font-size: 22px; }
.modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 14px 0; }
.info-cell { background: #f7f8fa; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.info-cell .k { font-size: 11.5px; color: var(--muted); }
.info-cell .v { font-size: 14px; font-weight: 700; }
.modal-body .desc-full { font-size: 14px; color: #2a3442; }
.credit { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 10px; }
.credit a { color: var(--blue-ink); }
.modal-close { position: sticky; top: 0; float: right; margin: 10px; background: rgba(255,255,255,.85); border: none; border-radius: 999px; width: 34px; height: 34px; font-size: 16px; cursor: pointer; color: var(--ink); }

/* caopu page */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 20px 0; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 10px; font-size: 18px; }
.panel p { margin: 6px 0; font-size: 14px; color: #2a3442; }
.panel .muted { color: var(--muted); font-size: 13px; }
.loc-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.loc-tags .badge { font-size: 12.5px; padding: 4px 12px; }
.two-col { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
thead th {
  position: sticky; top: 0; background: #f0f2f5; color: #3c4756;
  padding: 10px 12px; text-align: left; font-size: 12.5px; white-space: nowrap;
  border-bottom: 1px solid var(--line); z-index: 2;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid #eef1f5; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
td.time { font-family: ui-monospace, Consolas, "Courier New", monospace; font-weight: 700; color: var(--brand); }
tbody tr.next-soon { background: var(--brand-soft); }
tbody tr.next-soon td:first-child::after { content: " ⏰"; }
.dir-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.dir-out { background: var(--blue-bg); color: var(--blue-ink); }
.dir-in { background: #e6f6ec; color: #14743c; }
.type-tag { display: inline-block; min-width: 24px; text-align: center; font-weight: 800; font-size: 12.5px; padding: 2px 7px; border-radius: 7px; background: #eef0f4; color: #3c4756; }
.type-tag.C { background: #ffe8ea; color: #b4232a; }
.type-tag.D { background: #e8f0fe; color: #1d4e8f; }
.type-tag.G { background: #ece7fb; color: #5b3fb0; }
.type-tag.V { background: #fff0e0; color: #a05a10; }
.type-tag.N { background: #e0f5f2; color: #0e7a68; }
.type-tag.Z, .type-tag.T { background: #fff3d6; color: #8a5a00; }
.type-tag.K { background: #e6f6ec; color: #14743c; }

.next-banner {
  display: none; background: linear-gradient(90deg, var(--brand-soft), #fff);
  border: 1px solid #f3cfd2; border-radius: 12px; padding: 12px 16px; margin: 14px 0;
  font-size: 14px;
}
.next-banner.show { display: block; }
.next-banner b { color: var(--brand); font-size: 16px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 30px; }
.site-footer .wrap { padding: 20px 18px 26px; }
.site-footer p { color: var(--muted); font-size: 12.5px; margin: 6px 0; }

@media (max-width: 640px) {
  .brand { font-size: 17px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
}
