html {
    height: var(--mc-vvh, 100svh);
    max-height: var(--mc-vvh, 100svh);
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 0;
    background-color: #ffffff; /* inverted */
    color: #000000;            /* inverted */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: var(--mc-vvh, 100svh);
    max-height: var(--mc-vvh, 100svh);
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    padding: 16px 20px;
    gap: 10px;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 30px;
}

.subtitle {
    font-size: 10pt;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
    color: #000000; /* inverted */
}

.title {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    color: #000000; /* inverted */
    font-size: 3em;
    margin: 0;
    line-height: 1.1;
}

.top-container {
    display: grid;
    grid-template-columns: repeat(4, 120px);
    column-gap: 15px;
    align-items: stretch;
    width: 525px;
    max-width: 100%;
    flex-shrink: 0;
}

.score-container {
    display: contents;
}

#start-game {
    grid-column: 1 / 3;
    width: 100%;
    box-sizing: border-box;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #000000;
}

#start-game:hover {
    background-color: #333333;
    color: #ffffff;
    border-color: #333333;
}

#current-level,
#high-score {
    box-sizing: border-box;
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Prevent text selection inside buttons */
button,
button * {
    -webkit-user-select: none; /* Safari / iOS */
    -ms-user-select: none;     /* IE / old Edge */
    user-select: none;         /* Standard */
}

button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

/* Only apply hover effects on devices that support it */
@media (hover: hover) and (pointer: fine) {
    button:hover {
        transform: scale(1.1);
    }

    #start-game:hover,
    .ss-modal__btn:hover {
        transform: none;
        filter: none;
    }
}

#start-game:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;   /* no scaling when disabled */
    animation: none !important;
}

#start-game:disabled:hover {
    transform: none;
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
}

/* Note button styles */
.note-button {
    width: 120px;
    height: 120px;
    font-size: 20px;
    cursor: pointer;
    border: none;
    color: white;
    border-radius: 10px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); /* subtle bounce */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); /* normal depth */
}

.note-button:active {
    transform: scale(0.92); /* press in */
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
}

