/* Liquid Glass 風: 色のにじんだ背景の上に、すりガラスのカードを重ねる
 *
 * iPad 4（iOS 10 の Safari）でも崩れないように、新しめの CSS は使わないか、先に代わりの書き方を置く:
 *   - flex / grid の gap → margin
 *   - clamp() → 固定サイズ + メディアクエリ
 *   - inset → top / right / bottom / left
 *   - color-mix() → 使わない（色ごとに直接書く）
 */
:root {
    --text: #f8fafc;
    --text-sub: rgba(226, 232, 240, 0.72);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-bg-strong: rgba(255, 255, 255, 0.13);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-highlight: rgba(255, 255, 255, 0.45);
    --divider: rgba(255, 255, 255, 0.09);
    --radius: 28px;
    --space: 22px;

    --blue: #3b82f6;
    --sky: #06b6d4;
    --green: #22c55e;
    --red: #ef4444;
    --amber: #fbbf24;

    --line-den: #20a288;  /* 田園都市線 */
    --line-oi: #f18c43;   /* 大井町線 */
    --line-nanbu: #ffd400; /* 南武線 */
}

* {
    box-sizing: border-box;
}

html {
    background: #03050f;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 28px 20px 40px;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
        "Noto Sans JP", "Segoe UI", sans-serif;
    font-feature-settings: "palt";
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    background:
        radial-gradient(40vmax 40vmax at 8% 12%, rgba(59, 130, 246, 0.26), transparent 70%),
        radial-gradient(36vmax 36vmax at 92% 18%, rgba(168, 85, 247, 0.20), transparent 70%),
        radial-gradient(42vmax 42vmax at 78% 92%, rgba(20, 184, 166, 0.18), transparent 70%),
        radial-gradient(34vmax 34vmax at 12% 88%, rgba(244, 114, 182, 0.12), transparent 70%),
        linear-gradient(160deg, #070b1c 0%, #03050f 100%);
    background-attachment: fixed;
}

.page-wrap {
    max-width: 1280px;
    margin: 0 auto;
}

/* カード同士の間隔 */
.page-wrap > * {
    margin-top: var(--space);
}

.page-wrap > :first-child {
    margin-top: 0;
}

/* --- ガラス --- */
.glass {
    position: relative;
    background: linear-gradient(180deg, var(--glass-bg-strong), var(--glass-bg));
    -webkit-backdrop-filter: blur(28px) saturate(170%);
    backdrop-filter: blur(28px) saturate(170%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow:
        inset 0 1px 0 var(--glass-highlight),
        inset 0 -1px 0 rgba(255, 255, 255, 0.06),
        0 18px 40px rgba(0, 0, 0, 0.35);
}

/* 縁に光が回り込むようなハイライト */
.glass::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 35%,
            rgba(255, 255, 255, 0) 65%, rgba(255, 255, 255, 0.25));
    -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* --- ヘッダー --- */
.hero {
    padding: 22px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.hero h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hero .subtitle {
    margin-top: 4px;
    color: var(--text-sub);
    font-size: 0.95rem;
}

.clock {
    margin-left: auto;
    padding-left: 16px;
    text-align: right;
}

.clock #time {
    display: block;
    font-size: 3.4rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

.clock #date {
    display: block;
    margin-top: 6px;
    color: var(--text-sub);
    font-size: 0.95rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--text-sub);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-variant-numeric: tabular-nums;
}

.pill .dot {
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.notice {
    padding: 12px 20px;
    text-align: center;
    color: #fee2e2;
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.28), rgba(239, 68, 68, 0.16));
    border-color: rgba(248, 113, 113, 0.45);
}

/* --- カード --- */
.card {
    padding: 18px 20px 10px;
}

.section-title {
    margin-left: 8px;
    margin-right: 8px;
    margin-bottom: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.04em;
}

.page-wrap > .section-title + * {
    margin-top: 12px;
}

/* --- バス --- */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-variant-numeric: tabular-nums;
}

th,
td {
    padding: 12px 6px;
    text-align: center;
    vertical-align: middle;
}

th {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-sub);
    letter-spacing: 0.05em;
}

td {
    font-size: 1.25rem;
    border-top: 1px solid var(--divider);
}

td.strong {
    font-weight: 700;
    font-size: 1.5rem;
}

td.muted,
.empty {
    color: var(--text-sub);
}

td.late {
    color: var(--amber);
    font-weight: 700;
}

/* --- 電車（3 路線を横に並べる） --- */
.lines {
    display: flex;
    align-items: flex-start;
}

.lines > .line {
    flex: 1 1 0%;
    min-width: 0;
}

.lines > .line + .line {
    margin-left: var(--space);
}

.line {
    --accent: var(--text-sub);
    padding-top: 16px;
    overflow: hidden;
}

.line.den { --accent: var(--line-den); }
.line.oi { --accent: var(--line-oi); }
.line.nanbu { --accent: var(--line-nanbu); }

