*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 1920px;
    height: 540px;
    overflow: hidden;
    background: #0E1A2B;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #FFFFFF;
}

/* ===== Theme CSS Variables ===== */

.media-panel {
    --accent: #FFD400;
    --accent-glow: rgba(255,212,0,0.4);
    --accent-bg: rgba(255,212,0,0.10);
    --accent-dim: rgba(255,212,0,0.12);
    --passed: #B8C7E0;
    --passed-dark: #5a6a80;
    --bg: #0E1A2B;
    --surface: #142236;
    --text: #FFFFFF;
    --text-dim: #B8C7E0;
    --text-muted: rgba(184,199,224,0.5);
    --grid: rgba(255,212,0,0.03);
    --divider-color: rgba(255,212,0,0.12);
    --track: #2a3a52;
}

.media-panel[data-theme="red"] {
    --accent: #ef5350;
    --accent-glow: rgba(239,83,80,0.4);
    --accent-bg: rgba(239,83,80,0.10);
    --accent-dim: rgba(239,83,80,0.12);
    --passed: #a5d6a7;
    --passed-dark: #388e3c;
    --divider-color: rgba(239,83,80,0.12);
    --grid: rgba(239,83,80,0.03);
}

.media-panel[data-theme="green"] {
    --accent: #66bb6a;
    --accent-glow: rgba(102,187,106,0.4);
    --accent-bg: rgba(102,187,106,0.10);
    --accent-dim: rgba(102,187,106,0.12);
    --passed: #81d4fa;
    --passed-dark: #0277bd;
    --divider-color: rgba(102,187,106,0.12);
    --grid: rgba(102,187,106,0.03);
}

.media-panel[data-theme="orange"] {
    --accent: #ffa726;
    --accent-glow: rgba(255,167,38,0.4);
    --accent-bg: rgba(255,167,38,0.10);
    --accent-dim: rgba(255,167,38,0.12);
    --passed: #a5d6a7;
    --passed-dark: #388e3c;
    --divider-color: rgba(255,167,38,0.12);
    --grid: rgba(255,167,38,0.03);
}

.media-panel[data-theme="purple"] {
    --accent: #ab47bc;
    --accent-glow: rgba(171,71,188,0.4);
    --accent-bg: rgba(171,71,188,0.10);
    --accent-dim: rgba(171,71,188,0.12);
    --passed: #80cbc4;
    --passed-dark: #00695c;
    --divider-color: rgba(171,71,188,0.12);
    --grid: rgba(171,71,188,0.03);
}

/* ===== Animations ===== */

@-webkit-keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@-webkit-keyframes fadeInScale {
    from { opacity: 0; -webkit-transform: scale(1.05); transform: scale(1.05); }
    to { opacity: 1; -webkit-transform: scale(1); transform: scale(1); }
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(1.05); }
    to { opacity: 1; transform: scale(1); }
}

@-webkit-keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,212,0,0.4); }
    50% { box-shadow: 0 0 0 14px transparent; }
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,212,0,0.4); }
    50% { box-shadow: 0 0 0 14px transparent; }
}

@-webkit-keyframes pulseRing {
    0% { -webkit-transform: scale(1); transform: scale(1); opacity: 0.6; }
    100% { -webkit-transform: scale(2.8); transform: scale(2.8); opacity: 0; }
}
@keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(2.8); opacity: 0; }
}

