html[data-game-copy="train"], html[data-game-copy="train"] body {
    background: #132831;
}

html[data-game-copy="train"] body {
    display: block;
}

#page--preloader {
    background: #125374;
    color: #fff;
    isolation: isolate;
}

#page--preloader .rail-intro-art,
#page--preloader::before {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#page--preloader .rail-intro-art img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 36%;
}

#page--preloader::before {
    content: "";
    z-index: 1;
    background: linear-gradient(270deg, #102c40ed 0%, #102c40cf 17%, #102c4066 35%, transparent 62%);
}

#page--preloader .page--content.rail-intro-content {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    padding: max(20px, env(safe-area-inset-top)) min(8%, 88px) max(20px, env(safe-area-inset-bottom));
    transform: none;
    box-sizing: border-box;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
    z-index: 2;
    text-align: start;
    text-shadow: none;
    transition: opacity .2s ease;
}

#page--preloader .rail-brand {
    max-width: min(100%, 320px);
}

#page--preloader .rail-brand p {
    color: #ffdfa2;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.7;
    margin: 0;
    letter-spacing: 0;
}

#page--preloader .rail-kicker {
    display: flex;
    align-items: center;
    gap: 9px;
}

#page--preloader .rail-kicker::before {
    content: "";
    inline-size: 20px;
    block-size: 7px;
    border-block: 2px solid currentColor;
}

#page--preloader #rail-title {
    color: #fff;
    font-size: 64px;
    font-weight: 700;
    line-height: 1.3;
    margin: 7px 0 8px;
    letter-spacing: 0;
}

#page--preloader .rail-brand .rail-tagline {
    color: #f2f8fa;
    font-size: 16px;
    font-weight: 400;
}

#page--preloader .rail-intro-actions {
    display: grid;
    align-items: center;
    min-height: 62px;
    width: min(100%, 250px);
}

#rail-loading {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: #f1f5f6;
    line-height: 1.6;
}

#page--preloader [hidden], #rail-loading.is-failed progress {
    display: none !important;
}

#rail-progress {
    direction: rtl;
    display: block;
    width: 100%;
    height: 6px;
    border: 0;
    border-radius: 3px;
    overflow: hidden;
    background: #dae4ed36;
    color: #ffc96b;
    accent-color: #ffc96b;
}

#rail-progress::-webkit-progress-bar { background: #dae4ed36; }
#rail-progress::-webkit-progress-value { background: #ffc96b; border-radius: 3px; }
#rail-progress::-moz-progress-bar { background: #ffc96b; border-radius: 3px; }

#ui .trackEditor-btn-size-info {
    inset-inline: 4px;
    bottom: 3px;
    margin: 0;
    direction: rtl;
    text-align: center;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

#ui .rail-track-size-full { display: var(--rail-track-full, inline); }
#ui .rail-track-size-short { display: var(--rail-track-short, none); }

.is-mobile #ui .trackEditor-btn-size-info {
    --rail-track-full: none;
    --rail-track-short: inline;
    font-size: 12px;
}

@media (max-width: 812px) {
    #ui .trackEditor-btn-size-info {
        --rail-track-full: none;
        --rail-track-short: inline;
        font-size: 12px;
    }
}

#page--preloader .rail-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    justify-self: start;
    min-height: 48px;
    max-width: 100%;
    padding: 9px 19px;
    border: 1px solid #ffe5b2;
    border-radius: 8px;
    border-color: #ffd4a9;
    background: #b52e24;
    box-shadow: 0 4px 0 #641b1c, 0 9px 22px #0b192a61, inset 0 1px 0 #ffb58e80;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    touch-action: manipulation;
    cursor: pointer;
    transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}

#page--preloader #preloader-start--btn {
    min-height: 56px;
    padding-inline: 12px 18px;
    min-inline-size: min(100%, 188px);
}

#page--preloader .rail-action-icon {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    border-radius: 6px;
    color: #531713;
    background: #ffd68d;
}

#page--preloader .rail-action:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #641b1c, 0 5px 12px #0b192a61;
}

@media (hover: hover) {
    #page--preloader .rail-action:hover { background-color: #a5261f; }
}

#page--preloader .rail-action:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

html.not-supported #page--preloader { display: none; }

[data-game-copy="train"] :is(.about--summary-title, .about--section-wrapper, .toolTip, #share-container, #share-headline) {
    direction: rtl;
    text-align: start;
    letter-spacing: 0;
}

[data-game-copy="train"] .about--sections :is(h2, h3, h4, p) {
    text-transform: none;
}

#component--header .header-nav :is(#header-settings-btn, #header-snapshot, .rail-toolbar-icon) {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    color: #252d35;
    touch-action: manipulation;
}

