/* ==========================================
   タイムテーブル（サイト共通のポップなデザイン：黒い枠・ずらした色の影・丸ゴシック）

   ※ サイト内のほかのCSS（MYスケジュールなど）にも .act-card / .stage-col-header など
     同じ名前があるので、すべて #fes-timetable（表）と #act-modal（ポップアップ）の中だけに効くように書き、
     色や枠など見た目の要の部分は !important で確実にこちらを使う
   ※ 表の大きさ・並び方（グリッドの寸法）は今までと同じ
   ========================================== */

#fes-timetable,
#act-modal {
    --tt-ink: #1a1a1a;
    --tt-paper: #fffdfb;
    --tt-pink: #ff2d95;
    --tt-pink-soft: #ff8fd4;
    --tt-cyan: #00c2ff;
    --tt-cyan-soft: #7fe8ff;
    --tt-yellow: #ffd400;
    --tt-yellow-soft: #fff44f;
    --tt-green-soft: #b9f6a8;
    --tt-font: "Zen Maru Gothic", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
}

/* ---- テーマの初期デザインを打ち消す（リンクの下線・見出しの線や背景）---- */
#fes-timetable a,
#fes-timetable a:hover,
#act-modal a,
#act-modal a:hover {
    text-decoration: none !important;
    border-bottom-style: none;
    background-image: none !important;
}
#act-modal h3,
#act-modal h3::before,
#act-modal h3::after {
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
}
#act-modal h3::before,
#act-modal h3::after {
    content: none !important;
    display: none !important;
}
#fes-timetable button,
#act-modal button {
    font-family: var(--tt-font);
}

/* ---- 全体 ---- */
#fes-timetable {
    font-family: var(--tt-font);
    color: var(--tt-ink);
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* ---- 日付タブ ---- */
#fes-timetable .fes-day-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 0 4px 6px 0;
    justify-content: center;
}
#fes-timetable .fes-tab-btn {
    flex: 1 1 auto;
    min-width: 110px;
    padding: 9px 18px;
    background: var(--tt-paper) !important;
    border: 2px solid var(--tt-ink) !important;
    border-radius: 999px;
    box-shadow: 3px 3px 0 var(--tt-ink) !important;
    color: var(--tt-ink) !important;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    text-align: center;
    text-shadow: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
#fes-timetable .fes-tab-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--tt-ink) !important;
}
#fes-timetable .fes-tab-btn.active {
    background: var(--tt-pink) !important;
    color: #fff !important;
}

#fes-timetable .fes-timetable-container {
    display: none;
}
#fes-timetable .fes-timetable-container.active {
    display: block;
}

/* ---- 表の外枠 ---- */
#fes-timetable .timetable-scroll-area {
    position: relative;
    overflow: auto;
    max-height: 70vh;
    margin-right: 4px;   /* 影が切れないように */
    background: var(--tt-paper) !important;
    border: 2px solid var(--tt-ink) !important;
    border-radius: 16px 6px 16px 6px;
    box-shadow: 4px 4px 0 var(--tt-pink) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* 表の幅：その日に表示するステージの数（--tt-cols。JSが入れる）に合わせて広がる */
#fes-timetable .timetable-grid-inner {
    display: grid;
    grid-template-columns: 70px repeat(var(--tt-cols, 10), minmax(150px, 1fr));
    grid-template-rows: 48px repeat(51, 22px);
    min-width: calc(70px + var(--tt-cols, 10) * 150px);
    /* 30分ごとの薄い横線（表の目盛り。見出しの高さ 48px から 22px×3行ごと） */
    background: var(--tt-paper) repeating-linear-gradient(to bottom, rgba(26, 26, 26, 0.08) 0 1px, transparent 1px 66px) 0 48px !important;
}

/* ---- 見出し（時間・ステージ名）---- */
#fes-timetable .time-col-header {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tt-ink) !important;
    color: #fff !important;
    font-size: 13px;
    font-weight: 800;
    border: 0 !important;
    border-bottom: 2px solid var(--tt-ink) !important;
    box-shadow: none !important;
}
#fes-timetable .stage-col-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    background: var(--tt-pink-soft) !important;
    color: var(--tt-ink) !important;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-shadow: none;
    border: 0 !important;
    border-bottom: 2px solid var(--tt-ink) !important;
    border-left: 1.5px solid var(--tt-ink) !important;
    box-shadow: none !important;
}
#fes-timetable .stage-col-header:nth-child(3n+3) { background: var(--tt-cyan-soft) !important; }
#fes-timetable .stage-col-header:nth-child(3n+1) { background: var(--tt-yellow-soft) !important; }

