/* Achievements page — matches homepage / profile glass theme */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: clip;
}

body.achievements-page-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #050505;
    color: #f5f5f5;
    padding: 0;
    min-height: 100vh;
    overflow-x: clip;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.achievements-page-body .ach-page button,
body.achievements-page-body .ach-page input,
body.achievements-page-body .ach-page textarea,
body.achievements-page-body .ach-page select {
    font: inherit;
}

body.achievements-page-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.92em;
}

body.achievements-page-body .ach-page {
    position: relative;
    max-width: min(1200px, 100%);
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 32px) clamp(32px, 5vw, 48px);
    box-sizing: border-box;
}

body.achievements-page-body #headerContainer {
    width: 100%;
}

.ach-hero {
    position: relative;
    z-index: 1;
    margin: 0 0 clamp(20px, 3vw, 28px);
    padding: clamp(28px, 5vw, 44px) 0 clamp(24px, 4vw, 32px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ach-hero-title,
.ach-hero-lead,
.ach-hero-stats {
    position: relative;
    z-index: 1;
}

.ach-hero-title {
    margin: 0 0 10px;
    font-size: clamp(28px, 5vw, 40px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    line-height: 1.1;
}

.ach-hero-lead {
    margin: 0;
    max-width: 42rem;
    font-size: clamp(15px, 2.2vw, 17px);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.55);
}

.ach-hero-stats {
    display: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: clamp(20px, 3vw, 28px);
}

.ach-hero-stats.is-visible {
    display: grid;
}

@media (max-width: 720px) {
    .ach-hero-stats.is-visible {
        grid-template-columns: 1fr;
    }
}

.ach-stat-box {
    position: relative;
    border-radius: 16px;
    padding: 18px 18px 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.ach-stat-box::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    opacity: 0.12;
    pointer-events: none;
    transform: translate(30%, -30%);
    background: radial-gradient(circle, #818cf8 0%, transparent 70%);
}

.ach-stat-box .ach-stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.ach-stat-box .ach-stat-value {
    font-size: clamp(22px, 4vw, 28px);
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.ach-stat-box .ach-stat-value--accent {
    color: #c7d2fe;
}

.ach-callout {
    margin-bottom: clamp(20px, 3vw, 28px);
    padding: clamp(16px, 2.5vw, 20px) clamp(18px, 3vw, 22px);
    border-radius: 16px;
    border: 1px solid rgba(234, 179, 8, 0.35);
    border-left: 4px solid #eab308;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(99, 102, 241, 0.06) 100%);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ach-callout-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ach-callout-icon {
    font-size: 1.35em;
    line-height: 1;
    flex-shrink: 0;
}

.ach-callout-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fde047;
}

.ach-callout p {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.78);
}

.ach-callout a {
    color: #a5b4fc;
    text-decoration: underline;
}

.ach-callout a:hover {
    color: #c7d2fe;
}

.ach-glass-section {
    margin-bottom: clamp(22px, 3.5vw, 32px);
    padding: clamp(20px, 3vw, 28px);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.ach-section-title {
    margin: 0 0 8px;
    font-size: clamp(20px, 3vw, 24px);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.ach-section-intro {
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.5);
    max-width: 52rem;
}

.ach-subsection {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ach-subsection:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.ach-subsection-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.ach-subsection-intro {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.45);
}

.ach-game-group {
    margin-bottom: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.ach-game-group:last-child {
    margin-bottom: 0;
}

.ach-game-group[open] {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
}

.ach-game-summary {
    list-style: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.92);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.15s ease;
}

.ach-game-summary::-webkit-details-marker {
    display: none;
}

.ach-game-summary::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent rgba(165, 180, 252, 0.9);
    flex-shrink: 0;
    transition: transform 0.2s ease;
    transform-origin: 35% 50%;
}

details.ach-game-group:not([open]) .ach-game-summary {
    border-bottom-color: transparent;
}

details.ach-game-group[open] .ach-game-summary::before {
    transform: rotate(90deg);
}

.ach-game-summary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ach-game-summary:focus-visible {
    outline: 2px solid #818cf8;
    outline-offset: -2px;
}

.ach-game-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
}

.ach-game-title-text {
    flex: 1;
    min-width: 0;
}

.ach-game-progress {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: #86efac;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

ul.ach-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

ul.ach-list li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 14px 16px;
}

ul.ach-list li:last-child {
    border-bottom: none;
}

ul.ach-list li.ach-row-unlocked {
    box-shadow: inset 3px 0 0 #34d399;
    background: rgba(52, 211, 153, 0.06);
}

.ach-unlock-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #a7f3d0;
    background: rgba(52, 211, 153, 0.14);
    border: 1px solid rgba(52, 211, 153, 0.35);
    vertical-align: 0.08em;
}

