/* global */
:root {
    --bg-body: #050505;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-element: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --primary: #120b53;
    --primary-dark: #002e1f;
    --accent: #ffffff78;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --safe-area-bottom: env(safe-area-inset-bottom);
}
html { background-color: #000; overflow-x: hidden;}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    margin: 0;
    background: radial-gradient(circle at 50% -10%, #322d81 0%, #00081a 60%, #120b53 100%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Degular-Regular', -apple-system, BlinkMacSystemFont, sans-serif;
    padding-bottom: 100px;
    min-height: 100vh;
}

/* utils */
a { text-decoration: none; color: inherit; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px; }
.hidden { display: none !important; }

.top-app-logo {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 55px 20px 25px 20px;
}

/* header smooth */
.app-header {
    padding: 20px 20px 30px;
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    border-bottom: none;
}
.header-top { display: flex; justify-content: center; margin-bottom: 20px; }
.brand-logo { height: 45px; width: auto; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }

/* chip */
.chips-scroll { display: flex; justify-content: center; gap: 8px; }
.chip {
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-muted);
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Degular-Medium';
}
.chip.active {
    background: var(--text-main);
    color: var(--primary);
    border-color: white;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

/* match */
.feed-container { padding: 10px 20px; margin-top: -10px; }
.day-header {
    margin: 30px 0 15px;
    display: flex; align-items: baseline; gap: 10px;
    padding-left: 5px;
}
.day-name { font-family: 'Degular-Bold'; font-size: 22px; color: var(--text-main); text-transform: capitalize; }
.day-date { font-family: 'Degular-Medium'; font-size: 14px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; }

.match-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 15px;
    position: relative;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
}
.card-meta {
    display: flex; justify-content: space-between; margin-bottom: 15px;
    font-size: 11px; font-weight: bold; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.meta-court { color: var(--accent); }
.teams-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}
.team-col { display: flex; flex-direction: column; gap: 10px; position: relative; }
.team-col.right { align-items: flex-end; }
.team-col.is-loser { opacity: 0.3; filter: grayscale(1); }
.win-indicator {
    position: absolute;
    top: -10px;
    right: 0;
    background: rgb(71 129 236 / 80%);
    color: #ffffffcf;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 2;
    text-transform: uppercase;
}
.team-col.right .win-indicator {
    right: auto; left: 0;
}
.player-pill {
    display: flex; align-items: center; gap: 10px;
    background: rgba(0,0,0,0.3);
    padding: 5px 12px 5px 5px;
    border-radius: 40px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.3s;
}
.team-col:not(.is-loser) .player-pill {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.team-col.right .player-pill {
    flex-direction: row;
    padding: 5px 5px 5px 12px;
}
.avatar {
    width: 28px; height: 28px;
    background: var(--bg-element);
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.p-name {
    font-size: 13px; font-family: 'Degular-Medium';
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px;
}
.match-center { display: flex; justify-content: center; min-width: 50px; }
.vs-badge {
    font-size: 10px; font-weight: 900; color: #000;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.binary-result {
    width: 30px; height: 1px;
    background: var(--border);
    position: relative;
}

/* ranking */
.rank-card {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 10px;
    transition: transform 0.2s;
    backdrop-filter: blur(10px);
}
.rank-card:active { transform: scale(0.98); }
.rank-pos-box {
    width: 30px;
    font-family: 'Degular-MonoMedium', monospace;
    font-size: 16px;
    color: var(--text-muted);
    opacity: 0.5;
}
.rank-avatar-box { margin-right: 15px; }
.rank-avatar {
    width: 42px; height: 42px;
    border: 2px solid var(--border);
}

.rank-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.rank-name {
    font-family: 'Degular-Medium';
    font-size: 16px;
    color: var(--text-main);
    display: flex; align-items: center; gap: 6px;
}
.rank-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.rank-score {
    text-align: right;
    background: rgba(255,255,255,0.05);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.score-val {
    display: block;
    font-family: 'Degular-Bold';
    font-size: 18px;
    color: var(--text-main);
    line-height: 1;
}
.score-label {
    font-size: 8px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* calendar */
.calendar-scroll-container {
    width: 100vw;
    margin-left: -20px;
    margin-bottom: 20px;
    padding: 10px 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: sticky;
    top: 85px;
    z-index: 40;
}
.calendar-scroll-container::-webkit-scrollbar { display: none; }
.calendar-track {
    display: flex;
    gap: 12px;
    width: max-content;
}
.date-card {
    background: var(--bg-element);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 55px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.dc-day {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-family: 'Degular-Medium';
    letter-spacing: 0.5px;
}
.dc-num {
    font-size: 18px;
    font-family: 'Degular-Bold';
    color: var(--text-main);
    line-height: 1.1;
}
.date-card.active {
    background: #ffffff42;
    border-color: #ffffff42;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}
.date-card.active .dc-day { color: #fff; font-weight: bold; }
.date-card.active .dc-num { color: #fff; }
.date-match-group {
    transition: opacity 0.3s ease;
}
.app-header {
    transition: transform 0.3s ease-in-out;
}
.calendar-scroll-container {
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}
body.hide-nav .app-header {
    transform: translateY(-100%);
}
body.hide-nav .calendar-scroll-container {
    transform: translateY(-200%); 
    opacity: 0;
    pointer-events: none;
}

/* desktop view */
@media (min-width: 1024px) {
    body {
        padding-left: 37vw;
        padding-right: 37vw;
    }
    .app-header {
        background: none;
    }
    .header-top {
        margin: 0 !important
    }
}