#component--header .header-nav :is(#header-settings-btn, #header-snapshot) img {
    height: 36px;
    pointer-events: none;
}

.rail-toolbar-icon svg {
    width: 28px;
    height: 28px;
    overflow: visible;
    filter: drop-shadow(2px 0 #fff) drop-shadow(-2px 0 #fff)
            drop-shadow(0 2px #fff) drop-shadow(0 -2px #fff);
    pointer-events: none;
    transition: scale .16s ease;
}

@media (hover: hover) {
    .rail-toolbar-icon:hover svg { scale: 1.12; }
}

.rail-toolbar-icon:focus-visible,
.rail-dialog button:focus-visible,
#component--settings .rail-settings-site:focus-visible {
    outline: 2px solid #087987;
    outline-offset: 3px;
}

#ui .rail-dialog {
    --rail-dialog-surface: #fffdf7;
    --rail-dialog-ink: #192d35;
    --rail-dialog-muted: #465b63;
    --rail-dialog-rule: #dce4df;
    --rail-dialog-control: #edf3ef;
    --rail-dialog-accent: #11636b;
    --rail-dialog-cta-text: #fff;
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    width: min(440px, calc(100% - 32px));
    max-width: none;
    height: max-content;
    max-height: calc(100% - 36px);
    max-height: calc(100dvh - 36px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--rail-dialog-rule);
    border-radius: 8px;
    background: var(--rail-dialog-surface);
    color: var(--rail-dialog-ink);
    box-shadow: 0 18px 56px #101e3154;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    pointer-events: auto;
    cursor: default;
}

#ui .rail-dialog:not([open]) { display: none; }
#ui .rail-dialog[open] { animation: rail-dialog-enter .2s ease-out both; }

@keyframes rail-dialog-enter {
    from { opacity: 0; translate: 0 8px; }
    to { opacity: 1; translate: 0 0; }
}

.rail-dialog::backdrop { background: #13242d99; cursor: default; }
.rail-dialog button { cursor: pointer; touch-action: manipulation; }
.rail-dialog input { cursor: text; }

#ui .rail-dialog .rail-dialog-inner {
    display: grid;
    gap: 16px;
    padding: 22px;
    font-size: 16px;
    line-height: 1.85;
}

.rail-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

#ui .rail-dialog h2,
#ui .rail-dialog h3,
#ui .rail-dialog p {
    margin: 0;
    color: inherit;
    letter-spacing: 0;
}

#ui .rail-dialog h2 { font-size: 24px; line-height: 1.45; }
#ui .rail-dialog h3 { font-size: 17px; line-height: 1.6; }
#ui .rail-dialog p { color: var(--rail-dialog-muted); font-size: 15px; }

#ui .rail-dialog .rail-dialog-close {
    display: grid;
    place-items: center;
    position: static;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 8px;
    background: var(--rail-dialog-control);
    color: var(--rail-dialog-ink);
    transform: none;
}

.rail-dialog-close svg,
.rail-dialog-action svg { width: 20px; height: 20px; flex: 0 0 20px; }

#share-copyURL-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--rail-dialog-accent);
    color: var(--rail-dialog-cta-text);
    font-size: 15px;
    font-weight: 700;
}

#share-copyURL-btn:not(.copied) .rail-copy-check,
#share-copyURL-btn.copied .rail-copy-icon { display: none; }

#page--about .about--sections {
    position: relative;
    isolation: isolate;
}

#page--about .about--decoration {
    z-index: 0;
    opacity: .75;
}

#page--about #about-close-btn { z-index: 3; }

#page--about .rail-about-copy {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 26px;
    max-width: 850px;
    margin-inline: auto;
    padding-block: 22px;
    color: #22343e;
    text-shadow: 0 0 4px #fff, 0 1px 4px #fff;
    pointer-events: none;
}

#page--about .rail-about-copy .about--summary-title {
    max-width: none;
    margin: 0;
    font-size: 40px;
    line-height: 1.35 !important;
}

#page--about .rail-about-copy .about--section-wrapper { margin: 0; }

#page--about .rail-about-guide {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 44px;
}

#page--about .rail-about-copy .about--section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    align-content: start;
    gap: 7px;
    margin: 0;
}

#page--about .rail-about-copy :is(h3, h4, p) {
    width: auto;
    max-width: none;
    margin: 0;
    line-height: 1.75;
}

#page--about .rail-about-copy h4 { font-size: 18px; }

#page--about .rail-about-copy .rail-about-team {
    padding-top: 16px;
    border-top: 1px solid #8fa6b775;
}

