html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;
    background-image: url('../assets/images/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

:root {
    --var-redhat-red: #ea3323;
    --corner-action-right: 1.5rem;
    --corner-action-bottom: 1.5rem;
}

.level-intro__start,
.tutorial__next,
.level-complete__continue {
    min-width: 8rem;
    height: 3rem;
    padding: 0 2rem;
    border: none;
    border-radius: 0.35rem;
    background: var(--var-redhat-red);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.level-intro__start:hover,
.tutorial__next:hover,
.level-complete__continue:hover {
    filter: brightness(1.08);
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

#game {
    position: relative;
    aspect-ratio: 16 / 9;
    width: min(100vw, calc(100vh * 16 / 9));
    height: auto;
    overflow: hidden;
}

/* Let fixed full-window veils paint outside the 16:9 frame while active */
#game:has(.level-intro:not([hidden])),
#game:has(.level-countdown:not([hidden])),
#game:has(.game-exit-modal.is-open),
#game:has(.tutorial.is-visible),
#game:has(#screen-game-complete.screen--active),
#game:has(#screen-homescreen.screen--active) {
    overflow: visible;
}

#app {
    position: absolute;
    inset: 0;
}

.screen {
    position: absolute;
    inset: 0;
    padding: 2rem;
    box-sizing: border-box;
    color: #fff;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.screen h1 {
    margin: 0;
    font-size: 4rem;
    font-weight: 600;
}

.screen.screen--active {
    visibility: visible;
    pointer-events: auto;
}

.debug-btn {
    position: absolute;
    bottom: 5%;
    right: 5%;
    z-index: 1000;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid #fff;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: none !important;
}

.debug-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

#screen-select-event {
    display: flex;
    align-items: center;
    justify-content: center;
}

.select-event__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.select-event__close img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.select-event {
    width: min(88%, 40rem);
}

.select-event__label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}

.select-event__controls {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}

.select-event__field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.select-event__field::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid #707070;
    border-bottom: 2px solid #707070;
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.select-event__select {
    width: 100%;
    height: 3rem;
    padding: 0 2.5rem 0 1rem;
    border: none;
    border-radius: 4px;
    background-color: #fff;
    color: #151515;
    font: inherit;
    font-size: 1rem;
    appearance: none;
    cursor: pointer;
}

.select-event__select:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.select-event__confirm {
    flex-shrink: 0;
    height: 3rem;
    padding: 0 1.5rem;
    border: none;
    border-radius: 4px;
    background-color: var(--var-redhat-red);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.select-event__confirm:hover {
    filter: brightness(1.05);
}

.select-event__confirm:active {
    filter: brightness(0.95);
}

#screen-select-event .instructions {
    position: absolute;
    bottom: 100px;
    margin-top: 1rem;
    font-size: 1rem;
    font-weight: 400;
    color: #fff;
    opacity: 0.5;
}

.redhatlogo-bottom-right {
    position: absolute;
    bottom: 30px;
    right: 30px;
    margin-top: 1rem;
    text-align: center;
    width: 60px;
    height: 60px;
    background-image: url('../assets/images/Group 1620.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.homescreen-corner-btn {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 60;
    width: 6rem;
    height: 6rem;
    padding: 0;
    border: none;
    background: transparent;
    cursor: default;
    touch-action: none;
    -webkit-touch-callout: none;
}

#screen-homescreen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.homescreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.homescreen__logo {
    width: min(16rem, 44vw);
    height: auto;
    margin-bottom: 6rem;
}

.homescreen__title {
    margin: 0 0 3rem;
    font-size: 7rem;
    font-weight: 600;
    line-height: 1.05;
    color: #fff;
}

.homescreen__actions {
    display: flex;
    align-items: stretch;
    gap: 2.5rem;
}

.homescreen__btn {
    min-width: 14rem;
    height: 3.5rem;
    padding: 0 1.75rem;
    border: none;
    border-radius: 4px;
    font: inherit;
    font-size: 1.1rem;
    font-weight: 400;
    cursor: pointer;
}

.homescreen__btn--primary {
    background-color: var(--var-redhat-red);
    color: #fff;
    font-weight: 600;
}

.homescreen__btn--secondary {
    background-color: #fff;
    color: #151515;
}

.homescreen__btn:hover {
    filter: brightness(1.05);
}

