/* =========================================================
   RESET
========================================================= */

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


/* =========================================================
   BODY
========================================================= */

body {

    min-height: 100vh;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    color: #111;
    background: #fff;
    margin: 0 auto;
    overflow-x: hidden;
}


/* =========================================================
   NAVBAR
========================================================= */

.navbar {

    height: 100px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 4.7%;
    margin-top: 10px;
}


/* ================================
   LOGO
================================ */

.logo {
    display: flex;
    justify-content: center;
  
}

.logo img {
    display: block;
    width: 280px;
    height: auto;
}

.nav-button {

    width: 225px;

    height: 61px;

    border: none;

    border-radius: 40px;

    font-size: 16px;

    cursor: pointer;

    background: #e9bde2;

    color: #111;

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


.nav-button:hover {

    transform: translateY(-2px);
}


/* =========================================================
   INTRO SCREEN
========================================================= */

.intro-screen {

    min-height:
        calc(100vh - 130px);

    display: flex;

    align-items: center;

    justify-content: center;

    padding:
        50px 20px;
}


.intro-content {

    width: 100%;

    max-width: 620px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}


.intro-content h1 {

    font-size: 25px;

    margin-bottom: 35px;

    font-weight: 700;
}


.intro-instructions {

    display: flex;

    flex-direction: column;

    gap: 17px;

    text-align: center;
}


.intro-instruction {

    display: flex;

    align-items: center;

    gap: 15px;
}


.intro-instruction span {

    flex-shrink: 0;

    width: 30px;

    height: 30px;

    border-radius: 50%;

    background: #e9bde2;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 14px;

    font-weight: 700;
}


.intro-instruction p {

    font-size: 15px;

    line-height: 1.5;

    padding-top: 4px;

    color: #333;
}


.intro-tip {

    margin-top: 32px;

    font-size: 15px;

    font-weight: 700;

    color: #111;
}


.intro-play-button {

    margin-top: 30px;
}


/* =========================================================
   GAME
========================================================= */

.game {

    min-height:
        calc(100vh - 130px);

    display: none;

    flex-direction: column;

    align-items: center;

    padding-top: 50px;
}


.game h1 {

    font-size: 20px;

    font-weight: 700;

    text-align: center;

    margin-bottom: 12px;
}


/* =========================================================
   PATTERN COUNTER
========================================================= */

.pattern-counter {

    font-size: 13px;

    font-weight: 700;

    letter-spacing: .8px;

    color: #777;

    margin-bottom: 10px;

    text-align: center;
}


/* =========================================================
   SCOREBOARD
========================================================= */

.scoreboard {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 12px;

    font-size: 13px;

    font-weight: 700;

    letter-spacing: .5px;

    margin-bottom: 28px;
}


.score-divider {

    color: #bbb;
}


/* =========================================================
   PATTERN WRAPPER
========================================================= */

.pattern-wrapper {

    position: relative;

    width: 420px;

    height: 280px;

    user-select: none;

    touch-action: none;

    -webkit-user-select: none;

    -webkit-touch-callout: none;
}


/* =========================================================
   DOT GRID
========================================================= */

.pattern-grid {

    position: absolute;

    inset: 0;

    z-index: 3;
}


.dot {

    position: absolute;

    width: 34px;

    height: 34px;

    border-radius: 50%;

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

    z-index: 4;

    background: #d9d9d9;

    cursor: default;

    transition:
        background .12s ease,
        box-shadow .12s ease,
        transform .12s ease;
}


.pattern-grid.playing .dot {

    background: #000;

    cursor: pointer;
}


.dot.selected {

    background: #000;

    box-shadow:
        0 0 0 13px #e9bde2;
}


/* =========================================================
   SVG PATTERN LINE
========================================================= */

.pattern-svg {

    position: absolute;

    inset: 0;

    width: 100%;

    height: 100%;

    overflow: visible;

    pointer-events: none;

    z-index: 2;
}


#patternLine {

    fill: none;

    stroke: #e9bde2;

    stroke-width: 18;

    stroke-linecap: round;

    stroke-linejoin: round;
}


/* =========================================================
   COUNTDOWN AREA
========================================================= */

.countdown-area {

    display: flex;

    flex-direction: column;

    align-items: center;

    width: 100%;

    margin-top: 30px;
}


/* =========================================================
   COUNTDOWN CIRCLE
========================================================= */

.countdown {

    width: 62px;

    height: 62px;

    border-radius: 50%;

    background: #f1eeee;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 20px;

    font-weight: 700;

    transition:
        opacity .2s ease;
}


/* =========================================================
   PROGRESS BAR
========================================================= */

.progress-container {

    display: none;

    width: 372px;

    height: 8px;

    margin-top: 18px;

    background: #eee9e9;

    border-radius: 10px;

    overflow: hidden;
}


