/* ============================
   ranking.css
   ランキングページ
   ============================ */

/* ── ランキング ── */
#page-ranking {
    background: linear-gradient(160deg, #bae6fd 0%, #7dd3fc 100%);
    min-height: 100vh;
    box-sizing: border-box;
    padding: var(--space-2xl);
}


.podium-hero-box {
    background: transparent;
    border-radius: var(--radius-2xl);
    padding: 0 20px 0;
    margin-bottom: var(--space-2xl);
    overflow: hidden;
    border: none;
    box-shadow: none;
}


.ranking-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 50px;
    margin-bottom: var(--space-2xl);
    padding: 60px 0 40px;
    min-height: 480px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    /* var(--space-md) -> 4px (Phase 26: Tighten spacing) */
    position: relative;
}

.podium-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    box-shadow: var(--shadow-lg);
    background: var(--bg-surface);
    border: 6px solid var(--bg-surface);
    overflow: hidden;
    position: relative;
    z-index: 2;
    margin-bottom: -10px;
    /* Phase 26: Pull name closer to icon */
}

.podium-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.podium-item.rank-1 .podium-avatar {
    width: 130px;
    /* 160px -> 130px (Phase 16: ~0.8x) */
    height: 130px;
    font-size: 4.5rem;
    /* 5.5rem -> 4.5rem */
    border-color: var(--color-gold);
    box-shadow: 0 0 35px rgba(255, 215, 0, 0.4);
}

.podium-item.rank-2 .podium-avatar,
.podium-item.rank-3 .podium-avatar {
    width: 130px;
    /* 160px -> 130px (Phase 16: ~0.8x) */
    height: 130px;
    font-size: 4.5rem;
    border-color: var(--color-silver);
    box-shadow: var(--shadow-md);
}

.podium-item.rank-3 .podium-avatar {
    border-color: var(--color-bronze);
}

.rank-badge {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3));
}

.rank-badge--1 {
    font-size: 5.5rem;
    top: -85px;
    filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.7));
}

.rank-badge--2 {
    filter: grayscale(1) brightness(1.2) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.rank-badge--3 {
    filter: sepia(1) saturate(5) hue-rotate(-20deg) brightness(0.8) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.podium-block {
    background: transparent;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    /* width: 160px; (Phase 18: Overridden by L3067) */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 5px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
    margin-top: -20px;
    gap: 4px;
    color: #fff;
}

.podium-item.rank-1 .podium-block {
    height: 190px;
    /* width: 200px; (Phase 18: Overridden by L3067) */
    border-color: var(--color-gold);
    border-width: 8px;
    background: linear-gradient(180deg, rgba(255, 200, 0, 0.3) 0%, rgba(255, 180, 0, 0.15) 100%);
    box-shadow: 0 0 30px rgba(255, 200, 0, 0.25), inset 0 1px 0 rgba(255, 215, 0, 0.3);
}

.podium-item.rank-2 .podium-block {
    height: 140px;
    /* width: 210px; (Phase 18: Overridden by L3067) */
    border-color: #c0c0c0;
    background: linear-gradient(180deg, rgba(192, 192, 192, 0.2) 0%, rgba(192, 192, 192, 0.05) 100%);
}

.podium-item.rank-3 .podium-block {
    height: 100px;
    /* width: 210px; (Phase 18: Overridden by L3067) */
    border-color: #cd7f32;
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.05) 100%);
}

.podium-info {
    text-align: center;
    margin: 10px 0 25px 0;
    /* 10px 0 -> 10px 0 25px 0 (Phase 27: Fix grade overlap) */
    width: 100%;
}

.podium-name {
    font-weight: 900;
    font-size: 2.0rem;
    color: #333;
    line-height: 1.2;
    text-shadow: none;
    /* Phase 2: Dynamic font size adjustment via JS. Remove ellipsis to allow full name display with smaller font. */
    max-width: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.podium-grade {
    font-size: 1.2rem;
    /* 0.9rem -> 1.2rem (調整) (Phase 17) */
    font-weight: 700;
    color: #666;
}

.podium-score-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    justify-content: center;
}