.homescreen__btn:active {
    filter: brightness(0.95);
}

#screen-screensaver {
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 2.5rem 3rem;
}

.screensaver {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.95fr);
    gap: 3rem;
    width: 100%;
    height: 100%;
    align-items: center;
    box-sizing: border-box;
}

.screensaver__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.screensaver__brand .homescreen__logo {
    margin-bottom: 4rem;
}

.screensaver__brand .homescreen__title {
    margin-bottom: 2.5rem;
    font-size: clamp(3.5rem, 7vw, 6.5rem);
}

.screensaver__board {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: min(100%, 36rem);
    padding: 1.5rem 1.35rem 1.35rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-sizing: border-box;
}

.screensaver__board-title {
    margin: 0 0 1.25rem !important;
    text-align: left;
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
}

.screensaver__board .leaderboard__table-wrap {
    flex: 1;
    min-height: 0;
}

.screensaver__board .leaderboard__table-head {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
}

.screensaver__board .leaderboard__table {
    background: rgba(235, 235, 235, 0.94);
}

.screensaver__board .leaderboard__row {
    min-height: 2.35rem;
    padding: 0.4rem 1.1rem;
    font-size: 1.05rem;
}

.language-picker {
    position: absolute;
    right: 1.75rem;
    bottom: 1.75rem;
    z-index: 20;
    font-family: "Red Hat Display", sans-serif;
}

.language-picker__toggle {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 9.5rem;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.language-picker__toggle:hover {
    border-color: rgba(255, 255, 255, 0.65);
    background: rgba(0, 0, 0, 0.7);
}

.language-picker__label {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.65;
}

.language-picker__current {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

.language-picker__menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.5rem);
    display: none;
    flex-direction: column;
    width: max(12rem, 100%);
    max-height: 18rem;
    overflow: auto;
    padding: 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(21, 21, 21, 0.96);
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.45);
}

.language-picker.is-open .language-picker__menu {
    display: flex;
}

.language-picker__option {
    display: block;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
}

.language-picker__option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.language-picker__option.is-active {
    background: var(--var-redhat-red);
    font-weight: 600;
}

#screen-game {
    position: absolute;
    padding: 1.25rem 1.5rem 1rem;
}

#screen-game:has(#level-intro:not([hidden])) .game-sidebar--right,
#screen-game:has(#level-intro:not([hidden])) .game-sidebar--left,
#screen-game:has(#level-intro:not([hidden])) .game-board,
#screen-game:has(#level-intro:not([hidden])) .game-close {
    pointer-events: none;
}

.level-intro {
    position: absolute;
    inset: 0;
    z-index: 52;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.level-intro[hidden] {
    display: none !important;
}

/* Full-window veils (escape the 16:9 #game frame) */
.level-intro__veil,
.level-countdown__overlay,
.game-exit-modal__overlay,
.tutorial__veil {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
}

.level-intro__veil,
.level-countdown__overlay {
    background: rgba(0, 0, 0, 0.55);
}

.level-intro__veil {
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    transform: translateZ(0);
    /* Don't fade opacity — Chromium skips backdrop-filter until a repaint when opacity < 1 */
    opacity: 1;
    visibility: hidden;
    transition: none;
}

.level-intro.is-veil-visible .level-intro__veil {
    visibility: visible;
}

.level-countdown__overlay {
    opacity: 1;
    will-change: opacity;
}

.level-intro__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 2rem 2.5rem 5.5rem;
    box-sizing: border-box;
    pointer-events: none;
}

.level-intro-panel {
    width: min(100%, 34rem);
    padding: 3rem;
    border-radius: 0.45rem;
    background: #d9d9d9;
    box-shadow: 0 0.35rem 1.5rem rgba(0, 0, 0, 0.22);
    pointer-events: auto;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(0.65rem);
    transition:
        opacity 380ms ease-out,
        transform 380ms ease-out;
    container-type: inline-size;
    container-name: level-intro-panel;
}

.level-intro.is-panel-visible .level-intro-panel {
    opacity: 1;
    transform: translateY(0);
}

.level-intro-panel__inner {
    padding: 1.5rem 1.65rem 1.35rem;
    border-radius: 0.35rem;
    background: #fff;
    color: #151515;
}

.level-intro-panel__heading {
    font-size: clamp(1.45rem, 2.5vw, 2.05rem);
    line-height: 1.2;
}

