:root {
  color-scheme: light;
  --ink: #252525;
  --muted: #737373;
  --line: #dfe7e2;
  --green: #03c75a;
  --green-dark: #039447;
  --paper: #ffffff;
  --soft: #f5faf7;
  --accent: #2d6cdf;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef3f0;
  color: var(--ink);
  font-family: Arial, "Malgun Gothic", sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto 60px;
}

.page-nav {
  display: flex;
  justify-content: flex-start;
  margin: 0 0 12px;
}

.home-back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #14532d;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.home-back-link:hover {
  border-color: var(--green);
  background: #ecf8f1;
}

.home-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 44px auto 70px;
}

.home-header {
  margin-bottom: 22px;
}

.home-header h1 {
  font-size: 34px;
}

.bus-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--paper);
}

.bus-grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  padding: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.bus-grid-link {
  color: #14532d;
  background: #ecf8f1;
}

.bus-grid-link:hover {
  background: #dff4e8;
}

.empty-cell {
  background: #fbfdfc;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.blog-name {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1.2fr) minmax(150px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  position: relative;
}

.buspia-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.terminal-field {
  position: relative;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd8d2;
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

input:disabled {
  background: #f2f2f2;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  background: #b7c3bd;
  cursor: not-allowed;
}

.swap-terminals {
  min-width: 132px;
  background: #475569;
  white-space: nowrap;
}

.suggestions {
  display: none;
  position: absolute;
  z-index: 10;
  width: 100%;
  max-height: 260px;
  overflow: auto;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.suggestions.open {
  display: block;
}

.suggestion {
  width: 100%;
  min-height: auto;
  padding: 10px 12px;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 400;
}

.suggestion:hover {
  background: var(--soft);
}

.suggestion small {
  display: block;
  color: var(--muted);
}

.quick-terminals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.quick-terminal {
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid #cfd8d2;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.quick-terminal:hover,
.quick-terminal.selected {
  border-color: var(--green);
  background: #ecf8f1;
  color: #14532d;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.result-tools {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 14px 0;
}

.result-tools button {
  background: #334155;
}

.buspia-results {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.buspia-quick-panel {
  margin: 14px 0;
}

.buspia-quick-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.route-quick-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.buspia-quick-cell {
  display: flex;
  min-height: 82px;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: center;
}

.buspia-quick-cell:hover {
  border-color: var(--green);
  background: #ecf8f1;
}

.empty-quick-cell,
.empty-quick-cell:disabled {
  border-style: dashed;
  background: #f7faf8;
  cursor: default;
}

.buspia-quick-cell strong,
.buspia-quick-cell span,
.buspia-quick-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buspia-quick-cell strong {
  font-size: 14px;
}

.buspia-quick-cell span {
  font-size: 13px;
  font-weight: 700;
}

.buspia-quick-cell small {
  color: var(--muted);
  font-size: 12px;
}

.route-quick-cell {
  display: flex;
  min-height: 70px;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: center;
}

.route-quick-cell:hover {
  border-color: var(--green);
  background: #ecf8f1;
}

.route-quick-cell strong,
.route-quick-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-quick-cell strong {
  font-size: 18px;
}

.route-quick-cell span {
  color: var(--muted);
  font-size: 12px;
}

.buspia-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.buspia-result strong,
.buspia-result span,
.buspia-result small {
  display: block;
}

.buspia-result strong {
  font-size: 18px;
}

.buspia-result span {
  margin-top: 3px;
  font-weight: 700;
}

.buspia-result small {
  margin-top: 5px;
  color: var(--muted);
}

.buspia-result-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.download-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: 6px;
  padding: 0 16px;
  background: #334155;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.download-missing {
  color: #c2410c;
  font-size: 13px;
  font-weight: 700;
}

.blog-post {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 34px 38px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.empty {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.post-kicker {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-weight: 700;
}

.post-title {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}

.post-meta {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.direction-title {
  margin: 28px 0 8px;
  color: var(--green-dark);
  font-size: 18px;
  letter-spacing: 0;
}

.summary-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 24px 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.summary-item {
  padding: 14px;
  background: var(--soft);
}

.summary-item strong {
  display: block;
  color: var(--green-dark);
  font-size: 13px;
}

.summary-item span {
  display: block;
  margin-top: 4px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
}

th {
  background: #ecf8f1;
  color: #14532d;
}

.route-info-table {
  margin-bottom: 20px;
}

.route-info-table th {
  width: 18%;
}

.route-info-table td {
  text-align: left;
  font-weight: 700;
}

.route-info-table td[colspan] {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.route-info-table td:nth-child(2),
.route-info-table td:nth-child(4) {
  width: 32%;
}

.buspia-meta-table {
  table-layout: fixed;
}

.buspia-meta-table .label-col {
  width: 18%;
}

.buspia-meta-table .value-col {
  width: 32%;
}

.attached-table {
  margin-top: -21px;
}

.buspia-time-image {
  display: block;
  width: 100%;
  margin-top: 18px;
  border: 1px solid var(--line);
}

td:nth-child(2),
td:nth-child(3),
td:nth-child(4) {
  text-align: left;
}

.note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 780px) {
  .home-header h1 {
    font-size: 28px;
  }

  .bus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bus-grid-cell {
    min-height: 86px;
    font-size: 15px;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .buspia-search-form,
  .buspia-result {
    grid-template-columns: 1fr;
  }

  .buspia-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .swap-terminals {
    width: 100%;
  }

  .buspia-result-actions {
    flex-wrap: wrap;
  }

  .suggestions,
  #arrList {
    position: static;
    width: 100%;
    margin-top: -8px;
  }

  .quick-terminals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-box {
    grid-template-columns: 1fr;
  }

  .blog-post {
    padding: 24px 18px;
  }

  .result-tools {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .result-tools button {
    flex: 1 1 140px;
  }

}

@media print {
  body {
    background: #fff;
  }

  .search-panel,
  .result-tools {
    display: none;
  }

  .app-shell {
    width: 100%;
    margin: 0;
  }

  .blog-post {
    width: 100%;
    border: 0;
    padding: 0;
  }
}
