/* セトリ予測・AI予測 デザイン刷新（Issue #307）
   既存の各ページCSSの後に読み込まれ、帯見出し＋白カードの統一デザインへ寄せる。
   クラス名・JSフックは既存のまま維持する。 */

/* ===== レイアウト ===== */
.pr-main {
    width: 100%;
    max-width: 1348px;
    margin: 0;
    padding: 6px 30px 48px;
    box-sizing: border-box;
}

.pr-edit .pr-main {
    max-width: 1100px;
}

@media (max-width: 767px) {
    .pr-main {
        padding: 4px 16px 40px;
    }
}

/* ===== 見出し（帯見出し） ===== */
.pr-heading,
.pr-main .section-title h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--theme-heading);
    font-size: 19px;
    font-weight: bold;
}

.pr-heading::before,
.pr-main .section-title h2::before {
    content: "";
    width: 5px;
    height: 22px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--theme-btn-from), var(--theme-primary));
    flex: 0 0 auto;
}

.pr-heading {
    margin: 14px 0 14px;
}

.pr-main .section-title {
    width: auto;
    max-width: none;
    margin: 22px 0 12px;
}

/* ===== カードの共通表面 ===== */
.pr-main .prediction-card,
.pr-main .live-card,
.pr-main .prediction-result-card,
.pr-main .prediction-comparison-card,
.pr-main .ai-detail-card {
    background: #fff;
    border: 1px solid var(--theme-border-soft);
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(61, 44, 46, .06);
}

.pr-main .live-name {
    color: var(--theme-text);
    font-size: 17px;
    font-weight: bold;
    line-height: 1.45;
}

.pr-main .live-info {
    color: var(--theme-text-sub);
    font-size: 13px;
    line-height: 1.6;
}

/* ===== 空状態 ===== */
.pr-main .no-prediction,
.pr-main .no-live,
.pr-main .no-setlist {
    background: #fff;
    border: 1px solid var(--theme-border-soft);
    border-radius: 20px;
    padding: 26px 18px;
    color: var(--theme-text-sub);
    text-align: center;
    font-size: 14px;
}

/* ===== 入口（index） ===== */
.pr-index .prediction-menu {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pr-index .prediction-menu-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 88px;
    padding: 18px 20px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--theme-border-soft);
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(61, 44, 46, .06);
    color: var(--theme-text);
    font-size: 16.5px;
    font-weight: bold;
    text-decoration: none;
}

.pr-index .prediction-menu-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--theme-blush);
    color: var(--theme-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.pr-index .prediction-menu-icon svg {
    width: 26px;
    height: 26px;
}

@media (min-width: 768px) {
    .pr-index .prediction-menu {
        flex-direction: row;
    }

    .pr-index .prediction-menu-btn {
        flex: 1;
    }
}

/* ===== 一覧（ユーザー／AI） ===== */
.pr-list .prediction-search-area {
    background: #fff;
    border: 1px solid var(--theme-border-soft);
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(61, 44, 46, .06);
    padding: 14px;
    margin: 10px 0 16px;
}

.pr-list .prediction-search-area .search-form input[type="text"],
.pr-ai-list .search-area .search-form input[type="text"] {
    border: 1px solid var(--theme-border-soft);
    border-radius: 12px;
    min-height: 42px;
    padding: 8px 12px;
    box-sizing: border-box;
    font-size: 14.5px;
}

.pr-list .search-bottom button[type="submit"],
.pr-ai-list .search-bottom button[type="submit"] {
    background: linear-gradient(135deg, var(--theme-btn-from), var(--theme-primary));
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-weight: bold;
    min-height: 40px;
    padding: 8px 22px;
    cursor: pointer;
}

.pr-list .prediction-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pr-list .prediction-card {
    position: relative;
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 18px;
}

.pr-list .prediction-card .delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-blush);
    color: var(--theme-brand);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.pr-list .prediction-match-pending {
    margin-top: 10px;
    color: var(--theme-text-sub);
    font-size: 12.5px;
}

.pr-list .prediction-match-area {
    margin-top: 12px;
    background: var(--theme-tint);
    border-radius: 14px;
    padding: 12px 14px;
}

.pr-list .prediction-match-summary-value {
    color: var(--theme-brand);
    font-size: 30px;
    font-weight: bold;
    line-height: 1.15;
}

.pr-list .prediction-match-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.pr-list .prediction-match-breakdown span {
    background: var(--theme-blush);
    border-radius: 999px;
    padding: 4px 12px;
    color: var(--theme-text-sub);
    font-size: 12.5px;
}

