.gojuon-index {
    max-width: 1000px;
    margin: 20px auto;
    font-family: "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", Meiryo, sans-serif;
}

.gojuon-container {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.gojuon-left {
    flex: 0 0 300px;
}

.gojuon-right {
    flex: 1;
}

.gojuon-table,
#posts-container {
    background: #fff;
    border: 1px solid #ccc;
    box-sizing: border-box;
    height: 100%;
    min-height: 450px;
}

.gojuon-table {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#posts-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* 右側カード枠内をスクロール対応 */
    max-height: 450px;
    overflow: hidden;
}

.gojuon-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    justify-content: center;
    width: 100%;
}

.gojuon-row:last-child {
    margin-bottom: 0;
}

/* や行とわ行の調整 */
.gojuon-row:nth-child(8) { /* や行 */
    justify-content: center;
    padding: 0 32px;
}

.gojuon-row:nth-child(10) { /* わ行 */
    justify-content: center;
    padding: 0 64px;
}

.gojuon-char {
    width: 36px;
    height: 36px;
    border: 3px double #999;
    background: #b6e3d4;
    color: white;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.gojuon-char:hover {
    background-color: #a0d7c7;
    border-color: #777;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gojuon-char.has-posts {
    background-color: #b6e3d4;
    color: white;
    border-color: #666;
}

.gojuon-char.has-posts:hover {
    background-color: #9dd1c1;
    border-color: #555;
}

.gojuon-char.no-posts {
    background-color: #e0e0e0;
    color: #999;
    cursor: default;
    border-color: #ccc;
}

.gojuon-char.no-posts:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
    transform: none;
    box-shadow: none;
}

.gojuon-char.active {
    background-color: #8bc5b8;
    color: white;
    border-color: #444;
    box-shadow: 0 0 8px rgba(139, 197, 184, 0.6);
    transform: translateY(-1px);
}

.no-selection {
    text-align: center;
    color: #888;
    margin: auto 0;
    font-size: 14px;
}

#posts-container h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 16px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    flex-shrink: 0;
}

.posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.posts-list li {
    padding: 10px 0;
    border-bottom: 1px dotted #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.posts-list li:last-child {
    border-bottom: none;
}

.posts-list a {
    color: #4a90e2;
    text-decoration: none;
    font-size: 14px;
    flex: 1;
    margin-right: 10px;
}

.posts-list a:hover {
    text-decoration: underline;
}

.post-date {
    color: #888;
    font-size: 12px;
    flex-shrink: 0;
}

.gojuon-pagination {
    margin-top: 20px;
    text-align: center;
    border-top: 1px solid #ddd;
    padding-top: 15px;
    flex-shrink: 0;
}

