/* 公開サイト共通スタイル。スマートフォン幅を基準に、広い画面で段組みにする。 */
:root {
    --bg: #f6f7f4;
    --surface: #ffffff;
    --text: #1d2420;
    --muted: #5d6963;
    --line: #dfe4df;
    --accent: #14653f;
    --accent-weak: #e3f1e9;
    --warn: #8a4b08;
    --warn-weak: #fbf0df;
    --field: #7fb685;
    --infield: #c9a877;
    --stand: #dde3e8;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
    line-height: 1.7;
    -webkit-text-size-adjust: 100%;
    /* 中身が短いページでもフッターを画面の下端に置く */
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; width: 100%; }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid #f0a500;
    outline-offset: 2px;
}

h1 { font-size: 1.6rem; line-height: 1.35; margin: 0.4em 0; }
h2 { font-size: 1.2rem; margin: 1.8em 0 0.6em; }
h3 { font-size: 1.05rem; margin: 1.6em 0 0.6em; scroll-margin-top: 1rem; }

.container { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-size: 0.9rem; }
.lead { font-size: 1.05rem; }
.pre-line { white-space: pre-line; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
}

/* 管理画面のプレビューのときだけ出る帯 */
.preview-banner {
    position: sticky; top: 0; z-index: 10;
    padding: 8px 16px; text-align: center; font-size: 0.9rem; font-weight: 700;
    background: #f0c75e; color: #3b2a00;
}
.preview-banner a { color: #3b2a00; margin-left: 12px; }

/* ヘッダー・フッター */
.site-header { background: var(--accent); }
.header-inner {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 4px 16px; padding-block: 10px;
}
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    color: #fff; font-weight: 700; font-size: 1.45rem; text-decoration: none;
}
.brand img { display: block; border-radius: 50%; }
.site-nav { display: flex; gap: 16px; }
.site-nav a { color: #fff; font-size: 0.95rem; }
.site-footer {
    background: var(--bg);
    margin-top: 48px; padding: 20px 0; border-top: 1px solid var(--line);
    font-size: 0.85rem; color: var(--muted);
}

/* パンくず */
.breadcrumb { margin: 14px 0 4px; font-size: 0.85rem; color: var(--muted); }
.breadcrumb > * + *::before { content: "›"; margin: 0 6px; color: var(--muted); }

/* 球場ページの見出しと「球場を切り替える」。広い画面では横に並べ、狭い画面では見出しの下に出す */
.stadium-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 4px 24px; }
.stadium-head h1 { margin-bottom: 0.2em; }
.stadium-head .muted { margin: 0; }
.stadium-switch { display: grid; gap: 2px; margin-bottom: 4px; }
.stadium-switch label { font-size: 0.8rem; color: var(--muted); }
.stadium-switch-row { display: flex; gap: 6px; }
.stadium-switch select, .stadium-switch button {
    font: inherit; min-height: 44px; padding: 8px 12px; border-radius: 8px;
    border: 1px solid #b9c2bb; background: var(--surface); color: var(--text);
}
.stadium-switch select { max-width: 100%; min-width: 0; }
.stadium-switch button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
/* JS が動くときは選ぶとすぐ移るので、「移動」ボタンは要らない */
.stadium-switch.is-enhanced button { display: none; }

/* TOP */
.quick-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.95rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* 検索フォーム */
.search-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.search-form input, .search-form select, .search-form button {
    font: inherit; padding: 10px 12px; border: 1px solid #b9c2bb;
    border-radius: 8px; background: var(--surface); color: var(--text); min-height: 44px;
}
.search-form input { flex: 1 1 240px; min-width: 0; }
.search-form select { max-width: 100%; }
.search-form button {
    background: var(--accent); border-color: var(--accent); color: #fff;
    font-weight: 700; padding-inline: 22px; cursor: pointer;
}

