*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --gold: #ffd700;
    --gold-dark: #b8960f;
    --gold-glow: rgba(255, 215, 0, 0.35); /* schedules uses 0.35, standings 0.5 */
    --bg-deep: #060608;
    --bg-card: #0d0d12;
    --bg-card-hover: #13131a;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-gold: rgba(255, 215, 0, 0.15);
    --text-primary: #f0f0f0;
    --text-secondary: #888;
    --text-dim: #555;
    --winner-color: #ffd700;
    --loser-color: #999;
    --green-accent: #00e676;
    --red-accent: #ff4444;
}

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Noto Sans TC', 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* === ANIMATED BACKGROUND === */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-effects::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(255, 215, 0, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(180, 130, 0, 0.02) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(255, 215, 0, 0.02) 0%, transparent 40%);
    animation: bgPulse 12s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-3%, 2%) scale(1.05); }
}

.bg-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.08), transparent);
    animation: lineSweep 8s linear infinite;
    width: 100%;
}
.bg-line:nth-child(2) { top: 30%; animation-delay: -3s; opacity: 0.5; }
.bg-line:nth-child(3) { top: 60%; animation-delay: -5s; opacity: 0.3; }
.bg-line:nth-child(4) { top: 85%; animation-delay: -7s; opacity: 0.4; }

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

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

/* === MAIN CONTAINER === */
.page-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: max(20px, env(safe-area-inset-top)) 0 60px;
}

/* === HEADER === */
.hero-header {
    width: 100%;
    max-width: 700px;
    padding: 0 20px;
    text-align: center;
    margin-bottom: 35px;
    position: relative;
}

.logo-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.logo-svg {
    width: 280px;
    height: auto;
    max-width: 100%;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.15));
}

.back-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    text-decoration: none;
    color: #aaa;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 18px;
    border-radius: 25px;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.03);
}

.back-btn:hover, .back-btn:active {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--gold);
    color: var(--gold);
}

.hero-title {
    font-family: 'Orbitron', 'Noto Sans TC', sans-serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffd700, #fff5a0, #ffd700, #c9a300);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: goldShimmer 4s ease infinite;
    text-transform: uppercase;
    line-height: 1.3;
}

@keyframes goldShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-subtitle {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 10px;
    font-family: monospace;
    letter-spacing: 1px;
}

.hero-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 15px auto 0;
}

/* === FOOTER === */
.footer {
    margin-top: 30px;
    font-size: 11px;
    color: #333;
    text-align: center;
    padding: 20px;
    letter-spacing: 1px;
}

/* === LEGEND === */
.legend-container {
    width: 100%;
    max-width: 900px;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #bbb;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 25px;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
}

.legend-item:hover {
    border-color: var(--border-gold);
}

.legend-icon {
    font-size: 16px;
    margin-right: 8px;
    line-height: 1;
    vertical-align: middle;
}

.legend-icon-img {
    width: 20px;
    height: auto;
    margin-right: 8px;
    vertical-align: middle;
}