.ach-unlock-when {
    color: #6ee7b7;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.ach-row-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.ach-row-name {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    line-height: 1.35;
}

.ach-row-pts {
    color: #c7d2fe;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

.ach-row-desc {
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
    margin-top: 6px;
    line-height: 1.5;
}

.ach-row-meta {
    color: rgba(255, 255, 255, 0.38);
    font-size: 11px;
    margin-top: 8px;
    line-height: 1.4;
}

table.leader {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: inherit;
    font-size: 14px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
}

table.leader th,
table.leader td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
}

table.leader tbody tr:last-child td {
    border-bottom: none;
}

table.leader th {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.04);
}

table.leader a {
    color: #a5b4fc;
    text-decoration: none;
    font-weight: 600;
}

table.leader a:hover {
    text-decoration: underline;
    color: #c7d2fe;
}

table.leader .lb-rank-cell {
    width: 5.5rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

table.leader .lb-medal {
    font-size: 1.35em;
    line-height: 1;
    margin-right: 6px;
    vertical-align: -0.12em;
}

table.leader .lb-rank-num {
    color: #fff;
    font-weight: 700;
}

table.leader tr.lb-rank-1 td {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.18), rgba(35, 30, 10, 0.85));
    box-shadow: inset 4px 0 0 #f0c830;
}

table.leader tr.lb-rank-2 td {
    background: linear-gradient(90deg, rgba(210, 218, 230, 0.12), rgba(22, 24, 30, 0.88));
    box-shadow: inset 4px 0 0 #b8c4d8;
}

table.leader tr.lb-rank-3 td {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.16), rgba(32, 22, 14, 0.88));
    box-shadow: inset 4px 0 0 #c67f3a;
}

