/* ========================================
   天梯榜 - 炫麗修仙遊戲風格 (Xianxia Game Style)
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@400;700;900&display=swap');

:root {
    --game-bg: #05070a;
    --game-panel: rgba(13, 18, 28, 0.85);
    --game-border: #1f2d40;
    --game-gold: #ffd700;
    --game-gold-glow: rgba(255, 215, 0, 0.6);
    --game-cyan: #00e5ff;
    --game-cyan-glow: rgba(0, 229, 255, 0.5);
    --game-text: #e2e8f0;
    --game-text-muted: #8b9bb4;
}

body {
    background-color: var(--game-bg);
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(0, 229, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 100%, rgba(255, 215, 0, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--game-text);
    font-family: 'Noto Serif TC', serif;
}

.lb-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
}

/* ---- 標題區 (Hero) ---- */
.lb-hero {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    animation: fadeInDown 1s ease-out;
}

.lb-hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 200px;
    background: radial-gradient(ellipse, var(--game-cyan-glow) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
    z-index: -1;
    filter: blur(20px);
}

.lb-title {
    font-size: 3.5em;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(to bottom, #ffffff, var(--game-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px var(--game-cyan-glow);
    letter-spacing: 4px;
}

.lb-subtitle {
    font-size: 1.2em;
    color: var(--game-gold);
    margin-top: 10px;
    text-shadow: 0 0 10px var(--game-gold-glow);
    letter-spacing: 2px;
}

.lb-stats-board {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.1), transparent);
    padding: 15px 0;
    border-top: 1px solid rgba(0, 229, 255, 0.2);
    border-bottom: 1px solid rgba(0, 229, 255, 0.2);
}

.lb-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lb-stat-val {
    font-size: 2em;
    font-weight: 700;
    color: var(--game-cyan);
    text-shadow: 0 0 15px var(--game-cyan-glow);
    font-family: monospace;
}

.lb-stat-lbl {
    font-size: 0.9em;
    color: var(--game-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---- 領獎台 (Podium) ---- */
.lb-podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 350px;
    margin-bottom: 60px;
    gap: 20px;
    perspective: 1000px;
}

.lb-podium-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 160px;
    animation: floatUp 1s ease-out backwards;
}

.lb-podium-slot:hover {
    transform: translateY(-10px) scale(1.05);
    transition: all 0.3s ease;
}

.lb-podium-2 { animation-delay: 0.2s; }
.lb-podium-1 { animation-delay: 0s; width: 200px; z-index: 10; }
.lb-podium-3 { animation-delay: 0.4s; }

.lb-avatar-wrap {
    position: relative;
    margin-bottom: 15px;
}

.lb-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--game-panel);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
    color: #fff;
    border: 3px solid var(--game-border);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    position: relative;
    z-index: 2;
}

.lb-podium-1 .lb-avatar {
    width: 110px;
    height: 110px;
    font-size: 2.5em;
    border-color: var(--game-gold);
    box-shadow: 0 0 30px var(--game-gold-glow), inset 0 0 20px var(--game-gold-glow);
    animation: pulseGold 2s infinite;
}

.lb-podium-2 .lb-avatar {
    border-color: silver;
    box-shadow: 0 0 20px rgba(192, 192, 192, 0.5);
}

.lb-podium-3 .lb-avatar {
    border-color: #cd7f32;
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.5);
}

.lb-crown {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5em;
    filter: drop-shadow(0 0 10px var(--game-gold));
    animation: float 3s ease-in-out infinite;
    z-index: 3;
}

.lb-player-name {
    font-size: 1.2em;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 5px;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-podium-1 .lb-player-name {
    color: var(--game-gold);
    font-size: 1.4em;
}

.lb-player-title {
    font-size: 0.85em;
    color: var(--game-cyan);
    background: rgba(0, 229, 255, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.3);
    margin-bottom: 10px;
}

.lb-pillar {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 15px;
    border-radius: 10px 10px 0 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}

.lb-pillar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: rgba(255,255,255,0.5);
}