.pr-list .prediction-match-breakdown strong {
    color: var(--theme-brand);
}

.pr-list .prediction-actions {
    margin-top: 14px;
}

.pr-list .prediction-buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pr-main .detail-btn,
.pr-main .edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 6px 18px;
    border: 1px solid var(--theme-border-soft);
    border-radius: 999px;
    background: var(--theme-blush);
    color: var(--theme-brand);
    font-size: 13.5px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

.pr-list .share-btn {
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: #111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pr-list .share-btn .x-brand-logo {
    width: 16px;
    height: 16px;
}

.pr-list .unshare-btn {
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid var(--theme-border-soft);
    border-radius: 999px;
    background: #fff;
    color: var(--theme-text-sub);
    font-size: 12.5px;
    font-weight: bold;
    cursor: pointer;
}

.pr-list .add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--theme-btn-from), var(--theme-primary));
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
}

@media (min-width: 1200px) {
    .pr-list .prediction-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        align-items: start;
    }
}

@media (min-width: 1900px) {
    .pr-list .prediction-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== ライブ選択（new） ===== */
.pr-new .prediction-live-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pr-new .prediction-live-card {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--theme-border-soft);
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(61, 44, 46, .06);
}

.pr-new .prediction-live-card .select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--theme-btn-from), var(--theme-primary));
    color: #fff;
    font-size: 13.5px;
    font-weight: bold;
    text-decoration: none;
}

@media (min-width: 1200px) {
    .pr-new .prediction-live-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        align-items: start;
    }
}

@media (min-width: 1900px) {
    .pr-new .prediction-live-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== 詳細（ユーザー） ===== */
.pr-detail .live-card {
    width: auto;
    max-width: none;
    margin: 10px 0 16px;
    padding: 18px;
}

.pr-detail .live-name {
    font-size: 19px;
}

.pr-detail .official-link {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 14px;
    border: 1px solid var(--theme-border-soft);
    border-radius: 999px;
    background: var(--theme-blush);
    color: var(--theme-brand);
    font-size: 12.5px;
    font-weight: bold;
    text-decoration: none;
}

.pr-detail .prediction-result-card {
    width: auto;
    max-width: none;
    margin: 0 0 8px;
    padding: 20px 18px;
}

.pr-detail .prediction-result-heading {
    color: var(--theme-text-sub);
    font-size: 13px;
    font-weight: bold;
}

.pr-detail .prediction-result-value {
    color: var(--theme-brand);
    font-size: 42px;
    font-weight: bold;
    line-height: 1.15;
}

.pr-detail .prediction-result-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    border: 0;
    background: transparent;
}

.pr-detail .prediction-result-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 64px;
    padding: 10px 8px;
    background: #fff;
    border: 1px solid var(--theme-border-soft);
    border-radius: 11px;
    color: var(--theme-text-sub);
    font-size: 13px;
    font-weight: 600;
}

.pr-detail .prediction-result-row strong {
    color: var(--theme-brand);
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.pr-detail .prediction-comparison-card {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 18px;
}

.pr-detail .setlist-area {
    background: #fff;
    border: 1px solid var(--theme-border-soft);
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(61, 44, 46, .06);
    padding: 6px 18px;
}

.pr-detail .setlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--theme-border-soft);
}

.pr-detail .setlist-item:last-child {
    border-bottom: 0;
}

.pr-detail .song-order {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--theme-blush);
    color: var(--theme-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    flex: 0 0 auto;
}

.pr-detail .medley-badge,
.pr-edit .medley-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--theme-blush);
    color: var(--theme-brand);
    font-size: 11.5px;
    font-weight: bold;
    vertical-align: middle;
}

/* ===== AI詳細 ===== */
.pr-ai-detail .ai-detail-card {
    width: auto;
    max-width: none;
    padding: 18px;
}

.pr-ai-detail .ai-live-info-card {
    margin: 10px 0 16px;
}

.pr-ai-detail .detail-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--theme-heading);
    font-size: 16.5px;
    font-weight: bold;
    margin-bottom: 12px;
}

.pr-ai-detail .detail-section-title::before {
    content: "";
    width: 5px;
    height: 20px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--theme-btn-from), var(--theme-primary));
    flex: 0 0 auto;
}

.pr-ai-detail .ai-rate-highlight strong {
    color: var(--theme-brand);
    font-size: 30px;
}

.pr-ai-detail .ai-analysis-stat {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--theme-border-soft);
    color: var(--theme-text-sub);
    font-size: 13.5px;
}

.pr-ai-detail .ai-analysis-stat:last-of-type {
    border-bottom: 0;
}