#page--about .rail-about-team h3 {
    left: auto;
    transform: none;
    font-size: 18px;
}

#page--about .rail-about-copy .rail-about-share-heading,
#page--about .rail-about-copy .rail-about-share-heading + p {
    text-align: var(--rail-about-share-align, left) !important;
}

.is-mobile #page--about,
.is-mobile #page--about .page--content {
    touch-action: pan-y;
}

.is-mobile #page--about .page--content { overflow: visible; }

@media (max-width: 812px), (hover: none) and (pointer: coarse) {
    #page--about .rail-about-copy {
        --rail-about-share-align: right;
        gap: 18px;
        padding-block: 30px 8px;
    }

    #page--about .rail-about-copy .about--summary-title { font-size: 28px; }
    #page--about .rail-about-guide { grid-template-columns: minmax(0, 1fr); }
    #page--about .about--decoration { opacity: .4; }
}

#component--settings {
    background: #13242d59;
    overflow: hidden;
    transition: opacity .24s ease;
}

#component--settings .component--content {
    position: absolute;
    inset: 0 0 0 auto;
    box-sizing: border-box;
    width: min(380px, 100%);
    height: 100%;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) 12px;
    transform: translate3d(100%, 0, 0);
    transition: transform .24s ease;
}

#component--settings .component--content.animate {
    transform: translate3d(0, 0, 0);
    transition: transform .24s ease;
}

#component--settings .component--content .component-wrapper {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-width: 0;
    max-height: none;
    margin: 0;
    border-radius: 8px;
    padding: 44px 24px 20px;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

#component--settings .component--content .component-wrapper h3 { margin-bottom: 28px; }

#component--settings :is(.settings-switch-day-night, .settings-row) {
    animation-name: rail-settings-row-enter;
}

@keyframes rail-settings-row-enter {
    from { opacity: 0; transform: translate3d(16px, 0, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.night-time #ui .rail-dialog {
    --rail-dialog-surface: #262c36;
    --rail-dialog-ink: #f7f7f5;
    --rail-dialog-muted: #d0d7de;
    --rail-dialog-rule: #47515c;
    --rail-dialog-control: #394450;
    --rail-dialog-accent: #95d5ca;
    --rail-dialog-cta-text: #142a2e;
}

#component--settings .rail-settings-site {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-inline: auto;
    padding-inline: 12px;
    color: inherit;
    font: 700 16px/1.5 IRANYekanX, Tahoma, sans-serif;
    direction: rtl;
}

#component--settings .rail-settings-site:hover {
    text-decoration: underline;
}

#component--settings .rail-graphics {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    color: inherit;
    font: 700 14px/1.5 IRANYekanX, Tahoma, sans-serif;
}

#component--settings .rail-graphics select {
    min-height: 44px;
    max-width: 55%;
    padding-inline: 9px 24px;
    border: 1px solid #91afbc;
    border-radius: 8px;
    background: #f6fbff;
    color: #1b3e51;
    font: inherit;
}

#component--settings .rail-graphics select:focus-visible {
    outline: 2px solid #2184a8;
    outline-offset: 2px;
}

#rail-share-link:not([hidden]) {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
    margin-top: 14px;
    padding: 6px 10px;
    border: 1px solid #9bb9c9;
    border-radius: 6px;
    background: #f4faff;
    color: #132831;
    font-size: 14px;
}

@media (orientation: portrait) {
    #page--preloader .rail-intro-art img { object-position: 50% 26%; }

    #page--preloader::before {
        background: linear-gradient(0deg, #102c40 0%, #102c40f0 13%, #102c40b8 28%, #102c4033 49%, transparent 68%);
    }

    #page--preloader .page--content.rail-intro-content {
        justify-content: flex-end;
        gap: 15px;
        padding-bottom: max(23px, env(safe-area-inset-bottom));
    }

    #page--preloader #rail-title { font-size: 47px; }
}

@media (max-width: 760px) and (orientation: landscape) {
    #page--preloader #rail-title { font-size: 48px; }
}

@media (max-height: 340px) {
    #page--preloader .page--content.rail-intro-content { gap: 8px; }
    #page--preloader #rail-title { font-size: 32px; margin-block: 2px; }
    #page--preloader .rail-brand .rail-tagline { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    #page--preloader .page--content.rail-intro-content, #page--preloader .rail-action { transition: none; }
    #ui .rail-dialog[open], #component--settings :is(.settings-switch-day-night, .settings-row) {
        animation: none;
        opacity: 1;
        transform: none;
    }
    #component--settings .component--content,
    #component--settings .component--content.animate,
    .rail-toolbar-icon svg { transition: none; }
}
