:root {
    --bg-top: #102a20;
    --bg-mid: #0b1c15;
    --bg-bottom: #07100c;
    --card-text: #f5fff9;
    --muted-text: #b7d4c4;
    --card-top: rgba(255, 255, 255, 0.12);
    --card-bottom: rgba(255, 255, 255, 0.07);
    --card-border: rgba(255, 255, 255, 0.16);
    --card-shadow: rgba(0, 0, 0, 0.35);
    --green-text: #76eda1;
    --green-bg: rgba(63, 215, 123, 0.18);
    --red-text: #ff7a75;
    --red-bg: rgba(255, 122, 117, 0.16);
    --amber-text: #ffd36f;
    --amber-bg: rgba(255, 211, 111, 0.16);
    --neutral-bg: rgba(255, 255, 255, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --font-stack: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --green-fill: #33994f;
    --green-fill-text: #ffffff;
    --orange-fill: #b86b29;
    --orange-fill-text: #ffffff;
    --red-fill: #a82e2e;
    --red-fill-text: #ffffff;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-stack);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--card-text);
    background:
        radial-gradient(circle at top, rgba(63, 215, 123, 0.18), transparent 32%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 46%, var(--bg-bottom) 100%);
}

button,
input {
    font: inherit;
}

h1,
h2,
h3,
p,
dl,
dt,
dd {
    margin: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hidden {
    display: none !important;
}

.app-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 32px;
}

.layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    position: relative;
}

.main-column {
    display: grid;
    gap: 20px;
}

body:not(.detail-view-active) .sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 420px;
    max-width: min(420px, calc(100vw - 32px));
    z-index: 40;
    padding: 12px 12px 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 180ms ease, transform 220ms ease;
    box-shadow: 0 22px 46px rgba(0, 0, 0, 0.34);
    margin: 0;
    background: linear-gradient(180deg, rgba(33, 76, 57, 0.96), rgba(14, 36, 27, 0.98));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 0 0 18px 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

body:not(.detail-view-active) .sidebar::before {
    display: none;
}

body.search-sheet-active:not(.detail-view-active) .sidebar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

body.search-sheet-active:not(.detail-view-active) .main-column {
    grid-column: 1 / -1;
}

.card {
    background: linear-gradient(135deg, var(--card-top), var(--card-bottom));
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 18px 36px var(--card-shadow);
    backdrop-filter: blur(12px);
}

.app-header {
    padding: 22px 24px;
    margin-bottom: 20px;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
}

.eyebrow {
    font-size: 11px;
    line-height: 1.3;
    letter-spacing: 0.13em;
    font-weight: 700;
    color: var(--muted-text);
}

h1 {
    font-size: clamp(1.72rem, 3.1vw, 2.42rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    margin-top: 6px;
    font-weight: 800;
}


.header-branding {
    min-width: 0;
}

.header-branding-top {
    display: block;
}

.header-branding-copy {
    min-width: 0;
}

.header-branding-copy .eyebrow {
    display: block;
}

.header-branding-copy h1 {
    margin-top: 6px;
}


.app-header-subtitle {
    margin-top: 6px;
    color: rgba(245, 255, 249, 0.9);
    font-size: clamp(0.92rem, 1.5vw, 1.16rem);
    line-height: 1.14;
    font-weight: 600;
}

h2 {
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    line-height: 1.12;
    margin-top: 8px;
    font-weight: 700;
}

.header-copy {
    margin-top: 10px;
    color: var(--muted-text);
    max-width: 56ch;
}

.header-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-width: min(100%, 460px);
    margin-left: auto;
}

.detail-header-tools {
    min-width: auto;
    flex: 0 0 auto;
}

.header-search-field {
    flex: 1 1 auto;
    margin-top: 0;
}

.header-search-field input {
    min-height: 44px;
}

.header-action-button {
    flex: 0 0 auto;
    white-space: nowrap;
    margin-left: auto;
}

#pwa-install-button {
    margin-left: 0;
    background: rgba(63, 215, 123, 0.18);
    border-color: rgba(118, 237, 161, 0.32);
    color: var(--green-text);
}

#pwa-install-button:hover,
#pwa-install-button:focus-visible {
    background: rgba(63, 215, 123, 0.24);
    border-color: rgba(118, 237, 161, 0.5);
}

.snapshot-header-copy {
    display: grid;
    gap: 8px;
}

.snapshot-header-city {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.snapshot-header-crossing {
    color: rgba(245, 255, 249, 0.9);
    font-size: clamp(1rem, 1.9vw, 1.5rem);
    line-height: 1.12;
    font-weight: 600;
}

body.search-sheet-active:not(.detail-view-active) .map-section {
    position: relative;
}

body.search-sheet-active:not(.detail-view-active) .selected-crossing-card {
    display: none !important;
}

body.detail-view-active .layout-grid {
    grid-template-columns: minmax(0, 1fr);
}

body.detail-view-active .sidebar,
body.detail-view-active .map-section {
    display: none;
}

body.detail-view-active .snapshot-section-header {
    display: none;
}

body.detail-view-active .main-column {
    grid-column: 1 / -1;
}

body.train-detail-active .ad-section {
    display: none;
}

body.train-detail-active #snapshot-content > :not(#train-detail-view) {
    display: none !important;
}