@-webkit-keyframes glowBreathe {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
@keyframes glowBreathe {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Announce overlay */
@-webkit-keyframes announceIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes announceIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@-webkit-keyframes announceOut {
    from { opacity: 1; }
    to { opacity: 0; pointer-events: none; }
}
@keyframes announceOut {
    from { opacity: 1; }
    to { opacity: 0; pointer-events: none; }
}

@-webkit-keyframes announceNameIn {
    from { opacity: 0; -webkit-transform: translateY(40px) scale(0.8); transform: translateY(40px) scale(0.8); }
    to { opacity: 1; -webkit-transform: translateY(0) scale(1); transform: translateY(0) scale(1); }
}
@keyframes announceNameIn {
    from { opacity: 0; transform: translateY(40px) scale(0.8); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@-webkit-keyframes announceDotPulse {
    0% { -webkit-transform: scale(0); transform: scale(0); opacity: 1; }
    100% { -webkit-transform: scale(6); transform: scale(6); opacity: 0; }
}
@keyframes announceDotPulse {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(6); opacity: 0; }
}

/* ===== Main container — fixed 1920x540 ===== */

.media-panel {
    display: flex;
    width: 1920px;
    height: 540px;
    overflow: hidden;
    background: #0E1A2B;
}

/* ===== LEFT: Ads section — 1100px ===== */

.ads-section {
    width: 1100px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: #000;
}

.ad-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.ad-slide--prev {
    -webkit-animation: fadeOut 1.2s ease forwards;
    animation: fadeOut 1.2s ease forwards;
    z-index: 1;
}

.ad-slide--current {
    -webkit-animation: fadeInScale 1.2s ease forwards;
    animation: fadeInScale 1.2s ease forwards;
    z-index: 2;
}

.ad-media {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Dots */
.ad-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.ad-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    -webkit-transition: all 0.4s ease;
    transition: all 0.4s ease;
}

.ad-dot--active {
    width: 28px;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 0 10px rgba(255,255,255,0.4);
}

/* ===== Divider ===== */

.divider {
    width: 1px;
    background: rgba(255,212,0,0.12);
    position: relative;
}

.divider-glow {
    position: absolute;
    top: 20%;
    bottom: 20%;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, transparent, #FFD400, transparent);
    opacity: 0.3;
}

/* ===== RIGHT: Route section — 819px ===== */

.route-section {
    width: 819px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #0E1A2B;
    position: relative;
    overflow: hidden;
}

.route-grid-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,212,0,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,212,0,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* ===== Route Header ===== */

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 28px 12px;
    position: relative;
    z-index: 2;
}

.route-header-left {
    display: flex;
    flex-direction: column;
}

.route-number {
    font-family: monospace;
    font-size: 15px;
    font-weight: 600;
    color: #FFD400;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.route-name {
    font-size: 30px;
    font-weight: 700;
}

.route-meta {
    display: flex;
    gap: 12px;
    margin-top: 5px;
    font-size: 14px;
    color: #B8C7E0;
    align-items: center;
}

.route-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #FFD400;
    display: inline-block;
    -webkit-animation: glowBreathe 2s ease-in-out infinite;
    animation: glowBreathe 2s ease-in-out infinite;
}

/* ===== Clock / Date / Weather ===== */

.route-header-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.route-clock-time {
    font-size: 38px;
    font-weight: 700;
    font-family: monospace;
    color: #FFFFFF;
    line-height: 1;
}

.route-clock-date {
    font-size: 16px;
    color: #B8C7E0;
    margin-top: 2px;
}

.route-clock-weather {
    font-size: 16px;
    color: #B8C7E0;
    margin-top: 1px;
}

/* ===== Stops View ===== */

/* Подавляем только высотные переходы во время FLIP-слайда.
   .stop-dot оставляем — точка продолжает анимироваться во время слайда */
.stops-sliding .stop-label,
.stops-sliding .stop-name-text {
    -webkit-transition: none !important;
    transition: none !important;
}

.stops-clip {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.stops-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 28px;
    position: relative;
    z-index: 2;
}

/* Stop row — NO entry animation, smooth transitions only */
.stop-row {
    display: flex;
    align-items: center;
}

.stop-track {
    width: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Stop dot — smooth size/color transitions */
.stop-dot {
    border-radius: 50%;
    -webkit-transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.stop-dot--current {
    width: 28px;
    height: 28px;
    background: #FFD400;
    box-shadow: 0 0 24px rgba(255,212,0,0.4), 0 0 48px rgba(255,212,0,0.10);
    -webkit-animation: pulse 2s ease-in-out infinite;
    animation: pulse 2s ease-in-out infinite;
}

.stop-dot--passed {
    width: 12px;
    height: 12px;
    background: #5a6a80;
    box-shadow: none;
    -webkit-animation: none;
    animation: none;
}

.stop-dot--upcoming {
    width: 12px;
    height: 12px;
    border: 2px solid #2a3a52;
    background: #0E1A2B;
    box-shadow: none;
    -webkit-animation: none;
    animation: none;
}

/* Pulsing ring — only visible on current */
.stop-dot-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin-top: -14px;
    margin-left: -14px;
    border-radius: 50%;
    border: 2px solid #FFD400;
    pointer-events: none;
    opacity: 0;
}

.stop-dot-ring--visible {
    opacity: 1;
    -webkit-animation: pulseRing 2s ease-out infinite;
    animation: pulseRing 2s ease-out infinite;
}

/* Stop label — smooth transitions for all visual properties */
.stop-label {
    flex: 1;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 14px;
    margin: 0;
    box-shadow: none;
    -webkit-transition: padding 0.8s cubic-bezier(0.22,1,0.36,1),
                background 0.8s cubic-bezier(0.22,1,0.36,1),
                border-color 0.8s cubic-bezier(0.22,1,0.36,1),
                box-shadow 0.8s cubic-bezier(0.22,1,0.36,1),
                margin 0.8s cubic-bezier(0.22,1,0.36,1);
    transition: padding 0.8s cubic-bezier(0.22,1,0.36,1),
                background 0.8s cubic-bezier(0.22,1,0.36,1),
                border-color 0.8s cubic-bezier(0.22,1,0.36,1),
                box-shadow 0.8s cubic-bezier(0.22,1,0.36,1),
                margin 0.8s cubic-bezier(0.22,1,0.36,1);
}

.stop-label--current {
    padding: 16px 24px;
    background: rgba(255,212,0,0.10);
    border-color: rgba(255,212,0,0.12);
    margin: 8px 0;
    box-shadow: 0 0 30px rgba(255,212,0,0.10), inset 0 0 20px rgba(255,212,0,0.10);
}

/* Stop name text — smooth font transitions */
.stop-name-text {
    font-weight: 500;
    line-height: 1.2;
    -webkit-transition: font-size 0.8s cubic-bezier(0.22,1,0.36,1),
                color 0.8s cubic-bezier(0.22,1,0.36,1),
                text-shadow 0.8s cubic-bezier(0.22,1,0.36,1),
                font-weight 0.8s cubic-bezier(0.22,1,0.36,1);
    transition: font-size 0.8s cubic-bezier(0.22,1,0.36,1),
                color 0.8s cubic-bezier(0.22,1,0.36,1),
                text-shadow 0.8s cubic-bezier(0.22,1,0.36,1),
                font-weight 0.8s cubic-bezier(0.22,1,0.36,1);
}

.stop-label--current .stop-name-text {
    font-size: 47px;
    font-weight: 800;
    color: #FFD400;
    text-shadow: 0 0 20px rgba(255,212,0,0.4);
}

.stop-label--passed .stop-name-text {
    font-size: 33px;
    color: #B8C7E0;
    text-shadow: none;
}

.stop-label--upcoming .stop-name-text {
    font-size: 33px;
    color: #B8C7E0;
    text-shadow: none;
}

/* Gap between stops */
.stop-gap {
    display: flex;
    align-items: stretch;
    min-height: 20px;
}

.stop-gap-track {
    width: 56px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.stop-gap-line {
    width: 2px;
    background: #2a3a52;
    -webkit-transition: background 0.8s ease, box-shadow 0.8s ease;
    transition: background 0.8s ease, box-shadow 0.8s ease;
}

.stop-gap-track--active .stop-gap-line {
    background: #FFD400;
    opacity: 0.5;
    box-shadow: 0 0 6px rgba(255,212,0,0.4);
}

/* ===== Announce Overlay ===== */

.announce-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(14, 26, 43, 0.94);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    -webkit-animation: announceIn 0.4s ease-out, announceOut 0.6s ease-in 3s forwards;
    animation: announceIn 0.4s ease-out, announceOut 0.6s ease-in 3s forwards;
}

.announce-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFD400;
    margin-bottom: 20px;
    position: relative;
}

.announce-dot::before,
.announce-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid #FFD400;
    -webkit-animation: announceDotPulse 1.5s ease-out infinite;
    animation: announceDotPulse 1.5s ease-out infinite;
}