.level-intro-panel__title {
    font-weight: 400;
}

.level-intro-panel__title::after {
    content: ': ';
}

.level-intro-panel__subtitle {
    font-weight: 700;
}

.level-intro-panel__divider {
    height: 1px;
    margin: 1rem 0 0;
    background: rgba(21, 21, 21, 0.16);
}

.level-intro-panel__body {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 1rem;
}

.level-intro-panel__text {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: clamp(0.85rem, 3.8cqi, 1.2rem);
    line-height: 1.4;
    font-weight: 400;
}

.level-intro-panel__bug-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.35rem;
    background: #2a2240;
}

.level-intro-panel__bug-wrap[hidden] {
    display: none !important;
}

.level-intro-panel__bug {
    width: 2.15rem;
    height: 2.15rem;
    object-fit: contain;
}

.level-intro-panel__tip {
    position: relative;
    margin: 1rem 0 0;
    padding-left: 1.45rem;
    font-size: clamp(0.8rem, 3.2cqi, 1.1rem);
    line-height: 1.35;
    color: rgba(21, 21, 21, 0.9);
}

.level-intro-panel__tip::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.1rem;
    width: 1rem;
    height: 1rem;
    background: url('../assets/images/Group 1654.png') no-repeat center / contain;
}

.level-intro__start {
    position: absolute;
    right: var(--corner-action-right);
    bottom: var(--corner-action-bottom);
    z-index: 58;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 320ms ease-out;
}

.level-intro__start.is-visible {
    opacity: 1;
}

.level-intro__start[hidden] {
    display: none !important;
}

.level-countdown {
    position: absolute;
    inset: 0;
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.level-countdown[hidden] {
    display: none !important;
}

.level-countdown__text {
    position: relative;
    z-index: 1;
    font-size: clamp(6rem, 24vw, 15rem);
    font-weight: 700;
    color: #fff;
    line-height: 1;
    text-align: center;
    user-select: none;
    transform: scale(0.15);
    opacity: 0;
}

.level-countdown__text.is-pop {
    animation: level-countdown-pop 0.72s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}

.level-countdown__text.is-go {
    font-size: clamp(4.5rem, 18vw, 11rem);
    letter-spacing: 0.06em;
}

@keyframes level-countdown-pop {
    0% {
        transform: scale(0.15);
        opacity: 0;
    }
    45% {
        transform: scale(1.22);
        opacity: 1;
    }
    70% {
        transform: scale(0.94);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.game-toast {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: min(70%, 28rem);
    max-width: 72%;
    padding: 0.85rem 2.2rem;
    border-radius: 0 0 0.85rem 0.85rem;
    background: rgba(168, 158, 178, 0.55);
    color: #fff;
    text-align: center;
    font-size: clamp(1.15rem, 2.2vw, 1.65rem);
    font-weight: 500;
    line-height: 1.25;
    pointer-events: none;
    transform: translate(-50%, -110%);
    transition: transform 0.35s ease;
}

.game-toast[hidden] {
    display: flex !important;
    visibility: hidden;
}

.game-toast.is-visible {
    visibility: visible;
    transform: translate(-50%, 0);
}

.game-toast__text {
    display: block;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr) minmax(0, 1fr);
    gap: 2rem;
    height: 100%;
    align-items: stretch;
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.game-sidebar--left {
    justify-content: space-between;
}

.game-sidebar--right {
    position: relative;
    align-items: flex-end;
    justify-content: center;
}

.game-close {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.game-exit-modal {
    position: absolute;
    inset: 0;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
}

.game-exit-modal[hidden] {
    display: none !important;
}

.game-exit-modal.is-open {
    pointer-events: auto;
}

.game-exit-modal__overlay {
    background: rgba(0, 0, 0, 0.72);
}

.game-exit-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(92%, 58rem);
    padding: 2rem 2.5rem;
    border-radius: 0.4rem;
    background: #d9d9d9;
    color: #151515;
    text-align: center;
    box-sizing: border-box;
}

.game-exit-modal__title {
    margin: 0 0 0.5rem;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
}

.game-exit-modal__subtitle {
    margin: 0 0 1.6rem;
    font-size: clamp(1.2rem, 2.3vw, 2rem);
    font-weight: 500;
}

.game-exit-modal__actions {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.game-exit-modal__btn {
    min-width: 10rem;
    height: 3rem;
    padding: 0 2rem;
    border: none;
    border-radius: 0.4rem;
    font: inherit;
    font-size: 1.9rem;
    font-weight: 700;
    cursor: pointer;
}

.game-exit-modal__btn--no {
    background: #fff;
    color: #151515;
}

.game-exit-modal__btn--yes {
    background: var(--var-redhat-red);
    color: #fff;
}

.game-board {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    container-type: size;
}

.game-grid {
    position: relative;
    aspect-ratio: 1;
    width: min(100%, 100cqh);
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
}

.game-grid canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.level-item__expanded {
    display: none;
}

.level-item__collapsed {
    display: block;
    padding-left: 1rem;
}

.level-item.is-active .level-item__expanded {
    display: block;
}

.level-item.is-active .level-item__collapsed {
    display: none;
}

.level-item:not(.is-locked) .level-track__lock {
    visibility: hidden;
}

.level-panel {
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.3);
    container-type: inline-size;
    container-name: level-panel;
}

.level-panel__header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.level-panel__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #fff;
    color: #151515;
    font-size: 0.95rem;
    font-weight: 700;
}

.level-panel__title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
}

.level-panel__subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.85;
}