body.train-detail-active #train-detail-view {
    display: grid !important;
}

body.detail-view-active .header-search-field {
    display: none !important;
    width: 0 !important;
    max-width: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

body.detail-view-active .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

body.detail-view-active .app-header > :first-child {
    min-width: 0;
}

body.detail-view-active #app-header-title {
    font-size: clamp(1.58rem, 3vw, 2.18rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    font-weight: 800;
}

body.detail-view-active .header-tools {
    flex: 0 0 auto;
    width: auto;
    min-width: auto;
    margin-left: auto;
    justify-content: flex-end;
}

body.detail-view-active .header-action-button {
    margin-left: auto;
}

body:not(.detail-view-active) .snapshot-section,
body:not(.detail-view-active) .ad-section {
    display: none;
}

.metric-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--green-bg);
    color: var(--green-text);
    font-size: 0.9rem;
    font-weight: 700;
    border: 1px solid rgba(118, 237, 161, 0.22);
    text-align: center;
}

.metric-pill.neutral {
    background: var(--neutral-bg);
    color: var(--muted-text);
    border-color: rgba(255, 255, 255, 0.12);
}

.sidebar,
.map-section,
.ad-section,
.snapshot-section {
    padding: 18px;
}

.snapshot-section {
    position: relative;
    overflow: hidden;
}

.sidebar {
    max-height: min(58vh, 520px);
    overflow: hidden;
}

.sidebar-header,
.map-section-header,
.ad-section-header,
.snapshot-section-header,
.detail-card-header {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
}

.search-field {
    display: block;
    margin-top: 16px;
}

.search-field input {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.14);
    color: var(--card-text);
    border-radius: 16px;
    min-height: 48px;
    padding: 0 16px;
    outline: none;
    font-size: 15px;
    font-weight: 500;
}

.search-field input::placeholder {
    color: rgba(183, 212, 196, 0.7);
}

.sidebar-message,
.snapshot-message {
    margin-top: 14px;
    color: var(--muted-text);
    font-size: 0.95rem;
}

.snapshot-message.is-loading {
    min-height: 340px;
    display: grid;
    place-items: center;
    margin-top: 8px;
    text-align: center;
    color: var(--card-text);
}

body.detail-view-active .snapshot-message {
    margin-top: 0;
}

body.detail-view-active .snapshot-message.is-loading {
    min-height: clamp(220px, 38vh, 340px);
    margin-top: 0;
}

.snapshot-loading-state {
    display: grid;
    gap: 20px;
    justify-items: center;
    width: min(100%, 760px);
}

body.detail-view-active .snapshot-loading-state {
    width: min(100%, 620px);
    margin: 0 auto;
}

.snapshot-loading-title {
    font-size: clamp(1.2rem, 2.8vw, 1.55rem);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--muted-text);
}

.snapshot-loading-name {
    max-width: 18ch;
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    line-height: 1.06;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--card-text);
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.snapshot-loading-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.24);
    border-top-color: rgba(255, 255, 255, 0.96);
    animation: sr-spin 0.9s linear infinite;
}

.detail-blocking-loader {
    display: grid;
    place-items: center;
    min-height: clamp(220px, 38vh, 340px);
    padding: clamp(22px, 4vw, 34px) clamp(12px, 3vw, 24px);
}

.detail-blocking-loader__inner {
    width: min(100%, 620px);
    margin: 0 auto;
    display: grid;
    justify-items: center;
    gap: 18px;
    text-align: center;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.detail-blocking-loader__title {
    font-size: clamp(1.18rem, 2.9vw, 1.5rem);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--muted-text);
}

.detail-blocking-loader__name {
    max-width: min(100%, 24ch);
    font-size: clamp(2rem, 5vw, 3.1rem);
    line-height: 1.03;
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--card-text);
    text-wrap: balance;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.detail-blocking-loader--message .detail-blocking-loader__inner {
    gap: 20px;
}

.detail-blocking-loader--message .detail-blocking-loader__title {
    font-size: clamp(1.4rem, 3.2vw, 2.1rem);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--card-text);
}

.detail-blocking-loader__spinner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.22);
    border-top-color: rgba(255, 255, 255, 0.98);
    animation: sr-spin 0.9s linear infinite;
}

.crossing-list {
    margin-top: 14px;
    display: grid;
    gap: 10px;
    max-height: calc(min(58vh, 520px) - 118px);
    overflow: auto;
    padding-right: 4px;
}

.crossing-list:empty {
    display: none;
}

.crossing-item {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--card-text);
    padding: 12px 14px;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.crossing-item:hover,
.crossing-item:focus-visible,
.action-button:hover,
.action-button:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(118, 237, 161, 0.36);
    background: rgba(255, 255, 255, 0.08);
}

.crossing-item.is-selected {
    border-color: rgba(118, 237, 161, 0.42);
    background: rgba(63, 215, 123, 0.14);
}

.crossing-item-name {
    font-size: 1rem;
    font-weight: 700;
}

.crossing-item-city {
    margin-top: 6px;
    color: var(--muted-text);
    font-size: 0.93rem;
}