.announce-dot::after {
    animation-delay: 0.5s;
}

.announce-subtitle {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #B8C7E0;
    margin-bottom: 12px;
    -webkit-animation: announceNameIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
    animation: announceNameIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.announce-name {
    font-size: 56px;
    font-weight: 800;
    color: #FFD400;
    text-shadow: 0 0 40px rgba(255,212,0,0.4), 0 0 80px rgba(255,212,0,0.10);
    -webkit-animation: announceNameIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
    animation: announceNameIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
    text-align: center;
    padding: 0 40px;
}

/* ===== Arrived Overlay ===== */

@-webkit-keyframes arrivedPulse {
    0% { -webkit-transform: scale(0.8); transform: scale(0.8); opacity: 0; }
    20% { -webkit-transform: scale(1.1); transform: scale(1.1); opacity: 1; }
    40% { -webkit-transform: scale(1); transform: scale(1); }
    100% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
}
@keyframes arrivedPulse {
    0% { transform: scale(0.8); opacity: 0; }
    20% { transform: scale(1.1); opacity: 1; }
    40% { transform: scale(1); }
    100% { transform: scale(1); opacity: 1; }
}

@-webkit-keyframes arrivedRipple {
    0% { -webkit-transform: scale(0); transform: scale(0); opacity: 0.6; }
    100% { -webkit-transform: scale(4); transform: scale(4); opacity: 0; }
}
@keyframes arrivedRipple {
    0% { transform: scale(0); opacity: 0.6; }
    100% { transform: scale(4); opacity: 0; }
}

@-webkit-keyframes arrivedCheckDraw {
    0% { stroke-dashoffset: 48; }
    100% { stroke-dashoffset: 0; }
}
@keyframes arrivedCheckDraw {
    0% { stroke-dashoffset: 48; }
    100% { stroke-dashoffset: 0; }
}

@-webkit-keyframes arrivedSlideUp {
    from { opacity: 0; -webkit-transform: translateY(30px); transform: translateY(30px); }
    to { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}
@keyframes arrivedSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@-webkit-keyframes arrivedFadeOut {
    from { opacity: 1; }
    to { opacity: 0; pointer-events: none; }
}
@keyframes arrivedFadeOut {
    from { opacity: 1; }
    to { opacity: 0; pointer-events: none; }
}

.arrived-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: rgba(14, 26, 43, 0.96);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    -webkit-animation: announceIn 0.3s ease-out, arrivedFadeOut 0.8s ease-in 4.2s forwards;
    animation: announceIn 0.3s ease-out, arrivedFadeOut 0.8s ease-in 4.2s forwards;
}

.arrived-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #FFD400;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    position: relative;
    -webkit-animation: arrivedPulse 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation: arrivedPulse 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.arrived-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid #FFD400;
    -webkit-animation: arrivedRipple 1.2s ease-out 0.3s both;
    animation: arrivedRipple 1.2s ease-out 0.3s both;
}

.arrived-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid #FFD400;
    -webkit-animation: arrivedRipple 1.2s ease-out 0.6s both;
    animation: arrivedRipple 1.2s ease-out 0.6s both;
}

.arrived-check {
    width: 40px;
    height: 40px;
    stroke: #0E1A2B;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    -webkit-animation: arrivedCheckDraw 0.5s ease-out 0.4s forwards;
    animation: arrivedCheckDraw 0.5s ease-out 0.4s forwards;
}

.arrived-label {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #B8C7E0;
    margin-bottom: 12px;
    -webkit-animation: arrivedSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both;
    animation: arrivedSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both;
}

.arrived-stop-name {
    font-size: 52px;
    font-weight: 800;
    color: #FFD400;
    text-shadow: 0 0 40px rgba(255,212,0,0.4), 0 0 80px rgba(255,212,0,0.10);
    text-align: center;
    padding: 0 40px;
    -webkit-animation: arrivedSlideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both;
    animation: arrivedSlideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both;
}
