
:root {
    --black: #111111;
    --dark: #1b1b1b;
    --gray: #777777;
    --muted: #a0a0a0;
    --line: #e9e9e9;
    --soft: #f5f5f5;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #ffffff;
    color: var(--black);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    cursor: pointer;
}

.app {
    width: 100%;
    max-width: 600px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 22px calc(100px + env(safe-area-inset-bottom));
}

.topbar {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-mark {
    width: 39px;
    height: 39px;
    background: var(--black);
    color: white;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -1px;
}

.brand-name {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
}

.brand-subtitle {
    font-size: 8px;
    color: var(--gray);
    letter-spacing: 2px;
    margin-top: 4px;
}

.icon-button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
}

.page {
    display: none;
    padding-top: 32px;
    animation: appear .2s ease;
}

.page.active {
    display: block;
}

@keyframes appear {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-heading {
    margin-bottom: 25px;
}

.eyebrow {
    color: var(--gray);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.page-heading h1 {
    font-size: 29px;
    line-height: 1.15;
    letter-spacing: -1.2px;
    font-weight: 750;
}

.page-heading p {
    color: var(--gray);
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.5;
}

.profile-card {
    background: var(--black);
    color: white;
    padding: 22px;
    border-radius: 17px;
}

.profile-top {
    display: flex;
    align-items: center;
    gap: 13px;
}

.avatar {
    width: 49px;
    height: 49px;
    border-radius: 50%;
    background: white;
    color: var(--black);
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 750;
    overflow: hidden;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.profile-identity {
    min-width: 0;
    flex: 1;
}

.profile-name {
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-username {
    font-size: 11px;
    color: #aaaaaa;
    margin-top: 5px;
}

.level-badge {
    width: 48px;
    height: 48px;
    border: 1px solid #555555;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
}

.level-badge span {
    font-size: 8px;
    color: #aaaaaa;
    letter-spacing: 1px;
}

.level-badge strong {
    font-size: 19px;
    margin-top: 1px;
}

.profile-divider {
    height: 1px;
    background: #383838;
    margin: 21px 0;
}

.xp-heading, .xp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.xp-heading {
    font-size: 9px;
    letter-spacing: 1.3px;
    color: #bcbcbc;
}

.xp-heading strong {
    color: white;
    font-size: 11px;
    letter-spacing: 0;
}

.progress-track {
    height: 6px;
    background: #dedede;
    border-radius: 20px;
    overflow: hidden;
    margin-top: 12px;
}

.profile-card .progress-track {
    background: #414141;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: var(--black);
    border-radius: inherit;
    transition: width .3s ease;
}

.profile-card .progress-fill {
    background: white;
}

.xp-footer {
    margin-top: 10px;
    font-size: 9px;
    color: #aaaaaa;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 31px 0 14px;
}

.section-heading h2 {
    font-size: 16px;
    letter-spacing: -.3px;
}

.section-caption {
    font-size: 8px;
    color: var(--muted);
    letter-spacing: 1px;
}

.text-button {
    background: transparent;
    border: none;
    color: var(--gray);
    font-size: 11px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-card {
    min-height: 112px;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-icon {
    font-size: 16px;
    color: var(--gray);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 23px;
    font-weight: 750;
    letter-spacing: -.8px;
}

.stat-label {
    font-size: 10px;
    color: var(--gray);
    margin-top: 3px;
}

.activity-card {
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 4px 14px;
}

.empty-state {
    padding: 22px 8px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.collection-summary {
    background: var(--soft);
    border-radius: 13px;
    padding: 17px;
    margin-bottom: 18px;
}

.collection-summary > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-label {
    color: var(--gray);
    font-size: 9px;
    letter-spacing: 1px;
}

.collection-summary strong {
    font-size: 15px;
}

.summary-progress .progress-track {
    height: 5px;
    background: #dddddd;
}

.summary-progress .progress-fill {
    background: var(--black);
}

.achievement-list, .task-list, .leaderboard-list, .history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achievement-item, .task-item, .leader-item, .history-item {
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 13px;
}

.achievement-icon, .task-icon {
    width: 43px;
    height: 43px;
    background: var(--soft);
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 19px;
    flex-shrink: 0;
}

.achievement-item.locked {
    opacity: .48;
}

.achievement-info, .task-info, .leader-info, .history-info {
    flex: 1;
    min-width: 0;
}

.achievement-info strong, .task-info strong, .leader-info strong, .history-info strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.achievement-info p, .task-info p, .leader-info p, .history-info p {
    font-size: 10px;
    color: var(--gray);
    margin-top: 5px;
    line-height: 1.4;
}

.item-status {
    font-size: 9px;
    color: var(--gray);
    text-align: right;
    white-space: nowrap;
}

.task-reward {
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.task-progress {
    margin-top: 9px;
}

.task-progress .progress-track {
    height: 4px;
    margin-top: 0;
    background: #e5e5e5;
}

.task-progress .progress-fill {
    background: var(--black);
}

.daily-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-bottom: 17px;
}

.daily-date span {
    font-size: 9px;
    color: var(--gray);
    letter-spacing: 1.2px;
}

.daily-date strong {
    font-size: 11px;
}

.footnote {
    font-size: 10px;
    color: var(--muted);
    margin-top: 16px;
    line-height: 1.5;
}

.ranking-tabs {
    display: flex;
    background: var(--soft);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 17px;
}

.ranking-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    font-size: 11px;
    color: var(--gray);
}

.ranking-tab.active {
    background: var(--black);
    color: white;
}

.leader-item {
    padding: 12px;
}

.leader-place {
    width: 27px;
    text-align: center;
    font-size: 13px;
    font-weight: 750;
}

.leader-avatar {
    width: 37px;
    height: 37px;
    background: var(--soft);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
}

.leader-score {
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.history-summary {
    background: var(--black);
    color: white;
    border-radius: 13px;
    padding: 18px;
    margin-bottom: 17px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-summary span {
    font-size: 9px;
    color: #bcbcbc;
    letter-spacing: 1px;
}

.history-summary strong {
    font-size: 17px;
}

.history-item {
    padding: 13px;
}

.history-symbol {
    width: 36px;
    height: 36px;
    background: var(--soft);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 15px;
}

.history-amount {
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.history-amount.positive {
    color: var(--black);
}

.history-amount.negative {
    color: #888888;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--line);
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    z-index: 5;
    backdrop-filter: blur(12px);
}

.nav-item {
    border: none;
    background: transparent;
    color: #999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 9px;
    padding: 3px;
}

.nav-icon {
    font-size: 20px;
    line-height: 1;
}

.nav-item.active {
    color: var(--black);
    font-weight: 750;
}

.nav-item.active .nav-icon {
    transform: translateY(-1px);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    z-index: 10;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: white;
    border-radius: 16px;
    padding: 25px;
}

.modal h2 {
    font-size: 21px;
    margin-bottom: 12px;
}

.modal p {
    color: var(--gray);
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.modal .modal-note {
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 10px;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 12px;
    border: none;
    background: none;
    font-size: 24px;
    color: var(--gray);
}

@media (min-width: 500px) {
    .app {
        padding-left: 30px;
        padding-right: 30px;
    }
}

@media (max-width: 360px) {
    .app {
        padding-left: 16px;
        padding-right: 16px;
    }

    .profile-card {
        padding: 17px;
    }

    .xp-footer {
        font-size: 8px;
    }
}
