@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }

:root{
    --bg: #ffffff;
    --text: #143224;
    --muted: rgba(20, 50, 36, 0.55);
    --accent: #256C40;
    --accent-soft: #9BBF91;
    --card: #ffffff;
    --shadow: 0 12px 30px rgba(25, 17, 42, 0.14);
    --shadow-soft: 0 10px 24px rgba(25, 17, 42, 0.10);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

body {
    margin: 0;
    font-family: "Inter", sans-serif;
    background: #ffffff;
    color: var(--text);
    min-height: 100vh;
}

.screen{
    max-width: 768px;
    margin: 0 auto;
}

.header{
    position: relative;
    height: 190px;
    background:
        linear-gradient(135deg, rgba(155,191,145,0.55), rgba(37,108,64,0.55)),
        url("../assets/avatarBanner.jpg");
    background-size: cover;
    background-position: center;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.header-wave{
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 86px;
    background: var(--bg);
    border-top-left-radius: 48px;
    border-top-right-radius: 48px;
    transform: translateY(34px);
}

.header-shapes{
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.9;
    background:
        radial-gradient(circle at 18% 26%, rgba(255,255,255,0.30) 0 2px, transparent 3px),
        radial-gradient(circle at 78% 22%, rgba(255,255,255,0.26) 0 3px, transparent 4px),
        radial-gradient(circle at 82% 64%, rgba(255,255,255,0.18) 0 2px, transparent 3px),
        linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0) 40%),
        linear-gradient(0deg, rgba(255,255,255,0.10), rgba(255,255,255,0));
}

.header-shapes::before,
.header-shapes::after{
    content:"";
    position:absolute;
    inset:0;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    opacity: 0.9;
    pointer-events: none;
}

.header-shapes::before{
    background-image:
        radial-gradient(circle at 25% 55%, rgba(255,255,255,0.22) 0 2px, transparent 3px),
        radial-gradient(circle at 60% 36%, rgba(255,255,255,0.18) 0 2px, transparent 3px);
}

.header-shapes::after{
    background-image:
        linear-gradient(90deg, transparent 0 60%, rgba(255,255,255,0.18) 60% 61%, transparent 61%),
        linear-gradient(0deg, transparent 0 38%, rgba(255,255,255,0.18) 38% 39%, transparent 39%);
    mask-image:
        radial-gradient(circle at 70% 40%, black 0 20px, transparent 21px);
}

.menu-btn{
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: grid;
    align-content: center;
    justify-content: center;
    gap: 5px;
    -webkit-tap-highlight-color: transparent;
}
.menu-btn span{
    display:block;
    width: 18px;
    height: 2px;
    background: rgba(255,255,255,0.92);
    border-radius: 2px;
}

.profile-menu {
    position: absolute;
    top: 62px;
    left: 14px;
    z-index: 4;
    min-width: 160px;
    padding: 8px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(20, 50, 36, 0.22);
    border: 1px solid rgba(37, 108, 64, 0.14);
}

.profile-menu-item {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #b32727;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.profile-menu-item:hover {
    background: rgba(179, 39, 39, 0.08);
}

.card{
    margin-top: -54px;
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 0 18px 18px;
    position: relative;
}

.avatar-banner{ display: none; }

.avatar-wrap{
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto;
    transform: translateY(-60px);
    background: var(--card);
    padding: 4px;
    box-shadow: 0 12px 28px rgba(25, 17, 42, 0.18);
    border: 1px solid rgba(37,108,64,0.18);
}
.avatar{
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(37,108,64,0.65);
}