.page-btn {
    background: #f8f8f8;
    border: 1px solid #ccc;
    padding: 6px 10px;
    margin: 0 2px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.page-btn:hover {
    background-color: #e0e0e0;
    transform: translateY(-1px);
}

.page-btn.current {
    background-color: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 14px;
    margin: auto 0;
}

/* セット1とセット2の色分け（グループタイトルのみ） */
.grouped-posts {
    flex: 1;
    overflow-y: auto;
}

.main-group {
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.main-group:last-child {
    margin-bottom: 0;
}

.main-item-title {
    background: #f8f9fa;
    color: #333;
    font-size: 15px;
    font-weight: bold;
    margin: 0;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.gojuon-set1 .main-item-title {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.gojuon-set2 .main-item-title {
    background: #f3e5f5;
    border-left: 4px solid #9c27b0;
}

.sub-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
}

.sub-post-item {
    border-bottom: 1px dotted #ddd;
}

.sub-post-item:last-child {
    border-bottom: none;
}

/* 記事アイテムのレイアウト調整 */
.sub-post-main {
    display: flex;
    flex-direction: column;
    padding: 10px 15px;
}

.sub-post-main a.post-title-link {
    color: #4a90e2;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
}

.sub-post-main a.post-title-link:hover {
    text-decoration: underline;
}

.sub-post-main a {
    color: #4a90e2;
    text-decoration: none;
    font-size: 14px;
    flex: 1;
    margin-right: 10px;
}

.sub-post-main a:hover {
    text-decoration: underline;
}

/* アイキャッチ画像スタイル */
.post-thumbnail {
    margin-top: 0;
}

.post-thumbnail-link {
    display: block;
    text-decoration: none;
}

.post-thumbnail img {
    width: 100%;
    height: auto;
    max-width: 200px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.post-thumbnail-link:hover img {
    transform: scale(1.02);
}

/* モバイル版：高さ固定でコンパクト表示 */
@media (max-width: 768px) {
    .gojuon-row {
        gap: 3px; /* 横のパディング（ボタン間の間隔）を2pxから3pxに拡大 */
        margin-bottom: 3px; /* 縦のパディング（行間の間隔）を2pxから3pxに拡大 */
    }
    
    .gojuon-container { 
        gap: 8px;
        height: 270px;
    }
    
    .gojuon-left { 
        flex: 0 0 125px;
    }
    
    .gojuon-table,
    #posts-container {
        height: 270px;
        min-height: auto;
        padding: 8px;
        /* モバイル版でも右側カード枠内をスクロール対応 */
        max-height: 270px;
        overflow: hidden;
    }
    
    .gojuon-char { 
        width: 20px;
        height: 20px;
        font-size: 10px;
        border-width: 3px;
    }
    
    .gojuon-row {
        gap: 2px;
        margin-bottom: 2px;
    }
    
    .gojuon-row:nth-child(8) {
        padding: 0 12px;
    }
    
    .gojuon-row:nth-child(10) {
        padding: 0 24px;
    }
    
    .no-selection {
        font-size: 7px;
    }
    
    #posts-container h3 {
        margin: 0 0 6px 0;
        font-size: 7px;
        padding-bottom: 3px;
        line-height: 1.1;
        word-break: break-all;
    }
    
    .posts-list {
        max-height: 190px;
        overflow-y: auto;
    }
    
    .posts-list li {
        padding: 3px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .posts-list a {
        font-size: 7px;
        margin-right: 0;
        line-height: 1.3;
        word-break: break-all;
    }
    
    .post-date {
        font-size: 6px;
        align-self: flex-end;
    }
    
    .grouped-posts {
        max-height: 190px;
        overflow-y: auto;
    }
    
    .main-group {
        margin-bottom: 6px;
    }
    
    .main-item-title {
      font-size: 10px;
      padding: 0px;
      /* line-height: 1.3; */
      margin: 0;
      font-weight: 600;
      word-break: break-all;
    }
    
    .sub-post-main {
        padding: 3px 6px;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .sub-post-main a {
        font-size: 10px;
        margin-right: 0;
        line-height: 1.3;
        word-break: break-all;
    }
    
    .gojuon-pagination {
        margin-top: 6px;
        padding-top: 4px;
    }
    
    .page-btn {
        padding: 2px 3px;
        margin: 0 1px;
        font-size: 5px;
    }
    
    .loading {
        padding: 15px;
        font-size: 6px;
    }
    
    .no-posts {
        font-size: 6px !important;
        line-height: 1.2;
        padding: 8px 0;
    }
    
    /* モバイル版でのAFFINGER6のh3タイトルサイズをさらに小さく */
    .post h3.has-st-regular-font-size, .post h3:not([class^="is-style-st-heading-custom-"]):not( [class*=" is-style-st-heading-custom-"] ):not(.st-css-no2):not(.rankh3):not(.post-card-title):not(#reply-title), .h3modoki, .st-step-title {
        font-size: 10px !important;
        line-height: 9px !important;
        margin: 0 0 6px 0 !important;
        padding-bottom: 3px !important;
    }

    /* 右側カード枠内のh4タイトルのみを上書き */
    #posts-container .main-item-title {
        font-size: 10px !important;
        padding: 6px 8px !important;
        margin: 0 !important;
        line-height: 1.3 !important;
        font-weight: 600 !important;
        word-break: break-all;
        background-color: #f8f9fa !important;
    }

    /* セット1とセット2の色分けも維持 */
    #posts-container .gojuon-set1 .main-item-title {
        background: #e3f2fd !important;
        border-left: 3px solid #2196f3 !important;
    }

    #posts-container .gojuon-set2 .main-item-title {
        background: #f3e5f5 !important;
        border-left: 3px solid #9c27b0 !important;
    }

    /* モバイル版の調整 */
    @media (max-width: 768px) {
        .sub-post-main {
            padding: 8px 6px;
        }
        
        .sub-post-main a.post-title-link {
            font-size: 10px;
            margin-bottom: 4px;
            line-height: 1.3;
            word-break: break-all;
        }
        
        .post-thumbnail img {
            max-width: 100px;
            border-radius: 2px;
        }
    }
}
