body {
    background-color: #262421;
}

/* === Friends section === */
.friends-section { margin-top: 24px; display: flex; flex-direction: column; gap: 18px; }
.friends-action { display: flex; align-items: center; gap: 10px; }
.friends-block h3 { margin: 0 0 8px; font-size: 15px; color: #e8e8e8; }
.req-count { color: #ff6b6b; font-weight: 700; font-size: 13px; margin-left: 4px; }
.friend-row { display: grid; grid-template-columns: 36px 1fr auto auto auto auto; gap: 8px; align-items: center; padding: 6px 10px; background: #302e2b; border-radius: 4px; margin-bottom: 4px; font-size: 14px; }
.friend-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #444; }
.friend-name { color: #e8e8e8; text-decoration: none; font-weight: 600; }
.friend-name:hover { text-decoration: underline; }
.friend-rating { color: #38bdf8; font-weight: 600; font-family: monospace; }
.online-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.online-dot.on { background: #22c55e; }
.online-dot.off { background: #555; }
.btn-mini { padding: 4px 8px; font-size: 12px; border-radius: 3px; border: 1px solid #555; background: #444; color: #e8e8e8; cursor: pointer; }
.btn-mini.btn-accept { background: #2e7d32; border-color: #2e7d32; }
.btn-mini.btn-reject, .btn-mini.btn-cancel { background: #a33; border-color: #a33; }
.group-label { color: #888; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 6px 0 4px; }
.muted { color: #888; font-size: 13px; }
#btn-friend-action { background: #2e7d32; color: #fff; border: 1px solid #2e7d32; padding: 8px 14px; border-radius: 4px; cursor: pointer; }
#btn-friend-action:disabled { background: #555; border-color: #555; opacity: 0.7; cursor: default; }

    /* Container Layout */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    color: #ffffff;
}

/* Header */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Profile Card */
.profile-card {
    background-color: #262421;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.avatar-large {
    font-size: 3rem;
    background: #302e2b;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.info-section h2 { margin: 0 0 5px 0; }
.bio-text { color: #aaa; font-style: italic; font-size: 0.9rem; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.stat-box {
    background: #262421;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.stat-box .label { font-size: 0.8rem; color: #888; }
.stat-box .value { font-size: 1.2rem; font-weight: bold; }

.stat-box.win .value { color: #629924; }
.stat-box.loss .value { color: #cc3333; }
.stat-box.draw .value { color: #a0a0a0; }

/* Match History List */
.match-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-item {
    background: #262421;
    padding: 12px 15px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid transparent;
}

.match-item.win { border-left-color: #629924; }
.match-item.loss { border-left-color: #cc3333; }
.match-item.draw { border-left-color: #888; }

.match-opponent { display: block; font-weight: bold; }
.match-date { font-size: 0.8rem; color: #777; }
.match-result-badge { 
    font-weight: bold; 
    font-size: 0.9rem;
}

/* Modal Simple */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex; justify-content: center; align-items: center;
}
.modal.hidden { display: none; }
.modal-content {
    background: #302e2b; padding: 20px; border-radius: 8px; width: 300px;
}
input {
    width: 100%; padding: 8px; margin: 10px 0;
    background: #403d39; border: 1px solid #555; color: white;
}

/* 1. Container Kartu Profil (Pastikan Flexbox aktif) */
.profile-card {
    background-color: #262421; /* Warna background kartu */
    padding: 20px 30px;        /* Padding agar isi tidak mepet pinggir */
    border-radius: 8px;
    display: flex;             /* Agar Avatar di kiri, Teks di kanan */
    align-items: center;       /* Rata tengah secara vertikal */
    gap: 25px;                 /* Jarak antara Avatar dan Teks Nama */
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    overflow: hidden;          /* Mencegah isi keluar dari kartu */
}

/* 2. Container Avatar (Lingkaran Pembungkus) */
.avatar-large {
    width: 100px;           /* KUNCI: Harus ada ukuran tetap */
    height: 100px;          /* KUNCI: Harus ada ukuran tetap */
    border-radius: 50%;     /* Membuat bulat sempurna */
    position: relative;     /* Agar overlay "Ubah" terkunci di dalamnya */
    overflow: hidden;       /* Memotong gambar yang kotak jadi bulat */
    flex-shrink: 0;         /* Agar lingkaran tidak gepeng */
    border: 3px solid #403d39; /* Opsional: Border biar rapi */
}

/* 3. Gambar Avatar */
#img-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;      /* Agar gambar tidak penyet/gepeng */
    display: block;
}

/* 4. Overlay "Ubah" & Kamera (Perbaikan Utama Isu Anda) */
.avatar-overlay {
    position: absolute;     /* Posisi mutlak di atas gambar */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* Styling Tampilan */
    background: rgba(0, 0, 0, 0.6); /* Background hitam transparan */
    color: white;
    font-size: 0.9rem;      /* KUNCI: Mengecilkan tulisan & ikon */
    font-weight: bold;
    
    /* Penataan Posisi Teks ke Tengah */
    display: flex;
    flex-direction: column; /* Ikon di atas, teks di bawah */
    justify-content: center;
    align-items: center;
    
    /* Efek Hover (Sembunyi dulu, muncul pas kursor masuk) */
    opacity: 0;             
    transition: opacity 0.3s ease;
}

/* Munculkan overlay saat mouse di atas avatar */
.avatar-large:hover .avatar-overlay {
    opacity: 1;
}
/* === Match History === */
.history-section { margin-top: 24px; }
.history-section h3 { margin: 0 0 10px; }
#list-history { display: flex; flex-direction: column; gap: 6px; }
.history-row {
    display: grid;
    grid-template-columns: 24px 1fr 70px 70px 120px;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: #302e2b;
    border-left: 3px solid #555;
    border-radius: 4px;
    font-size: 14px;
}
.history-row .h-color { font-size: 18px; text-align: center; }
.history-row .h-opponent { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row .h-result { font-family: monospace; color: #ccc; }
.history-row .h-outcome { font-weight: 600; }
.history-row .h-date { color: #888; font-size: 12px; text-align: right; }
.history-row.outcome-win { border-left-color: #44cc44; }
.history-row.outcome-win .h-outcome { color: #44cc44; }
.history-row.outcome-loss { border-left-color: #cc4444; }
.history-row.outcome-loss .h-outcome { color: #e05a5a; }
.history-row.outcome-draw { border-left-color: #c0a033; }
.history-row.outcome-draw .h-outcome { color: #e0c060; }
.history-row.clickable { cursor: pointer; transition: background 0.15s; }
.history-row.clickable:hover,
.history-row.clickable:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; }
.history-empty { color: #888; padding: 12px; text-align: center; }
@media (max-width: 600px) {
    .history-row { grid-template-columns: 20px 1fr 60px 60px; }
    .history-row .h-date { display: none; }
}

/* === Friends section === */
.friends-section { margin-top: 24px; display: flex; flex-direction: column; gap: 18px; }
.friends-action { display: flex; align-items: center; gap: 10px; }
.friends-block h3 { margin: 0 0 8px; font-size: 15px; color: #e8e8e8; }
.req-count { color: #ff6b6b; font-weight: 700; font-size: 13px; margin-left: 4px; }
.friend-row { display: grid; grid-template-columns: 36px 1fr auto auto auto; gap: 8px; align-items: center; padding: 6px 10px; background: #302e2b; border-radius: 4px; margin-bottom: 4px; font-size: 14px; }
.friend-avatar { width: 32px; height: 32px; border-radius: 50