.pr-ai-detail .ai-song {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--theme-border-soft);
}

.pr-ai-detail .ai-song:last-child {
    border-bottom: 0;
}

.pr-ai-detail .ai-song-order {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--theme-blush);
    color: var(--theme-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    flex: 0 0 auto;
}

/* ===== 作成・編集 ===== */
.pr-edit .live-card {
    width: auto;
    max-width: none;
    margin: 10px 0 6px;
    padding: 18px;
}

.pr-edit .button-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 14px;
}

.pr-edit .add-btn {
    min-height: 42px;
    padding: 8px 24px;
    border: 1px solid var(--theme-border);
    border-radius: 999px;
    background: #fff;
    color: var(--theme-brand);
    font-size: 14.5px;
    font-weight: bold;
    cursor: pointer;
}

.pr-edit .save-btn {
    min-height: 42px;
    padding: 8px 34px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--theme-btn-from), var(--theme-primary));
    color: #fff;
    font-size: 14.5px;
    font-weight: bold;
    cursor: pointer;
}

.pr-edit .setlist-area {
    background: #fff;
    border: 1px solid var(--theme-border-soft);
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(61, 44, 46, .06);
    padding: 6px 18px;
}

.pr-edit .setlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--theme-border-soft);
    background: #fff;
}

.pr-edit .setlist-item:last-child {
    border-bottom: 0;
}

.pr-edit .song-order {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--theme-blush);
    color: var(--theme-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    flex: 0 0 auto;
}

.pr-edit .song-name {
    flex: 1;
    min-width: 0;
    font-weight: bold;
    color: var(--theme-text);
}

.pr-edit .setlist-item .delete-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--theme-border-soft);
    background: var(--theme-blush);
    color: var(--theme-brand);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
}

.pr-edit .drag-handle {
    color: var(--theme-text-muted);
    cursor: grab;
    padding: 6px 2px;
    flex: 0 0 auto;
    touch-action: none;
}

/* 曲選択モーダル（編集画面のみに存在する） */
#song-modal .modal-content {
    border-radius: 20px;
}

#song-modal .modal-add-btn {
    min-height: 38px;
    padding: 7px 22px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--theme-btn-from), var(--theme-primary));
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

#song-modal .search-btn {
    min-height: 38px;
    padding: 7px 18px;
    border: 1px solid var(--theme-border-soft);
    border-radius: 999px;
    background: var(--theme-blush);
    color: var(--theme-brand);
    font-weight: bold;
    cursor: pointer;
}

/* ===== 旧レイアウト上限の解除 ===== */
@media (min-width: 601px) {
    .background .page-scroll {
        max-width: none;
    }
}

.pr-ai-detail .pr-main {
    max-width: 1348px;
}

.pr-index .prediction-menu {
    max-width: none;
}

.pr-ai-detail .ai-prediction-detail-footer {
    width: auto;
    max-width: none;
    margin: 0;
    text-align: left;
}

.background .pr-main {
    max-width: 1348px;
}

.pr-edit .pr-main {
    max-width: 1100px;
}

.pr-list .prediction-buttons .share-btn {
    flex: 1 1 0;
    min-width: 0;
    height: 38px;
    border-radius: 999px;
}

/* ===== 統合ページの切替カード（#307 追加対応） ===== */
.pr-index .prediction-menu {
    width: 100%;
    max-width: none;
    margin: 0 0 18px;
}

.pr-slider-dots {
    display: none;
}

@media (max-width: 767px) {
    .pr-slider-dots {
        display: flex;
        gap: 6px;
        justify-content: center;
        margin: -6px 0 16px;
    }

    .pr-slider-dots .dot {
        position: relative;
        width: 7px;
        height: 7px;
        border-radius: 99px;
        background: var(--theme-border);
        cursor: pointer;
    }

    .pr-slider-dots .dot::after {
        content: "";
        position: absolute;
        inset: -10px -6px;
    }

    .pr-slider-dots .dot.active {
        width: 18px;
        background: var(--theme-primary);
    }
}

.pr-index .prediction-menu-btn.is-current {
    border-color: var(--theme-primary);
    background: var(--theme-tint);
}

.pr-view-badge {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--theme-primary);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    flex: 0 0 auto;
}

.pr-list-section .prediction-search-area {
    margin-top: 0;
}

.pr-list .prediction-search-area {
    width: 100%;
    max-width: none;
}

.pr-list .search-form {
    max-width: none;
}