.crossing-item-meta,
.detail-list-tags {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.crossing-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted-text);
}

.crossing-tag.tag-red {
    background: var(--red-bg);
    color: var(--red-text);
}

.map-frame {
    position: relative;
    margin-top: 16px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 520px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.map-canvas {
    width: 100%;
    height: 100%;
}


.crossing-map-pin {
    position: relative;
    display: block;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.crossing-map-pin:focus {
    outline: none;
}

.crossing-map-pin-hit-area,
.crossing-map-pin-halo,
.crossing-map-pin-visual {
    position: absolute;
    left: 50%;
    pointer-events: none;
}

.crossing-map-pin-hit-area {
    top: 0;
    width: 44px;
    height: 44px;
    transform: translateX(-50%);
    border-radius: 999px;
}

.crossing-map-pin-halo {
    bottom: 6px;
    width: 30px;
    height: 30px;
    transform: translateX(-50%) scale(0.88);
    border-radius: 999px;
    background: rgba(10, 132, 255, 0.2);
    opacity: 0;
    transition: opacity 160ms ease, transform 160ms ease;
}

.crossing-map-pin-visual {
    bottom: 6px;
    width: 18px;
    height: 18px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: #0A84FF;
    border: 2px solid rgba(255, 255, 255, 0.96);
    box-shadow: 0 6px 12px rgba(10, 132, 255, 0.28);
}

.crossing-map-pin-visual::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #0A84FF;
}

.crossing-map-pin.is-selected .crossing-map-pin-halo {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.crossing-map-pin.is-selected .crossing-map-pin-visual {
    box-shadow: 0 8px 18px rgba(10, 132, 255, 0.34);
}

.map-overlay-message {
    position: absolute;
    inset: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px;
    border-radius: 0 0 18px 18px;
    background: rgba(7, 16, 12, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--muted-text);
    line-height: 1.5;
}

.selected-crossing-card,
.snapshot-status-card,
.detail-card {
    margin-top: 16px;
    padding: 16px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.22);
}

.selected-crossing-card h3,
.snapshot-status-card h3,
.detail-card h3 {
    margin-top: 8px;
    font-size: 1.25rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.selected-crossing-city,
.snapshot-status-subtitle,
.detail-list-subline {
    margin-top: 6px;
    color: var(--muted-text);
}

.selected-crossing-grid,
.snapshot-kpi-grid,
.snapshot-meta-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.selected-crossing-grid dt,
.snapshot-kpi-grid dt,
.snapshot-meta-grid dt {
    color: var(--muted-text);
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.selected-crossing-grid dd,
.snapshot-kpi-grid dd,
.snapshot-meta-grid dd {
    font-weight: 700;
    line-height: 1.4;
    word-break: break-word;
}

.ad-content,
.snapshot-content {
    margin-top: 14px;
}















.ad-slot-card {
    margin-top: 0;
}

.snapshot-inline-ad-card {
    margin-top: 0;
}

.ad-panel {
    margin-top: 0;
    display: flex;
    justify-content: center;
}

.ad-banner-link,
.ad-banner-static,
.ad-placeholder-shell {
    display: flex;
    width: min(100%, 640px);
    min-height: 250px;
    border-radius: 26px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

.ad-banner-link {
    text-decoration: none;
}

.ad-banner-image {
    display: block;
    width: 100%;
    aspect-ratio: 6 / 5;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.04);
}

.ad-placeholder-shell {
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.ad-placeholder-frame {
    width: min(100%, 560px);
    min-height: 150px;
    border-radius: 16px;
    border: 2px dashed rgba(96, 215, 137, 0.22);
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.ad-placeholder-eyebrow {
    color: rgba(194, 219, 204, 0.95);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.ad-placeholder-title {
    margin-top: 14px;
    font-size: clamp(1.35rem, 2.7vw, 2.2rem);
    line-height: 1.08;
    font-weight: 800;
    color: var(--card-text);
}

.ad-placeholder-subtitle {
    margin-top: 12px;
    color: rgba(231, 243, 235, 0.85);
    font-size: clamp(1rem, 1.8vw, 1.35rem);
    font-weight: 500;
}


.snapshot-status-topline {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.status-open {
    background: var(--green-bg);
    color: var(--green-text);
    border-color: rgba(118, 237, 161, 0.22);
}

.status-closed {
    background: var(--red-bg);
    color: var(--red-text);
    border-color: rgba(255, 122, 117, 0.22);
}

.status-moving {
    background: var(--amber-bg);
    color: var(--amber-text);
    border-color: rgba(255, 211, 111, 0.22);
}

.status-neutral {
    background: var(--neutral-bg);
    color: var(--muted-text);
    border-color: rgba(255, 255, 255, 0.12);
}

.snapshot-status-reason {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--card-text);
    line-height: 1.5;
}

.snapshot-detail-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.detail-list {
    margin-top: 14px;
    display: grid;
    gap: 12px;
}

.detail-list-item {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-list-headline-row {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

.detail-list-headline {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.detail-time-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(63, 215, 123, 0.14);
    color: var(--green-text);
    font-size: 0.82rem;
    font-weight: 700;
}

.detail-empty-state {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--muted-text);
    line-height: 1.5;
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: var(--card-text);
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.action-button:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
}

.status-green {
    color: var(--green-text);
}

.status-red {
    color: var(--red-text);
}

.train-detail-view {
    display: grid;
    gap: 16px;
}

.train-detail-header-card,
.train-detail-schedule-card {
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.07));
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow: 0 14px 28px rgba(0,0,0,0.24);
}

.train-detail-header-card {
    padding: 20px;
}

.train-detail-schedule-card {
    overflow: hidden;
}

.train-detail-header-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.train-detail-icon {
    width: 50px;
    height: 50px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #fff;
    flex: 0 0 50px;
    transition: opacity 160ms ease, filter 160ms ease;
}

.train-detail-icon.is-cancelled {
    opacity: 0.55;
}

.train-detail-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
    flex: 1 1 auto;
}

.train-detail-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.train-detail-name {
    font-size: clamp(1.4rem, 2.2vw, 1.72rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--card-text);
}

.train-detail-name.is-cancelled {
    color: rgba(183, 212, 196, 0.72);
    text-decoration: line-through;
}

.train-detail-destination {
    font-size: 1rem;
    line-height: 1.35;
    color: var(--card-text);
}

.train-detail-destination.is-cancelled {
    color: rgba(183, 212, 196, 0.72);
    text-decoration: line-through;
}

.train-detail-type {
    font-size: 0.9375rem;
    line-height: 1.35;
    color: var(--muted-text);
}

.train-detail-type.is-cancelled {
    color: rgba(183, 212, 196, 0.72);
}

.train-detail-cancelled {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--red-text);
    padding-top: 2px;
}

.train-detail-delay-reasons,
.train-detail-info-reasons {
    display: grid;
    gap: 3px;
    padding-top: 4px;
}

.train-detail-delay-reasons p {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--red-text);
}

.train-detail-info-reasons p {
    font-size: 12px;
    font-weight: 500;
    color: var(--green-text);
}

.train-detail-schedule-header {
    padding: 16px 18px 12px;
}

.train-detail-schedule-header h3 {
    font-size: 20px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.train-detail-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 0 18px 8px;
}

.train-detail-schedule-body {
    min-height: 160px;
}

.train-detail-loading-state,
.train-detail-empty-state {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 12px;
    padding: 24px;
}

.train-detail-loading-state p,
.train-detail-empty-state p {
    color: var(--muted-text);
    line-height: 1.45;
}

.train-detail-loading-spinner {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 4px solid rgba(255,255,255,0.24);
    border-top-color: rgba(245,255,249,0.96);
    animation: sr-spin 0.9s linear infinite;
}

.train-detail-empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--muted-text);
    background: rgba(255,255,255,0.06);
}

