:root {
    --primary: #1976d2;
    --primary-dark: #0d47a1;
    --accent: #ff9800;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --danger: #d32f2f;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    max-width: 800px;
    margin: 0 auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
}
.brand:hover { text-decoration: none; }
.brand__icon { font-size: 1.4rem; }
.menu-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
}

.nav {
    display: none;
    flex-direction: column;
    background: var(--primary-dark);
    padding: 8px 0;
}
.nav--open { display: flex; }
.nav a {
    color: #fff;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.nav a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.nav__apk { background: var(--accent); color: #fff !important; font-weight: 600; }

@media (min-width: 768px) {
    .menu-btn { display: none; }
    .nav {
        display: flex !important;
        flex-direction: row;
        background: var(--primary);
        max-width: 800px;
        margin: 0 auto;
        padding: 0 16px;
        border-top: 1px solid rgba(255,255,255,0.15);
    }
    .nav a {
        border-bottom: none;
        padding: 10px 14px;
    }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
}

h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.2rem; margin: 24px 0 12px; }
.subtitle { color: var(--muted); margin: 0 0 20px; }

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 12px;
    display: block;
    color: var(--text);
}
.card:hover { text-decoration: none; transform: translateY(-1px); transition: transform .15s; }

.route-card {
    display: flex;
    align-items: center;
    gap: 14px;
}
.route-badge {
    flex: 0 0 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
}
.route-card__body { flex: 1; min-width: 0; }
.route-card__name { font-weight: 600; margin: 0 0 4px; }
.route-card__desc { color: var(--muted); font-size: .9rem; margin: 0; overflow: hidden; text-overflow: ellipsis; }

/* Forms */
.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.search-form input,
.search-form select {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: #fff;
    min-width: 0;
}
.search-form button {
    padding: 12px 18px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.search-form--vertical { flex-direction: column; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; }

/* Route detail */
.route-header {
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.route-header h1 { color: #fff; margin: 0 0 4px; display: flex; align-items: center; gap: 12px; }
.route-header__num {
    background: #fff;
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 1.2rem;
}
.route-header p { margin: 8px 0 0; opacity: .92; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 14px;
}
.info-grid__item {
    background: rgba(255,255,255,0.15);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: .9rem;
}
.info-grid__label { display: block; font-size: .75rem; opacity: .85; }

/* Stops list */
.stops-list { list-style: none; padding: 0; margin: 0; }
.stops-list li {
    position: relative;
    padding: 12px 0 12px 32px;
    border-bottom: 1px solid var(--border);
}
.stops-list li:last-child { border-bottom: none; }
.stops-list li::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(25,118,210,.15);
}
.stops-list li::after {
    content: '';
    position: absolute;
    left: 13px;
    top: 30px;
    bottom: -2px;
    width: 2px;
    background: var(--border);
}
.stops-list li:last-child::after { display: none; }
.stops-list a { color: var(--text); }

/* Map */
#map {
    width: 100%;
    height: 360px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
@media (min-width: 768px) {
    #map { height: 460px; }
}

/* Footer */
.footer {
    text-align: center;
    color: var(--muted);
    padding: 24px 16px;
    font-size: .85rem;
}

/* Empty / hint */
.empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--muted);
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 24px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.hero h1 { color: #fff; margin: 0 0 6px; }
.hero p { margin: 0 0 14px; opacity: .92; }
.hero .search-form input { background: #fff; }

.actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.actions a {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    color: var(--text);
    box-shadow: var(--shadow);
    font-weight: 500;
}
.actions a:hover { text-decoration: none; }
.actions__icon { display: block; font-size: 1.6rem; margin-bottom: 4px; }

.tag {
    display: inline-block;
    background: #e3f2fd;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .8rem;
    margin-right: 4px;
}
.tag--reverse {
    background: #fff3e0;
    color: #e65100;
    margin-left: 4px;
}
