/* --- GRID LAYOUT --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    max-width: 1400px;
    margin: 20px auto;
    gap: 20px;
    justify-items: start;
}

/* --- KORTIT --- */
.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 6px var(--card-shadow);
    width: 100%;
    max-width: 100%;
    justify-self: start;
}

.card-wide {
    grid-column: 1 / -1;
    justify-self: start;
}

/* --- PROFIILIKUVA --- */
.profile-photo-large {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 10px auto;
}

/* --- TAULUKKO: OTTELUHISTORIA --- */
.player-history {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.player-history th {
    background: var(--card-top-bg);
    padding: 8px;
    text-align: left;
    color: var(--text);
}

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

/* --- NAPIT --- */
.btn-edit {
    background: #3498db;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.btn-edit:hover {
    background: #217dbb;
}

.btn-challenge {
    display: inline-block;
    background: #e67e22;
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
}

.btn-challenge:hover {
    background: #d35400;
}

/* --- ELO-VÄRIT --- */
.elo-master { color: #d40000; font-weight: bold; }
.elo-expert { color: #e67e22; font-weight: bold; }
.elo-intermediate { color: #2980b9; font-weight: bold; }
.elo-beginner { color: #27ae60; font-weight: bold; }

/* --- CROP-MODAALI --- */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.crop-content {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 2px 6px var(--card-shadow);
}

.crop-content img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
}

.crop-content button {
    margin: 5px;
}

/* --- MUOKKAA TIETOJA -KORTTI --- */
.edit-card {
    max-width: 650px;
    margin: 0;
    padding: 20px 24px;
    justify-self: start;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 6px var(--card-shadow);
}

.edit-card form {
    display: grid;
    grid-template-columns: 160px 1fr;
    column-gap: 16px;
    row-gap: 12px;
    align-items: center;
}

.edit-card form label {
    text-align: right;
    font-weight: 600;
    padding-right: 6px;
    color: var(--text);
}

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

.edit-card form button {
    grid-column: 2 / 3;
    justify-self: flex-start;
    margin-top: 10px;
}

/* --- ELO-KORTIN KOKO --- */
.elo-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.elo-chart-wrapper {
    width: 100%;
    max-width: 700px;
    height: 300px;
}

.elo-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}