/* ステージ名を押すと、マップでその日のそのステージの時間割が開く */
#fes-timetable .stage-col-header .stage-map-link,
#fes-timetable .stage-col-header .stage-map-link:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--tt-ink) !important;
    transition: background 0.15s ease;
}
#fes-timetable .stage-col-header .stage-map-link:hover {
    background: rgba(255, 255, 255, 0.6);
}
#fes-timetable .stage-map-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
#fes-timetable .stage-map-icon {
    flex: 0 0 auto;
}

/* ---- 時間の列 ---- */
#fes-timetable .time-label {
    position: sticky;
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tt-paper) !important;
    color: #555 !important;
    font-size: 11px;
    font-weight: 700;
    border: 0 !important;
    border-right: 2px solid var(--tt-ink) !important;
}

/* ---- 企画カード ---- */
#fes-timetable .act-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-sizing: border-box;
    overflow: hidden;
    margin: 2px 3px;
    padding: 5px 26px 5px 8px;   /* 右はハートのぶん */
    background: #fff !important;
    border: 2px solid var(--tt-ink) !important;
    border-radius: 10px 4px 10px 4px !important;
    box-shadow: 2px 2px 0 var(--tt-pink) !important;
    font-size: 11px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
#fes-timetable .act-card::before,
#fes-timetable .act-card::after {
    content: none !important;
    display: none !important;
}
#fes-timetable .act-card:hover {
    z-index: 6;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--tt-pink) !important;
}
/* 企画名は省略せず、折り返して見せる（枠に入りきらない分だけ隠れる） */
#fes-timetable .act-title {
    font-weight: 800;
    color: var(--tt-ink) !important;
    line-height: 1.3;
    white-space: normal !important;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: normal;
}
#fes-timetable .act-time {
    font-size: 9px;
    font-weight: 800;
    color: var(--tt-pink) !important;
    letter-spacing: 0.3px;
}

/* 枠が短い企画（30分未満） */
#fes-timetable .act-card.compact {
    padding-top: 1px;
    padding-bottom: 1px;
}

/* ---- カード右上のハート ---- */
#fes-timetable .tt-fav-heart {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1.5px solid var(--tt-ink) !important;
    border-radius: 50%;
    background: #fff !important;
    color: #cccccc !important;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease;
}
#fes-timetable .tt-fav-heart::after {
    content: "";
    position: absolute;
    top: -5px; right: -5px; bottom: -5px; left: -5px;   /* タップしやすいよう当たり判定を広げる */
}
#fes-timetable .tt-fav-heart.is-active {
    color: var(--tt-pink) !important;
    background: #fff0f5 !important;
    border-color: var(--tt-pink) !important;
    transform: scale(1.1);
}
#fes-timetable .act-card.compact .tt-fav-heart {
    top: 1px;
    right: 2px;
    width: 16px;
    height: 16px;
    font-size: 9px;
}

/* ---- その日に企画が無いとき ---- */
#fes-timetable .tt-empty {
    padding: 40px 16px;
    text-align: center;
    color: #4a4a4a;
    font-size: 14px;
    font-weight: 800;
}

/* ---- 天気モード（通常 / 雨天時）---- */
#fes-timetable .fes-weather-bar {
    margin-bottom: 14px;
}
#fes-timetable .fes-weather-bar .fes-weather {
    margin-bottom: 0;
}
/* 雨天時モードのときは、ピンクのところを水色にする */
#fes-timetable.is-rain .fes-tab-btn.active {
    background: var(--tt-cyan) !important;
}
#fes-timetable.is-rain .timetable-scroll-area {
    box-shadow: 4px 4px 0 var(--tt-cyan) !important;
}
#fes-timetable.is-rain .act-card,
#fes-timetable.is-rain .act-card:hover {
    box-shadow: 2px 2px 0 var(--tt-cyan) !important;
}
#fes-timetable.is-rain .act-time {
    color: #0088bb !important;
}

/* ==========================================
   企画を押したときのポップアップ（検索結果・マップと同じデザインのカード）
   ========================================== */
