/* ======================================== */
/* 업적 페이지 기본 레이아웃               */
/* ======================================== */
.ach-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ======================================== */
/* 대시보드 (상단 통계)                     */
/* ======================================== */
.ach-dashboard {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 28px;
    color: #fff;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.ach-dashboard::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}
.ach-dashboard::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 30%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}
.ach-dash-top {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}
.ach-progress-ring {
    position: relative;
    width: 88px;
    height: 88px;
    flex-shrink: 0;
}
.ach-progress-ring svg {
    transform: rotate(-90deg);
}
.ach-progress-pct {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: 800;
}
.ach-dash-info {
    flex: 1;
    min-width: 0;
}
.ach-dash-info h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}
.ach-dash-info p {
    margin: 0;
    font-size: 14px;
    opacity: 0.85;
}
.ach-dash-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.ach-rarity-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255,255,255,0.18);
}
.ach-rarity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* 최근 달성 미니 리스트 (대시보드 내) */
.ach-dash-recent {
    position: relative;
    z-index: 1;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.15);
}
.ach-dash-recent-title {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 8px;
    font-weight: 600;
}
.ach-dash-recent-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.ach-dash-recent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    font-size: 12px;
}
.ach-dash-recent-item i {
    font-size: 14px;
}

/* 카테고리 진행 바 */
.ach-cat-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}
.ach-cat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    font-size: 12px;
}
.ach-cat-pill i {
    font-size: 11px;
    opacity: 0.8;
}

/* ======================================== */
/* 비로그인 / 통계 배너                     */
/* ======================================== */
.ach-guest-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 28px;
    color: #fff;
    margin-bottom: 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.ach-guest-banner h2 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
}
.ach-guest-banner p {
    margin: 0;
    font-size: 14px;
    opacity: 0.85;
}
.ach-guest-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.ach-guest-stat {
    text-align: center;
}
.ach-guest-stat-num {
    font-size: 28px;
    font-weight: 800;
    display: block;
}
.ach-guest-stat-label {
    font-size: 12px;
    opacity: 0.75;
}

/* ======================================== */
/* 필터 탭 (카테고리)                       */
/* ======================================== */
.ach-filters {
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ach-filter-btn {
    flex: none;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}
.ach-filter-btn:hover {
    color: #2c3e50;
    background: #f8f9fa;
}
.ach-filter-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}
.ach-filter-btn .filter-count {
    font-size: 10px;
    color: #bdc3c7;
    margin-left: 3px;
}
.ach-filter-btn.active .filter-count {
    color: #667eea;
}

/* ======================================== */
/* 필터 행 (레어리티 + 정렬 + 검색)         */
/* ======================================== */
.ach-filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.ach-rarity-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.ach-rarity-btn {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}
.ach-rarity-btn:hover {
    border-color: #bbb;
}
.ach-rarity-btn.active {
    color: #fff;
}

/* 정렬/뷰 토글 */
.ach-view-controls {
    display: flex;
    gap: 8px;
    margin-left: auto;
    align-items: center;
}
.ach-sort-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 12px;
    color: #555;
    background: #fff;
    cursor: pointer;
    outline: none;
}
.ach-sort-select:focus {
    border-color: #667eea;
}
.ach-view-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #999;
    transition: all 0.2s;
}
.ach-view-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* ======================================== */
/* 업적 그리드                              */
/* ======================================== */
.ach-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.ach-grid.list-view {
    grid-template-columns: 1fr;
    gap: 8px;
}