.train-detail-empty-state.has-error .train-detail-empty-icon,
.train-detail-empty-state.has-error h4 {
    color: var(--red-text);
}

.train-detail-empty-state h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--card-text);
}

.train-detail-stop-list {
    display: grid;
    gap: 0;
    padding: 8px 16px;
}

.train-stop-row {
    display: flex;
    gap: 10px;
    padding: 8px 2px;
    position: relative;
}

.train-stop-row:not(.is-last) {
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.train-stop-track {
    width: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 14px;
}

.train-stop-symbol {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(118, 237, 161, 0.55);
    margin-top: 2px;
}

.train-stop-symbol.is-target {
    width: 12px;
    height: 12px;
    background: var(--green-text);
}

.train-stop-symbol.is-passed {
    background: rgba(183, 212, 196, 0.72);
}

.train-stop-line {
    width: 2px;
    flex: 1 1 auto;
    margin-top: 4px;
    background: rgba(118, 237, 161, 0.45);
}

.train-stop-line.is-passed {
    background: rgba(183, 212, 196, 0.45);
}

.train-stop-copy {
    flex: 1 1 auto;
    min-width: 0;
    padding-bottom: 12px;
}

.train-stop-row.is-last .train-stop-copy {
    padding-bottom: 4px;
}

.train-stop-copy.is-passed .train-stop-title,
.train-stop-copy.is-passed .train-time-expected,
.train-stop-copy.is-passed .train-time-delay {
    color: rgba(183, 212, 196, 0.78);
}

.train-stop-title {
    font-size: 15px;
    line-height: 1.35;
    font-weight: 400;
    color: var(--card-text);
}

.train-stop-target-title {
    font-weight: 600;
}

.train-stop-subtitle {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted-text);
}

.train-stop-time-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.train-time-block {
    display: grid;
    gap: 2px;
}

.train-time-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--muted-text);
}

