/* ========================================
   ! PROFILE PANEL
   Выезжающая справа панель профиля — тот же визуальный язык и та же
   drawer-архитектура (backdrop + panel), что у Stats (stats-panel.css) и
   Notepad (notepad.css). Раньше профиль открывался центрированной модалкой
   (.profile-modal-overlay в style.css) — теперь единый паттерн приложения.
   append to index.html <head>, load after style.css
   ======================================== */

.profile-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 6999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
}
.profile-panel-backdrop.open { opacity: 1; pointer-events: auto; }

.profile-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 88vw;
    max-width: 400px;
    background: var(--m-surface);
    border-left: 2px solid var(--m-dark);
    box-shadow: -4px 0 0 rgba(26, 26, 26, .55);
    z-index: 7000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s ease;
    outline: none;
}
.profile-panel.open { transform: translateX(0); }

.profile-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
    background: var(--m-dark);
    color: var(--m-yellow);
    flex-shrink: 0;
}
.profile-panel-title {
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-panel-close {
    background: none;
    border: 2px solid var(--m-yellow);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    min-width: 30px;
    color: var(--m-yellow);
    font-weight: 900;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s, border-color .12s;
}
.profile-panel-close:hover,
.profile-panel-close:active { background: var(--m-pink); border-color: var(--m-pink); color: #fff; }

.profile-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

/* Toolbar/footer button — same "active = filled yellow" language as
   #statsPanelBtn.active (stats-panel.css) / .translater-btn.active. */
#profileFooterBtn.active .btn-icon { color: var(--m-dark); }
#profileFooterBtn.active { background: var(--m-yellow) !important; }

/* ── Avatar block (unchanged visuals, was .profile-modal's top section) ── */
.profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px 16px;
    gap: 10px;
    position: relative;
}

.profile-avatar-img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid var(--m-dark);
    object-fit: cover;
}

.profile-avatar-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid var(--m-dark);
    background: var(--m-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 900;
    color: var(--m-dark);
}

.profile-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 18px;
    background: var(--m-surface2);
    border: 3px solid var(--m-dark);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 800;
    color: var(--m-dark);
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.profile-avatar-btn:hover  { background: var(--m-teal); color: #fff; }
.profile-avatar-btn:active { transform: translate(2px,2px); }

.profile-field-error {
    font-size: 11px;
    font-weight: 700;
    color: #d32;
    min-height: 16px;
    text-align: center;
}

.profile-fields {
    padding: 4px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-field label {
    display: block;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--m-dark);
    opacity: .5;
    margin-bottom: 5px;
}

.profile-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--m-dark);
    padding: 8px 12px;
    background: var(--m-surface2);
    border: 2px solid var(--m-dark);
    border-radius: 8px;
    word-break: break-all;
}

.profile-phone-input {
    flex: 1;
    background: var(--m-surface2);
    border: 3px solid var(--m-dark);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    color: var(--m-dark);
    outline: none;
    transition: border-color .15s;
}
.profile-phone-input:focus { border-color: var(--m-teal); }

.profile-save-btn {
    background: var(--m-lime);
    border: 3px solid var(--m-dark);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 900;
    font-family: inherit;
    color: var(--m-dark);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.profile-save-btn:hover { background: var(--m-teal); color: #fff; }

/* ── Font size slider ──────────────────────────────────────────────── */
.profile-field-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 5px;
}
.profile-field-label-row label { margin-bottom: 0; }
.profile-font-size-val {
    font-size: 11px;
    font-weight: 900;
    color: var(--m-dark);
    opacity: .7;
}

.profile-font-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 20px;
    background: var(--m-surface2);
    border: 2px solid var(--m-dark);
    outline: none;
    cursor: pointer;
}
.profile-font-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--m-teal);
    border: 3px solid var(--m-dark);
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--m-dark);
}
.profile-font-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--m-teal);
    border: 3px solid var(--m-dark);
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--m-dark);
}
.profile-font-slider::-moz-range-track {
    height: 8px;
    border-radius: 20px;
    background: var(--m-surface2);
}

/* ========== Mobile ========== */
@media (max-width: 480px) {
    .profile-panel { width: 100vw; max-width: 100vw; }
}