/* ======================================== */
/* 업적 카드                                */
/* ======================================== */
.ach-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid #eee;
    position: relative;
    overflow: hidden;
}
.ach-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.ach-card.locked {
    opacity: 0.55;
    filter: grayscale(0.6);
}
.ach-card.locked .ach-card-icon {
    color: #bdc3c7 !important;
}
.ach-card.unlocked {
    border-color: var(--ach-color, #3498db);
}
.ach-card.unlocked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ach-color, #3498db);
}
.ach-card.unlocked::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    color: #fff;
    background: var(--ach-color, #3498db);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* glow 효과 - 레어리티별 */
.ach-card.unlocked.rarity-common {
    box-shadow: 0 0 8px rgba(149,165,166,0.15);
}
.ach-card.unlocked.rarity-uncommon {
    box-shadow: 0 0 10px rgba(39,174,96,0.2);
}
.ach-card.unlocked.rarity-rare {
    box-shadow: 0 0 14px rgba(52,152,219,0.25);
}
.ach-card.unlocked.rarity-epic {
    box-shadow: 0 0 18px rgba(142,68,173,0.3);
}
.ach-card.unlocked.rarity-legendary {
    box-shadow: 0 0 22px rgba(243,156,18,0.35);
    animation: ach-glow-legendary 2s ease-in-out infinite alternate;
}
@keyframes ach-glow-legendary {
    from { box-shadow: 0 0 14px rgba(243,156,18,0.2); }
    to   { box-shadow: 0 0 28px rgba(243,156,18,0.5); }
}

.ach-card-icon {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
    transition: transform 0.3s;
}
.ach-card:hover .ach-card-icon {
    transform: scale(1.15);
}
.ach-card-lock {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    color: #bdc3c7;
}
.ach-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}
.ach-card-desc {
    font-size: 11px;
    color: #95a5a6;
    margin-bottom: 8px;
    line-height: 1.4;
    min-height: 30px;
}
.ach-card-meta {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
}
.ach-card-rarity {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
}
.ach-card-reward {
    font-size: 11px;
    color: #e67e22;
    font-weight: 600;
}
.ach-card-date {
    font-size: 10px;
    color: #95a5a6;
    margin-top: 6px;
}

/* 리스트 뷰 카드 */
.ach-grid.list-view .ach-card {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    padding: 14px 20px;
}
.ach-grid.list-view .ach-card-icon {
    font-size: 24px;
    margin-bottom: 0;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}
.ach-grid.list-view .ach-card-name {
    font-size: 14px;
    margin-bottom: 0;
}
.ach-grid.list-view .ach-card-desc {
    min-height: auto;
    margin-bottom: 0;
    flex: 1;
}
.ach-grid.list-view .ach-card-meta {
    flex-shrink: 0;
}
.ach-grid.list-view .ach-card-date,
.ach-grid.list-view .ach-progress,
.ach-grid.list-view .ach-progress-text {
    display: none;
}

/* ======================================== */
/* 진행도 바                                */
/* ======================================== */
.ach-progress {
    width: 100%;
    height: 4px;
    background: #eee;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}
.ach-progress-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}
.ach-progress-text {
    font-size: 10px;
    color: #95a5a6;
    margin-top: 3px;
}

/* ======================================== */
/* 섹션 헤더                                */
/* ======================================== */
.ach-section {
    margin-bottom: 32px;
}
.ach-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ach-section-title i {
    color: #667eea;
}

/* ======================================== */
/* 타임라인                                 */
/* ======================================== */
.ach-timeline {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.ach-tl-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}
.ach-tl-item:last-child {
    border-bottom: none;
}
.ach-tl-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.ach-tl-info {
    flex: 1;
    min-width: 0;
}
.ach-tl-info strong {
    font-size: 13px;
    color: #2c3e50;
}
.ach-tl-info span {
    font-size: 12px;
    color: #95a5a6;
}
.ach-tl-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}
.ach-tl-time {
    font-size: 11px;
    color: #bdc3c7;
    white-space: nowrap;
}

/* ======================================== */
/* 랭킹                                    */
/* ======================================== */
.ach-ranking {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.ach-rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}
.ach-rank-item:last-child {
    border-bottom: none;
}
.ach-rank-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    background: #f0f0f0;
    color: #666;
    flex-shrink: 0;
}
.ach-rank-num.top1 {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
}
.ach-rank-num.top2 {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    color: #fff;
}
.ach-rank-num.top3 {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: #fff;
}
.ach-rank-info {
    flex: 1;
    min-width: 0;
}
.ach-rank-nick {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}
.ach-rank-detail {
    font-size: 12px;
    color: #95a5a6;
}
.ach-rank-score {
    font-size: 16px;
    font-weight: 800;
    color: #667eea;
}