.profile-name{
    margin: -44px 0 6px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.profile-subtitle{
    margin: 0 0 5px;
    text-align:center;
    font-size: 13px;
    color: var(--muted);
}

.stats-row{
    display:flex;
    justify-content: center;
    gap: 30px;
    padding: 6px 4px;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
}
.stat-item{
    /* flex:; */
    text-align:center;
    padding: 4px 0;
}
.stat-value{
    display:block;
    font-size: 18px;
    font-weight: 700;
    color: rgba(31, 26, 43, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.stat-value .fa-fire-alt{
    color: #ff6b35;
    font-size: 16px;
}
.stat-label{
    display:block;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(31, 26, 43, 0.50);
}

.actions{
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 16px 0 10px;
}
.primary-btn{
    padding: 0 40px;
    height: 42px;
    border: none;
    border-radius: 16px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(37, 108, 64, 0.16);
    -webkit-tap-highlight-color: transparent;
}
.primary-btn:active{ transform: translateY(1px); }

.icon-btn{
    width: 42px;
    height: 42px;
    border-radius: 16px;
    border: 1px solid rgba(37,108,64,0.18);
    background: rgba(155,191,145,0.22);
    color: rgba(37,108,64,1);
    cursor:pointer;
    display:grid;
    place-items:center;
    -webkit-tap-highlight-color: transparent;
}
.icon-btn:active{ transform: translateY(1px); }

.tabs{
    display:flex;
    gap: 18px;
    margin-top: 8px;
    padding: 4px 6px 0;
    border-bottom: 1px solid rgba(25, 17, 42, 0.08);
}
.tab{
    position: relative;
    border: none;
    background: transparent;
    padding: 10px 2px 12px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(31, 26, 43, 0.42);
    cursor: pointer;
}
.tab.active{
    color: rgba(37,108,64,1);
}
.tab.active::after{
    content:"";
    position:absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-soft), var(--accent));
}

.content{
    padding-top: 14px;
}

.hidden { display: none !important; }

.content-panel.hidden {
    display: none !important;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.achievement-card {
    border-radius: var(--radius-lg, 18px);
    overflow: hidden;
    background: var(--card, #fff);
    box-shadow: var(--shadow-soft, 0 10px 24px rgba(25, 17, 42, 0.10));
    border: 1px solid rgba(37, 108, 64, 0.12);
    display: flex;
    flex-direction: column;
}

.achievement-image-wrap {
    position: relative;
    aspect-ratio: 1;
    background: rgba(155, 191, 145, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.achievement-placeholder {
    font-size: 48px;
}

.achievement-placeholder.hidden {
    display: none !important;
}

.achievement-card.locked .achievement-image-wrap {
    filter: grayscale(1);
    opacity: 0.85;
}

.achievement-card.locked .achievement-image-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.achievement-locked-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    z-index: 2;
}

.achievement-locked-badge .fa-fire-alt {
    color: #f5c542;
}

.grid{
    display:grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.grid-card{
    border-radius: 18px;
    min-height: 112px;
    box-shadow: 0 10px 18px rgba(25, 17, 42, 0.08);
    position: relative;
    overflow: hidden;
}
.grid-card::after{
    content:"";
    position:absolute;
    inset: 12px;
    border-radius: 14px;
    border: 1px dashed rgba(31,26,43,0.14);
    opacity: 0.55;
}
.pastel-1{ background: #efe9ff; }
.pastel-2{ background: #f7e9ff; }
.pastel-3{ background: #eaf4ff; }
.pastel-4{ background: #eafff5; }
.pastel-5{ background: #fff2e6; }
.pastel-6{ background: #fff0f5; }

.bottom-nav {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 88%;
    max-width: 420px;
    height: 64px;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-radius: 20px;
    box-shadow: 0 -4px 20px rgba(25, 17, 42, 0.12);
    border: 1px solid rgba(25, 17, 42, 0.06);
}

.bottom-nav a {
    text-decoration: none;
    color: rgba(31, 26, 43, 0.52);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bottom-nav a.active {
    color: rgba(37,108,64,1);
    font-weight: 600;
}

/* Модалда (embed) көрсетілгенде тек төменгі навигацияны жасыру, скролл қосу */
body.profile-embed .bottom-nav {
    display: none !important;
}

body.profile-embed {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    height: 100%;
}

/* Edit profile modal */
.edit-modal.hidden { display: none; }

.edit-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.edit-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
}

.edit-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(20, 50, 36, 0.35);
    padding: 18px 16px 16px;
}

.edit-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(37,108,64,0.12);
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.edit-title {
    margin: 10px 0 14px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}

.edit-form { display: flex; flex-direction: column; gap: 12px; }

.edit-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }

.edit-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.edit-input {
    height: 44px;
    padding: 0 12px;
    border-radius: 14px;
    border: 1px solid rgba(37,108,64,0.12);
    outline: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
}

.edit-input:focus {
    border-color: rgba(37,108,64,0.35);
    box-shadow: 0 0 0 3px rgba(37,108,64,0.10);
}

.edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.edit-primary-btn,
.edit-secondary-btn {
    flex: 1;
    height: 44px;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}

.edit-primary-btn {
    border: none;
    background: var(--accent);
    color: #fff;
}

.edit-secondary-btn {
    border: 1px solid rgba(37,108,64,0.18);
    background: #fff;
    color: var(--accent);
}

.edit-hint {
    margin: 2px 0 0;
    min-height: 16px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.avatar-picker{
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: -4px;
    margin-bottom: 6px;
}

.avatar-pill{
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid rgba(37,108,64,0.25);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.avatar-pill .material-symbols-outlined{
    font-size: 26px;
    color: var(--accent);
}

.avatar-pill-img{
    padding: 0;
}

.avatar-pill-img img{
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.avatar-pill.active{
    box-shadow: 0 0 0 3px rgba(37,108,64,0.14);
    border-color: rgba(37,108,64,0.35);
}

.avatar-file{
    display: none;
}
