/* --- Sivun yleinen kortti --- */
.page-card {
    max-width: 1200px;
    margin: 30px auto;
    padding: 25px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 6px var(--card-shadow);
}

/* --- Otsikot --- */
.page-card-title {
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--text);
}

/* --- Profiiligridi --- */
.player-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

@media (max-width: 800px) {
    .player-profile-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Oma profiilikortti --- */
.profile-card {
    background: var(--card-top-bg);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--header-border);
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid var(--header-border);
}

/* --- ELO värit --- */
.elo-master { color: #d40000; font-weight: bold; }
.elo-expert { color: #ff8c00; font-weight: bold; }
.elo-intermediate { color: #0077ff; font-weight: bold; }
.elo-beginner { color: #555; }

/* --- Vertailukortti --- */
.compare-card {
    background: var(--card-top-bg);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--header-border);
}

.compare-card h2 {
    margin-top: 0;
    color: var(--text);
}

/* --- Hakukenttä --- */
.search-box input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--header-border);
    background: var(--card-bg);
    color: var(--text);
}

.search-box button,
.compare-form button {
    padding: 10px 15px;
    background: #0077ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
}

.search-box button:hover,
.compare-form button:hover {
    background: #005fcc;
}

/* --- Vertailulista --- */
.compare-form {
    margin-top: 15px;
}

.compare-form select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--header-border);
    background: var(--card-bg);
    color: var(--text);
}

/* --- Vertailutaulukko --- */
.compare-result {
    margin-top: 20px;
}

.compare-table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
}

.compare-table th,
.compare-table td {
    padding: 10px;
    border-bottom: 1px solid var(--header-border);
    text-align: center;
    color: var(--text);
}

.compare-table th {
    background: var(--card-top-bg);
}

/* --- Pelaajalista --- */
.player-list {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.player-list th {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 12px;
    text-align: left;
}

.player-list td {
    padding: 12px;
    border-bottom: 1px solid var(--header-border);
    color: var(--text);
}

.player-list tr:hover {
    background: var(--card-top-bg);
}

/* --- Pienet kuvat --- */
.profile-photo-small {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--header-border);
}

/* --- Napit --- */
.btn-challenge-small {
    background: #28a745;
    padding: 6px 10px;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}

.btn-challenge-small:hover {
    background: #1e7e34;
}

.btn-delete {
    background: #d40000;
    padding: 6px 10px;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}

.btn-delete:hover {
    background: #a80000;
}

/* --- Sivun pääkortti (toinen määritelmä) --- */
.page-card {
    max-width: 1100px;
    margin: 30px auto;
    padding: 25px;
    background: var(--card-bg);
    border-radius: 10px;
}

/* Profiiligridi */
.player-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    max-width: 900px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .player-profile-grid {
        grid-template-columns: 1fr;
    }
}

/* Profiilikortti */
.profile-card {
    background: var(--card-top-bg);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--header-border);
    max-width: 400px;
    margin: 0 auto;
}

.skill-tag {
    display: inline-block;
    margin-top: 3px;
    padding: 2px 6px;
    background: var(--card-top-bg);
    border: 1px solid var(--header-border);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text);
}

/* Tilastotaulukko */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.stats-table th,
.stats-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--header-border);
    color: var(--text);
}

.stats-table th {
    background: var(--card-top-bg);
    text-align: left;
}

/* Korttigridi */
.card-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

/* Kaksi korttia vierekkäin */
.two-col {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

/* Kortit jotka täyttävät koko rivin */
.card-wide {
    grid-column: 1 / -1;
}

/* --- Uusi profiilinakyma: mobiililahtoista viimeistelya --- */
.topbar {
    max-width: 1120px;
    margin: 0 auto 12px;
}

.topbar h1 {
    margin: 0;
    color: var(--text);
    font-size: 26px;
    line-height: 1.2;
}

.tabs.sticky-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0 12px;
    margin: 0 auto 16px;
    max-width: 1120px;
    background: var(--bg, var(--card-bg));
    scrollbar-width: none;
}

.tabs.sticky-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 0 0 auto;
    border: 1px solid var(--header-border);
    border-radius: 8px;
    padding: 9px 12px;
    background: var(--card-bg);
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--nav-link-active-bg);
    color: var(--nav-link-active-text);
}

#tab-profile .card-grid.two-col-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
}

#tab-profile .card,
.tab-page .card {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--header-border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    color: var(--text);
}

#tab-profile .left-col {
    text-align: center;
}

.profile-photo-large-wrapper {
    width: 152px;
    height: 152px;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--header-border);
    background: var(--card-top-bg);
}

.profile-photo-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-photo-large.silhouette {
    object-fit: contain;
    padding: 18px;
}

.venue-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 8px 0 0;
    list-style: none;
}

.venue-list li {
    padding: 8px 10px;
    border: 1px solid var(--header-border);
    border-radius: 8px;
    background: var(--card-top-bg);
}

.venue-role,
.default-venue-tag {
    color: var(--text-muted);
    font-size: 13px;
}

.edit-card form {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.edit-card label {
    margin: 4px 0 -4px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.edit-card input,
.edit-card select {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-height: 42px;
    border: 1px solid var(--header-border);
    border-radius: 8px;
    padding: 9px 11px;
    background: var(--card-top-bg);
    color: var(--text);
}

.btn-edit {
    box-sizing: border-box;
    max-width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 9px 14px;
    background: var(--accent, #2563eb);
    color: #fff;
    font-weight: 700;
}

.player-history {
    width: 100%;
    border-collapse: collapse;
}

.player-history th,
.player-history td {
    padding: 10px;
    border-bottom: 1px solid var(--header-border);
    color: var(--text);
    vertical-align: top;
}

@media (max-width: 768px) {
    .topbar {
        margin-bottom: 8px;
    }

    .topbar h1 {
        font-size: 22px;
    }

    .tabs.sticky-tabs {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
        top: 0;
    }

    .tab-btn {
        padding: 8px 10px;
        font-size: 14px;
    }

    .card-grid,
    .card-grid.two-col-layout,
    .two-col {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    #tab-profile .card,
    .tab-page .card,
    .stats-section {
        padding: 14px;
        border-radius: 8px;
    }

    .profile-photo-large-wrapper {
        width: 124px;
        height: 124px;
    }

    #tab-profile h2,
    #tab-profile h3,
    .tab-page h3 {
        font-size: 18px;
        line-height: 1.25;
    }

    #tab-profile p {
        margin: 8px 0;
        line-height: 1.35;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .stat-card {
        padding: 12px 10px;
    }

    .stat-card h4 {
        font-size: 13px;
        line-height: 1.2;
    }

    .stat-card p {
        font-size: 18px;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .player-history,
    .player-history tbody,
    .player-history tr,
    .player-history td {
        display: block;
        width: 100%;
    }

    .player-history tr:first-child {
        display: none;
    }

    .player-history tr {
        padding: 10px 0;
        border-bottom: 1px solid var(--header-border);
    }

    .player-history td {
        border: 0;
        padding: 3px 0;
    }

}

@media (max-width: 420px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .edit-card input,
    .edit-card select,
    .btn-edit {
        min-height: 44px;
        font-size: 16px;
    }
}