/* カード */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stack { display: grid; gap: 10px; }
.card {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px; color: var(--text); text-decoration: none;
}
a.card:hover { border-color: var(--accent); }
.card.is-empty { background: transparent; color: var(--muted); }
.card-body { display: grid; gap: 2px; min-width: 0; }
.card-eyebrow { font-size: 0.8rem; color: var(--muted); margin: 0; }
.card-title { font-weight: 700; line-height: 1.45; }
a.card .card-title { color: var(--accent); }
.card-text { font-size: 0.9rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag {
    font-size: 0.75rem; padding: 1px 8px; border-radius: 999px;
    background: var(--accent-weak); color: var(--accent);
}
.pin-number {
    flex: none; width: 30px; height: 30px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 700;
    display: grid; place-items: center; font-size: 0.9rem;
}

/* 座席リスト（partials/seat-table）。スマートフォン幅では階ごとに縦に並べ、広い画面で「階 × 方向」の表にする */
.seat-table, .seat-table tbody, .seat-table tr, .seat-table th, .seat-table td { display: block; }
.seat-table thead { display: none; }
.seat-table tr { margin: 0 0 18px; }
.seat-table th[scope="row"] {
    text-align: left; font-size: 0.95rem; line-height: 1.4;
    padding: 0 0 4px; margin-bottom: 8px; border-bottom: 2px solid var(--line);
}
.seat-table-none { font-weight: 400; font-size: 0.85rem; color: var(--muted); margin-left: 8px; }
.seat-table tbody td { margin-bottom: 10px; min-width: 0; }
.seat-table tbody td.is-empty { display: none; }
.seat-table tbody td::before {
    content: attr(data-side); display: block;
    font-size: 0.8rem; font-weight: 700; color: var(--muted); margin-bottom: 4px;
}
/* マスの中: カードを新しい順に横に並べ、1 枚ずつ横にスクロールする。複数あるときは次のカードの端を見せる */
.seat-scroller {
    position: relative; /* カードの offsetLeft をこの枠からの位置にする（js/seat-table.js） */
    display: flex; gap: 8px;
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.seat-scroller > .seat-chip { flex: 0 0 100%; scroll-snap-align: start; }
.seat-scroller.is-multi > .seat-chip { flex-basis: 86%; }
/*
 * JS が動くとき（is-enhanced。js/seat-table.js）: スクロールバーを隠してカードを 1 枚ずつ見せ、‹ › で切り替える。
 * 後ろに重なったカードの縁で、ほかにも席があることを示す。画面に入ったときに 1 回、次のカードを少し見せる（is-nudging）
 */
.seat-carousel.is-enhanced .seat-scroller {
    scrollbar-width: none;
    margin: 0 8px 8px 0; border-radius: 8px;
    box-shadow:
        4px 4px 0 -1px var(--surface), 4px 4px 0 0 var(--line),
        8px 8px 0 -1px var(--surface), 8px 8px 0 0 var(--line);
}
.seat-carousel.is-enhanced .seat-scroller::-webkit-scrollbar { display: none; }
.seat-carousel.is-enhanced .seat-scroller > .seat-chip { flex-basis: 100%; }
.seat-scroller.is-nudging > .seat-chip { animation: seat-nudge 1.2s ease-in-out 0.2s both; }
@keyframes seat-nudge {
    0%, 100% { transform: translateX(0); }
    40%, 60% { transform: translateX(-44px); }
}
@media (prefers-reduced-motion: reduce) {
    .seat-scroller.is-nudging > .seat-chip { animation: none; }
}
/* ‹ 1 / 3 › 。ボタンは JS が動くときだけ出す */
.seat-carousel-nav { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 4px; }
.seat-carousel-count { font-size: 0.75rem; line-height: 1.4; color: var(--muted); }
.seat-carousel-btn {
    flex: none; width: 44px; height: 36px; padding: 0;
    font: inherit; font-size: 1.3rem; line-height: 1; font-weight: 700;
    color: var(--accent); background: var(--surface);
    border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.seat-carousel-btn:hover:not(:disabled) { border-color: var(--accent); }
.seat-carousel-btn:disabled { color: #b9c2bb; cursor: default; }
.seat-carousel-btn[hidden] { display: none; }
.seat-table-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.seat-chip {
    display: block; min-width: 0; padding: 10px 12px; line-height: 1.45;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
    color: var(--text); text-decoration: none;
}
.seat-chip:hover { border-color: var(--accent); }
.seat-chip-name { display: block; font-weight: 700; color: var(--accent); }
.seat-chip-date { display: flex; flex-wrap: wrap; column-gap: 0.8em; font-size: 0.8rem; color: var(--muted); }
.seat-chip-date { align-items: center; row-gap: 2px; }
.seat-chip-date > span { white-space: nowrap; }
/* 動画の本数（partials/video-count）。TOP の地図のピン（.jm-dot / .jm-count）と同じ色の丸に数字 */
.video-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
    background: #ffb81f; color: #1d2420; box-shadow: 0 0 0 2px #fff;
    font-size: 0.78rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.seat-chip.is-current { background: var(--accent); border-color: var(--accent); }
.seat-chip.is-current .seat-chip-name { color: #fff; }
.seat-chip.is-current .seat-chip-date { color: rgba(255, 255, 255, 0.85); }
.seat-chip.is-current .tag { background: rgba(255, 255, 255, 0.2); color: #fff; }

@media (min-width: 800px) {
    .seat-table {
        display: table; table-layout: fixed;
        border-collapse: separate; border-spacing: 6px;
        width: calc(100% + 12px); margin: 0 -6px;
    }
    .seat-table thead { display: table-header-group; }
    .seat-table tbody { display: table-row-group; }
    .seat-table tr { display: table-row; margin: 0; }
    .seat-table th, .seat-table td { display: table-cell; }
    .seat-table-corner { width: 9.5rem; }
    .seat-table th[scope="col"] { font-size: 0.85rem; color: var(--muted); text-align: center; padding: 0 4px; }
    .seat-table th[scope="row"] {
        vertical-align: middle; font-size: 0.9rem;
        padding: 8px 8px 8px 2px; margin: 0; border: 0;
    }
    .seat-table-none { display: none; }
    .seat-table tbody td {
        vertical-align: top; height: 64px; padding: 6px; margin: 0;
        background: #eceee9; border-radius: 8px;
    }
    .seat-table tbody td.is-empty { display: table-cell; }
    .seat-table tbody td::before { content: none; }
    .seat-table .seat-chip { padding: 8px 10px; font-size: 0.85rem; }
    .seat-carousel-btn { width: 32px; height: 28px; font-size: 1.1rem; border-radius: 6px; }
}

/* 座席 Map（partials/seat-map。保留中で、今は画面で使っていない） */
.seat-map-stage { max-width: 680px; margin: 12px auto 0; text-align: center; }
.seat-map-stage.is-small { max-width: 420px; }
/* 縦長の図でも 1 画面に収める（横幅が余れば中央に寄る） */
.seat-map { width: 100%; height: auto; max-height: 80vh; display: block; }
.map-stand { fill: var(--stand); stroke: #b8c2cb; stroke-width: 0.5; }
.map-field { fill: var(--field); stroke: #fff; stroke-width: 0.6; }
.map-infield { fill: var(--infield); }
.map-mound { fill: #fff; }
.map-labels text { font-size: 3.2px; text-anchor: middle; fill: #33403a; }
/* 球場ごとの図（partials/seat-maps/）。座席の色は自前の配色 */
.map-block { stroke: #fff; stroke-width: 0.35; }
.map-block.is-bay-lower { fill: #7fb0dc; }
.map-block.is-bay-upper { fill: #5a93c8; }
.map-block.is-star-lower { fill: #a9c9e6; }
.map-block.is-star-upper { fill: #86b1d8; }
.map-block.is-net-lower { fill: #4d7fb3; }
.map-block.is-net-upper { fill: #3b6a9c; }
.map-block.is-outfield { fill: #6c9fd0; }
.map-block.is-screen { fill: #33403a; }
.map-block.is-wing { fill: #2f5f8f; }
/* 段ごとの色（横浜スタジアム）。前ほど明るい */
.map-block.is-lower { fill: #a9c9e6; }
.map-block.is-middle { fill: #7fb0dc; }
.map-block.is-upper { fill: #5a93c8; }
.map-block.is-wing, .map-block.is-outfield { stroke-width: 0.25; }
.map-block.is-lower, .map-block.is-middle, .map-block.is-upper { stroke-width: 0.25; }
.map-ground { fill: var(--field); }
.map-line { fill: none; stroke: #fff; stroke-width: 0.4; }
.map-labels text.is-on-stand {
    font-size: 2.6px; font-weight: 700; fill: #fff;
    paint-order: stroke; stroke: #1f3f5f; stroke-width: 0.7; stroke-linejoin: round;
}
/* 階ごとの色（エスコンフィールド）。下の階ほど明るい。凡例（.map-legend）の色見本も同じ色 */
.map-block.is-1f, .map-legend-swatch.is-1f { fill: #a9c9e6; background: #a9c9e6; }
.map-block.is-2f, .map-legend-swatch.is-2f { fill: #7fb0dc; background: #7fb0dc; }
.map-block.is-3f, .map-legend-swatch.is-3f { fill: #5a93c8; background: #5a93c8; }
.map-block.is-4f, .map-legend-swatch.is-4f { fill: #2f5f8f; background: #2f5f8f; }
.map-block.is-1f, .map-block.is-2f, .map-block.is-3f, .map-block.is-4f { stroke-width: 0.2; }
.map-legend {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px;
    list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.85rem;
}
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.map-legend-swatch { width: 14px; height: 14px; border-radius: 3px; }
/* 横浜スタジアム: バックネット裏の前方 */
.map-block.is-net { fill: #3b6a9c; }
/* 通路（区画の中央の線） */
.map-aisles path { fill: none; stroke: #fff; stroke-width: 0.25; stroke-dasharray: 0.6 0.4; opacity: 0.9; }
/* 観戦した席の区画（通路単位の図がある球場） */
.map-block.is-visited { fill: #f0c75e; }
.map-block.is-current { fill: #f0a500; stroke: #7a4f00; stroke-width: 0.4; }
/* 区画が階まるごとの球場は、塗る範囲が広いので色を淡くする（主役はピン） */
.map-block.is-1f.is-current, .map-block.is-2f.is-current, .map-block.is-3f.is-current, .map-block.is-4f.is-current {
    fill: #f0c75e; stroke: #fff; stroke-width: 0.2;
}
/* ピン。先端（三角）が席の位置を指し、上の丸に番号 */
.map-pin path { fill: var(--accent); }
.map-pin circle { fill: #fff; stroke: var(--accent); stroke-width: 0.7; }
.map-pin text {
    font-size: 3.2px; font-weight: 700; text-anchor: middle;
    fill: var(--accent); pointer-events: none;
}
.map-pin:hover circle, .map-pin:focus circle, .map-pin.is-current circle { fill: var(--accent); }
.map-pin:hover text, .map-pin:focus text, .map-pin.is-current text { fill: #fff; }
.map-pin.is-current circle { stroke: #f0a500; stroke-width: 1; }
.map-pin.is-current path { fill: #f0a500; }

/* 座席ページ */
.seat-notes { display: grid; gap: 16px; }
.prose { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px; }
.prose h2 { font-size: 1.05rem; margin-top: 1.2em; }
/* 球場メモ・座席コメント：写真 → コメントを縦に並べる（ブログ風） */
.notes { display: grid; gap: 28px; max-width: 760px; }
.note { display: grid; gap: 10px; }
.note-photo { margin: 0; }
.note-photo img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: var(--line); }
.note-comment { margin: 0; line-height: 1.8; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.weather { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 1.1rem; }
.weather-icon { font-size: 2.4rem; line-height: 1; }
.weather .muted { display: block; }

/* 動画 */
.video-card { flex-direction: column; padding: 0; overflow: hidden; gap: 0; }
.video-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #ccd3cd; display: block; }
.video-card .card-body { padding: 10px 14px 14px; }

/* ページ送り */
.pagination { display: flex; gap: 16px; align-items: center; margin: 20px 0; }

/* TOP の日本地図。色は地球儀（public/js/home.js）と合わせる */
.japan-map { width: 100%; height: auto; display: block; }
.jm-sea { fill: #2f76a8; }
.jm-land { fill: #7ebe8c; stroke: #5fa570; stroke-width: 0.8; stroke-linejoin: round; }
.jm-prefectures { stroke: #f4fbf5; stroke-width: 1.4; }
.jm-area { fill: none; stroke: #fff; stroke-width: 1.5; stroke-dasharray: 4 3; }
.jm-area-line { stroke: #fff; stroke-width: 1.5; stroke-dasharray: 4 3; }
.jm-inset { fill: #3f8dc0; }
.jm-inset-frame { fill: none; stroke: #fff; stroke-width: 2.5; }
.jm-inset-title {
    font-size: 20px; font-weight: 700; fill: #fff;
    paint-order: stroke; stroke: #123c5c; stroke-width: 4; stroke-linejoin: round;
}
.jm-leader { stroke: #fff; stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; }
.jm-shift { stroke: #123c5c; stroke-width: 2; }
.jm-origin { fill: #123c5c; stroke: #fff; stroke-width: 1; }
.jm-hit { fill: transparent; }
.jm-pin .jm-dot { fill: #ffb81f; stroke: #fff; stroke-width: 2.5; }
.jm-count { font-size: 18px; font-weight: 700; fill: #1d2420; text-anchor: middle; pointer-events: none; }
.jm-label {
    font-size: 22px; font-weight: 700; fill: #fff;
    paint-order: stroke; stroke: #123c5c; stroke-width: 5; stroke-linejoin: round;
}
a.jm-pin { cursor: pointer; }
a.jm-pin:hover .jm-dot, a.jm-pin:focus .jm-dot { fill: #fff; }
a.jm-pin:hover .jm-label, a.jm-pin:focus .jm-label { fill: #ffd76a; }
.jm-pin.is-empty .jm-dot { fill: #fff; stroke: #123c5c; stroke-width: 2; }
.jm-pin.is-empty .jm-label { font-weight: 400; fill: #e3eef5; stroke-width: 4; }
/* TOP：背景で切り替わる球場の写真。画面に固定して、地図などをその上に重ねる */
.bg-slides { position: fixed; inset: 0; z-index: -1; background: #12251c; overflow: hidden; }
.bg-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; }
.bg-slide.is-active { opacity: 1; }
.bg-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-slide.is-active img { animation: bg-drift 8s ease-out both; }
/* 地図が主役なので写真は少し暗くする */
.bg-slide::after { content: ""; position: absolute; inset: 0; background: rgba(8, 20, 30, 0.35); }
@keyframes bg-drift {
    from { transform: scale(1.08); }
    to { transform: scale(1); }
}

/* TOP：ヘッダーは写真の上に重ねる */
.is-home .site-header { background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0)); }
.is-home .brand { font-size: clamp(1.6rem, 4vw, 2.2rem); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.is-home .brand img { width: 64px; height: 64px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
.is-home .header-inner { padding-block: 14px 6px; }

/* TOP：地図の下の「席・動画を探す」 */
.map-actions { text-align: center; margin: 20px 0 0; }
.map-search {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 28px;
    border-radius: 999px; background: #fff; color: var(--text);
    font-weight: 700; text-decoration: none; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.map-search::before { content: "🔍"; }
.map-search:hover { background: #ffd76a; }

/* TOP の地球儀 → 日本地図 */
html { scroll-behavior: smooth; }
.map-section { scroll-margin-top: 8px; }
.map-stage {
    position: relative; max-width: 720px; margin: 16px auto 0;
    border-radius: var(--radius); overflow: hidden;
}
.map-stage:not(.is-intro) { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45); }
.map-stage .japan-map { margin: 0; transition: opacity 0.5s ease; }
.map-stage.is-intro .japan-map { opacity: 0; pointer-events: none; }
.map-globe {
    position: absolute; inset: 0; width: 100%; height: 100%;
    cursor: pointer; transition: opacity 0.5s ease;
}
.map-globe.is-leaving { opacity: 0; pointer-events: none; }
.map-stage.is-revealed .jm-pin { animation: pin-drop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes pin-drop {
    from { opacity: 0; transform: translateY(-18px); }
    to { opacity: 1; transform: none; }
}
.map-replay {
    position: absolute; right: 0; top: 0; display: none;
    width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: transparent; color: #fff; font-size: 1.3rem; cursor: pointer;
}
.map-stage.can-replay:not(.is-intro) .map-replay { display: block; }
.map-replay:hover { background: rgba(255, 255, 255, 0.2); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .map-stage.is-revealed .jm-pin { animation: none; }
    .bg-slide.is-active img { animation: none; }
}