#act-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2147483000;   /* サイトのヘッダーより必ず上に出す */
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 26, 0.45) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    font-family: var(--tt-font);
}
#act-modal.open {
    display: flex;
}
#act-modal .fes-modal-content {
    position: relative;
    box-sizing: border-box;
    width: min(360px, calc(100% - 40px));
    max-height: calc(100% - 60px);
    margin-top: 20px;   /* 上にはみ出した×ボタンが画面の外に出ないように */
    padding: 0;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0;
    overflow: visible;
}
#act-modal .fes-modal-body {
    max-height: calc(100vh - 90px);
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    padding: 0 6px 6px 0;   /* カードの影が切れないように */
    overscroll-behavior: contain;
}
/* 閉じるボタン：カードの右上の外側 */
#act-modal .fes-modal-close {
    position: absolute;
    top: -14px;
    right: -8px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 2px solid var(--tt-ink) !important;
    border-radius: 50%;
    background: #fff !important;
    color: var(--tt-ink) !important;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--tt-ink) !important;
    transition: transform 0.15s ease;
}
#act-modal .fes-modal-close:hover {
    transform: rotate(90deg);
}

/* カード本体 */
#act-modal .club-card {
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--tt-paper) !important;
    border: 2px solid var(--tt-ink) !important;
    border-radius: 14px 6px 14px 6px !important;
    box-shadow: 4px 4px 0 var(--tt-pink) !important;
    text-align: left;
}
#act-modal .club-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 42vh;   /* 画像が大きすぎて文字やボタンが画面の外に出ないように */
    max-height: 42dvh;
    overflow: hidden;
    border-bottom: 2px solid var(--tt-ink);
}
#act-modal .club-card-thumb img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    margin: 0;
}
#act-modal .club-card-body {
    display: flex;
    flex-direction: column;
    padding: 12px 14px 14px;
}
#act-modal .club-card-title {
    margin: 0 0 2px !important;
    padding: 0 34px 0 0 !important;
    font-family: var(--tt-font) !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
    letter-spacing: 0.02em;
    color: #222 !important;
    overflow-wrap: anywhere;
}
/* 画像があるときはハートが画像の上にあるので、タイトルの右を空けなくてよい */
#act-modal .club-card-thumb ~ .club-card-body .club-card-title {
    padding-right: 0 !important;
}
#act-modal .club-card-sub-title {
    margin: 0 0 8px !important;
    padding: 0 !important;
    font-family: var(--tt-font);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    color: #777;
    overflow-wrap: anywhere;
}
#act-modal .club-card-meta,
#act-modal .club-card-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 6px !important;
}
#act-modal .meta-chip,
#act-modal .genre-chip {
    display: inline-block;
    padding: 2px 9px;
    border: 1.5px solid var(--tt-ink);
    border-radius: 999px;
    background: #fff;
    color: var(--tt-ink);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
    white-space: nowrap;
}
#act-modal .meta-date { background: var(--tt-pink-soft); }
#act-modal .meta-building { background: var(--tt-cyan-soft); }
#act-modal .genre-chip { background: var(--tt-yellow-soft); }
#act-modal .club-card-excerpt {
    margin: 6px 0 0 !important;
    padding: 0;
    font-size: 13px;
    line-height: 1.7 !important;
    color: #4a4a4a;
    white-space: pre-line;   /* 説明文の改行をそのまま */
    overflow-wrap: anywhere;
}

/* 「開催中」「まもなく」「終了」（マップのカードと同じ） */
#act-modal .card-status {
    align-self: flex-start;
    margin: 0 0 6px;
    padding: 1px 9px;
    border: 1.5px solid var(--tt-ink);
    border-radius: 999px;
    background: #fff;
    color: var(--tt-ink);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
}
#act-modal .card-status[data-status="now"] {
    background: var(--tt-pink);
    border-color: var(--tt-pink);
    color: #fff;
}
#act-modal .card-status[data-status="soon"] { background: var(--tt-yellow-soft); }
#act-modal .card-status[data-status="ended"] {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #6b7280;
}

/* 右上のハート（お気に入り） */
#act-modal .tt-card-heart {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1.5px solid var(--tt-ink) !important;
    border-radius: 50%;
    background: #fff !important;
    color: #cccccc !important;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 1px 1px 0 var(--tt-ink) !important;
    transition: transform 0.1s ease;
}
#act-modal .tt-card-heart.is-active {
    color: var(--tt-pink) !important;
    background: #fff0f5 !important;
    border-color: var(--tt-pink) !important;
    transform: scale(1.1);
}

/* 下のボタン（マップ・Instagram） */
#act-modal .tt-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
#act-modal .tt-card-btn,
#act-modal .tt-card-btn:visited {
    flex: 1 1 140px;
    display: block;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 2px solid var(--tt-ink) !important;
    border-radius: 999px;
    color: var(--tt-ink) !important;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    box-shadow: 2px 2px 0 var(--tt-ink) !important;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
