@charset "UTF-8";

:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  color: #172d26;
  background: #f5f7f6;
  --green: #174e3f;
  --secondary: #4d6158;
  --border: #cbd5ce;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) max(28px, env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px); font-size: 16px; line-height: 1.6; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; min-height: 44px; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid #9b4b22;
  outline-offset: 3px;
}
.wrap { width: min(1100px, calc(100% - 64px)); margin-inline: auto; }
.site-header {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 23px; font-weight: 650; }
.brand-mark {
  width: 40px; height: 40px;
  background: var(--green); color: white;
  display: grid; place-items: center; border-radius: 10px;
}
.brand-mark svg { width: 27px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.text-button { border: 0; background: none; padding: 10px 0 10px 12px; font-size: 15px; color: var(--green); }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.search-section { margin-top: 28px; }
#search-form {
  display: flex; align-items: center; gap: 14px; padding: 7px;
  background: white; border: 1px solid #8b9f92; border-radius: 10px;
}
#search-form:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px #174e3f19; }
.search-icon { width: 23px; height: 23px; flex-shrink: 0; margin-left: 12px; stroke: var(--secondary); fill: none; stroke-width: 1.8; }
#train-search { flex: 1; min-width: 0; border: 0; padding: 12px 0; color: #172d26; background: transparent; font-size: 18px; outline: none; }
#train-search:focus-visible { outline: none; }
#train-search::placeholder { color: #586a60; opacity: 1; }
#search-help { font-size: 14px; color: var(--secondary); margin: 10px 0 0; }
.catalog { margin-top: 32px; }
.catalog-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.catalog h2 { font-size: 21px; font-weight: 600; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.filter-bar { margin: 0 0 20px; }
.status-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.status-filters button {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; min-height: 44px;
  border: 1px solid var(--border); border-radius: 6px; background: white;
  color: #40564a; font-size: 14px; white-space: nowrap;
}
.status-filters button span { font-size: 14px; font-variant-numeric: tabular-nums; }
.status-filters button:hover { border-color: #698b76; background: #edf3ee; }
.status-filters button.active { background: var(--green); border-color: var(--green); color: white; font-weight: 550; }
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.train-card { background: white; border: 1px solid #bccbc1; border-radius: 10px; overflow: hidden; }
.route { display: flex; align-items: center; gap: 8px; padding: 17px 14px 14px; }
.station { font-size: 18px; font-weight: 650; line-height: 1.5; max-width: 44%; overflow-wrap: anywhere; }
.route-connector { display: flex; align-items: center; gap: 3px; flex: 1; min-width: 25px; color: #627e6b; }
.route-connector span { flex: 1; border-top: 1px solid #a5b6aa; }
.comparison { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; margin: 0 8px 10px; }
.code-block { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; align-items: center; column-gap: 7px; padding: 9px 7px; min-width: 0; border: 1px solid transparent; border-radius: 6px; }
.code-block.new { background: #eef4ef; }
.code-block.matched { border-color: #3d7655; background: #e5f0e7; }
.code-caption { font-size: 14px; color: #4d6158; font-weight: 500; white-space: nowrap; }
.code-value {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 22px; font-weight: 600; line-height: 1.4; letter-spacing: -.5px;
  min-width: 0; overflow-wrap: anywhere; color: #243e31;
}
.new .code-value { color: #124b34; }
.new .code-value.missing-value { font-family: inherit; font-size: 14px; letter-spacing: 0; color: #70501f; }
.type-line { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 14px; }
.type-line:empty { display: none; }
.code-block:has(.type-line:empty) .code-value { grid-column: 2 / -1; }
.type-badge { padding: 2px 7px; background: #eeeae1; color: #60512c; border-radius: 4px; white-space: nowrap; }
.type-badge.z { background: #00477D; color: #fff; }
.type-badge.n { background: #002FA7; color: #fff; }
.type-badge.v { background: #b94e06; color: #fff; }
.type-badge.regular, .type-badge.local { background: #267344; color: #fff; }
.type-badge.muted { background: #e6e9e5; color: #4c5a4c; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid #d7dfd8; font-size: 14px; line-height: 1.7; }
.status-tag { font-size: 14px; padding: 2px 7px; border-radius: 4px; color: #495c4d; background: #eaf0e9; white-space: nowrap; }
.status-tag.unchanged { background: #DDF3DF; color: #265840; }
.status-tag.changed { background: #FDE2E5; color: #9F2030; }
.status-tag.missing { background: #f7ecda; color: #79521b; }
.card-note { color: #70501f; overflow-wrap: anywhere; }
.load-more-wrap { text-align: center; margin-top: 24px; }
.load-more { border: 1px solid #92a997; border-radius: 6px; background: white; color: var(--green); padding: 11px 25px; font-size: 15px; }
.load-more:hover { background: #e9f1e9; }
.load-more span { margin-left: 12px; }
#page-count { font-size: 14px; color: var(--secondary); margin: 10px 0 0; }
#page-count:empty, .load-more-wrap:has(#load-more[hidden]):has(#page-count:empty) { display: none; }
.site-footer { border-top: 1px solid var(--border); color: var(--secondary); margin-top: 32px; padding: 20px 0 28px; font-size: 14px; }
.loading-state, .empty-state { grid-column: 1/-1; text-align: center; background: white; border: 1px dashed #a4b5a9; border-radius: 10px; padding: 40px 24px; color: var(--secondary); }
.empty-state h3 { font-size: 20px; color: #254b36; margin: 12px 0; }
.empty-state p { font-size: 15px; margin: 10px 0; }
.empty-symbol { font-size: 30px; color: var(--green); }
.empty-state button { margin-top: 10px; padding: 10px 18px; border: 1px solid #92a997; border-radius: 5px; background: #edf3ed; font-size: 15px; color: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
dialog { width: min(650px, calc(100% - 32px)); max-height: 90vh; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; padding: 28px; background: #fff; border: 1px solid #a0b3a4; border-radius: 12px; color: #172d26; }
dialog::backdrop { background: #142a226b; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-header h2 { font-size: 23px; margin: 0; }
.close-button { width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 6px; background: #eef3ef; font-size: 24px; line-height: 1; }
dialog h3 { font-size: 17px; margin: 22px 0 10px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 15px; }
th { color: #344c3b; background: #eaf1ea; font-weight: 550; }
th, td { padding: 10px 12px; border-bottom: 1px solid #d2ded4; white-space: nowrap; }
td:first-child { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.old-rules { display: flex; flex-wrap: wrap; gap: 10px; font-size: 15px; }
.old-rules span { background: #edf2ed; padding: 7px 10px; border-radius: 5px; }
.old-rules b { font-weight: 550; margin-right: 6px; }
.dialog-footnote { color: var(--secondary); font-size: 14px; line-height: 1.8; border-top: 1px solid var(--border); padding-top: 16px; margin: 22px 0 0; }

@media (max-width: 1100px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .wrap { width: calc(100% - 40px); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
  .wrap { width: calc(100% - 32px); }
  .site-header { height: 72px; }
  .search-section { margin-top: 20px; }
  #train-search { font-size: 16px; }
  .load-more { width: 100%; }
  .old-rules { display: grid; grid-template-columns: minmax(0, 1fr); }
  .old-rules span { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .old-rules b { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 480px) {
  .wrap { width: calc(100% - 32px); }
  .site-header { height: 72px; }
  .brand { font-size: 21px; gap: 10px; }
  .brand-mark { width: 36px; height: 36px; }
  .text-button { font-size: 14px; }
  #search-form { gap: 8px; padding: 6px; }
  .search-icon { width: 20px; height: 20px; margin-left: 7px; }
  #train-search { font-size: 16px; padding: 10px 0; }
  #search-help { line-height: 1.8; margin-top: 9px; }
  .catalog { margin-top: 24px; }
  .catalog h2 { font-size: 20px; }
  .status-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-filters button { padding: 8px; }
  dialog { padding: 20px; }
  .dialog-header h2 { font-size: 21px; }
  th, td { padding: 10px 8px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
