/* StopBoard — app.css */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #050a0e;
    --surface: #0c1219;
    --border: #1a2332;
    --text: #e8edf2;
    --muted: #5a6a7a;
    --live: #34d27b;
    --dim: #2a3442;
    --label: #8fa3b8;
    --bus-glow: rgba(52, 210, 123, 0.25);
}

body {
    font-family: 'Instrument Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'Space Mono', monospace; }

@keyframes shimmer {
    0% { background-position: -300px 0; }
    100% { background-position: 300px 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
    background-size: 600px 100%;
    animation: shimmer 1.8s infinite;
    border-radius: 4px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Route card ── */
.route-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px 10px;
    margin-bottom: 10px;
    animation: fadeIn 0.4s ease-out both;
}
.route-card:last-child { margin-bottom: 0; }

.route-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.route-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.route-number {
    font-family: 'Space Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.route-destination {
    color: var(--label);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-destination.is-empty {
    display: none;
}

.route-eta {
    font-family: 'Space Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Track ── */
.track {
    position: relative;
    height: 56px;
    overflow: visible;

    -webkit-user-select: none;
    user-select: none;
}

.track-rail {
    position: absolute;
    top: 18px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
}

/* Left stop node */
.track-node {
    position: absolute;
    top: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    z-index: 2;
    pointer-events: none;
}

.track-node-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--label);
}

.track-node-label {
    font-size: 12px;
    line-height: 1.25;
    color: var(--label);
    margin-top: 4px;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    font-weight: 500;

    display: -webkit-box;
    -webkit-box-orient: vertical;

    -webkit-line-clamp: 2;
    line-clamp: 2;

    white-space: normal;
}

/* Your stop — pinned right */
.track-you {
    position: absolute;
    right: 0;
    top: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 3;

    -webkit-user-select: none;
    user-select: none;
}

.track-you-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 8px var(--bus-glow);
}

.track-you-label {
    font-size: 9px;
    color: var(--label);
    margin-top: 4px;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* Bus icon — fixed center with idle bounce */
.track-bus {
    position: absolute;
    left: 42%;
    top: -4px;
    z-index: 5;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.track-bus img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px var(--bus-glow));
}

/* Idle driving animation — subtle road vibration + sway */
@keyframes busIdle {
    0%   { transform: translateX(-50%) translateY(0px) rotate(0deg); }
    10%  { transform: translateX(-50%) translateY(-0.6px) rotate(0.3deg); }
    20%  { transform: translateX(-50%) translateY(0.3px) rotate(-0.2deg); }
    35%  { transform: translateX(-50%) translateY(-0.8px) rotate(0.4deg); }
    50%  { transform: translateX(-50%) translateY(0px) rotate(0deg); }
    60%  { transform: translateX(-50%) translateY(-0.4px) rotate(-0.3deg); }
    75%  { transform: translateX(-50%) translateY(0.5px) rotate(0.2deg); }
    85%  { transform: translateX(-50%) translateY(-0.3px) rotate(-0.15deg); }
    100% { transform: translateX(-50%) translateY(0px) rotate(0deg); }
}

.track-bus.is-live {
    animation: busIdle 1.8s ease-in-out infinite;
}

.track-bus.is-live img {
    filter: drop-shadow(0 0 8px var(--bus-glow));
}

.track-bus.is-stale img {
    filter: grayscale(0.7) brightness(0.7);
}

@keyframes busGlow {
    0%, 100% { filter: drop-shadow(0 0 6px var(--bus-glow)); }
    50% { filter: drop-shadow(0 0 14px var(--bus-glow)) drop-shadow(0 0 22px rgba(52, 210, 123, 0.12)); }
}

/* Stop counter — right of bus */
.track-counter {
    position: absolute;
    left: 56%;
    top: 10px;

    font-size: 10px;
    font-weight: 600;
    color: var(--label);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    z-index: 4;
}

.track-counter.is-next {
    color: var(--live);
}

/* Arrived state */
.track-arrived {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;

    animation: fadeIn 0.3s ease-out;
    will-change: opacity;
}

.track-arrived img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.track-arrived-text {
    font-family: 'Space Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--live);
    letter-spacing: 0.02em;
}

/* No bus */
.track-empty {
    font-size: 11px;
    color: var(--muted);
    line-height: 56px;
    text-align: center;
}

/* ETA disclaimer */
.eta-disclaimer {
    margin-top: 12px;
    font-size: 0.85rem;
    opacity: 0.7;
    text-align: center;
}

/* ── Bottom sheet ── */
.bottom-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 60;
    max-height: 60vh;
    overflow-y: auto;
    max-width: 420px;
    margin: 0 auto;
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 55;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.bottom-sheet-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Footer ── */
.site-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    text-align: center;
    font-size: 10px;
    color: var(--dim);
    padding: 8px 16px;
    background: var(--bg);
}
.site-footer-inner { max-width: 420px; margin: 0 auto; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Header ── */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    cursor: pointer;
}
.header-brand { display: flex; align-items: center; gap: 8px; }
.header-logo { width: 28px; height: 28px; border-radius: 6px; }
.header-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.header-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; }

.skeleton-title { height: 24px; width: 60%; margin-bottom: 8px; }
.skeleton-subtitle { height: 14px; width: 30%; margin-bottom: 32px; }
.skeleton-row { height: 48px; width: 100%; margin-bottom: 8px; }
.skeleton-row:last-child { margin-bottom: 0; }

.empty-state { font-size: 14px; color: var(--muted); padding: 40px 0; text-align: center; }

.board-header { margin-bottom: 24px; }
.stop-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stop-status { font-size: 13px; color: var(--muted); margin-top: 4px; }

.board-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.btn-board {
    flex: 1; padding: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit;
}

.app-container { max-width: 420px; margin: 0 auto; padding: 20px 20px 80px; min-height: 100vh; }

.hero { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.hero-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.hero-subtitle { font-size: 14px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.footer-link { color: var(--muted); text-decoration: underline; }

.empty-search { margin-top: 16px; }
.search-input {
    width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 12px 14px; color: var(--text); font-size: 14px; outline: none; font-family: inherit;
}
.search-results { margin-top: 8px; text-align: left; }