.level-panel__divider {
    height: 1px;
    margin: 0.65rem 0;
    background: rgba(255, 255, 255, 0.35);
}

.level-panel__text {
    margin: 0.5rem 0 0;
    flex: 1;
    min-width: 0;
    font-size: clamp(0.7rem, 2.8cqi, 0.8rem);
    line-height: 1.35;
    font-weight: 400;
}

.level-panel__body {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-top: 0.5rem;
}

.level-panel__body .level-panel__text {
    margin-top: 0;
}

.level-panel__bug {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    margin-top: 0.15rem;
    object-fit: contain;
}

.level-panel__tip {
    position: relative;
    margin: 0.85rem 0 0;
    padding-left: 1.1rem;
    font-size: clamp(0.68rem, 2.5cqi, 0.8rem);
    line-height: 1.35;
    opacity: 0.9;
}

.level-panel__tip::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.1rem;
    width: 0.85rem;
    height: 0.85rem;
    background: url('../assets/images/Group 1654.png') no-repeat center / contain;
}

.level-track__item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: -0.4rem;
}

.level-track__line {
    display: block;
    width: 3px;
    height: 2rem;
    margin: 0.15rem 0 0.15rem 1.9rem;
    object-fit: contain;
    object-position: center;
    opacity: 1;
}

.level-track__badge {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.1rem;
    font-weight: 500;
}

.level-track__title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    padding-bottom: 0.3rem;
}

.level-track__subtitle {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
}

.level-track__lock {
    width: 1.2rem;
    height: 1.2rem;
    margin-left: auto;
    object-fit: contain;
    opacity: 1;
}

.moves-counter {
    margin-top: auto;
}

.moves-counter__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1.3rem;
    font-weight: 500;
}

.moves-counter__value {
    display: inline-block;
    min-width: 100%;
    padding: 0.6rem .75rem;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.3);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.game-close img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.power-ups {
    width: 100%;
    max-width: 15rem;
}

.power-ups__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.power-ups__title {
    font-size: 1.4rem;
    font-weight: 700;
}

.power-ups__info {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
}

.power-ups__info img {
    width: 1rem;
    height: 1rem;
    object-fit: contain;
    opacity: 0.95;
}

.power-ups__list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.power-up {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    background-color: transparent;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    font: inherit;
    font-size: 1.1rem;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    padding-left: 4rem;
    container-type: inline-size;
    container-name: power-up;
}

/* Available (white) */
.power-up[data-powerup="minus5"] {
    background-image: url("../assets/images/Group 1715.png");
}

.power-up[data-powerup="automatch"] {
    background-image: url("../assets/images/Group 1716.png");
}

.power-up[data-powerup="pause"] {
    background-image: url("../assets/images/Group 1717.png");
}

.power-up[data-powerup="reveal"] {
    background-image: url("../assets/images/Group 1718.png");
}

/* Used (grey) */
.power-up[data-powerup="minus5"].is-used {
    background-image: url("../assets/images/Group 1711.png");
}