.train-time-values {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.train-time-planned {
    font-size: 11px;
    color: rgba(183, 212, 196, 0.78);
    text-decoration: line-through;
}

.train-time-delay {
    font-size: 11px;
    font-weight: 700;
    color: var(--red-text);
}

.train-time-expected {
    font-size: 12px;
    font-weight: 700;
    color: var(--card-text);
}

@media (max-width: 1080px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }

    body.search-sheet-active:not(.detail-view-active) .sidebar {
        width: min(420px, calc(100vw - 40px));
    }

    .crossing-list {
        max-height: 360px;
    }

    .snapshot-detail-grid {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 720px) {
    .app-shell {
        width: min(100%, calc(100% - 18px));
        padding-top: 10px;
    }

    body.search-sheet-active:not(.detail-view-active) .sidebar {
        width: calc(100% - 8px);
        max-width: none;
        left: 0;
        right: 0;
    }

    .app-header {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-branding-top {
        gap: 14px;
        align-items: flex-start;
    }

    .header-app-icon {
        width: 64px;
        height: 64px;
        flex-basis: 64px;
        border-radius: 18px;
    }

    body.detail-view-active .app-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px;
        align-items: start;
    }

    .header-tools {
        min-width: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    body.detail-view-active .header-tools {
        width: auto;
        flex-direction: row;
        align-items: center;
    }

    .sidebar,
    .map-section,
    .ad-section,
    .snapshot-section {
        padding: 16px;
    }

    .selected-crossing-grid,
    .snapshot-kpi-grid,
    .snapshot-meta-grid {
        grid-template-columns: 1fr;
    }

    .map-frame {
        height: 420px;
    }

    .map-canvas {
        height: 100%;
    }

    .snapshot-status-topline,
    .detail-list-headline-row,
    .ad-section-header,
    .ad-slot-meta,
    .snapshot-section-header,
    .detail-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .status-badge,
    .action-button {
        width: 100%;
    }

    #app-header-title {
        font-size: clamp(1.48rem, 7.2vw, 1.9rem);
    }

    .app-header-subtitle {
        font-size: 0.92rem;
    }

    body.detail-view-active #app-header-title {
        font-size: clamp(1.36rem, 7vw, 1.72rem);
    }
}


@media (max-width: 520px) {
    .header-branding-top {
        gap: 12px;
    }

    .header-app-icon {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
        border-radius: 16px;
    }

    .map-frame {
        height: 340px;
    }

    .snapshot-countdown-row {
        grid-template-columns: 72px minmax(0, 1fr) 72px;
        gap: 8px;
    }

    .snapshot-time-side-right {
        justify-self: end;
    }

    .snapshot-countdown {
        font-size: clamp(2rem, 10.8vw, 2.7rem);
    }

    .snapshot-progress-bar {
        height: 16px;
    }

    .snapshot-time-side strong {
        font-size: 0.74rem;
    }
}


.app-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.22);
}

.snapshot-content > .detail-card,
.snapshot-content > .app-card,
.detail-mobile-grid > .detail-card,
.detail-mobile-grid > .app-card {
    margin-top: 0;
}

.snapshot-content {
    display: grid;
    gap: 12px;
}

.detail-mobile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.compact-header h3 {
    margin-top: 6px;
}

.status-eyebrow-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.snapshot-status-copy {
    display: grid;
    gap: 8px;
}

.status-pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(255,255,255,0.2);
    animation: sr-pulse 1.8s ease-out infinite;
}

.status-pulse-dot.status-open-dot {
    animation: none;
}

.status-open-dot {
    background: #37c96a;
    box-shadow: 0 0 0 0 rgba(63, 215, 123, 0.35);
}

.status-closed-dot {
    background: #ff625d;
    box-shadow: 0 0 0 0 rgba(255, 98, 93, 0.34);
}

.status-moving-dot {
    background: #f3a64d;
    box-shadow: 0 0 0 0 rgba(243, 166, 77, 0.34);
}

.status-neutral-dot {
    background: rgba(245,255,249,0.9);
    box-shadow: none;
    animation: none;
}

.snapshot-zone-pill {
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 12px;
    background: rgba(255, 122, 117, 0.12);
    color: #ff847f;
    border: 1px solid rgba(255, 122, 117, 0.08);
    font-size: 0.72rem;
    font-weight: 700;
    width: fit-content;
}