.gold-text { color: #FFD700; text-shadow: 0 0 5px rgba(255, 215, 0, 0.6); }
.silver-text { color: #C0C0C0; text-shadow: 0 0 5px rgba(192, 192, 192, 0.6); }
.silver-emoji { filter: grayscale(100%) brightness(1.2); }

/* === PLAYER MODAL === */
.qual-badge {
    font-size: 11px; padding: 2px 6px; border-radius: 4px; border: 1px solid;
    font-weight: 700; font-family: 'Noto Sans TC', sans-serif; letter-spacing: 1px;
}
.badge-gold { color: #ffd700; border-color: rgba(255, 215, 0, 0.4); background: rgba(255, 215, 0, 0.1); }
.badge-silver { color: #c0c0c0; border-color: rgba(192, 192, 192, 0.4); background: rgba(192, 192, 192, 0.1); }
.badge-green { color: #81d4fa; border-color: rgba(129, 212, 250, 0.4); background: rgba(129, 212, 250, 0.1); }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    z-index: 1000; display: none; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.35s ease;
}

.modal-overlay.show { opacity: 1; }

.modal-content {
    background: linear-gradient(180deg, #141418, #0a0a0e);
    border: 1px solid var(--border-gold); border-radius: 20px;
    width: 92%; max-width: 520px; max-height: 82vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.05);
    transform: scale(0.92) translateY(20px); transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.modal-overlay.show .modal-content { transform: scale(1) translateY(0); }

.modal-header {
    padding: 18px 22px; border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.06), transparent);
}

.modal-title {
    font-family: 'Orbitron', 'Noto Sans TC', sans-serif; font-size: 20px;
    font-weight: 900; color: var(--gold); letter-spacing: 1px;
    display: flex; align-items: center; gap: 8px;
}

.modal-close {
    background: none; border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888; font-size: 20px; cursor: pointer; padding: 4px 10px;
    border-radius: 8px; transition: all 0.2s;
}

.modal-close:hover { border-color: var(--red-accent); color: var(--red-accent); }

.modal-body { padding: 22px; overflow-y: auto; }

.stats-summary {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 22px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03); padding: 14px 10px; border-radius: 12px;
    text-align: center; border: 1px solid var(--border-subtle); transition: all 0.3s;
    position: relative; overflow: hidden;
}

.stat-box:hover { border-color: var(--border-gold); background: rgba(255, 215, 0, 0.03); }

.stat-val { font-family: 'Rajdhani', 'Noto Sans TC', sans-serif; font-size: 22px; font-weight: 700; color: #fff; display: block; }
.stat-label { font-size: 11px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; display: block; position: relative; z-index: 2; }

/* Win Streak Fire Effects */
@keyframes fireGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 80, 0, 0.4), inset 0 0 15px rgba(255, 100, 0, 0.2); border-color: rgba(255, 100, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 120, 0, 0.7), inset 0 0 25px rgba(255, 150, 0, 0.4); border-color: rgba(255, 150, 0, 0.8); }
}
@keyframes fireGlowIntense {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 200, 0, 0.6), inset 0 0 20px rgba(255, 150, 0, 0.5); border-color: rgba(255, 220, 0, 0.8); }
    50% { box-shadow: 0 0 30px rgba(255, 255, 0, 0.9), inset 0 0 35px rgba(255, 200, 0, 0.8); border-color: #fff; }
}
@keyframes fireFlicker {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
    75% { opacity: 0.8; }
}
.streak-fire-3 {
    animation: fireGlow 1.5s infinite alternate; background: linear-gradient(180deg, rgba(255, 100, 0, 0.1), rgba(255, 50, 0, 0.25));
}
.streak-fire-3::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 50%;
    background: linear-gradient(0deg, rgba(255, 120, 0, 0.4), transparent);
    animation: fireFlicker 0.4s infinite alternate; pointer-events: none; z-index: 1; border-radius: 0 0 12px 12px;
}
.streak-fire-3 .stat-val { color: #ffcc00; text-shadow: 0 0 8px rgba(255, 100, 0, 0.8); }

.streak-fire-5 {
    animation: fireGlowIntense 1s infinite alternate; background: linear-gradient(180deg, rgba(255, 180, 0, 0.2), rgba(255, 80, 0, 0.4));
}
.streak-fire-5::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 60%;
    background: linear-gradient(0deg, rgba(255, 200, 0, 0.6), transparent);
    animation: fireFlicker 0.25s infinite alternate; pointer-events: none; z-index: 1; border-radius: 0 0 12px 12px;
}
.streak-fire-5 .stat-val { color: #fff; text-shadow: 0 0 12px #ffcc00, 0 0 20px #ff5500; }

.section-title {
    margin: 18px 0 10px; color: var(--text-dim); font-size: 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); padding-bottom: 6px;
    text-transform: uppercase; letter-spacing: 2px; font-weight: 700;
}

.history-list { list-style: none; padding: 0; margin: 0; }
.history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 14px;
}
.history-item:last-child { border-bottom: none; }

.h-date { color: var(--gold); font-weight: 700; font-size: 13px; width: 50px; font-family: 'Rajdhani', 'Noto Sans TC', sans-serif; }
.h-matchup { flex-grow: 1; color: #fff; text-align: center; font-weight: 700; font-size: 13px; }
.vs-tag { color: var(--text-dim); font-size: 10px; margin: 0 6px; font-weight: normal; }
.h-score { font-family: 'Rajdhani', 'Noto Sans TC', sans-serif; font-weight: 700; padding: 3px 10px; border-radius: 6px; min-width: 44px; text-align: center; font-size: 13px; }

.res-win { color: var(--gold); border: 1px solid rgba(255, 215, 0, 0.25); background: rgba(255, 215, 0, 0.08); }
.res-loss { color: var(--red-accent); border: 1px solid rgba(255, 68, 68, 0.25); background: rgba(255, 68, 68, 0.06); }
.res-void { color: #888; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.03); }

.h-time { font-family: 'Rajdhani', 'Noto Sans TC', sans-serif; font-weight: 700; color: #bbb; background: rgba(255, 255, 255, 0.04); padding: 3px 8px; border-radius: 6px; font-size: 12px; border: 1px solid var(--border-subtle); }

/* === RESPONSIVE === */
@media screen and (max-width: 768px) {
    body { padding-top: 0; }
    .page-wrapper { padding-top: 60px; }
    .back-btn {
        position: fixed; top: max(12px, env(safe-area-inset-top)); left: 15px;
        z-index: 100; background: rgba(6, 6, 8, 0.92); transform: none; backdrop-filter: blur(15px);
    }
    .hero-title { font-size: 20px; letter-spacing: 2px; }
    .logo-svg { width: 220px; }
    .hero-header { margin-bottom: 25px; }
    .legend-icon { font-size: 20px !important; }
}