.power-up[data-powerup="automatch"].is-used {
    background-image: url("../assets/images/Group 1712.png");
}

.power-up[data-powerup="pause"].is-used {
    background-image: url("../assets/images/Group 1713.png");
}

.power-up[data-powerup="reveal"].is-used {
    background-image: url("../assets/images/Group 1714.png");
}

.power-up.is-used {
    cursor: default;
}

.power-up__label {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
    line-height: 1.15;
    font-size: clamp(0.65rem, 5.5cqi, 1.1rem);
    padding-left: 10px;
}

#screen-game .redhatlogo-bottom-right {
    bottom: 1rem;
    right: 1rem;
}

.tutorial {
    position: absolute;
    inset: 0;
    z-index: 50;
    opacity: 1;
    pointer-events: none;
}

.tutorial.is-visible {
    pointer-events: auto;
}

.tutorial__veil {
    z-index: 1;
    pointer-events: none;
}

.tutorial__veil-frost {
    position: absolute;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    transform: translateZ(0);
}

.tutorial__steps {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.tutorial-step {
    position: absolute;
    inset: 0;
}

.tutorial-callout {
    position: absolute;
    z-index: 2;
    width: min(15rem, 34%);
    padding: 2.5rem;
    border-radius: 0.45rem;
    background: #d8d8d8;
    color: #151515;
    box-sizing: border-box;
    pointer-events: auto;
}

.tutorial-callout--objectives {
    width: min(54rem, 52%);
}

.tutorial-callout--powerups {
    width: min(72rem, 92%);
    padding: 1.75rem 1.75rem 1.25rem;
}

.tutorial-callout--info-tip {
    width: min(34rem, 58%);
    padding: 1.15rem 1.35rem;
}

.tutorial-info-tip {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tutorial-info-tip__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--var-redhat-red);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
}

.tutorial-info-tip__text {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.4;
}

.tutorial-info-tip__text strong {
    font-weight: 700;
}

.tutorial-callout--compact {
    width: auto;
    min-width: 9rem;
    padding: 1.1rem 3rem;
}

.tutorial-callout__title {
    margin-bottom: 0.55rem;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.2;
}

.tutorial-callout--compact .tutorial-callout__title {
    margin-bottom: 0;
    font-size: 1.5rem;
}

.tutorial-callout__body {
    font-size: 1.0rem;
    font-weight: 400;
    line-height: 1.4;
}

.tutorial-callout__connector {
    position: absolute;
    top: 50%;
    height: 1px;
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-50%);
    pointer-events: none;
}

.tutorial-callout__connector.is-left {
    right: 100%;
}

.tutorial-callout__connector.is-right {
    left: 100%;
}

.tutorial-objectives {
    display: flex;
    gap: 0.65rem;
    margin-top: 1.5rem;
}

.tutorial-objective {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border-radius: 0.35rem;
    background: #fff;
    box-sizing: border-box;
    container-type: inline-size;
    container-name: tutorial-objective;
}

.tutorial-objective__content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.tutorial-objective__heading {
    margin-bottom: 0.55rem;
    font-size: clamp(0.85rem, 4.5cqi, 1.1rem);
    font-weight: 700;
    line-height: 1.2;
}

.tutorial-objective__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 0.5rem;
    width: 100%;
}

.tutorial-objective__text {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: clamp(0.95rem, 5.2cqi, 1.2rem);
    line-height: 1.35;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    font-weight: 400;
    border-top: 1px solid black;
}

.tutorial-objective__body .tutorial-objective__text {
    flex: none;
}

.tutorial-objective__tip {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    margin: auto 0 0;
    padding-top: 0.75rem;
    font-size: clamp(0.68rem, 3.2cqi, 0.8rem);
    line-height: 1.35;
    font-weight: 400;
}

.tutorial-objective__tip::before {
    content: '';
    flex-shrink: 0;
    width: 0.9rem;
    height: 0.9rem;
    margin-bottom: 0.1rem;
    background: url('../assets/images/Group 1654.png') no-repeat center / contain;
}

.tutorial-objective__bug {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    flex-shrink: 0;
    width: clamp(1.75rem, 18cqi, 2.5rem);
    height: clamp(1.75rem, 18cqi, 2.5rem);
    margin-top: 0.65rem;
    object-fit: contain;
}

