:root {
    font-family: Inter, "Noto Sans", sans-serif;
    font-size: 16px;
    --bg-1: #09111f;
    --bg-2: #111a2b;
    --glow: rgba(95, 134, 178, 0.16);
    --panel-top: #fbf8f4;
    --panel-bottom: #f2ebe3;
    --surface: rgba(255,255,255,0.96);
    --text: #142338;
    --muted: #6d798a;
    --line: rgba(20, 35, 56, 0.08);
    --line-strong: rgba(20, 35, 56, 0.13);
    --primary-1: #102741;
    --primary-2: #2c567a;
    --primary-soft: #e8f0f7;
    --accent-1: #d71f3d;
    --accent-2: #eb435d;
    --accent-3: #f27687;
    --shadow-xl: 0 28px 72px rgba(2, 6, 23, 0.26);
    --shadow-lg: 0 16px 34px rgba(20, 35, 56, 0.14);
    --shadow-md: 0 10px 22px rgba(20, 35, 56, 0.10);
    --shadow-sm: 0 5px 12px rgba(20, 35, 56, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    padding: 24px 14px 40px;
    background:
        radial-gradient(1200px 560px at 50% -10%, var(--glow), transparent 58%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
}

.container {
    width: min(100%, 620px);
    margin: 0 auto;
    background: linear-gradient(180deg, var(--panel-top) 0%, var(--panel-bottom) 100%);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 2px solid #09111f;
}

.site-title {
    padding: 18px 18px 16px;
    text-align: center;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.16), transparent 34%),
        linear-gradient(135deg, var(--primary-1) 0%, var(--primary-2) 100%);
}

.site-title h1 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: clamp(1.35rem, 1.15rem + 1vw, 1.5rem);
    line-height: 1;
    letter-spacing: -0.03em;
    font-weight: 900;
    color: #fff;
}

.site-title a:link,
.site-title a:visited {
    color: #fff;
    text-decoration: none;
}

.title-icon {
    font-size: 1.15rem;
    opacity: 0.92;
}

.info-container {
    padding: 16px 16px 8px;
}

.schedule-title {
    margin: 0 0 8px;
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.timetable {
    margin: 0 0 14px;
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.line-container,
.direction-container {
    display: grid;
    gap: 10px;
    justify-content: center;
}

.line-container {
    grid-template-columns: repeat(4, minmax(0, 54px));
    margin-bottom: 10px;
}

.direction-container {
    grid-template-columns: repeat(2, minmax(0, 140px));
    margin-bottom: 12px;
}

.change-line,
.change-direction {
    min-height: 44px;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(180deg, var(--primary-1) 0%, var(--primary-2) 100%);
    box-shadow: 0 10px 20px rgba(15, 39, 65, 0.15);
    font-weight: 800;
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.change-line {
    font-size: 1rem;
}

.change-direction {
    padding: 0 14px;
    font-size: 0.92rem;
}

.change-line:hover,
.change-direction:hover {
    cursor: pointer;
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 14px 26px rgba(15, 39, 65, 0.20);
}

.change-direction:disabled,
.change-station:disabled {
    display: none;
}

.station-container {
    display: flex;
    justify-content: center;
    padding-bottom: 4px;
}

.change-station {
    width: min(100%, 290px);
    appearance: none;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    color: var(--text);
    border-radius: 14px;
    padding: 11px 14px;
    font-size: 0.93rem;
    box-shadow: var(--shadow-sm);
}

.schedule-container {
    padding: 6px 16px 18px;
}

.line-head {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    text-align: center;
}

.line-number {
    margin: 0;
    font-size: clamp(2rem, 1.8rem + 1vw, 2rem);
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--accent-1);
    font-weight: 900;
}

.tram-info {
    display: grid;
    gap: 4px;
}

.tram-station {
    font-size: 1.08rem;
    font-weight: 900;
    color: var(--text);
}

.line-direction {
    font-size: 0.92rem;
    color: var(--muted);
    font-style: normal;
    font-weight: 600;
}

.arrival-card,
.time-dept {
    width: min(100%, 520px);
    margin: 0 auto;
    border-radius: 22px;
    border: 1px solid rgba(20,35,56,0.06);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.arrival-card {
    margin-bottom: 14px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(248,250,252,0.80) 100%);
}

.arrival-top {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.time-rem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 126px;
    max-width: 176px;
    padding: 9px 16px;
    white-space: nowrap;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(180deg, #16304e 0%, #2a5376 100%);
    box-shadow: 0 12px 24px rgba(22, 48, 78, 0.18);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.time-rem.countdown-blue {
    background: linear-gradient(180deg, #16304e 0%, #2a5376 100%);
    box-shadow: 0 12px 24px rgba(22, 48, 78, 0.18);
}

.time-rem.urgent {
    animation: countdownPulse 1.05s ease-in-out infinite;
    background: linear-gradient(180deg, var(--accent-1) 0%, var(--accent-2) 100%);
}

.arrival-track {
    position: relative;
    height: 58px;
    padding: 0 8px;
}

.track-line {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 30px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #dce7f1 0%, #c8d7e6 100%);
}

.track-line::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0.12) 100%);
}

.track-stop {
    position: absolute;
    top: 6px;
    right: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.map-pin {
    position: relative;
    width: 24px;
    height: 24px;
    background: linear-gradient(180deg, #102741 0%, #2c567a 100%);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: inline-block;
    box-shadow: 0 6px 14px rgba(16,39,65,0.35);
}

.map-pin::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.tram-progress {
    --progress: 0.08;
    position: absolute;
    top: 30px; /* dokładnie środek linii */
    left: calc(var(--progress) * (100% - 42px));  
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--primary-1) 0%, var(--primary-2) 100%);
    color: #fff;
    box-shadow: 0 12px 22px rgba(15, 39, 65, 0.22);
    transform: translateY(-50%);
    transition: left 0.9s ease, background 0.25s ease, box-shadow 0.25s ease;
    z-index: 3;
}

.tram-progress i {
    font-size: 0.84rem;
}

.tram-progress.arriving {
    background: linear-gradient(180deg, #18314d 0%, #38678f 100%);
}

.time-dept {
    padding: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.88) 0%, rgba(248,250,252,0.78) 100%);
}

.departure-times {
    display: grid;
    gap: 8px;
}

.departure-row {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 9px;
    align-items: start;
}

.departure-hour {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary-1);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.departure-minutes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.departure-minute {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 28px;
    padding: 0 8px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.next-departure {
    background: linear-gradient(180deg, var(--accent-1) 0%, var(--accent-2) 100%);
    color: #fff;
    border-color: rgba(215,31,61,0.16);
    box-shadow: 0 12px 24px rgba(215,31,61,0.22);
}

.departure-minute.urgent,
.next-departure.urgent {
    animation: none !important;
}

.no-departures {
    text-align: center;
    color: var(--muted);
    font-weight: 700;
    padding: 12px 6px;
}

.next-dept {
    display: none !important;
}

@keyframes countdownPulse {
    0%, 100% {
        background: linear-gradient(180deg, var(--accent-1) 0%, var(--accent-2) 100%);
        box-shadow: 0 12px 24px rgba(215,31,61,0.22);
        transform: scale(1);
    }
    50% {
        background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent-3) 100%);
        box-shadow: 0 16px 30px rgba(215,31,61,0.34);
        transform: scale(1.03);
    }
}