.buttons-container.is-idle .note-button {
    filter: grayscale(1);
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

.buttons-container.is-revealing .note-button {
    filter: none;
    opacity: 1;
    cursor: default;
    pointer-events: none;
}

.note-button.is-lit,
.buttons-container.is-revealing .note-button.is-lit {
    z-index: 1;
    transform: scale(1.08);
    filter: brightness(1.28);
    box-shadow: 0 0 0 4px #000000, 0 8px 18px rgba(0, 0, 0, 0.35);
}

.color-0 { background-color: #F46C3F; }
.color-1 { background-color: #e36f46; }
.color-2 { background-color: #e3c33b; color: #222; }
.color-3 { background-color: #8BC34A; color: #222; }
.color-4 { background-color: #22b4be; }
.color-5 { background-color: #A7226F; }
.color-6 { background-color: #5B8DEF; }
.color-7 { background-color: #9B59B6; }
.color-8 { background-color: #FF5C8A; }
.color-9 { background-color: #FF8C42; }
.color-10 { background-color: #1D929A; }
.color-11 { background-color: #2ECC71; }

#game-message {
    margin: 0;
    font-size: 18px;
    color: #000000; /* inverted */
    min-height: 1.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.buttons-wrap {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.buttons-container {
    display: grid;
    grid-template-columns: repeat(4, 120px);
    grid-template-rows: repeat(3, 120px);
    gap: 15px;
    width: max-content;
    margin: 0;
}

#current-level, #high-score {
    font-size: 16px;
    color: #000000; /* inverted */
    border: 2px solid #000000;
    padding: 8px;
    border-radius: 5px;
}

/* Mobile — keep 3×4 tiles, still centered and viewport-fit */
@media screen and (max-width: 767px) {
    .container {
        padding: 12px 16px;
        gap: 8px;
    }
    .subtitle { font-size: 8pt; }
    .title { font-size: 2em; }
    .title-container,
    .top-container,
    #game-message {
        width: 260px;
        max-width: 100%;
        box-sizing: border-box;
    }
    .top-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 260px;
    }
    #start-game {
        grid-column: auto;
        width: 100%;
        box-sizing: border-box;
        padding: 10px 12px;
    }
    .score-container {
        display: flex;
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
        gap: 10px;
    }
    .note-button {
        width: 80px;
        height: 80px;
        font-size: 14px;
    }
    .buttons-container {
        grid-template-columns: repeat(3, 80px);
        grid-template-rows: repeat(4, 80px);
        gap: 10px;
    }
    #game-message {
        font-size: 14px;
    }
    #current-level,
    #high-score {
        box-sizing: border-box;
        padding: 8px 6px;
        font-size: 14px;
    }
    #current-level { width: 40%; }
    #high-score { width: 60%; }
}

/* Game-over modal — initials + hi scores (arcade flow, Simon palette) */
#ss-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: safe center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.45);
}

#ss-overlay[hidden] {
    display: none;
}

.ss-modal {
    position: relative;
    width: min(100%, 20rem);
    padding: 1.5rem 1.35rem 1.25rem;
    border: 2px solid #000000;
    border-radius: 12px;
    background: #ffffff;
    color: #000000;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.ss-modal--wide {
    width: min(100%, 22rem);
}

.ss-modal__title {
    margin: 0;
    text-align: center;
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
}

.ss-modal__score-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.6rem;
    margin: 0.75rem 0 0;
}

.ss-modal__label {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ss-modal__score {
    font-size: 1.6rem;
    font-weight: 700;
}

.ss-modal__form {
    margin-top: 1.1rem;
}

.ss-modal__prompt {
    margin: 0 0 0.75rem;
    text-align: center;
    font-size: 0.9rem;
}

.ss-modal__prompt--solo {
    margin: 1rem 0 0;
    font-size: 1rem;
}

.ss-modal__flash {
    margin: 0.55rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #000000;
}

.ss-modal__error {
    margin: 0.65rem 0 0;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.35;
    color: #000000;
}

.ss-initials {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
}

.ss-initials__cell {
    box-sizing: border-box;
    width: 2.65rem;
    height: 2.65rem;
    border: 2px solid #000000;
    border-radius: 8px;
    background: #fff;
    color: #000;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    text-transform: uppercase;
    caret-color: #000000;
    outline: none;
}

.ss-initials__cell:focus {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
}

.ss-modal__btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.65rem 0.75rem;
    border: 2px solid #000000;
    border-radius: 5px;
    background: #ffffff;
    color: #000000;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.ss-modal__actions {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-top: 1rem;
}

.ss-modal__actions .ss-modal__btn {
    margin-top: 0;
    flex: 1;
}

@media screen and (max-width: 767px) {
    .ss-modal__actions {
        flex-direction: column;
    }
}

.ss-modal__btn--ghost {
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
}

.ss-modal__btn:hover {
    background: #000000;
    color: #ffffff;
    filter: none;
}

.ss-modal__btn:focus-visible {
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.ss-hiscore {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    overflow: visible;
    font-size: 0.95rem;
}

.ss-hiscore__row {
    display: grid;
    grid-template-columns: 2.2ch max-content minmax(1.25rem, 1fr) auto;
    align-items: center;
    column-gap: 0.7rem;
    min-height: 1.85rem;
    padding: 0.15rem 0;
    color: #444;
}

.ss-hiscore--highlight-player .ss-hiscore__row--other {
    color: #bbb;
}

.ss-hiscore__row--player {
    margin: 0.1rem 0;
    padding: 0.35rem 0.3rem;
    color: #000;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    font-weight: 700;
}

.ss-hiscore__rank {
    color: #999;
}

.ss-hiscore__row--player .ss-hiscore__rank {
    color: #000000;
}

.ss-hiscore__initials {
    font-weight: 700;
    letter-spacing: 0.12em;
    padding-right: 0.12em;
}

.ss-hiscore__leader {
    min-width: 0.5rem;
    height: 0;
    border-bottom: 1px dotted #ccc;
}

.ss-hiscore__score {
    font-variant-numeric: tabular-nums;
}

.ss-hiscore__empty {
    padding: 0.5rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: #999;
}
