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

:root {
    --color-bg: #efefef;
    --color-text: #1c1c1c;
    --color-accent: #32ff00;
    --color-muted: #6f6f6f;
    --color-white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: 'DM Sans', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    overflow: hidden;
}

.portfolio-page {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 24px;
}

.clickathon-page {
    min-height: 100vh;
}

/* Back */

.interact-cta {
    position: relative;
    z-index: 260;

    display: inline-flex;
    align-items: center;
    gap: 8px;

    color: var(--color-text);
    text-decoration: none;

    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.03em;

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}

.interact-cta:hover {
    transform: translateX(-6px);
    opacity: 0.7;
}

.cta-arrow {
    transition: transform 0.25s ease;
}

.interact-cta:hover .cta-arrow {
    transform: translateX(-6px);
}

/* Center */

.clickathon-center {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 20;

    width: min(850px, calc(100vw - 48px));

    transform: translate(-50%, -50%);

    text-align: center;
}

.clickathon-note-trigger {
    border: none;
    background: transparent;

    font: inherit;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;

    color: var(--color-text);

    cursor: pointer;

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}

.clickathon-note-trigger:hover {
    opacity: 0.65;
    transform: translateY(-2px);
}

.clickathon-fineprint {
    max-width: 520px;
    margin: 18px auto 0;

    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: -0.02em;

    color: var(--color-muted);
}

.clickathon-limit-notice {
    min-height: 1.45em;
    margin-top: 12px;
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.02em;
}

/* Game */

.game-shell {
    position: fixed;
    inset: 0;
    z-index: 20;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-topbar {
    position: fixed;
    top: 28px;
    left: 50%;
    z-index: 70;

    transform: translateX(-50%);

    color: var(--color-text);
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.game-topbar strong {
    display: block;
    font: inherit;
}

.cube-grid-wrap {
    position: relative;

    width: min(94vw, 1120px);
    height: min(72vh, 680px);

    overflow: hidden;
}

.cube-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 20px);
    grid-auto-rows: 20px;
    gap: 2px;

    justify-content: center;
    align-content: center;

    width: 100%;
    height: 100%;

    pointer-events: none;
}

.cube-grid.is-active {
    pointer-events: auto;
}

.cube {
    width: 20px;
    height: 20px;

    border: 1px solid rgba(28, 28, 28, 0.14);
    border-radius: 4px;

    background: rgba(255, 255, 255, 0.55);

    cursor: pointer;

    transition:
        opacity 0.12s ease,
        visibility 0.12s ease,
        transform 0.12s ease,
        background 0.12s ease;
}

.cube:hover {
    transform: scale(0.92);
}

.cube.is-smashed {
    background: var(--color-accent);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.2) rotate(12deg);
    pointer-events: none;
}

.countdown-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(239, 239, 239, 0.7);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.countdown-overlay span {
    font-size: clamp(5rem, 14vw, 12rem);
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: -0.08em;
}

/* Leaderboard */

.leaderboard-card {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 30;

    width: min(300px, calc(100vw - 48px));

    padding: 16px;

    border-radius: 22px;

    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.leaderboard-label {
    margin-bottom: 12px;

    font-size: 0.9rem;
    font-weight: 800;
    text-transform: lowercase;
    /*letter-spacing: -0.03em;*/
}

.leaderboard-list {
    display: grid;
    gap: 8px;
    color: #c3c3c3;
    list-style: none;
}

.leaderboard-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;

    padding-top: 8px;

    border-top: 1px solid rgba(28, 28, 28, 0.08);
}

.leaderboard-list span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 0.9rem;
    font-weight: 800;
}

.leaderboard-list strong {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-muted);
    text-align: right;
}

/* Modal */