/* ===== 切替カードのスライダー（スマホのみ） ===== */
@media (max-width: 767px) {
    .pr-index .pr-slider {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .pr-index .pr-slider::-webkit-scrollbar {
        display: none;
    }

    .pr-index .pr-slider .prediction-menu-btn {
        flex: 0 0 100%;
        scroll-snap-align: start;
    }
}

/* ===== 一覧専用ローディング（回収済み楽曲・アーカイブと同じ作り） ===== */
.pr-list-wrap{
    position:relative;
    min-height:120px;
}

.pr-list-loading{
    position:absolute;
    inset:0;
    z-index:5;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:12px;
    border-radius:20px;
    background:rgba(255,255,255,.78);
    color:var(--theme-text-sub);
    font-size:13.5px;
    font-weight:bold;
}

.pr-list-loading p{
    margin:0;
}

.pr-list-loading[hidden]{
    display:none;
}

.pr-spinner{
    width:34px;
    height:34px;
    border-radius:50%;
    border:3px solid var(--theme-border);
    border-top-color:var(--theme-primary);
    animation:pr-spin .8s linear infinite;
}

@keyframes pr-spin{
    to{ transform:rotate(360deg); }
}

/* Issue #381 アンコール枠の帯 */
.setlist-section-band{
    display:flex;
    align-items:center;
    gap:10px;
    margin:18px 0 10px;
    font-size:14px;
    font-weight:800;
    color:var(--theme-heading);
}
.setlist-section-band::before,
.setlist-section-band::after{
    content:"";
    flex:1;
    height:1px;
    background:var(--theme-border);
}

/* Issue #382 予測作成・編集の枠 */
.pr-section-band{
    font-size:13px;
    font-weight:800;
    color:var(--theme-heading);
    background:var(--theme-tint);
    border-radius:8px;
    padding:6px 12px;
    margin:16px 0 8px;
}
.pr-seg{
    display:flex;
    border:1.5px solid var(--theme-border);
    border-radius:999px;
    overflow:hidden;
    margin-bottom:12px;
}
.pr-seg button{
    flex:1;
    border:none;
    background:#fff;
    color:var(--theme-heading);
    font-size:12.5px;
    font-weight:bold;
    padding:9px 2px;
    cursor:pointer;
}
.pr-seg button.on{
    background:var(--theme-primary);
    color:#fff;
}

/* =========================================================
   Issue #384 曲追加を管理セトリ方式に統一
   ========================================================= */

.pr-picker{
    display:none;
}

.pr-album-head{
    font-size:12.5px;
    font-weight:800;
    color:var(--theme-heading);
    background:var(--theme-tint);
    border-radius:8px;
    padding:6px 10px;
    margin:12px 0 6px;
}

.pr-album-head:first-child{
    margin-top:0;
}

@media(min-width:1100px){
    .pr-panes{
        display:flex;
        gap:16px;
        align-items:flex-start;
    }

    .pr-left{
        flex:1;
        min-width:0;
    }

    .pr-add-sp{
        display:none;
    }

    .pr-picker{
        display:flex;
        flex-direction:column;
        gap:10px;
        width:360px;
        flex:0 0 360px;
        position:sticky;
        top:12px;
        background:#fff;
        border:1px solid var(--theme-border-soft);
        border-radius:14px;
        padding:14px;
        max-height:calc(100vh - 120px);
        box-sizing:border-box;
    }

    .pr-picker-head{
        font-size:14px;
        font-weight:800;
        color:var(--theme-heading);
    }

    .pr-pane-search{
        width:100%;
        box-sizing:border-box;
        padding:10px 12px;
        border:1px solid var(--theme-border);
        border-radius:10px;
        font-size:14px;
    }

    .pr-pane-medley{
        font-size:13px;
        color:var(--theme-text-sub);
        display:flex;
        align-items:center;
        gap:6px;
    }

    .pr-pick-list{
        overflow-y:auto;
        min-height:0;
    }

    .pr-pick-row{
        display:flex;
        align-items:center;
        width:100%;
        box-sizing:border-box;
        text-align:left;
        background:#fff;
        border:1px solid var(--theme-border-soft);
        border-radius:10px;
        padding:10px 12px;
        margin-bottom:6px;
        cursor:pointer;
        font-size:14px;
        color:var(--theme-text);
    }

    .pr-pick-row:hover{
        background:var(--theme-tint);
    }
}

/* Issue #384 追加修正：ペイン／モーダル内の固定要素が縦に潰れないようにする */
.pr-seg{
    flex-shrink:0;
}

.pr-picker > *{
    flex-shrink:0;
}

.pr-picker > .pr-pick-list{
    flex-shrink:1;
    flex-grow:1;
    min-height:0;
}