#act-modal .tt-card-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--tt-ink) !important;
}
#act-modal .tt-card-btn-map { background: var(--tt-cyan-soft) !important; }
#act-modal .tt-card-btn-insta { background: var(--tt-pink-soft) !important; }

/* ==========================================
   スマホ用（画面幅600px以下）
   ・全体を小さく表示
   ・表を画面の左右いっぱいまで広げる
   ・端まで引っぱっても、時間の列とステージ名の行が動かない
   ========================================== */
@media (max-width: 600px) {
    #fes-timetable .fes-weather-bar { margin-bottom: 10px; }

    /* 日付タブ：4つを1行に並べる */
    #fes-timetable .fes-day-tabs {
        flex-wrap: nowrap;
        gap: 6px;
        margin-bottom: 10px;
        padding: 0 3px 4px 0;
    }
    #fes-timetable .fes-tab-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 6px 2px;
        font-size: 11px;
        box-shadow: 2px 2px 0 var(--tt-ink) !important;
    }
    #fes-timetable .fes-tab-btn:hover {
        transform: none;
        box-shadow: 2px 2px 0 var(--tt-ink) !important;
    }

    #fes-timetable .timetable-scroll-area {
        width: calc(100vw - 12px);
        margin-left: calc(50% - 50vw + 4px);
        margin-right: 0;
        border-radius: 10px 4px 10px 4px;
        box-shadow: 3px 3px 0 var(--tt-pink) !important;
        max-height: 70vh;
        overscroll-behavior: none;   /* 端まで引っぱってもバウンドせず、見出しが動かない */
    }
    #fes-timetable .timetable-grid-inner {
        grid-template-columns: 42px repeat(var(--tt-cols, 10), minmax(100px, 1fr));
        grid-template-rows: 36px repeat(52, 16px);
        grid-auto-rows: 16px;
        min-width: calc(42px + var(--tt-cols, 10) * 100px);
        /* 見出しの高さ 36px から 16px×3行ごと */
        background: var(--tt-paper) repeating-linear-gradient(to bottom, rgba(26, 26, 26, 0.08) 0 1px, transparent 1px 48px) 0 36px !important;
    }
    #fes-timetable .stage-col-header {
        font-size: 10px;
        line-height: 1.2;
        padding: 0 2px;
        border-left-width: 1px !important;
    }
    #fes-timetable .stage-col-header .stage-map-link {
        flex-direction: column;
        gap: 1px;
        padding: 1px 2px;
    }
    #fes-timetable .stage-map-icon {
        width: 10px;
        height: 10px;
    }
    #fes-timetable .time-col-header {
        font-size: 10px;
    }
    #fes-timetable .time-label {
        font-size: 9px;
        z-index: 7;            /* タップしたカードが時間の列の上に重ならないように */
        border-right-width: 1.5px !important;
    }

    #fes-timetable .act-card {
        margin: 1px;
        padding: 1px 17px 1px 4px;
        border-width: 1.5px !important;
        border-radius: 7px 3px 7px 3px !important;
        box-shadow: 1.5px 1.5px 0 var(--tt-pink) !important;
        font-size: 10px;
    }
    #fes-timetable .act-card:hover {
        transform: none;       /* スマホではタップ後に浮いたままになるので動かさない */
        box-shadow: 1.5px 1.5px 0 var(--tt-pink) !important;
    }
    #fes-timetable.is-rain .act-card,
    #fes-timetable.is-rain .act-card:hover {
        box-shadow: 1.5px 1.5px 0 var(--tt-cyan) !important;
    }
    #fes-timetable .act-time { font-size: 8px; letter-spacing: 0; }
    #fes-timetable .act-title { font-size: 10px; line-height: 1.2; }

    #fes-timetable .tt-fav-heart {
        top: 1px;
        right: 1px;
        width: 14px;
        height: 14px;
        font-size: 8px;
        border-width: 1px !important;
    }
    #fes-timetable .act-card.compact .tt-fav-heart {
        top: 0;
        right: 1px;
        width: 12px;
        height: 12px;
        font-size: 7px;
    }

    /* ポップアップのカード */
    #act-modal .fes-modal-content {
        width: min(340px, calc(100% - 36px));
    }
    #act-modal .club-card-body {
        padding: 10px 12px 12px;
    }
    #act-modal .club-card-title {
        font-size: 16px !important;
    }
    #act-modal .club-card-excerpt {
        font-size: 12px;
    }
    #act-modal .tt-card-btn {
        padding: 8px;
        font-size: 12px;
    }
}