.game-result {
    position: fixed;
    inset: 0;
    z-index: 100;

    display: grid;
    place-items: center;

    padding: 24px;

    background: rgba(239, 239, 239, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.result-card {
    position: relative;

    width: min(460px, 100%);

    padding: 32px;

    border-radius: 28px;

    background: var(--color-white);
    text-align: center;
}

.result-label {
    margin-bottom: 4px;

    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-muted);
    letter-spacing: -0.03em;
}

#finalScore {
    display: block;

    margin: 0 auto 24px;

    font-size: clamp(3.25rem, 7vw, 5rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.06em;

    color: var(--color-text);
}

#nicknameInput {
    width: 100%;
    min-height: 52px;

    border: none;
    outline: none;

    padding: 14px 16px;

    border-radius: 999px;

    background: var(--color-bg);
    color: var(--color-text);

    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-align: center;
}

#submitScoreBtn,
#playAgainBtn {
    width: 100%;
    min-height: 52px;

    margin-top: 10px;

    border: none;

    padding: 14px 16px;

    border-radius: 999px;

    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;

    cursor: pointer;
}

#submitScoreBtn {
    background: var(--color-accent);
    color: var(--color-text);
}

#playAgainBtn {
    background: transparent;
    color: var(--color-muted);
}

.result-message {
    margin-top: 12px;

    min-height: 18px;

    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-muted);
    letter-spacing: -0.02em;
}

[hidden] {
    display: none !important;
}

/* Responsive */

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .clickathon-center {
        position: relative;
        left: auto;
        top: auto;

        margin: 96px auto 48px;

        transform: none;
    }

    .game-topbar {
        top: 24px;
        gap: 12px;
    }

    .cube-grid-wrap {
        width: 100%;
        height: 62vh;
    }

    .leaderboard-card {
        position: relative;
        right: auto;
        bottom: auto;

        width: 100%;

        margin: 0 auto;
    }
}

/* ==================================================
   LEADERBOARD BUTTON
================================================== */

.leaderboard-toggle {
    position: fixed;
    right: 32px;
    bottom: 32px;
    z-index: 90;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    background: transparent;

    color: var(--color-text);

    font-size: 1.8rem;
    cursor: pointer;

    transition:
        transform .2s ease,
        color .2s ease;
}

.leaderboard-toggle:hover {
    transform: translateY(-2px);
    color: var(--color-accent);
}

body.blitz-active .leaderboard-toggle {
    top: 28px;
    right: max(24px, calc((100vw - 1600px) / 2 + 24px));
    bottom: auto;
}

/* ==================================================
   MODAL BASE
================================================== */

.leaderboard-modal,
.score-confirmation {
    position: fixed;
    inset: 0;
    z-index: 200;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(0,0,0,.25);
    backdrop-filter: blur(8px);
}

/* ==================================================
   CARD
================================================== */

.confirmation-card {
    position: relative;

    width: min(520px, 100%);
    max-height: 80vh;

    padding: 36px 32px;

    overflow-y: auto;

    border-radius: 28px;
    background: white;
    text-align: center;
}

.score-confirmation .leaderboard-card,
.leaderboard-modal .leaderboard-card {
    position: relative;
    width: min(440px, 100%);
    max-height: 80vh;
    padding: 44px 34px 36px;
    overflow-y: auto;
    border-radius: 34px;
    background: white;
    text-align: initial;
}

/* ==================================================
   CLOSE
================================================== */

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;

    border: none;
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;
}

/* ==================================================
   RANK
================================================== */

.rank-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;

    margin: 12px 0 24px;
}

#rankPlace {
    font-size: clamp(3.5rem, 7vw, 5.5rem);
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: -0.06em;
}

.rank-movement {
    display: none;
}

.rank-movement.is-up {
    color: #32ff00;
}

.rank-movement.is-down {
    color: #ff4d4d;
}

/* ==================================================
   CONFIRMATION BUTTONS
================================================== */

.confirmation-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    margin-top: 0;
}

.confirmation-actions button {
    min-height: 52px;

    border: none;
    border-radius: 999px;

    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;

    cursor: pointer;
}

#tryAgainBtn {
    background: var(--color-accent);
    color: var(--color-text);
}

#shareScoreBtn {
    background: var(--color-text);
    color: white;
}

.confirmation-message {
    color: var(--color-text);
    font-size: clamp(1.05rem, 1.7vw, 1.45rem);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.04em;
}