.podium-score {
    font-weight: 900;
    font-size: 2.2rem;
    line-height: 1;
}

.podium-item.rank-1 .podium-score {
    font-size: 3rem;
}

.podium-unit {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
}

/* 4位以下のリストをグリッド化 */
.ranking-list {
    margin-top: var(--space-2xl);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: var(--space-2xl);
}

.ranking-row {
    display: grid;
    grid-template-columns: 60px 50px 1.5fr 1fr 120px;
    align-items: center;
    gap: var(--space-md);
    padding: 12px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
}

.ranking-row:hover {
    transform: translateX(8px);
    border-color: var(--color-primary-light);
}

.rank-num {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text-muted);
}

.rank-trend {
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.rank-trend.up { color: var(--color-danger); }
.rank-trend.down { color: var(--color-primary); }
.rank-trend.same { color: var(--text-muted); opacity: 0.5; }

.rank-name-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rank-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    overflow: hidden;
    flex-shrink: 0;
}

.rank-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rank-name {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-grade {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 10px;
    border-radius: 20px;
    white-space: nowrap;
    display: inline-block;
    justify-self: start;
}

.rank-pts {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--color-primary);
    text-align: right;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
}

.rank-pts .unit {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.ranking-period {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
}

.ranking-period select {
    background: var(--bg-input);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 6px 12px;
    font-size: 0.875rem;
    outline: none;
}


/* ── Phase5 追加スタイル ── */

/* ── ランキング・ヘッダー（究極洗練・Phase 5） ── */
.ranking-pg-header {
    display: flex;
    align-items: flex-end;
    position: relative;
    /* 子要素の中央配置用 */
    margin-bottom: 56px;
    padding-bottom: 8px;
    /* border-bottom 削除（開放感のあるデザインへ） */
}

.header-left-col {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.ranking-period-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

/* ランキング種別：ページ全体の中央へ配置 (Phase 7: Royal Laurel) */
.ranking-type-wrapper {
    position: absolute;
    left: 50%;
    bottom: 0px;
    /* 位置微調整 */
    transform: translateX(-50%);
    background: transparent;
    /* 背景を透明にして月桂冠を際立たせる */
    padding: 10px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    white-space: nowrap;
    transition: all var(--transition-base);
}

/* 月表示テキスト (1.8rem + 黒) */
.ranking-period-wrapper .display-label {
    font-size: 1.8rem;
    font-weight: 900;
    color: #000;
    letter-spacing: -0.02em;
    cursor: pointer;
}

/* ランキング種別：ページ全体の中央へ配置 (Phase 12: Seamless Diagonal Shine) */
.ranking-type-wrapper {
    position: absolute;
    left: 50%;
    bottom: -10px;
    /* リボンに合わせて位置を微調整 */
    transform: translateX(-50%);
    z-index: 20;
    white-space: nowrap;
    transition: all var(--transition-base);

    /* ベース：高品質メタリックゴールド (静的) */
    background: linear-gradient(135deg,
            #bf953f 0%,
            #fcf6ba 25%,
            #b38728 50%,
            #fbf5b7 75%,
            #bf953f 100%);
    color: #4a332d;
    /* 視認性のための深いブロンズ/ダークブラウン */
    padding: 14px 100px;
    clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%);
    box-shadow: 0 12px 35px rgba(132, 94, 19, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* わずかなエッジの輝き */
    overflow: hidden;
    /* 斜めの光をリボン内に収める */
}

/* 斜めの光の帯 (Phase 12: Diagonal Light Sweep) */
.ranking-type-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg,
            rgba(255, 255, 255, 0) 30%,
            rgba(255, 255, 255, 0.6) 50%,
            rgba(255, 255, 255, 0) 70%);
    animation: golden-diagonal-sweep 4s infinite;
    pointer-events: none;
}

@keyframes golden-diagonal-sweep {
    0% {
        left: -150%;
    }

    100% {
        left: 150%;
    }
}

/* 以前の擬似要素（葉っぱ）を無効化 */
.ranking-type-wrapper::before {
    display: none !important;
}

/* ランキング種別テキスト (Phase 12: Refined Style) */
.ranking-type-wrapper .display-label {
    font-size: 2.5rem;
    font-weight: 900;
    color: #4a332d !important;
    -webkit-text-fill-color: initial;
    background: none;
    animation: none;
    letter-spacing: 0.1em;
    text-shadow: 0 1px 0px rgba(255, 255, 255, 0.4);
    position: relative;
    z-index: 2;
    cursor: pointer;
}

@keyframes golden-shine {
    to {
        background-position: 200% center;
    }
}

/* 旧擬似要素を削除 */

/* ── プレミアム種別セレクター（モーダル） ── */
.selector-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.selector-modal-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.selector-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40%);
    width: 90%;
    max-width: 600px;
    /* 450px -> 600px (Phase 24: For Grid) */
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
    z-index: 2001;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.selector-modal.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.selector-modal-header {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: 0.1em;
}

