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

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background-color: #f5f5f7;
    color: #1c1c1e;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    width: 220px;
    flex-shrink: 0;
    background-color: #1c1c2e;
    padding: 1.5rem 0;
    transition: width 0.2s ease;
    overflow: hidden;
}

.sidebar--collapsed {
    width: 72px;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 0 1rem 1.5rem;
    background: none;
    border: none;
    color: #cfcfe8;
    cursor: pointer;
    border-radius: 6px;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background-color: #2a2a45;
    color: #ffffff;
}

.sidebar-toggle-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.sidebar--collapsed .sidebar-toggle {
    margin-left: auto;
    margin-right: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.5rem;
    color: #cfcfe8;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.sidebar--collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar-icon {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar--collapsed .sidebar-label {
    display: none;
}

.sidebar-link:hover {
    background-color: #2a2a45;
    color: #ffffff;
}

.sidebar-link.active {
    background-color: #3a3a5f;
    color: #ffffff;
    border-left: 3px solid skyblue;
}

.main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.page-header {
    padding: 1rem 2rem;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e6;
}

.page-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.page-subtitle {
    margin: 0.25rem 0 0;
    color: #6e6e80;
    font-size: 0.9rem;
}

.page-subtitle:empty {
    display: none;
}

.content {
    flex: 1;
    padding: 2rem;
}

.home-layout {
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 100%;
}

.podium {
    flex: 1;
    min-width: 0;
}

.ranking {
    flex: 0 1 420px;
    min-width: 0;
}

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1rem;
}

.podium-place {
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    width: 33%;
    padding: 1rem 0.75rem;
    border-radius: 8px 8px 0 0;
    color: #ffffff;
    text-align: center;
}

.podium-medal {
    position: absolute;
    top: -7rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 5.5rem;
    line-height: 1;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.podium-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
}

.podium-logo {
    font-size: 2.5rem;
    line-height: 1;
}

.podium-team {
    font-size: 1.15rem;
    font-weight: 600;
}

.podium-points {
    font-size: 1.1rem;
    opacity: 0.9;
}

.podium-trend {
    margin-top: 0.15rem;
}

.trend {
    font-size: 0.9rem;
    font-weight: 700;
}

.trend--up {
    color: #34c759;
}

.trend--down {
    color: #ff3b30;
}

.trend--same {
    color: #d0d0e0;
}

.podium-place--1 {
    height: 300px;
    background-color: #d4af37;
    order: 2;
}

.podium-place--2 {
    height: 200px;
    background-color: #9aa0a6;
    order: 1;
}

.podium-place--3 {
    height: 140px;
    background-color: #b06a35;
    order: 3;
}

.ranking-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background-color: #ffffff;
    border-radius: 6px;
    border: 1px solid #e0e0e6;
}

.ranking-item--up {
    background-color: #eafaf0;
    border-color: #34c759;
}

.ranking-item--down {
    background-color: #fdecea;
    border-color: #ff3b30;
}

.ranking-position {
    font-weight: 700;
    color: #6e6e80;
    width: 1.5rem;
}

.ranking-trend {
    width: 1rem;
    text-align: center;
}

.ranking-logo {
    font-size: 1.3rem;
    line-height: 1;
}

.ranking-team {
    flex: 1;
    font-weight: 500;
}

.ranking-points {
    color: #6e6e80;
}

