/* =====================================================
   SL（蒸気機関車）テーマ (theme-sl.css)
   ===================================================== */

/* 基本テーマ変数 */
body.theme-sl {
    --train-body-color: #1a1a1a;
    /* 石炭の黒色 */
    --train-roof-color: #111;
    --train-window-frame: #444;
    --train-line-color: #d4af37;
    /* ゴールド */
    --passenger-car-color: #5d4037;
    /* レトロブラウン */
}

/* Red accents for SL */
body.theme-sl .train-car {
    border-bottom: 8px solid #a00;
}

/* ------------------------------------------------
   1. 機関車（1両目）
   ------------------------------------------------ */
body.theme-sl .train-car:first-child {
    /* 標準の車両スタイルをリセット */
    background: none;
    box-shadow: none;
    border: none;
    overflow: visible;

    /* ボイラーの形状 */
    background: linear-gradient(to bottom,
            #2c2c2c 0%,
            #000000 30%,
            #2c2c2c 60%,
            #000000 100%);
    border-radius: 10px 10px 0 0;
    width: 340px;
    height: 140px;
    margin-top: 20px;
    /* 他と下部を揃える */
    position: relative;
    z-index: 5;
    /* ロッドの上に重なるようにする */
}

/* 機関車の通常の窓を隠す */
body.theme-sl .train-car:first-child .window {
    display: none;
}

/* 運転席の窓を表示（最後の一つのみ）*/
body.theme-sl .train-car:first-child .window:last-child {
    display: block;
    position: absolute;
    right: 10px;
    top: 10px;
    width: 60px;
    height: 60px;
    background: #444;
    border: 2px solid #d4af37;
    border-radius: 4px;
    z-index: 10;
}

/* 機関車の運転席構造（後部のボックス） */
body.theme-sl .train-car:first-child::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100px;
    height: 160px;
    /* ボイラーより高い */
    background: #111;
    border-top: 4px solid #1a1a1a;
    z-index: 4;
    transform: translateY(-20px);
    /* 突き出る */
}

/* 運転席のナンバープレート */
body.theme-sl .train-car:first-child .window:last-child::after {
    content: 'C57 1';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #d4af37;
    border: 1px solid #d4af37;
    font-size: 10px;
    padding: 1px 4px;
    white-space: nowrap;
}

/* 煙突 */
body.theme-sl .train-car:first-child::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 30px;
    width: 30px;
    height: 50px;
    background: linear-gradient(90deg, #111, #333, #111);
    border-top: 5px solid #000;
    border-radius: 4px 4px 0 0;
    z-index: 4;
}

/* 煙エフェクト */
body.theme-sl.active .train-car:first-child::before {
    box-shadow: 0 -20px 20px rgba(100, 100, 100, 0.5);
    animation: realSmoke 2s infinite ease-out;
}

@keyframes realSmoke {
    0% {
        box-shadow: 0 -10px 10px rgba(50, 50, 50, 0.8), 10px -20px 20px rgba(100, 100, 100, 0.5);
    }

    50% {
        box-shadow: -10px -40px 30px rgba(80, 80, 80, 0.6), 20px -60px 40px rgba(150, 150, 150, 0.4);
    }

    100% {
        box-shadow: -20px -80px 50px rgba(100, 100, 100, 0), 40px -100px 60px rgba(200, 200, 200, 0);
    }
}

/* 前面の排障器（カウキャッチャー） */
body.theme-sl .train-car:first-child .window:first-child {
    display: block;
    /* 最初の窓を排障器のアンカーとして再利用 */
    width: 0;
    height: 0;
    border: none;
    background: none;
    position: absolute;
    bottom: 0;
    left: -20px;
}

body.theme-sl .train-car:first-child .window:first-child::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 40px;
    background: repeating-linear-gradient(45deg, #111, #111 5px, #333 5px, #333 10px);
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
    z-index: 6;
}

/* 動輪（大）- 車輪1 */
body.theme-sl .train-car:first-child .window:nth-child(2) {
    display: block;
    /* 車輪コンテナとして再利用 */
    position: absolute;
    bottom: -15px;
    left: 80px;
    width: 60px;
    height: 60px;
    background: none;
    border: none;
    z-index: 3;
}

body.theme-sl .train-car:first-child .window:nth-child(2)::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, transparent 30%, #a00 35%, #a00 45%, #111 50%);
    border: 4px solid #ccc;
    border-radius: 50%;
    animation: slWheelTurn 1s infinite linear;
    animation-play-state: paused;
}

/* 動輪2 */
body.theme-sl .train-car:first-child .window:nth-child(3)::before {
    content: '';
    position: absolute;
    right: 70px;
    bottom: -5px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, transparent 30%, #a00 35%, #a00 45%, #111 50%);
    border: 4px solid #ccc;
    border-radius: 50%;
    z-index: 3;
    animation: slWheelTurn 1s infinite linear;
    animation-play-state: paused;
}

/* 主連棒（メインロッド） */
body.theme-sl .train-car:first-child .window:nth-child(2)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10px;
    width: 140px;
    height: 8px;
    background: silver;
    border: 1px solid #666;
    transform-origin: 20% 50%;
    z-index: 4;
    animation: slRodMove 1s infinite linear;
    animation-play-state: paused;
}

/* ------------------------------------------------
   2. 炭水車（2両目 - 石炭車）
   ------------------------------------------------ */
body.theme-sl .train-car:nth-child(2) {
    width: 200px;
    height: 100px;
    /* 高さを低く */
    margin-top: 60px;
    /* 下に押し下げる */
    background: #111;
    border-radius: 0 0 4px 4px;
    overflow: visible;
    border: none;
    box-shadow: 4px 5px 10px rgba(0, 0, 0, 0.5);
}

/* 炭水車の窓を隠す */
body.theme-sl .train-car:nth-child(2) .window {
    display: none;
}

/* 積まれた石炭 */
body.theme-sl .train-car:nth-child(2)::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 10px;
    right: 10px;
    height: 40px;
    background:
        radial-gradient(circle at 30% 50%, #000 50%, transparent 55%),
        radial-gradient(circle at 70% 60%, #111 50%, transparent 55%),
        radial-gradient(circle at 50% 40%, #050505 50%, transparent 55%);
    z-index: -1;
}

/* 炭水車の車輪（標準的な台車） */
body.theme-sl .train-car:nth-child(2)::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #333;
    border: 2px solid #555;
    box-shadow: 120px 0 0 #333;
}

/* ------------------------------------------------
   3. 客車（3両目以降）
   ------------------------------------------------ */
body.theme-sl .train-car:nth-child(n+3) {
    background: var(--passenger-car-color);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    border-bottom: 8px solid #000;
}

/* レトロな窓 */
body.theme-sl .train-car:nth-child(n+3) .window {
    border: 2px solid #8d6e63;
    background: rgba(135, 206, 235, 0.6);
}

body.theme-sl .train-car:nth-child(n+3)::before {
    /* 屋根のライン */
    content: '';
    position: absolute;
    top: 5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
}