@keyframes sr-pulse {
    0% { box-shadow: 0 0 0 0 currentColor; }
    70% { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.forecast-header-single {
    align-items: flex-start;
}

.snapshot-status-card {
    padding: 20px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.snapshot-status-card h3.snapshot-status-title-large {
    font-size: clamp(1.72rem, 2.3vw, 2.08rem);
    line-height: 0.94;
    margin-top: 6px;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.snapshot-status-card h3.snapshot-status-title-large.status-open-text {
    color: #37c96a;
}

.snapshot-status-subtitle,
.snapshot-status-reason,
.snapshot-zone-pill {
    display: none !important;
}

.snapshot-status-card h3.snapshot-status-title-large.status-closed-text {
    color: #ff625d;
}

.snapshot-status-card h3.snapshot-status-title-large.status-moving-text {
    color: #f3a64d;
}

.snapshot-status-card h3.snapshot-status-title-large.status-neutral-text {
    color: var(--card-text);
}

.snapshot-status-subtitle {
    margin-top: 12px;
    color: var(--muted-text);
    max-width: 70ch;
}

.snapshot-zone-pill {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(255, 122, 117, 0.12);
    color: #ff847f;
    border: 1px solid rgba(255, 122, 117, 0.14);
    font-size: 0.75rem;
    font-weight: 700;
}

.snapshot-countdown-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 120px;
    gap: 12px;
    align-items: end;
}

.snapshot-countdown {
    font-size: clamp(2.02rem, 3.9vw, 2.42rem);
    line-height: 0.95;
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.snapshot-time-side {
    display: grid;
    gap: 4px;
}

.snapshot-time-side strong {
    font-size: 0.76rem;
    font-weight: 700;
    color: rgba(210, 223, 216, 0.92);
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.snapshot-time-side-left {
    text-align: left;
    justify-self: start;
}

.snapshot-time-side-right {
    text-align: right;
    justify-self: end;
}

.snapshot-time-label {
    color: var(--muted-text);
    font-size: 0.66rem;
    text-transform: lowercase;
}

.snapshot-progress-bar {
    position: relative;
    width: 100%;
    height: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.snapshot-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(63, 215, 123, 0.92), rgba(63, 215, 123, 0.7));
    transition: width 0.18s linear, background 0.3s ease;
    will-change: width;
}

.snapshot-progress-fill.status-closed-fill {
    background: linear-gradient(90deg, rgba(255, 98, 93, 0.95), rgba(255, 98, 93, 0.72));
}

.snapshot-progress-fill.status-moving-fill {
    background: linear-gradient(90deg, rgba(243, 166, 77, 0.95), rgba(243, 166, 77, 0.72));
}

.forecast-visualization {
    display: grid;
    gap: 14px;
}

.forecast-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 8px 0 10px;
    color: var(--muted-text);
    font-size: 0.76rem;
    font-weight: 600;
}

.forecast-legend-item {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.forecast-legend-color {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    display: inline-block;
}

.forecast-legend-color-open {
    background: rgba(63, 215, 123, 0.9);
}

.forecast-legend-color-closed {
    background: rgba(255, 98, 93, 0.9);
}

.forecast-strip {
    display: flex;
    gap: 2px;
    align-items: stretch;
    min-height: 52px;
    padding-top: 2px;
    overflow: hidden;
}

.forecast-strip-segment {
    position: relative;
    min-width: 8px;
    border-radius: 14px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    text-align: center;
    overflow: hidden;
}

.forecast-strip-segment.is-closed {
    background: linear-gradient(180deg, rgba(255, 98, 93, 0.96), rgba(214, 67, 58, 0.95));
}

.forecast-strip-segment.is-open {
    background: linear-gradient(180deg, rgba(63, 215, 123, 0.96), rgba(43, 179, 98, 0.95));
}

.forecast-segment-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    padding: 0 6px;
    text-align: center;
}

.forecast-segment-duration {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    text-align: center;
    font-size: clamp(0.82rem, 1.28vw, 1.28rem);
    font-weight: 800;
    line-height: 1;
    margin: 0;
    white-space: nowrap;
}

.forecast-strip-segment.is-text-hidden .forecast-segment-inner {
    display: none;
}

.forecast-segment-subtext {
    font-size: 0.78rem;
    font-weight: 700;
    opacity: 0.96;
}

.forecast-axis {
    position: relative;
    min-height: 20px;
    margin-top: 4px;
    color: var(--muted-text);
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
}

.forecast-axis-label {
    position: absolute;
    top: 0;
    white-space: nowrap;
    font-weight: 400;
    transform: translateX(-50%);
}

.forecast-axis-label.is-hidden {
    display: none;
}

.forecast-axis-label.align-left {
    transform: none;
    text-align: left;
}

.forecast-axis-label.align-right {
    transform: translateX(-100%);
    text-align: right;
}

.forecast-axis-label.is-open {
    color: var(--green-text);
}

.forecast-axis-label.is-closed {
    color: var(--red-text);
}

.forecast-axis-label.is-neutral {
    color: var(--muted-text);
}

.recommendation-card {
    padding: 16px;
}

.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 12px;
    align-items: start;
    grid-auto-rows: min-content;
}

.recommendation-tile {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    padding: 14px;
    color: var(--card-text);
    display: grid;
    align-content: start;
    justify-items: start;
    gap: 6px;
    align-self: start;
    min-height: 0;
    height: auto;
    box-shadow: none;
}

.recommendation-tile.recommendation-tile-neutral {
    background: rgba(255, 255, 255, 0.06);
    color: var(--card-text);
}

.recommendation-tile.recommendation-tile-green {
    background: #33994f;
    color: #ffffff;
}

.recommendation-tile.recommendation-tile-orange {
    background: #b86b29;
    color: #ffffff;
}

.recommendation-tile.recommendation-tile-red {
    background: #a82e2e;
    color: #ffffff;
}

.recommendation-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: 0;
}

.recommendation-subtitle {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    color: rgba(245, 255, 249, 0.8);
}

.recommendation-detail {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.18;
    color: currentColor;
    opacity: 0.9;
}

.timetable-card {
    padding: 16px;
}

.timetable-list {
    display: grid;
    gap: 0;
    margin-top: 8px;
    max-height: min(64vh, 504px);
    overflow-y: auto;
    padding-right: 6px;
}

.timetable-empty-state {
    color: var(--muted-text);
    padding: 18px 6px 8px;
}

.timetable-row {
    appearance: none;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) minmax(76px, auto) 12px;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
}

