/* ── Page ────────────────────────────────────────────────────── */
body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────── */
#page-header {
    background: var(--c-primary);
    color: #fff;
    padding: 14px 16px;
}

#page-title {
    font-size: var(--fs-lg);
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

#page-subtitle {
    font-size: var(--fs-xs);
    color: rgba(255,255,255,0.75);
}

/* ── Main grid ───────────────────────────────────────────────── */
main {
    flex: 1;
    padding: 14px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.road-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
}

/* ── Road card ───────────────────────────────────────────────── */
.road-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.road-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.road-badge {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--c-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1.1;
    font-size: var(--fs-sm);
    letter-spacing: -0.5px;
}

.road-badge .badge-num {
    font-size: var(--fs-base);
}

.road-info {
    flex: 1;
    min-width: 0;
}

.road-name {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--c-text);
}

.road-endpoints {
    font-size: var(--fs-xs);
    color: var(--c-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Direction buttons ───────────────────────────────────────── */
.road-dirs {
    display: flex;
    gap: 6px;
}

.dir-btn {
    flex: 1;
    padding: 8px 4px;
    border: 1.5px solid var(--c-border);
    border-radius: 7px;
    background: var(--c-bg);
    color: var(--c-text);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1.3;
}

.dir-btn:hover {
    background: var(--c-primary-lt);
    border-color: var(--c-primary);
    color: var(--c-primary-dk);
}

.dir-btn .dir-arrow {
    font-size: 1rem;
    line-height: 1;
}

.dir-btn.both {
    color: var(--c-muted);
    font-size: var(--fs-2xs);
    font-weight: 500;
}

.dir-btn.both:hover {
    color: var(--c-primary-dk);
}

.dir-btn.map,
.dir-btn.etag {
    flex: 0 0 auto;
    color: var(--c-muted);
    font-size: var(--fs-2xs);
    font-weight: 500;
    border-color: var(--c-border);
    padding-left: 8px;
    padding-right: 8px;
}

.dir-btn.map:hover,
.dir-btn.etag:hover {
    background: var(--c-primary-lt);
    border-color: var(--c-primary);
    color: var(--c-primary-dk);
}
