﻿@charset "utf-8";

/* ==========================================
   親大会メニュー＆結果カード枠
   ========================================== */
.menu-section {
    border: 1px solid #A1B9C8;
    padding: 10px;
    background-color: #fff;
    margin-bottom: 15px;
    border-radius: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.result-section {
    border: 1px solid #A1B9C8;
    padding: 15px;
    background-color: #fff;
    margin-bottom: 15px;
    border-radius: 4px;
}

.result-header {
    text-align: right;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* ==========================================
   テーブルレスポンシブ枠 & リンク
   ========================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 10px;
}

.custom-grid {
    min-width: 600px;
}

.error-message {
    color: #d9534f;
    font-size: 0.9rem;
    display: block;
    margin-top: 5px;
}

.sub-link-wrapper {
    margin-top: 10px;
}

/* ==========================================
   PC表示 (769px以上)
   左：メイン可変 / 右：サイドバー 300px固定
   ========================================== */
@media screen and (min-width: 769px) {
    .main-layout {
        display: grid;
        grid-template-columns: 1fr 300px;
        grid-template-areas: "main side";
        gap: 20px;
        align-items: start;
    }

    .main-content {
        grid-area: main;
        min-width: 0;
    }

    .sidebar-right {
        grid-area: side;
        width: 300px;
        display: flex;
        flex-direction: column;
    }

    .ad-sidebar {
        width: 300px;
    }
}

/* ==========================================
   スマホ表示 (768px以下)
   順序: 1. メイン ➔ 2. 広告 ➔ 3. ナビ ➔ 4. 広告
   ========================================== */
@media screen and (max-width: 768px) {
    .main-layout {
        display: flex;
        flex-direction: column;
    }

    /* ラッパー枠を解体して要素単位で並べる */
    .sidebar-right, 
    .main-content {
        display: contents;
    }

    /* --- 並び順ソート (order) --- */
    .block-main       { order: 1; } /* 1. メインエリア（メニュー ＆ 大会一覧） */
    .block-ad-sidebar { order: 2; } /* 2. 広告 */
    .block-nav        { order: 3; } /* 3. ナビゲーションボタン */
    .block-ad-bottom  { order: 4; } /* 4. 広告 */
}