:root {
  --bg: #f4f6fb; --card: #ffffff; --card2: #f1f3f8; --line: #e2e6ef; --text: #141822; --muted: #5d6576;
  --accent: #2F6BFF; --red: #e5484d; --green: #1f9d57; --yellow: #b8860b; --chip: #eef1f7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f14; --card: #161821; --card2: #1d2030; --line: #252935; --text: #eceef4; --muted: #9aa3b5;
    --accent: #3d7bff; --red: #ff5a5a; --green: #4ade80; --yellow: #f5ce63; --chip: #1d2130;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f14; --card: #161821; --card2: #1d2030; --line: #252935; --text: #eceef4; --muted: #9aa3b5;
  --accent: #3d7bff; --red: #ff5a5a; --green: #4ade80; --yellow: #f5ce63; --chip: #1d2130;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Pretendard", "Noto Sans KR", system-ui, -apple-system, sans-serif; line-height: 1.45; }
a { color: var(--accent); }
main { max-width: 720px; margin: 0 auto; padding: 0 16px 24px; }

.hdr { max-width: 720px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 38px; height: 38px; border-radius: 11px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; }
.brand-txt b { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.brand-txt small { font-size: 11px; color: var(--muted); }
.live { color: #22c55e; font-weight: 800; margin-right: 4px; }
.hdr-act { display: flex; gap: 8px; }
.pill { height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 13px; display: inline-flex; align-items: center; text-decoration: none; cursor: pointer; white-space: nowrap; }

.tabs { max-width: 720px; margin: 0 auto 10px; display: flex; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; text-align: center; padding: 12px 0; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.tab.on { color: var(--text); font-weight: 800; border-bottom-color: var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-top: 12px; }
.search-row { display: flex; gap: 8px; }
.search-box { flex: 1; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 6px 0 14px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); color: var(--muted); min-width: 0; }
.search-box input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 16px; outline: none; }
.loc { width: 40px; height: 40px; border: 0; background: none; color: var(--accent); border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
.btn { height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { height: 34px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chips:empty { display: none; }
.chip { font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 16px; background: var(--chip); border: 1px solid var(--line); color: var(--text); cursor: pointer; text-decoration: none; }
.chip-label { font-size: 12px; font-weight: 800; color: var(--accent); align-self: center; }
.chip-label.fav { color: #f5b301; }

.meta { color: var(--muted); font-size: 13px; }
.h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.h2 h2 { margin: 0; font-size: 17px; }
.h2 h2 small { font-size: 12px; color: var(--muted); font-weight: 500; }
.star { width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--card2); color: var(--muted); cursor: pointer; font-size: 18px; flex: none; }
.star.on { color: #f5b301; }

.list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.stop-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.stop-item small { color: var(--muted); font-size: 12px; }
.route-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.route-item .sub { color: var(--muted); font-size: 12px; }
.route-item .no { flex: none; max-width: 104px; white-space: normal; word-break: keep-all; font-size: 14px; }

.no { min-width: 52px; text-align: center; padding: 4px 8px; border-radius: 8px; color: #fff; font-weight: 800; font-size: 15px; white-space: nowrap; }
.bus { border-radius: 14px; background: var(--card2); border: 1px solid var(--line); padding: 12px; }
.bus-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bus-top .l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bus-top .dest { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eta { font-weight: 800; font-size: 16px; white-space: nowrap; }
.eta.soon { color: var(--red); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.bus-sub { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.tag { padding: 2px 7px; border-radius: 10px; background: var(--chip); color: var(--text); font-weight: 700; font-size: 11px; }
.tag.c-여유 { color: var(--green); }
.tag.c-보통 { color: var(--yellow); }
.tag.c-혼잡, .tag.c-매우혼잡 { color: var(--red); }
.more { margin-top: 8px; background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; padding: 0; }

/* 노선 위치 */
.route-head { display: flex; align-items: center; gap: 10px; }
.route-head .no { font-size: 20px; padding: 5px 10px; }
.route-head b { font-size: 15px; }
.dir-tog { display: flex; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); padding: 4px; margin-top: 10px; }
.dir-tog button { flex: 1; height: 40px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-tog button.on { background: var(--card); color: var(--text); font-weight: 800; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.track { position: relative; margin-top: 8px; }
.track::before { content: ""; position: absolute; left: 17px; top: 20px; bottom: 20px; width: 4px; border-radius: 2px; background: var(--rc, var(--accent)); }
.st { display: grid; grid-template-columns: 38px 1fr; align-items: center; min-height: 52px; gap: 6px; position: relative; padding: 4px 0; }
.st .dot { width: 14px; height: 14px; border-radius: 7px; background: var(--card); border: 3px solid var(--rc, var(--accent)); justify-self: center; position: relative; z-index: 1; }
.st.has .dot { background: var(--rc, var(--accent)); }
.st .nm { font-size: 14px; font-weight: 600; }
.st .nm small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.st .bb { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bmark { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border-radius: 8px; background: var(--rc, var(--accent)); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.bmark.mov { background: color-mix(in srgb, var(--rc, var(--accent)) 70%, transparent); }
.st.mine { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 12px; }

.foot { max-width: 720px; margin: 10px auto 30px; padding: 0 16px; color: var(--muted); font-size: 12px; }
.foot p { margin: 4px 0; }