.lb-pillar-1 {
    height: 160px;
    background: linear-gradient(to bottom, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-bottom: none;
}

.lb-pillar-2 {
    height: 120px;
    background: linear-gradient(to bottom, rgba(192, 192, 192, 0.3), rgba(192, 192, 192, 0.05));
    border: 1px solid rgba(192, 192, 192, 0.4);
    border-bottom: none;
}

.lb-pillar-3 {
    height: 90px;
    background: linear-gradient(to bottom, rgba(205, 127, 50, 0.3), rgba(205, 127, 50, 0.05));
    border: 1px solid rgba(205, 127, 50, 0.4);
    border-bottom: none;
}

.lb-pillar-rank {
    font-size: 3em;
    font-weight: 900;
    color: rgba(255,255,255,0.2);
    line-height: 1;
}

.lb-pillar-score {
    font-size: 1.1em;
    color: #fff;
    font-weight: bold;
    margin-top: 5px;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}

/* ---- 列表區 (List) ---- */
.lb-list-container {
    background: var(--game-panel);
    border: 1px solid var(--game-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8), inset 0 0 20px rgba(0, 229, 255, 0.05);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.lb-list-header {
    display: grid;
    grid-template-columns: 80px 2fr 1.5fr 1fr 2fr 1fr;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid var(--game-border);
    font-weight: bold;
    color: var(--game-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lb-list-row {
    display: grid;
    grid-template-columns: 80px 2fr 1.5fr 1fr 2fr 1fr;
    padding: 15px 20px;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.lb-list-row:hover {
    background: rgba(0, 229, 255, 0.05);
    transform: scale(1.01);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
    z-index: 1;
    border-color: transparent;
}

.lb-list-row::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--game-cyan);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.lb-list-row:hover::before {
    transform: scaleY(1);
}

.lb-row-me {
    background: rgba(255, 215, 0, 0.08) !important;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.lb-row-me::before {
    background: var(--game-gold);
    transform: scaleY(1);
}

/* 欄位內容 */
.lb-col {
    display: flex;
    align-items: center;
}

.lb-col-rank {
    font-size: 1.5em;
    font-weight: 900;
    color: var(--game-text-muted);
    font-style: italic;
}

.lb-col-player {
    gap: 15px;
}

.lb-mini-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2c3e50, #000000);
    border: 1px solid var(--game-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--game-cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.lb-player-info {
    display: flex;
    flex-direction: column;
}

.lb-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #fff;
}

.lb-me-badge {
    background: var(--game-gold);
    color: #000;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 900;
    vertical-align: middle;
}

.lb-tier-badge {
    background: rgba(176, 38, 255, 0.15);
    border: 1px solid rgba(176, 38, 255, 0.4);
    color: #e0b0ff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    box-shadow: 0 0 10px rgba(176, 38, 255, 0.2);
}

/* 評級徽章 (S, A, B, C, D, E) */
.lb-grade {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 900;
    font-size: 1.2em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transform: rotate(-5deg);
}

.lb-grade-s { background: linear-gradient(135deg, #ff0055, #ffaa00); color: #fff; box-shadow: 0 0 15px rgba(255, 0, 85, 0.6); animation: pulseS 2s infinite; }
.lb-grade-a { background: linear-gradient(135deg, #ffd700, #ff8c00); color: #000; box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
.lb-grade-b { background: linear-gradient(135deg, #b026ff, #5a00ff); color: #fff; box-shadow: 0 0 15px rgba(176, 38, 255, 0.6); }
.lb-grade-c { background: linear-gradient(135deg, #00e5ff, #0055ff); color: #fff; box-shadow: 0 0 15px rgba(0, 229, 255, 0.6); }
.lb-grade-d { background: linear-gradient(135deg, #00ff9d, #008000); color: #000; }
.lb-grade-e { background: linear-gradient(135deg, #8b9bb4, #4a5568); color: #fff; }

/* 進度條 */
.lb-progress-wrap {
    width: 100%;
    padding-right: 20px;
}

.lb-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    margin-bottom: 4px;
    color: var(--game-text-muted);
}

.lb-progress-text strong {
    color: #fff;
}

.lb-progress-track {
    height: 8px;
    background: rgba(0,0,0,0.6);
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    position: relative;
}

.lb-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--game-cyan), #00ff9d);
    box-shadow: 0 0 10px var(--game-cyan);
    border-radius: 4px;
    position: relative;
}

.lb-progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: shimmer 2s infinite;
}

.lb-col-score {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--game-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* ---- 展開的書籍詳情 ---- */
.lb-details {
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid var(--game-border);
    padding: 15px 20px 15px 100px;
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.5);
}

.lb-book-card {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 5px;
    gap: 10px;
    transition: all 0.2s;
}

.lb-book-card:hover {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--game-cyan);
    transform: translateY(-2px);
}

.lb-book-card.mastered {
    border-color: var(--game-gold);
    background: rgba(255, 215, 0, 0.05);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
}

.lb-book-icon {
    font-size: 1.5em;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.5));
}

.lb-book-info {
    display: flex;
    flex-direction: column;
}

.lb-book-title {
    font-weight: bold;
    color: #fff;
    font-size: 0.9em;
}

.lb-book-stats {
    font-size: 0.8em;
    color: var(--game-text-muted);
}

/* ---- 底部圖例 (Legend) ---- */
.lb-legend-box {
    margin-top: 40px;
    background: var(--game-panel);
    border: 1px solid var(--game-border);
    border-radius: 12px;
    padding: 25px;
}

.lb-legend-title {
    color: var(--game-cyan);
    font-size: 1.2em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lb-legend-title::before, .lb-legend-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--game-cyan), transparent);
}

.lb-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.lb-legend-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}

/* ---- 動畫 (Animations) ---- */
@keyframes float {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -10px); }
}

@keyframes floatUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGold {
    0%, 100% { box-shadow: 0 0 30px var(--game-gold-glow), inset 0 0 20px var(--game-gold-glow); }
    50% { box-shadow: 0 0 50px var(--game-gold), inset 0 0 30px var(--game-gold); }
}

@keyframes pulseS {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 0, 85, 0.6); }
    50% { box-shadow: 0 0 25px rgba(255, 0, 85, 1); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 響應式 */
@media (max-width: 768px) {
    .lb-list-header, .lb-list-row {
        grid-template-columns: 50px 1fr 1fr;
    }
    .lb-col-tier, .lb-col-grade, .lb-progress-wrap {
        display: none;
    }
    .lb-podium-container {
        transform: scale(0.8);
        margin-bottom: 20px;
    }
}
