body { font-family: var(--font-main); margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
main { background: var(--bg); padding-top: 0; margin: 0; }
.container { max-width: var(--layout-max-width); margin: 0 auto; padding: 0 var(--layout-pad-x) 60px; }
.notation { display: block; padding: 5px; text-align: right; font-size: 13px; color: var(--ink-muted); }
.mode-switcher { display: flex; gap: 10px; margin: 20px 0; padding: 6px; background: var(--surface-soft); border-radius: var(--radius-sm); flex-wrap: wrap; justify-content: center; box-shadow: var(--shadow-soft); border: 1px solid var(--line-soft); }
.mode-switch-btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border: none; border-radius: var(--radius-xs); background: transparent; color: var(--ink-soft); font-family: var(--font-main); font-size: 15px; font-weight: 600; cursor: pointer; transition: var(--transition); white-space: nowrap; position: relative; }
.mode-switch-btn.active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-soft); }
.mode-switch-btn.active::after { content: ''; position: absolute; bottom: -3px; left: 50%; transform: translateX(-50%); width: 30px; height: 3px; background: var(--accent); border-radius: 3px; }
.mode-icon { font-size: 18px; }
.mode-panel { display: none; opacity: 0; transform: translateY(20px); }
.mode-panel.active { display: block; opacity: 1; transform: translateY(0); animation: fadeInUp .35s ease; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.route-selection { display: flex; flex-direction: column; gap: 15px; background: var(--surface); padding: 28px 24px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line-soft); margin-bottom: 24px; }
.route-selection h2 { margin: 0 0 4px; text-align: center; font-family: var(--font-display); font-size: clamp(1.25rem, 2vw + .8rem, 1.6rem); font-weight: 400; letter-spacing: -0.02em; color: var(--ink); }
.header-title { margin: 20px; text-align: center; font-family: var(--font-display); font-weight: 400; letter-spacing: -0.02em; color: var(--ink); }
.header-note { text-align: center; font-size: 13px; color: var(--ink-muted); line-height: 1.5; }
.route-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.route-buttons button, .route-btn { font-family: var(--font-main); font-weight: 700; width: 80px; height: 44px; border-radius: var(--radius-xs); border: 2px solid transparent; color: #fff; font-size: 19px; text-align: center; cursor: pointer; position: relative; transition: var(--transition); box-shadow: var(--shadow-soft); }
.route-buttons button.red, .route-btn.red { background: #e05c7b; }
.route-buttons button.green, .route-btn.green { background: #4e9e4e; }
.route-buttons button.orange, .route-btn.orange { background: #f5a442; }
.route-buttons button.ebus, .route-btn.ebus { background: #4a7db5; }
.route-buttons button.active, .route-btn.active { border-color: var(--ink); box-shadow: var(--shadow-accent); }
.ruble-symbol { position: absolute; top: 4px; right: 6px; font-size: 12px; color: #fff; font-weight: 700; }
.route-legend { font-weight: 400; margin-top: 10px; font-size: 12px; color: var(--ink-muted); line-height: 1.6; }
.route-legend span { margin-right: 5px; }
.note-tram { color: #e05c7b; }
.note-trolley { color: #4e9e4e; }
.note-bus { color: #f5a442; }
.direction-container { display: flex; flex: 1; gap: 0; }
#direction-a, #direction-b { display: flex; width: 50%; flex-direction: column; text-align: center; }
.direction-block { width: 100%; text-align: center; }
.direction-block input { height: 50px; margin: 0 auto; width: 80%; border-radius: var(--radius-xs); border: 2px solid var(--line-soft); background: var(--surface); box-shadow: var(--shadow-soft); font-family: var(--font-main); font-size: 15px; color: var(--ink); padding: 0 14px; transition: var(--transition); }
.direction-block input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-accent); }
.direction-title { text-align: center; margin: 0 0 15px 0; font-family: var(--font-display); font-size: 1.1rem; font-weight: 400; letter-spacing: -0.02em; color: var(--ink); }
.direction-btn { display: block; width: 90%; margin: 10px auto; padding: 16px 20px; border: 2px solid; border-radius: var(--radius-xs); font-family: var(--font-main); font-size: 15px; font-weight: 600; cursor: pointer; transition: var(--transition); text-align: center; background: var(--surface); box-shadow: var(--shadow-soft); -webkit-tap-highlight-color: transparent; }
.direction-btn.direction-a { border-color: var(--accent); color: var(--accent-strong); }
.direction-btn.direction-b { border-color: var(--info); color: var(--info-strong); }
#schedule-output { display: grid; grid-template-columns: 1fr 1fr; justify-items: center; gap: 20px; }
.shtitle { display: flex; grid-column: 1 / span 2; flex-direction: column; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 3vw + .8rem, 1.75rem); letter-spacing: -0.02em; text-align: center; padding: 0 25px; margin: 20px 0; color: var(--ink); }
.schedule-table__bd, .schedule-table__vh { padding: 14px; border-radius: var(--radius-sm); width: 100%; table-layout: fixed; border-collapse: collapse; box-shadow: var(--shadow-soft); background: var(--surface); }
.schedule-table__bd { background: linear-gradient(to bottom, var(--sage-soft) 0%, var(--surface) 100%); }
.schedule-table__vh { background: linear-gradient(to bottom, var(--warm-soft) 0%, var(--surface) 100%); }
.schedule-table__bd td, .schedule-table__vh td { width: 25%; border-bottom: 1px solid var(--line-soft); padding: 8px; }
.schedule-caption { font-family: var(--font-display); font-size: clamp(1.1rem, 2vw + .9rem, 1.5rem); font-weight: 400; letter-spacing: -0.02em; margin-bottom: 15px; }
.schedule-table__bd .schedule-caption { color: var(--ink); }
.schedule-table__vh .schedule-caption { color: var(--warm-strong); }
.hour { font-size: clamp(1.3rem, 4vw + .5rem, 1.7rem); font-weight: 500; text-align: right; vertical-align: middle; color: var(--ink); letter-spacing: -0.02em; }
.minutes { font-size: clamp(.5rem, 2vw + .2rem, .85rem); color: var(--ink-soft); text-align: left; vertical-align: middle; }
.route-badge { display: inline-flex; align-items: center; justify-content: center; background: #f5a442; color: #fff; min-width: 80px; padding: 6px 14px; border-radius: var(--radius-xs); font-family: var(--font-main); font-size: 26px; font-weight: 800; text-align: center; letter-spacing: -0.02em; box-shadow: var(--shadow-soft); }
.route-badge.red { background: #e05c7b; }
.route-badge.green { background: #4e9e4e; }
.route-badge.orange { background: #f5a442; }
.route-badge.ebus { background: #4a7db5; }
.depot-time.to { color: #e05c7b; font-weight: 600; }
.depot-time.from { color: #4a7db5; font-weight: 600; }
.depot-time.dinner { color: #f5a442; font-weight: 600; }
.depot-time.service { color: #a78bfa; font-weight: 600; }
.depot-tag { display: inline-block; margin-right: 15px; font-size: 13px; font-weight: 500; }
.depot-tag.to { color: #e05c7b; }
.depot-tag.from { color: #4a7db5; }
.depot-tag.dinner { color: #f5a442; }
.depot-tag.service { color: #a78bfa; }
.depot-legend { width: 100%; margin-top: 15px; text-align: center; }
.depot-legend-inner { font-size: 14px; font-family: var(--font-main); display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); z-index: 9999; justify-content: center; align-items: center; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px; }
.modal-content { background: var(--surface); border-radius: var(--radius); padding: 24px; max-width: 500px; width: 100%; max-height: 90dvh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); margin: auto; border: 1px solid var(--line-soft); }
.modal-title { margin: 0 0 15px 0; text-align: center; font-family: var(--font-display); font-size: 1.15rem; font-weight: 400; letter-spacing: -0.02em; color: var(--ink); }
.modal-input { width: 100%; padding: 12px 14px; border: 2px solid var(--accent-soft); border-radius: var(--radius-xs); font-family: var(--font-main); font-size: 15px; color: var(--ink); margin-bottom: 10px; box-sizing: border-box; flex-shrink: 0; transition: var(--transition); background: var(--surface); }
.modal-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-accent); }
.modal-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.modal-close-btn { margin-top: 15px; padding: 12px; background: var(--accent-soft); border: none; border-radius: var(--radius-xs); font-family: var(--font-main); font-size: 15px; font-weight: 600; color: var(--accent-strong); cursor: pointer; width: 100%; flex-shrink: 0; transition: var(--transition); }
.modal-no-results { padding: 10px; color: var(--ink-muted); text-align: center; font-size: 14px; }
.modal-stop-item { padding: 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft); font-size: 15px; color: var(--ink-soft); transition: var(--transition); }
.error-message { color: var(--danger-strong); font-size: 14px; text-align: center; margin: 12px 0; }
.loading-text { text-align: center; color: var(--ink-muted); }
.retry-button { display: block; margin: 10px auto; padding: 10px 20px; background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--radius-xs); font-family: var(--font-main); font-size: 14px; font-weight: 600; color: var(--accent-strong); cursor: pointer; transition: var(--transition); }
.custom-datalist { display: none; position: inherit; width: 100%; max-width: 100%; background: var(--surface); border-radius: var(--radius-xs); box-shadow: var(--shadow); border: 1px solid var(--line-soft); z-index: 1000; overflow-y: auto; max-height: 300px; }
.stops-list { list-style: none; padding: 0; margin: 0; }
.stops-list li { padding: 10px 14px; font-size: 15px; color: var(--ink-soft); cursor: pointer; transition: var(--transition); border-bottom: 1px solid var(--line-soft); }
.stops-list li:last-child { border-bottom: none; }
.dachi-panel { text-align: center; padding: 40px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line-soft); margin: 20px 0; }
.dachi-panel h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 15px; }
.dachi-panel p { color: var(--ink-soft); margin-bottom: 20px; }
.dachi { display: block; max-width: 600px; margin: 10px auto; padding: 12px 20px; border-radius: var(--radius-xs); background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; text-align: center; box-shadow: var(--shadow-accent); transition: var(--transition); }
.switch-to-stop-mode { background: transparent; border: none; cursor: pointer; font-size: 13px; color: var(--accent-strong); padding: 3px 6px; font-family: var(--font-main); font-weight: 500; white-space: nowrap; text-decoration: underline; text-decoration-style: dashed; text-underline-offset: 3px; transition: var(--transition); display: inline-block; margin-left: 10px; }
.schedule-loading-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; }
.schedule-loading-spinner { width: 50px; height: 50px; border: 4px solid rgba(255, 255, 255, .3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.schedule-loading-text { margin-top: 20px; color: #fff; font-size: 17px; font-family: var(--font-main); }
@keyframes spin {
  to { transform: rotate(360deg); }
}
@media (max-width: 1500px) {
  #direction-a, #direction-b { display: flex; flex-direction: column; }
}
@media (max-width: 1200px) {
  #schedule-output { display: flex; flex-direction: column; align-items: center; row-gap: 30px; }
}
@media (max-width: 768px) {
  .container { padding: 0 var(--layout-pad-x) 24px; }
  .notation { font-size: 10px; }
  .mode-switcher { gap: 5px; margin: 12px 0; padding: 4px; border-radius: var(--radius-xs); }
  .mode-switch-btn { padding: 10px 16px; font-size: 13.5px; gap: 5px; }
  .route-selection { padding: 20px 14px; border-radius: var(--radius-sm); align-items: center; }
  .header-note { font-size: 11px; }
  .route-buttons { justify-content: center; }
  .route-buttons button, .route-btn { width: 58px; height: 58px; font-size: 17px; }
  .direction-container { position: relative; flex-direction: column; }
  .direction-block input { width: 100%; }
  .shtitle { font-size: clamp(1.15rem, 4vw + -.4rem, 1.6rem); padding: 0 16px; margin: 15px 0 0 0; gap: 10px; }
  #direction-a, #direction-b { width: 100%; }
  .route-badge { min-width: 52px; font-size: 20px; padding: 4px 10px; }
  .trolleybus::after { content: "\A"; white-space: pre; }
  .custom-datalist { position: absolute; width: 90%; left: auto; bottom: 239.65px; border-top: 1px solid var(--line-soft); }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-content { border-radius: var(--radius-sm) var(--radius-sm) 0 0; max-height: 90dvh; padding: 20px 16px; }
}
@media (max-width: 400px) {
  .mode-switch-btn { padding: 8px; font-size: 13px; flex: 1; justify-content: center; }
  .route-selection { align-items: center; padding: 16px 12px; }
  .route-buttons button, .route-btn { width: 54px; height: 54px; font-size: 16px; }
  .schedule-table__bd td, .schedule-table__vh td { padding: 5px 3px; }
  #schedule-output { row-gap: 20px; }
  .route-badge { min-width: 46px; font-size: 18px; }
}
@media (hover: hover) and (pointer: fine) {
  .mode-switch-btn:hover { background: var(--accent-soft); color: var(--ink); }
  .route-buttons button:hover, .route-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-accent); }
  .direction-btn.direction-a:hover { background: var(--accent-soft); }
  .direction-btn.direction-b:hover { background: var(--info-soft); }
  .modal-close-btn:hover { background: var(--accent); color: #fff; }
  .modal-stop-item:hover { background: var(--accent-soft); color: var(--accent-strong); }
  .stops-list li:hover { background: var(--accent-soft); color: var(--accent-strong); }
  .retry-button:hover { background: var(--accent); color: #fff; }
  .dachi:hover { background: var(--accent-strong); transform: translateY(-2px); }
  .switch-to-stop-mode:hover { color: var(--ink); }
}
.mode-switch-btn:active, .route-btn:active, .direction-btn:active, .modal-close-btn:active, .modal-stop-item:active, .stops-list li:active, .retry-button:active, .dachi:active, .switch-to-stop-mode:active { transform: scale(0.97); }