.selector-modal-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2カラム構成 (Phase 24) */
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

/* カスタムスクロールバー (Phase 24) */
.selector-modal-list::-webkit-scrollbar {
    width: 6px;
}

.selector-modal-list::-webkit-scrollbar-track {
    background: transparent;
}

.selector-modal-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.selector-modal-item {
    background: #f8f9fc;
    border: 2px solid transparent;
    padding: 16px 20px;
    /* 少しタイトに調整 */
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.selector-modal-item:hover {
    background: #ffffff;
    border-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.selector-modal-item.is-active {
    background: var(--color-primary-glow);
    border-color: var(--color-primary);
}

.selector-item-name {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--text-primary);
}

.selector-active-check {
    color: var(--color-primary);
    font-weight: 900;
    font-size: 1.4rem;
}

.selector-modal-close {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s;
}

.selector-modal-close:hover {
    color: var(--text-primary);
}

.native-month-picker {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* ── 表彰台のリフトアップ（Phase 5 巨大化 ＆ Phase 6 段差化 ＆ 位置下げ） ── */
.podium-hero-box {
    margin-top: 30px;
    /* 0 -> 30px (Phase 20: Prevent crown clipping) */
    position: relative;
    z-index: 10;
}

/* 台座をより大きく迫力あるサイズに */
.podium-block {
    background: white !important;
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    width: 336px;
    /* 288px -> 336px (Phase 19: 1.4x width) */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.1);
    position: relative;
    border-bottom: 12px solid transparent;
    /* 境界線をさらに太く */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 1 !important;
}

/* 各順位ごとの高さ設定（3位を基準に段差化） */
.rank-1 .podium-block {
    min-height: 300px;
    border-bottom-color: var(--color-gold);
    box-shadow: 0 25px 60px rgba(253, 203, 110, 0.5);
}

.rank-2 .podium-block {
    min-height: 250px;
    border-bottom-color: var(--color-silver);
    box-shadow: 0 18px 45px rgba(176, 190, 197, 0.3);
}

.rank-3 .podium-block {
    min-height: 200px;
    border-bottom-color: var(--color-bronze);
    box-shadow: 0 15px 40px rgba(205, 127, 50, 0.2);
}

.podium-score {
    font-size: 2.8rem;
    /* 段差に合わせて1位付近がより映えるようさらに拡大 */
    font-weight: 900;
    color: #000 !important;
    line-height: 1;
}

.podium-unit {
    color: #333 !important;
    font-weight: 700;
    font-size: 1.1rem;
}

.podium-name {
    color: #000 !important;
    font-weight: 900;
    font-size: 2.0rem;
    /* 2.4rem -> 2.0rem (Phase 16: ~0.8x) */
    margin-bottom: 8px;
}

.ranking-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 40px;
    padding: 40px 0 40px 0;
    /* 20px -> 40px (Phase 25: Safe spacing) */
    margin-top: 20px;
}

/* ── ランキング空状態 ── */
.ranking-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 32px;
    background: white;
    border: 2px dashed var(--border-dim);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    text-align: center;
    grid-column: 1 / -1;
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ── 枚数表示など（レガシー互換用または非表示化） ── */
.ranking-month-select {
    display: none;
    /* ranking.jsで分離型ボタンとして描画するため一旦非表示 */
}

/* ── ショップ追加スタイル ── */

/* ソートUI */