/* ======================================== */
/* 모달                                     */
/* ======================================== */
.ach-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.ach-modal-overlay.show {
    display: flex;
}
.ach-modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    max-width: 440px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: ach-modal-in 0.3s ease;
}
@keyframes ach-modal-in {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.ach-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 20px;
    color: #bdc3c7;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    line-height: 1;
}
.ach-modal-close:hover {
    color: #e74c3c;
}
.ach-modal-icon {
    font-size: 56px;
    text-align: center;
    margin-bottom: 16px;
}
.ach-modal-name {
    font-size: 20px;
    font-weight: 800;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 4px;
}
.ach-modal-desc {
    font-size: 14px;
    color: #7f8c8d;
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.5;
}
.ach-modal-details {
    border-top: 1px solid #eee;
    padding-top: 16px;
}
.ach-modal-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid #f8f8f8;
}
.ach-modal-detail-row:last-child {
    border-bottom: none;
}
.ach-modal-label {
    color: #7f8c8d;
}
.ach-modal-value {
    font-weight: 600;
    color: #2c3e50;
}

/* 모달 진행도 바 (모달 내부) */
.ach-modal-progress {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.ach-modal-progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}
.ach-modal-progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.ach-modal-progress-text {
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
}

/* ======================================== */
/* 토스트 알림                              */
/* ======================================== */
.ach-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.ach-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    border-left: 4px solid #667eea;
    animation: ach-toast-in 0.4s ease, ach-toast-out 0.4s ease 4s forwards;
    max-width: 360px;
    pointer-events: auto;
}
@keyframes ach-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes ach-toast-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}
.ach-toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}
.ach-toast-text {
    flex: 1;
}
.ach-toast-title {
    font-size: 12px;
    color: #95a5a6;
    font-weight: 600;
}
.ach-toast-name {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
}

/* ======================================== */
/* 빈 상태                                  */
/* ======================================== */
.ach-empty {
    text-align: center;
    padding: 40px;
    color: #bdc3c7;
    font-size: 14px;
}

/* ======================================== */
/* 2열 레이아웃 (타임라인 + 랭킹)           */
/* ======================================== */
.ach-bottom-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ======================================== */
/* 그리드 통계 바                           */
/* ======================================== */
.ach-grid-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: #7f8c8d;
}
.ach-grid-stats strong {
    color: #2c3e50;
}

/* ======================================== */
/* 반응형                                   */
/* ======================================== */
@media (max-width: 992px) {
    .ach-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .ach-bottom-cols {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .ach-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .ach-card {
        padding: 14px 10px;
    }
    .ach-card-icon {
        font-size: 26px;
    }
    .ach-card-name {
        font-size: 13px;
    }
    .ach-card-desc {
        font-size: 10px;
        min-height: 24px;
    }
    .ach-dashboard {
        padding: 20px;
    }
    .ach-dash-top {
        gap: 16px;
    }
    .ach-progress-ring {
        width: 68px;
        height: 68px;
    }
    .ach-progress-pct {
        font-size: 18px;
    }
    .ach-dash-info h2 {
        font-size: 18px;
    }
    .ach-modal {
        padding: 24px 20px;
    }
    .ach-filter-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .ach-view-controls {
        margin-left: 0;
    }
    .ach-dash-recent-list {
        flex-direction: column;
        gap: 6px;
    }
}
@media (max-width: 480px) {
    .ach-page {
        padding: 12px 8px;
    }
    .ach-filter-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
    .ach-guest-stats {
        gap: 16px;
    }
    .ach-guest-stat-num {
        font-size: 22px;
    }
}