table.leader tr.lb-rank-tier td {
    box-shadow: inset 4px 0 0 var(--lb-accent, #6366f1);
}

table.leader tr.lb-viewer-placement td {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: inset 4px 0 0 #818cf8;
}

.ach-leader-table-wrap {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

.ach-leader-table-wrap table.leader {
    width: 100%;
}

.ach-recent-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 20px;
    margin-top: 16px;
}

.ach-recent-pager-info {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 600;
    min-width: 11rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.ach-pager-btn {
    font: inherit;
    cursor: pointer;
    padding: 9px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ach-pager-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(129, 140, 248, 0.5);
}

.ach-pager-btn:focus-visible {
    outline: 2px solid #818cf8;
    outline-offset: 2px;
}

.ach-pager-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ach-newuser-sub {
    display: block;
    color: rgba(255, 255, 255, 0.42);
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.loading {
    color: rgba(255, 255, 255, 0.45);
}

.ach-loading-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px 16px;
    min-height: 56px;
}

.ach-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: ach-loading-spin 0.75s linear infinite;
}

@keyframes ach-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

.ach-how-details {
    padding: 0;
    overflow: hidden;
}

.ach-how-summary {
    list-style: none;
    cursor: pointer;
    padding: clamp(18px, 2.5vw, 24px) clamp(20px, 3vw, 28px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
    -webkit-user-select: none;
}

.ach-how-summary::-webkit-details-marker {
    display: none;
}

.ach-how-summary::after {
    content: '+';
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    transition: transform 0.2s ease, background 0.15s ease;
}

.ach-how-details[open] .ach-how-summary::after {
    content: '−';
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.35);
}

.ach-how-summary .ach-section-title {
    margin: 0;
}

.ach-how-body {
    padding: 0 clamp(20px, 3vw, 28px) clamp(20px, 3vw, 28px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ach-how-body h3 {
    color: rgba(255, 255, 255, 0.88);
    font-size: 15px;
    font-weight: 700;
    margin: 20px 0 10px;
}

.ach-how-body h3:first-child {
    margin-top: 0;
}

.ach-how-body p {
    margin: 0 0 14px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 15px;
    line-height: 1.6;
}

.ach-how-body ul {
    margin: 0 0 14px;
    padding-left: 1.35em;
    color: rgba(255, 255, 255, 0.58);
}

.ach-how-body ul li {
    margin-bottom: 8px;
    line-height: 1.55;
}

.ach-page-footer {
    margin-top: clamp(28px, 4vw, 40px);
    padding: 20px 0 8px;
    text-align: center;
    color: rgba(255, 255, 255, 0.38);
    font-size: 13px;
    line-height: 1.65;
}

.ach-page-footer a {
    color: #a5b4fc;
    text-decoration: none;
}

.ach-page-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 720px) {
    .ach-leader-table-wrap:not(.ach-leader-mobile-cards) table.leader {
        width: 100%;
        min-width: 100%;
        table-layout: fixed;
    }

    .ach-leader-table-wrap:not(.ach-leader-mobile-cards) table.leader th,
    .ach-leader-table-wrap:not(.ach-leader-mobile-cards) table.leader td {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .ach-leader-table-wrap:not(.ach-leader-mobile-cards) table.leader .lb-rank-cell {
        width: 3.25rem;
    }
}

@media (max-width: 640px) {
    .ach-leader-mobile-cards.ach-leader-table-wrap {
        overflow-x: visible;
    }

    .ach-leader-mobile-cards table.leader {
        border: none;
        background: transparent;
        table-layout: auto;
    }

    .ach-leader-mobile-cards table.leader thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .ach-leader-mobile-cards table.leader tbody {
        display: block;
    }

    .ach-leader-mobile-cards table.leader tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        padding: 14px;
        background: rgba(255, 255, 255, 0.04);
        overflow: hidden;
    }

    .ach-leader-mobile-cards table.leader tbody tr:last-child {
        margin-bottom: 0;
    }

    .ach-leader-mobile-cards table.leader tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        text-align: right;
        background: transparent !important;
        box-shadow: none !important;
    }

    .ach-leader-mobile-cards table.leader tbody td:last-child {
        border-bottom: none;
        padding-bottom: 2px;
    }

    .ach-leader-mobile-cards table.leader tbody td::before {
        content: attr(data-label);
        color: rgba(255, 255, 255, 0.45);
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        text-align: left;
        flex-shrink: 0;
        max-width: 42%;
        line-height: 1.35;
        padding-top: 2px;
    }

    .ach-leader-mobile-cards table.leader tbody td .ach-m-td-val {
        flex: 1;
        min-width: 0;
        text-align: right;
        line-height: 1.4;
    }

    .ach-leader-mobile-cards table.leader tbody tr.lb-rank-1 {
        box-shadow: inset 4px 0 0 #f0c830;
        background: linear-gradient(90deg, rgba(255, 215, 0, 0.15), rgba(35, 30, 10, 0.7)) !important;
    }

    .ach-leader-mobile-cards table.leader tbody tr.lb-rank-2 {
        box-shadow: inset 4px 0 0 #b8c4d8;
        background: linear-gradient(90deg, rgba(210, 218, 230, 0.1), rgba(22, 24, 30, 0.75)) !important;
    }

    .ach-leader-mobile-cards table.leader tbody tr.lb-rank-3 {
        box-shadow: inset 4px 0 0 #c67f3a;
        background: linear-gradient(90deg, rgba(205, 127, 50, 0.14), rgba(32, 22, 14, 0.75)) !important;
    }

    .ach-leader-mobile-cards table.leader tbody tr.lb-viewer-placement {
        box-shadow: inset 4px 0 0 #818cf8;
        background: rgba(99, 102, 241, 0.1) !important;
    }
}