.site-info,
.foot-info {
    width: min(100%, 620px);
    margin: 0 auto;
    text-align: center;
    color: #e6ebf1;
}

.site-info {
    padding: 18px 8px;
    font-size: 0.8rem;
    line-height: 1.5;
}

.foot-info {
    padding: 0 8px 20px;
    font-size: 0.74rem;
    line-height: 1.5;
}

.foot-info p {
    margin: 0;
}

.foot-info a:link,
.foot-info a:visited {
    color: #fff;
}

.cookie-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    padding: 0 12px 12px;
    pointer-events: none;
}

.cookie-bar__inner {
    width: min(100%, 620px);
    margin: 0 auto;
    min-height: 42px;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border-radius: 12px;
    background: rgba(16, 39, 65, 0.96);
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);

    pointer-events: auto;
}

.cookie-bar__text {
    font-size: 0.82rem;
    line-height: 1.35;
    text-align: center;
    justify-self: center;
}

.cookie-bar__close {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    justify-self: end;
}

.cookie-bar__close:hover {
    background: rgba(255, 255, 255, 0.24);
    transform: scale(1.05);
}

.cookie-bar--hide {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

@media screen and (max-width: 520px) {
    body {
        padding: 14px 10px 28px;
    }

    .container {
        border-radius: 22px;
    }

    .site-title {
        padding: 14px;
    }

    .site-title h1 {
        gap: 10px;
        font-size: 1.22rem;
    }

    .title-icon {
        font-size: 1rem;
    }

    .info-container,
    .schedule-container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .timetable {
        font-size: 0.82rem;
    }

    .line-container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .direction-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .change-direction {
        padding: 0 8px;
        font-size: 0.86rem;
    }

    .change-station {
        width: min(100%, 260px);
        font-size: 0.88rem;
    }

    .arrival-card,
    .time-dept {
        width: 100%;
    }

    .time-rem {
        min-width: 118px;
        font-size: 0.96rem;
        padding: 8px 14px;
    }

    .arrival-track {
        height: 56px;
    }

    .track-line {
        top: 29px;
    }

    .track-stop {
        top: 11px;
    }

    .map-pin {
        width: 17px;
        height: 17px;
    }

    .map-pin::after {
        width: 7px;
        height: 7px;
    }

    .tram-progress {
        width: 32px;
        height: 32px;
        top: 29px;
        left: calc(var(--progress) * (100% - 40px));
        transform: translateY(-50%);
    }

    .tram-progress i {
        font-size: 0.8rem;
    }

    .departure-row {
        grid-template-columns: 38px 1fr;
        gap: 8px;
    }

    .departure-hour {
        min-height: 26px;
        font-size: 0.76rem;
    }

    .departure-minute {
        min-width: 32px;
        min-height: 27px;
        padding: 0 7px;
        font-size: 0.84rem;
    }

    .cookie-bar {
        padding: 0 10px 10px;
    }

    .cookie-bar__inner {
        padding: 10px 12px;
        gap: 10px;
        border-radius: 10px;
    }

    .cookie-bar__text {
        font-size: 0.76rem;
    }
}

@media screen and (max-width: 360px) {
    .direction-container {
        grid-template-columns: 1fr;
    }

    .change-station {
        width: 100%;
    }
}