.powerups-guide {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.powerups-guide__intro {
    flex: 0 0 11rem;
    padding-top: 0.35rem;
}

.powerups-guide__title {
    margin-bottom: 0.75rem;
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.15;
}

.powerups-guide__body {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.powerups-guide__grid {
    display: flex;
    flex: 1;
    gap: 0.75rem;
    min-width: 0;
}

.powerup-detail {
    flex: 1;
    min-width: 0;
}

.powerup-detail__panel {
    position: relative;
    width: 100%;
    aspect-ratio: 642 / 1338;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    container-type: inline-size;
    container-name: powerup-detail;
}

.powerup-detail__video,
.powerup-detail__video-fallback {
    position: absolute;
    top: 5.5%;
    left: 11%;
    width: 78%;
    height: 38%;
    object-fit: contain;
    border-radius: 0.35rem;
    background: transparent;
}

.powerup-detail__video-fallback {
    pointer-events: none;
}

#tutorial.is-alpha-fallback .powerup-detail__video {
    opacity: 0;
}

.powerup-detail__text {
    position: absolute;
    top: 42%;
    left: 10%;
    right: 10%;
    margin: 0;
    font-size: clamp(0.55rem, 1.05vw, 0.78rem);
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    color: #151515;
}

.powerup-detail__label {
    position: absolute;
    top: 56%;
    left: 50%;
    transform: translateX(-50%);
    width: 78%;
    height: 1.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem 0 1.6rem;
    box-sizing: border-box;
    border-radius: 0.3rem;
    background-color: var(--var-redhat-red);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    font-size: clamp(0.5rem, 4.5cqi, 0.72rem);
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

.tutorial__skip,
.tutorial__back {
    min-width: 5.5rem;
    height: 3rem;
    padding: 0 3.5rem;
    border: none;
    border-radius: 0.35rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}

.tutorial__skip {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 3;
    background: rgba(255, 255, 255, 0.18);
}

.tutorial__nav {
    position: absolute;
    right: var(--corner-action-right);
    bottom: var(--corner-action-bottom);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tutorial__back {
    display: none;
    background: #6b6b6b;
}

.tutorial__nav.has-back .tutorial__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tutorial__next {
    background: var(--var-redhat-red);
}

.tutorial__skip:hover,
.tutorial__back:hover {
    filter: brightness(1.08);
}

#screen-leaderboards {
    padding: 1.25rem 1.5rem 1rem;
}

.leaderboard__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.leaderboard__close img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.leaderboard__title {
    margin: 0 0 1rem;
    text-align: center;
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 700;
    color: #fff;
    margin-top: 2rem !important;
    margin-bottom: 4rem !important;
}

.leaderboard {
    display: grid;
    grid-template-columns: minmax(12rem, 0.85fr) minmax(0, 1.6fr) minmax(8rem, 0.7fr);
    gap: 1.25rem;
    align-items: stretch;
    height: calc(100% - 14rem);
    min-height: 0;
    width: 80%;
    margin-left: 10%;
}

.leaderboard__player {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    min-height: 0;
    container-type: size;
    container-name: player-summary;
}

.leaderboard__player-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.leaderboard__player-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-height: 0;
    padding: clamp(0.55rem, 2.5cqh, 1rem) clamp(0.65rem, 4cqi, 1.1rem) clamp(0.75rem, 3cqh, 1.1rem);
    box-sizing: border-box;
    color: #fff;
}

.leaderboard__greeting {
    margin: clamp(0.2rem, 2cqh, 1.5rem) 0 clamp(0.2rem, 1.2cqh, 0.65rem);
    font-size: clamp(0.95rem, 5cqi, 1.35rem);
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
    flex-shrink: 0;
}

.leaderboard__score-label {
    font-size: clamp(1rem, 5.5cqh, 2rem);
    font-weight: 500;
    opacity: 0.95;
    margin-bottom: clamp(0.1rem, 0.8cqh, 0.45rem);
    text-align: center;
    line-height: 1.1;
    flex-shrink: 0;
}

.leaderboard__score {
    margin: 0 0 clamp(0.2rem, 1.2cqh, 0.65rem);
    font-size: clamp(1.5rem, 8.5cqh, 3.25rem);
    font-weight: 700;
    line-height: 1;
    text-align: center;
    flex-shrink: 1;
    min-height: 0;
}

.leaderboard__rank {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16rem;
    margin-bottom: clamp(0.25rem, 1cqh, 0.45rem);
    padding: clamp(0.4rem, 1.5cqh, 0.6rem) clamp(0.55rem, 3cqi, 0.85rem);
    border-radius: 0.4rem;
    background: rgba(20, 8, 55, 0.55);
    font-size: clamp(0.85rem, 3.6cqi, 1.05rem);
    font-weight: 600;
    width: min(75%, 100%);
    box-sizing: border-box;
    flex-shrink: 0;
}

.leaderboard__rank-value {
    font-weight: 700;
}

.leaderboard__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    margin-top: 0;
    margin-bottom: 0;
    padding: clamp(0.4rem, 1.5cqh, 0.6rem) clamp(0.3rem, 2cqi, 0.5rem);
    border-radius: 0.4rem;
    background: rgba(20, 8, 55, 0.55);
    text-align: center;
    width: min(80%, 100%);
    box-sizing: border-box;
    flex-shrink: 0;
}