.timetable-row + .timetable-row,
.timetable-gap-row + .timetable-row,
.timetable-row + .timetable-gap-row {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.timetable-row:hover,
.timetable-row:focus-visible {
    background: rgba(255, 255, 255, 0.035);
    border-radius: 18px;
    outline: none;
}

.timetable-row.is-cancelled .timetable-train-name,
.timetable-row.is-cancelled .timetable-destination {
    color: rgba(183, 212, 196, 0.72);
}

.timetable-row.is-cancelled .timetable-actual-time,
.timetable-row.is-cancelled .timetable-delay-line {
    color: rgba(183, 212, 196, 0.72);
}

.timetable-row.is-cancelled .timetable-delay-line .planned-time {
    color: rgba(183, 212, 196, 0.56);
}

.timetable-row.is-cancelled .train-badge {
    opacity: 0.5;
}

.train-badge {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    flex-shrink: 0;
}

.train-badge.type-re,
.train-badge.type-rb,
.train-detail-icon.type-re,
.train-detail-icon.type-rb {
    background: #ff3f3f;
}

.train-badge.type-s,
.train-detail-icon.type-s {
    background: #31cf63;
}

.train-badge.type-mex,
.train-detail-icon.type-mex {
    background: #db8a3c;
}

.train-badge.type-outline-red,
.train-badge.type-outline-green,
.train-detail-icon.type-outline-red,
.train-detail-icon.type-outline-green {
    background: #ffffff;
    font-style: italic;
    border: 2px solid #ff3f3f;
    color: #ff3f3f;
}

.train-badge.type-outline-green,
.train-detail-icon.type-outline-green {
    border-color: #31cf63;
    color: #31cf63;
}

.train-badge.type-default,
.train-detail-icon.type-default {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

.timetable-main {
    min-width: 0;
}

.timetable-train-header {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.timetable-train-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.15;
    min-width: 0;
}

.timetable-cancel-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 93, 88, 0.16);
    color: #ff7a72;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.timetable-destination {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--muted-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timetable-timing {
    min-width: 76px;
    text-align: right;
    display: grid;
    gap: 2px;
    justify-items: end;
}

.timetable-delay-line {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 9px;
    color: #ff5d58;
    font-weight: 500;
    line-height: 1.1;
}

.timetable-delay-line .delay-value {
    color: #ff5d58;
    font-weight: 500;
}

.timetable-delay-line .planned-time {
    color: var(--muted-text);
    text-decoration: line-through;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.timetable-actual-time {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.timetable-actual-time.is-delayed {
    color: #ff5d58;
}

.timetable-chevron {
    color: rgba(255, 255, 255, 0.52);
    font-size: 12px;
    text-align: right;
}

.timetable-gap-row {
    padding: 8px 14px;
    display: flex;
    justify-content: center;
}

.timetable-gap-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 12px;
    background: rgba(63, 215, 123, 0.12);
    color: #4dd27a;
    border: 1px solid rgba(63, 215, 123, 0.08);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.technical-details {
    padding: 16px;
}

.technical-details summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--muted-text);
}

.technical-details[open] summary {
    margin-bottom: 14px;
}

@media (max-width: 1080px) {
    .detail-mobile-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .snapshot-countdown-row {
        grid-template-columns: minmax(64px, auto) minmax(0, 1fr) minmax(64px, auto);
        gap: 10px;
        align-items: end;
    }

    .snapshot-time-side-left {
        text-align: left;
    }

    .snapshot-time-side-right {
        text-align: right;
    }

    .snapshot-countdown {
        text-align: center;
        font-size: clamp(1.92rem, 7.9vw, 2.72rem);
    }

    .recommendation-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .recommendation-tile {
        min-height: 0;
        height: auto;
        padding: 16px 14px;
        border-radius: 22px;
    }

    .timetable-list {
        max-height: min(62vh, 500px);
    }

    .timetable-row {
        grid-template-columns: 34px minmax(0, 1fr) minmax(72px, auto);
        gap: 10px;
        padding-inline: 12px;
    }

    .timetable-chevron {
        display: none;
    }
}

@media (max-width: 520px) {
    .snapshot-status-card,
    .recommendation-card,
    .timetable-card,
    .technical-details {
        padding: 16px;
    }

    .forecast-strip {
        min-height: 47px;
        padding-top: 0;
    }

    .timetable-row {
        grid-template-columns: 34px minmax(0, 1fr) minmax(68px, auto);
        gap: 10px;
        padding-inline: 12px;
    }

    .train-badge {
        width: 34px;
        height: 34px;
        font-size: 10px;
    }

    .forecast-legend {
        font-size: 0.76rem;
        gap: 12px;
    }

    .forecast-axis {
        font-size: 0.76rem;
    }

    .recommendation-card {
        padding: 14px;
    }

    .recommendation-grid {
        gap: 10px;
    }

    .recommendation-tile {
        min-height: 0;
        height: auto;
        padding: 14px;
        border-radius: 16px;
        gap: 6px;
    }

    .recommendation-title {
        font-size: 17px;
    }

    .recommendation-subtitle {
        font-size: 12px;
    }

    .recommendation-detail {
        font-size: 11px;
    }

    .timetable-train-name,
    .timetable-actual-time {
        font-size: 13px;
    }

    .timetable-destination {
        font-size: 10px;
    }
}