@media (max-width: 640px), (orientation: portrait) {
    .layout {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    .sidebar {
        order: 2;
        flex-direction: row;
        width: 100%;
        padding: 0;
    }

    .sidebar-toggle {
        display: none;
    }

    .main {
        order: 1;
    }

    .sidebar-link {
        flex: 1;
        justify-content: center;
        padding: 0.75rem 0.5rem;
    }

    .sidebar-link.active {
        border-left: none;
        border-top: 3px solid skyblue;
    }

    .main {
        min-height: 0;
    }

    .content {
        padding: 1rem;
        min-height: 0;
    }

    .home-layout {
        flex-direction: column;
        align-items: stretch;
        height: 100%;
        gap: 1rem;
    }

    .podium {
        flex: 1 1 50%;
        min-height: 0;
        gap: 0.5rem;
        padding-top: 2.5rem;
    }

    .podium-place--1 {
        height: 100%;
    }

    .podium-place--2 {
        height: 78%;
    }

    .podium-place--3 {
        height: 56%;
    }

    .podium-place {
        padding: 0.75rem 0.35rem;
    }

    .podium-medal {
        top: -2.3rem;
        font-size: 2.5rem;
    }

    .podium-name-row {
        flex-direction: column;
        gap: 0.15rem;
    }

    .podium-logo {
        font-size: 1.3rem;
    }

    .podium-team {
        font-size: 0.8rem;
    }

    .podium-points {
        font-size: 0.85rem;
    }

    .ranking {
        flex: 1 1 50%;
        width: 100%;
        min-height: 0;
        overflow-y: auto;
    }

    .podium {
        justify-content: center;
    }

    .ranking-list {
        gap: 0.4rem;
    }

    .ranking-item {
        padding: 0.4rem 0.6rem;
        gap: 0.5rem;
    }

    .ranking-position {
        font-size: 1.05rem;
    }

    .ranking-logo {
        font-size: 1.2rem;
    }

    .ranking-team {
        font-size: 1.05rem;
    }

    .ranking-points {
        font-size: 1.05rem;
    }
}

.admin-login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 320px;
    margin: 2rem auto;
}

.admin-login-form label {
    font-weight: 600;
}

.admin-login-form input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e0e0e6;
    border-radius: 6px;
    font-size: 1rem;
}

.admin-login-form button {
    padding: 0.6rem 1rem;
    background-color: #1c1c2e;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.admin-login-form button:hover {
    background-color: #2a2a45;
}

.admin-login-error {
    color: #ff3b30;
    font-weight: 600;
}

.leaderboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
}

.leaderboard-team {
    background-color: #ffffff;
    border: 1px solid #e0e0e6;
    border-radius: 8px;
    overflow: hidden;
}

.leaderboard-team--1 {
    background-color: #d4af37;
    border-color: #d4af37;
    color: #ffffff;
}

.leaderboard-team--2 {
    background-color: #9aa0a6;
    border-color: #9aa0a6;
    color: #ffffff;
}

.leaderboard-team--3 {
    background-color: #b06a35;
    border-color: #b06a35;
    color: #ffffff;
}

.leaderboard-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
}

.leaderboard-summary::-webkit-details-marker {
    display: none;
}

.leaderboard-summary::before {
    content: '▸';
    order: 99;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.leaderboard-summary:hover::before {
    background-color: rgba(0, 0, 0, 0.15);
}

.leaderboard-team[open] .leaderboard-summary::before {
    transform: rotate(90deg);
}

.leaderboard-team--1 .leaderboard-summary::before,
.leaderboard-team--2 .leaderboard-summary::before,
.leaderboard-team--3 .leaderboard-summary::before {
    background-color: rgba(255, 255, 255, 0.25);
}

.leaderboard-team--1 .leaderboard-summary:hover::before,
.leaderboard-team--2 .leaderboard-summary:hover::before,
.leaderboard-team--3 .leaderboard-summary:hover::before {
    background-color: rgba(255, 255, 255, 0.4);
}

.leaderboard-position {
    font-weight: 700;
    font-size: 1.1rem;
    width: 1.75rem;
}

.leaderboard-trend {
    width: 2rem;
    text-align: center;
}

.leaderboard-logo {
    font-size: 1.3rem;
    line-height: 1;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
}

.leaderboard-points {
    font-weight: 600;
}

.member-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #f5f5f7;
    color: #1c1c1e;
}

.member-table th,
.member-table td {
    padding: 0.5rem 1rem;
    text-align: left;
}

.member-table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6e6e80;
    border-bottom: 1px solid #e0e0e6;
}

.member-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #e0e0e6;
}

.member-table tbody td:first-child {
    font-weight: 500;
}

.member-table th:nth-child(n+2),
.member-table td:nth-child(n+2) {
    text-align: center;
}

.multiplier-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background-color: #ffffff;
    border: 1px solid #e0e0e6;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
}

.member-empty {
    margin: 0;
    padding: 0.75rem 1rem;
    background-color: #f5f5f7;
    color: #6e6e80;
    font-style: italic;
}