@container player-summary (max-height: 560px) {
    .leaderboard__greeting {
        margin-top: 0.15rem;
        margin-bottom: 0.2rem;
        font-size: clamp(0.9rem, 4.5cqi, 1.15rem);
    }

    .leaderboard__score-label {
        font-size: clamp(0.95rem, 4.5cqh, 1.45rem);
        margin-bottom: 0.15rem;
    }

    .leaderboard__score {
        font-size: clamp(1.35rem, 7cqh, 2.4rem);
        margin-bottom: 0.25rem;
    }

    .leaderboard__rank {
        margin-top: clamp(1.5rem, 18cqh, 8rem);
        margin-bottom: 0.3rem;
        padding: 0.4rem 0.55rem;
    }

    .leaderboard__stats {
        padding: 0.4rem 0.3rem;
    }

    .leaderboard__stat-label {
        margin-bottom: 0.2rem;
        padding-bottom: 0.2rem;
        font-size: clamp(0.7rem, 3.2cqi, 0.9rem);
    }

    .leaderboard__stat-value {
        font-size: clamp(0.7rem, 3.2cqi, 0.9rem);
    }
}

.leaderboard__stat-label {
    display: block;
    margin-bottom: 0.3rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    font-size: clamp(0.7rem, 3.2cqi, 0.95rem);
    font-weight: 600;
    opacity: 0.9;
}

.leaderboard__stat-value {
    display: block;
    font-size: clamp(0.7rem, 3.2cqi, 0.95rem);
    font-weight: 700;
}

.leaderboard__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

#screen-leaderboards .leaderboard__table-wrap {
    position: relative;
}

#screen-leaderboards .leaderboard__table-head {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    transform: translateY(calc(-100% - 0.55rem));
}

.leaderboard__table-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.leaderboard__table-head {
    display: grid;
    grid-template-columns: 4.5rem 1fr 7rem;
    gap: 0.75rem;
    padding: 0 1.5rem 0.55rem;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.9;
}

.leaderboard__table {
    flex: 1;
    overflow: auto;
    border-radius: 0.55rem;
    background: rgba(235, 235, 235, 0.92);
    color: #2b2b2b;
}

.leaderboard__row {
    display: grid;
    grid-template-columns: 4.5rem 1fr 7rem;
    gap: 0.75rem;
    align-items: center;
    min-height: 2.6rem;
    padding: 0.55rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    font-size: 1.2rem;
}

.leaderboard__row:last-child {
    border-bottom: none;
}

.leaderboard__row.is-current {
    background: #6d4fb8;
    color: #fff;
}

.leaderboard__col--rank {
    font-weight: 600;
    text-align: center;
    /* padding-right: 3rem; */
}

.leaderboard__col--name {
    margin-left: 2rem;
}

.leaderboard__col--score {
    text-align: right;
    font-weight: 600;
}

.leaderboard__filters {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.75rem;
}

#screen-leaderboards .leaderboard__filter-group {
    position: relative;
}

#screen-leaderboards .leaderboard__filter-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin-bottom: 0;
    transform: translateY(calc(-100% - 0.45rem));
}

.leaderboard__filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    /* margin-top: auto; */
}

.leaderboard__filter-label {
    margin-bottom: 0.15rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
}