@media (max-width: 380px) {
    .recommendation-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .snapshot-section-header {
        align-items: flex-start;
    }

    .snapshot-header-city {
        font-size: clamp(1.9rem, 8vw, 3rem);
    }

    .snapshot-header-crossing {
        font-size: clamp(1.05rem, 4.2vw, 1.5rem);
    }

    .snapshot-message.is-loading {
        min-height: 260px;
    }
}


@media (max-width: 720px) {
    .train-detail-header-layout {
        align-items: flex-start;
    }

    .train-detail-name {
        font-size: clamp(1.4rem, 7vw, 1.8rem);
    }

    .train-detail-schedule-header h3 {
        font-size: 1.15rem;
    }

    .train-stop-time-grid {
        gap: 12px;
    }
}

@media (max-width: 520px) {
    .train-detail-header-card,
    .train-detail-schedule-card {
        padding: 16px;
        border-radius: 22px;
    }

    .train-detail-header-layout {
        gap: 12px;
    }

    .train-detail-icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
        font-size: 1rem;
    }

    .train-stop-row {
        gap: 8px;
    }

    .train-stop-time-grid {
        flex-direction: column;
        gap: 8px;
    }
}

@keyframes sr-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.snapshot-status-card .status-badge {
    display: none !important;
}


.forecast-legend-item strong {
    font-size: inherit;
    font-weight: 500;
    line-height: 1;
}

.timetable-list {
    position: relative;
}

.timetable-row,
.timetable-gap-row {
    transition: opacity 240ms ease, transform 240ms ease, max-height 240ms ease, margin 240ms ease, padding 240ms ease;
}

.timetable-row.is-entering,
.timetable-gap-row.is-entering {
    opacity: 0;
    transform: translateY(6px);
}

.timetable-row.is-removing,
.timetable-gap-row.is-removing {
    opacity: 0;
    transform: translateY(-14px);
    pointer-events: none;
}

.detail-list-subline:empty {
    display: none;
}


/* Step 10: mobile header fit + ads removed */
body.detail-view-active #app-header-title {
    white-space: nowrap;
}

body.detail-view-active .app-header-subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 720px) {
    body.detail-view-active .app-header {
        padding: 15px 16px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    body.detail-view-active #app-header-title {
        font-size: clamp(1.12rem, 5.6vw, 1.44rem);
        line-height: 1.02;
        letter-spacing: -0.035em;
    }

    body.detail-view-active .app-header-subtitle {
        margin-top: 4px;
        font-size: clamp(0.78rem, 3.3vw, 0.94rem);
        line-height: 1.08;
        font-weight: 600;
    }

    body.detail-view-active .header-action-button {
        min-height: 42px;
        padding: 10px 18px;
        font-size: 0.92rem;
    }
}

@media (max-width: 520px) {
    body.detail-view-active .app-header {
        padding: 14px 14px;
        gap: 9px;
    }

    body.detail-view-active #app-header-title {
        font-size: clamp(1.02rem, 5.1vw, 1.24rem);
    }

    body.detail-view-active .app-header-subtitle {
        font-size: clamp(0.72rem, 3vw, 0.84rem);
    }

    body.detail-view-active .header-action-button {
        min-height: 40px;
        padding: 9px 16px;
        font-size: 0.88rem;
    }
}

.snapshot-inline-ad-card,
#ad-section {
    display: none !important;
}


.legal-footer {
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.legal-footer-nav {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  gap: 10px 18px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.legal-footer-link {
  color: rgba(235, 242, 239, 0.68);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.legal-footer-link:hover,
.legal-footer-link:focus-visible {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: underline;
}

@media (max-width: 720px) {
  .legal-footer {
    margin-top: 16px;
    margin-bottom: 16px;
    padding: 0;
  }

  .legal-footer-nav {
    width: 100%;
    justify-content: center;
    gap: 8px 14px;
    text-align: center;
  }

  .legal-footer-link {
    font-size: 12px;
  }
}


.map-section-header-minimal {
    display: block;
}

.map-section-header-minimal > div {
    min-width: 0;
}


@media (max-width: 720px) {
    #pwa-install-button {
        min-height: 42px;
        padding: 10px 14px;
        font-size: 0.92rem;
    }
}

@media (max-width: 640px) {
    body:not(.detail-view-active) .header-tools {
        width: 100%;
        min-width: 0;
        flex-wrap: wrap;
    }

    body:not(.detail-view-active) .header-search-field {
        flex: 1 1 100%;
    }
}


.detail-ad-card {
    padding: 14px 16px 16px;
}

.detail-ad-slot {
    border-radius: 18px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.detail-adsense,
.detail-adsense-slot {
    width: 100%;
    min-height: 96px;
}

@media (max-width: 720px) {
    .detail-ad-card {
        padding: 12px 14px 14px;
    }

    .detail-ad-slot {
        border-radius: 16px;
        padding: 8px 10px;
    }
}