.progress-bar {

    width: 100%;

    height: 100%;

    background: #e9bde2;

    border-radius: 10px;

    transform-origin: left center;

    transform: scaleX(1);
}


/* =========================================================
   MESSAGE
========================================================= */

.game-message {

    min-height: 26px;

    margin-top: 22px;

    text-align: center;

    font-size: 16px;

    line-height: 1.5;

    font-weight: 600;
}


.game-message.success {

    color: #5b9461;
}


.game-message.failure {

    color: #b75e5e;
}


/* =========================================================
   GAME BUTTONS
========================================================= */

.game-buttons {

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 20px;

    margin-top: 25px;
}


.primary-button,
.secondary-button {

    width: 225px;

    height: 63px;

    border-radius: 35px;

    font-size: 15px;

    cursor: pointer;

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


.primary-button:hover,
.secondary-button:hover {

    transform:
        translateY(-2px);
}


.primary-button {

    border: none;

    background: #e9bde2;

    color: #111;
}


.primary-button:disabled,
.secondary-button:disabled {

    opacity: .4;

    cursor: not-allowed;

    transform: none;
}


.secondary-button {

    background: #fff;

    border: 1px solid #111;
}


/* =========================================================
   CLEAR / NEXT
========================================================= */

.clear-button {

    display: none;
}


.next-button {

    display: none;
}


/* =========================================================
   MODALS
========================================================= */

.modal {

    position: fixed;

    inset: 0;

    background:
        rgba(0, 0, 0, .25);

    display: none;

    align-items: center;

    justify-content: center;

    z-index: 100;

    padding: 20px;
}


.modal.show {

    display: flex;
}


.modal-content {

    position: relative;

    width: min(600px, 100%);

    max-height: 90vh;

    overflow-y: auto;

    background: #fff;

    border-radius: 25px;

    padding: 45px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, .12);
}


.modal-content h2 {

    text-align: center;

    font-size: 22px;

    margin-bottom: 30px;
}


.modal-close {

    position: absolute;

    top: 15px;

    right: 20px;

    width: 38px;

    height: 38px;

    border: none;

    background: #f4f0f2;

    border-radius: 50%;

    font-size: 25px;

    line-height: 1;

    cursor: pointer;
}


/* =========================================================
   INSTRUCTIONS MODAL
========================================================= */

.instructions {

    display: flex;

    flex-direction: column;

    gap: 20px;
}


.instruction {

    display: flex;

    align-items: flex-start;

    gap: 15px;
}


.instruction-number {

    flex-shrink: 0;

    width: 32px;

    height: 32px;

    border-radius: 50%;

    background: #e9bde2;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 14px;

    font-weight: 700;
}


.instruction p {

    font-size: 15px;

    line-height: 1.5;

    padding-top: 5px;

    color: #333;
}


.instruction-tip {

    margin-top: 30px;

    padding-top: 25px;

    border-top: 1px solid #eee;

    font-size: 14px;

    line-height: 1.5;

    color: #666;

    text-align: center;
}


/* =========================================================
   FINAL SCORE
========================================================= */

.final-score {

    margin-top: 5px;

    font-size: 17px;

    font-weight: 700;

    line-height: 1.7;

    text-align: center;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {

    .navbar {

        height: 90px;

        padding: 0 20px;
    }


    .logo img {
    
    width: 180px;
   
}

    .nav-buttons {

        gap: 8px;
    }


    .nav-button {

        width: auto;

        padding: 0 17px;

        height: 45px;

        font-size: 13px;
    }


    .intro-screen {

        min-height:
            calc(100vh - 90px);

        padding:
            40px 25px;
    }


    .intro-content h1 {

        font-size: 21px;

        margin-bottom: 28px;
    }


    .intro-instruction p {

        font-size: 14px;
    }


    .game {

        min-height:
            calc(100vh - 90px);

        padding-top: 40px;
    }


    .game h1 {

        font-size: 17px;

        margin-bottom: 10px;
    }


    .pattern-counter {

        font-size: 11px;

        margin-bottom: 8px;
    }


    .scoreboard {

        font-size: 12px;

        margin-bottom: 20px;
    }


    .pattern-wrapper {

        width:
            min(88vw, 360px);

        height:
            min(62vw, 250px);
    }


    .dot {

        width: 27px;

        height: 27px;
    }


    .dot.selected {

        box-shadow:
            0 0 0 10px #e9bde2;
    }


    #patternLine {

        stroke-width: 15;
    }


    .progress-container {

        width:
            min(82vw, 372px);

        height: 7px;
    }


    .primary-button,
    .secondary-button {

        width: 200px;

        height: 56px;
    }


    .modal-content {

        width: 90%;

        padding:
            35px 25px;
    }

}