.leaderboard__filter-btn {
    width: 100%;
    min-height: 2.6rem;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 0.4rem;
    background: #d8d8d8;
    color: #151515;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.leaderboard__filter-btn.is-active {
    background: var(--var-redhat-red);
    color: #fff;
}

#screen-leaderboards .redhatlogo-bottom-right {
    bottom: 1rem;
    right: 1rem;
}

#screen-game-complete {
    padding: 0;
    overflow: visible;
    background: transparent;
}

#screen-game-complete.screen--active {
    z-index: 5;
}

/* Full-bleed backdrop behind the 16:9 frame (letterboxing) */
#screen-game-complete.screen--active::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #2a1a5e;
    pointer-events: none;
}

.level-complete__video {
    position: fixed;
    inset: 0;
    z-index: 1;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    pointer-events: none;
    background: transparent;
}

/*
 * confettiLoop.webm is VP9 + alpha. Desktop Chrome composites alpha correctly.
 * Safari/iPad often fills transparent pixels with opaque black — screen blend
 * drops those blacks out over the purple ::before backdrop.
 */
#screen-game-complete.is-alpha-fallback .level-complete__video {
    mix-blend-mode: screen;
}

.level-complete__balloons {
    position: fixed;
    inset: 0;
    z-index: 2;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    pointer-events: none;
}

.level-complete__balloon {
    position: absolute;
    top: 100%;
    width: clamp(14rem, 32vw, 24rem);
    will-change: transform;
    animation-name: level-complete-balloon-rise;
    animation-timing-function: cubic-bezier(0.4, 0, 0.7, 0.2);
    animation-fill-mode: forwards;
}

.level-complete__balloon-img {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0.95;
    transform-origin: 50% 20%;
    animation: level-complete-balloon-sway 1.83s ease-in-out infinite alternate;
    will-change: transform;
}

.level-complete__balloon--left {
    left: -3%;
}

.level-complete__balloon--right {
    right: -3%;
    left: auto;
}

@keyframes level-complete-balloon-rise {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(var(--balloon-drift, 0px), calc(-100vh - 100%), 0);
    }
}

@keyframes level-complete-balloon-sway {
    0% {
        transform: rotate(-3.5deg);
    }
    100% {
        transform: rotate(3.5deg);
    }
}

.level-complete__content {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.level-complete__title {
    margin-bottom: 1.25rem;
    font-size: clamp(1.4rem, 2.8vw, 2rem);
    font-weight: 500;
    color: #fff;
}

#screen-game-complete.is-final .level-complete__title {
    margin-bottom: 0.75rem;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
}

.level-complete__score-label {
    margin-bottom: 0.35rem;
    font-size: clamp(1.2rem, 2.4vw, 1.7rem);
    font-weight: 500;
    color: #fff;
}

#screen-game-complete.is-final .level-complete__score-label {
    display: none;
}

.level-complete__score {
    font-size: clamp(3.5rem, 9vw, 6.5rem);
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

.level-complete__submit {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(92%, 40rem);
    margin-top: 2.5rem;
    pointer-events: auto;
}

.level-complete__submit[hidden] {
    display: none !important;
}

.level-complete__submit-label {
    margin: 0 0 1.1rem;
    max-width: 28rem;
    font-size: clamp(0.95rem, 1.8vw, 1.2rem);
    font-weight: 500;
    line-height: 1.35;
    color: #fff;
}

.level-complete__submit-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    width: 100%;
}

.level-complete__name {
    flex: 1 1 auto;
    min-width: 0;
    height: 3rem;
    padding: 0 1rem;
    border: none;
    border-radius: 0.35rem;
    background: #fff;
    color: #151515;
    font: inherit;
    font-size: 1.05rem;
    box-sizing: border-box;
}

.level-complete__name:focus {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: 2px;
}

.level-complete__submit-btn {
    flex: 0 0 auto;
    min-width: 8.5rem;
    height: 3rem;
    padding: 0 1.6rem;
    border: none;
    border-radius: 0.35rem;
    background: var(--var-redhat-red);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.level-complete__submit-btn:hover {
    filter: brightness(1.08);
}

.level-complete__continue {
    position: absolute;
    right: var(--corner-action-right);
    bottom: var(--corner-action-bottom);
    z-index: 3;
}

#screen-game-complete.is-final .level-complete__continue {
    display: none;
}