/* 路線カラーの光 */
.line::after {
    content: "";
    position: absolute;
    top: -40%;
    right: -20%;
    width: 70%;
    height: 80%;
    background: radial-gradient(closest-side, var(--accent), transparent);
    opacity: 0.28;
    pointer-events: none;
}

/* 末長バス停: 川崎市バス（水色）と東急バス（赤）の 2 色 */
.line.bus .bar {
    background: linear-gradient(90deg, var(--sky), var(--red) 55%, transparent);
}

.line.bus::after {
    top: -60%;
    right: -10%;
    width: 60%;
    height: 130%;
    background:
        radial-gradient(closest-side at 35% 50%, var(--sky), transparent),
        radial-gradient(closest-side at 70% 50%, var(--red), transparent);
}

/* 光より手前に内容を出す */
.line > * {
    position: relative;
    z-index: 1;
}

.line-head {
    display: flex;
    align-items: center;
    margin: 0 4px 6px;
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
}

.line-head > * + * {
    margin-left: 10px;
}

.line-head img {
    height: 22px;
}

.line-head .bar {
    flex: 1 1 auto;
    min-width: 12px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.departures {
    list-style: none;
    margin: 0;
    padding: 0;
}

.departures li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 6px;
    border-top: 1px solid var(--divider);
}

.departures .time {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.departures li:first-child .time {
    font-size: 1.9rem;
    font-weight: 700;
}

/* --- 種別バッジ（色付きガラス） ---
 * iOS 10 の Safari は color-mix() も、var() を含む行の代わりの指定も効かないので、色ごとに直接書く */
.badge {
    display: inline-block;
    min-width: 52px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    color: #fff;
    background-color: #3b82f6;
    background-image: linear-gradient(180deg, #5894f7, #3b82f6);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px rgba(59, 130, 246, 0.45);
}

.badge.blue {
    background-color: #3b82f6;
    background-image: linear-gradient(180deg, #5894f7, #3b82f6);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px rgba(59, 130, 246, 0.45);
}

.badge.sky {
    background-color: #06b6d4;
    background-image: linear-gradient(180deg, #2bc1da, #06b6d4);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px rgba(6, 182, 212, 0.45);
}

.badge.green {
    background-color: #22c55e;
    background-image: linear-gradient(180deg, #43cd76, #22c55e);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px rgba(34, 197, 94, 0.45);
}

.badge.red {
    background-color: #ef4444;
    background-image: linear-gradient(180deg, #f16060, #ef4444);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px rgba(239, 68, 68, 0.45);
}

/* --- 中くらいの幅（iPad 縦など）: 3 路線は横並びのまま詰める --- */
@media (max-width: 1100px) {
    :root {
        --space: 16px;
        --radius: 24px;
    }

    body {
        padding: 20px 16px 28px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .clock #time {
        font-size: 2.8rem;
    }

    td {
        font-size: 1.1rem;
    }

    td.strong {
        font-size: 1.3rem;
    }

    /* iPad ではバス・電車とも行の高さを 42px にそろえて詰める */
    .line.bus tbody tr {
        height: 42px;
    }

    .line.bus td {
        padding-top: 0;
        padding-bottom: 0;
    }

    .line.bus .badge {
        padding: 2px 10px;
        font-size: 0.8rem;
    }

    .lines .card {
        padding: 14px 12px 6px;
    }

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

    .line-head > * + * {
        margin-left: 6px;
    }

    .departures li {
        height: 42px;
        padding: 0 4px;
    }

    .departures .time {
        line-height: 1.2;
    }

    .departures .time {
        font-size: 1.3rem;
    }

    .departures li:first-child .time {
        font-size: 1.6rem;
    }

    .lines .badge {
        min-width: 44px;
        padding: 3px 8px;
        font-size: 0.75rem;
        letter-spacing: 0.02em;
    }
}

/* --- スマホ: 縦 1 列 --- */
@media (max-width: 600px) {
    body {
        padding: 14px 12px 28px;
    }

    .hero {
        padding: 18px 20px;
    }

    .hero h1 {
        font-size: 1.3rem;
    }

    .clock {
        flex-basis: 100%;
        margin-left: 0;
        padding-left: 0;
        margin-top: 12px;
        text-align: left;
    }

    .clock #time {
        font-size: 2.2rem;
    }

    .card {
        padding: 14px 10px 6px;
    }

    .lines {
        display: block;
    }

    .lines > .line + .line {
        margin-left: 0;
        margin-top: var(--space);
    }

    th {
        font-size: 0.7rem;
    }

    td {
        padding: 10px 2px;
        font-size: 0.95rem;
    }

    td.strong {
        font-size: 1.1rem;
    }

    .badge {
        min-width: 44px;
        padding: 3px 8px;
        font-size: 0.75rem;
    }

    .departures .time {
        font-size: 1.25rem;
    }

    .departures li:first-child .time {
        font-size: 1.5rem;
    }
}
