.festival-page {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
    font-family: 'Unbounded', sans-serif;
    animation: none;
    background:
        radial-gradient(circle at 50% 88%, color-mix(in srgb, var(--gradient-glow-color) 48%, transparent), transparent 32rem),
        linear-gradient(180deg, #000000 0%, #090303 34%, var(--gradient-mid-color) 68%, var(--gradient-late-color) 100%);
}

.festival-page p {
    padding-left: 0;
}

html.festival-root {
    animation: none;
    background:
        radial-gradient(circle at 50% 88%, color-mix(in srgb, var(--gradient-glow-color) 48%, transparent), transparent 32rem),
        linear-gradient(180deg, #000000 0%, #090303 34%, var(--gradient-mid-color) 68%, var(--gradient-late-color) 100%);
}

.festival-shell {
    width: min(1380px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 30px;
}

.festival-topbar,
.festival-hero,
.festival-score,
.festival-controls,
.festival-board {
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    background: rgba(18, 18, 22, 0.52);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
    contain: layout paint style;
}

.festival-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 8px;
    border-radius: 8px;
}

.festival-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.festival-home,
.festival-icon-button,
.festival-controls button,
.festival-import-button {
    color: #fff;
    font: inherit;
}

.festival-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15em;
    line-height: 1;
}

.festival-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.festival-home {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 16px;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.festival-home:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.festival-icon-button {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.festival-top-action-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.festival-top-action-button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.festival-icon-button:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.festival-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 18px 0;
    padding: 18px;
    border-radius: 8px;
}

.festival-hero > div {
    min-width: 0;
}

.festival-kicker {
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.82rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.festival-hero h1 {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 2rem;
    line-height: 1.1;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.festival-beta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(255, 209, 102, 0.38);
    border-radius: 999px;
    color: #ffd166;
    background:
        linear-gradient(135deg, rgba(255, 209, 102, 0.16), rgba(255, 77, 109, 0.1)),
        rgba(255, 255, 255, 0.06);
    font-size: 0.68rem;
    line-height: 1;
    text-transform: uppercase;
    box-shadow: 0 0 18px rgba(255, 209, 102, 0.12);
}

.festival-track-status {
    flex: 1 1 280px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95rem;
    text-align: right;
    overflow-wrap: anywhere;
}

.festival-game {
    display: grid;
    grid-template-columns: minmax(245px, 270px) minmax(520px, 740px) minmax(320px, 338px);
    gap: 16px;
    align-items: stretch;
    justify-content: center;
}

.festival-score,
.festival-controls {
    min-width: 0;
    border-radius: 8px;
    padding: 18px;
}

.festival-score {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.festival-score-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.festival-score-row span,
.festival-score-grid span,
.festival-controls button span,
.festival-range span,
.festival-select span,
.festival-leaderboard h2,
.festival-leaderboard-head small {
    min-width: 0;
    overflow-wrap: anywhere;
}

.festival-score span,
.festival-score-grid span,
.festival-range span,
.festival-select span,
.festival-player-field span,
.festival-range b {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: uppercase;
}

.festival-score strong {
    flex: 0 0 auto;
    font-size: 1.35rem;
    line-height: 1;
}

.festival-score-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 0;
}

.festival-score-grid div {
    min-width: 0;
    min-height: 66px;
    overflow: hidden;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.festival-score-grid span,
.festival-score-grid strong {
    display: block;
}

.festival-score-grid span {
    line-height: 1.25;
}

.festival-score-grid strong {
    margin-top: 8px;
}

.festival-board {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    max-width: 740px;
    height: clamp(660px, 76svh, 820px);
    border-radius: 8px;
    contain: strict;
    touch-action: none;
    user-select: none;
    background:
        radial-gradient(circle at 50% 84%, rgba(255, 255, 255, 0.15), transparent 18rem),
        linear-gradient(180deg, rgba(14, 14, 22, 0.86), rgba(3, 3, 7, 0.92));
}

#festival-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    transform: translateZ(0);
}

.festival-judgement {
    position: absolute;
    left: 50%;
    bottom: 35%;
    top: auto;
    min-width: 170px;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.48);
    color: rgba(255, 255, 255, 0.86);
    text-align: center;
    text-transform: uppercase;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0.78;
    transition: opacity 0.12s ease, transform 0.12s ease, color 0.12s ease, text-shadow 0.12s ease;
}

.festival-judgement.is-hit {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px) scale(1.05);
}

.festival-summary {
    position: absolute;
    left: 50%;
    top: 43%;
    width: min(92%, 430px);
    padding: 20px;
    overflow: hidden;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035)),
        rgba(8, 8, 13, 0.9);
    border: 1.5px solid rgba(255, 255, 255, 0.16);
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.48),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    color: #f9f9ff;
    transform: translate(-50%, -50%);
    backdrop-filter: blur(14px);
    text-align: left;
    z-index: 5;
    animation: festival-summary-in 0.32s cubic-bezier(0.2, 1.15, 0.25, 1) both;
}

.festival-summary[data-grade="ss"] {
    --result-color: #d783ff;
    --result-color-2: #ffd166;
}

.festival-summary[data-grade="s"] {
    --result-color: #72ff8f;
    --result-color-2: #35d0ff;
}

.festival-summary[data-grade="a"] {
    --result-color: #35d0ff;
    --result-color-2: #d783ff;
}

.festival-summary[data-grade="b"] {
    --result-color: #ffd166;
    --result-color-2: #35d0ff;
}

.festival-summary[data-grade="c"] {
    --result-color: #ff4d6d;
    --result-color-2: #ffd166;
}

.festival-summary-header {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.festival-summary-grade {
    display: grid;
    place-items: center;
    width: 92px;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--result-color, #72ff8f) 32%, transparent), rgba(255, 255, 255, 0.06)),
        rgba(255, 255, 255, 0.07);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 26px color-mix(in srgb, var(--result-color, #72ff8f) 20%, transparent);
    color: #fff;
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: 0;
    text-shadow: 0 0 16px color-mix(in srgb, var(--result-color, #72ff8f) 55%, transparent);
}

.festival-summary-copy h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
}

.festival-summary-copy p {
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
    line-height: 1.45;
}

.festival-summary-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.festival-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.065);
    font-size: 0.82rem;
}

.festival-summary-row.is-wide {
    grid-column: 1 / -1;
    min-height: 58px;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--result-color, #72ff8f) 18%, transparent), rgba(255, 255, 255, 0.06)),
        rgba(255, 255, 255, 0.065);
}

.festival-summary-row strong {
    font-size: 0.96rem;
    font-weight: 700;
}

.festival-summary-row.is-wide strong {
    font-size: 1.25rem;
}

.festival-summary-row span {
    color: rgba(255, 255, 255, 0.68);
    text-transform: uppercase;
    font-size: 0.68rem;
}

.festival-summary::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--result-color, #72ff8f) 30%, transparent), transparent 42%),
        linear-gradient(180deg, rgba(255,255,255,0.09), transparent 52%);
}

.festival-summary::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    top: 0;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, var(--result-color, #72ff8f), var(--result-color-2, #35d0ff));
    opacity: 0.9;
}

@keyframes festival-summary-in {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.festival-judgement.perfect {
    color: #d783ff;
    text-shadow: 0 0 20px rgba(215, 131, 255, 0.5), 0 0 8px rgba(215, 131, 255, 0.35);
}

.festival-judgement-multiplier {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.72em;
    opacity: 0.9;
    vertical-align: top;
}

.festival-judgement.great,
.festival-judgement.good {
    color: #ffd166;
    text-shadow: 0 0 14px rgba(255, 209, 102, 0.45);
}

.festival-judgement.miss,
.festival-judgement.bad {
    color: #ff4d6d;
    text-shadow: 0 0 12px rgba(255, 77, 109, 0.4);
}

.festival-judgement.combo-50 {
    background:
        linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(53, 208, 255, 0.12)),
        rgba(0, 0, 0, 0.58);
    box-shadow: 0 0 24px rgba(255, 209, 102, 0.22);
    animation: festival-judgement-pop 0.28s ease both;
}

.festival-judgement.combo-100 {
    background:
        linear-gradient(135deg, rgba(255, 77, 109, 0.18), rgba(215, 131, 255, 0.18), rgba(53, 208, 255, 0.12)),
        rgba(0, 0, 0, 0.62);
    box-shadow: 0 0 30px rgba(215, 131, 255, 0.3), 0 0 16px rgba(255, 255, 255, 0.08) inset;
    animation: festival-judgement-pop 0.28s ease both, festival-combo-glow 1.05s ease infinite alternate;
}

.festival-judgement.combo-200 {
    background:
        linear-gradient(135deg, rgba(255, 77, 109, 0.22), rgba(255, 209, 102, 0.18), rgba(114, 255, 143, 0.18), rgba(53, 208, 255, 0.18)),
        rgba(0, 0, 0, 0.66);
    box-shadow: 0 0 38px rgba(114, 255, 143, 0.32), 0 0 20px rgba(255, 255, 255, 0.14) inset;
    animation: festival-judgement-pop 0.28s ease both, festival-combo-glow 0.8s ease infinite alternate;
}

.festival-judgement.countdown {
    min-width: 120px;
    padding: 14px 22px;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    background:
        radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.24), transparent 4rem),
        rgba(0, 0, 0, 0.68);
    box-shadow: 0 0 34px rgba(53, 208, 255, 0.3);
    animation: festival-countdown-pop 1s ease both;
}

@keyframes festival-judgement-pop {
    0% {
        transform: translateX(-50%) translateY(2px) scale(0.92);
    }
    70% {
        transform: translateX(-50%) translateY(-10px) scale(1.08);
    }
    100% {
        transform: translateX(-50%) translateY(-8px) scale(1.05);
    }
}

@keyframes festival-countdown-pop {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(4px) scale(0.82);
    }
    20%,
    78% {
        opacity: 1;
        transform: translateX(-50%) translateY(-8px) scale(1.08);
    }
    100% {
        opacity: 0.9;
        transform: translateX(-50%) translateY(-8px) scale(1);
    }
}

@keyframes festival-combo-glow {
    from {
        filter: saturate(1);
    }
    to {
        filter: saturate(1.35) brightness(1.12);
    }
}

.festival-combo-effects {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

.festival-combo-burst {
    position: absolute;
    left: 50%;
    top: 18%;
    width: min(82%, 430px);
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.64);
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    text-transform: uppercase;
    transform: translate(-50%, -12px) scale(0.94);
    animation: festival-combo-burst 1.5s ease forwards;
}

.festival-combo-photo {
    position: absolute;
    width: clamp(76px, 22%, 128px);
    aspect-ratio: 1;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.82);
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
    transform: translate(-50%, -50%) translate(var(--combo-photo-x), var(--combo-photo-y)) scale(0.56) rotate(0deg);
    animation: festival-combo-photo 1.5s ease forwards;
}

.festival-confetti-piece {
    position: absolute;
    width: 7px;
    height: 12px;
    border-radius: 2px;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(0deg);
    animation: festival-confetti 1.2s ease-out forwards;
}

.festival-result-confetti {
    position: absolute;
    border-radius: 2px;
    opacity: 0;
    transform: translate(-50%, -50%) rotate(0deg);
    animation: festival-result-confetti 1.9s cubic-bezier(0.12, 0.78, 0.28, 1) forwards;
}

@keyframes festival-combo-burst {
    0% {
        opacity: 0;
        transform: translate(-50%, -10px) scale(0.9);
    }
    18%,
    72% {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -16px) scale(0.96);
    }
}

@keyframes festival-result-confetti {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translate(0, -18px) rotate(0deg) scale(0.8);
    }

    12% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translate(var(--result-confetti-x), var(--result-confetti-y)) rotate(var(--result-confetti-rotate)) scale(1);
    }
}

@keyframes festival-combo-photo {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translate(var(--combo-photo-x), 44px) scale(0.52) rotate(0deg);
    }
    16%,
    72% {
        opacity: 1;
        transform: translate(-50%, -50%) translate(0, 0) scale(1) rotate(var(--combo-photo-rotate));
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translate(0, -24px) scale(0.96) rotate(var(--combo-photo-rotate));
    }
}

@keyframes festival-confetti {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
    }
    12% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--confetti-x)), calc(-50% + var(--confetti-y))) scale(0.9) rotate(var(--confetti-rotate));
    }
}

.festival-skip-button {
    position: absolute;
    left: 50%;
    bottom: 7.5%;
    z-index: 2;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.34);
    border-radius: 999px;
    color: #fff;
    font: inherit;
    font-size: 0.86rem;
    background: rgba(0, 0, 0, 0.58);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    cursor: pointer;
    transform: translateX(-50%);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.festival-skip-button:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.58);
    transform: translateX(-50%) translateY(-1px);
}

.festival-skip-button[hidden] {
    display: none;
}

.festival-progress {
    position: absolute;
    left: 16px;
    right: 112px;
    bottom: 14px;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

#progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff4d6d, #ffd166, #35d0ff, #72ff8f, #d783ff);
}

.festival-multiplier {
    --multiplier-progress: 0;
    --multiplier-main: #ff4d6d;
    --multiplier-next: #ffd166;
    position: absolute;
    right: 18px;
    bottom: 42px;
    width: 76px;
    height: 76px;
    z-index: 3;
    isolation: isolate;
    pointer-events: none;
    transform: translateZ(0);
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    background: rgba(18, 18, 22, 0.56);
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.24),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.festival-multiplier::before {
    content: "";
    position: absolute;
    inset: 5px;
    z-index: -1;
    border-radius: 50%;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    opacity: 1;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.festival-multiplier::after {
    content: attr(data-next);
    position: absolute;
    right: 50%;
    bottom: -8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(18, 18, 22, 0.92);
    color: color-mix(in srgb, var(--multiplier-next) 72%, #fff);
    font-size: 0.5rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    transform: translateX(50%);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.26);
}

.festival-multiplier-ring {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 0 20px rgba(0, 0, 0, 0.22);
}

.festival-multiplier-ring::before {
    content: "";
    position: absolute;
    inset: 8px;
    z-index: 1;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(18, 18, 24, 0.96), rgba(8, 8, 13, 0.96));
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 -8px 18px rgba(0, 0, 0, 0.28);
}

.festival-multiplier-ring::after {
    content: "";
    position: absolute;
    inset: 4px;
    z-index: 0;
    border-radius: inherit;
    background:
        conic-gradient(var(--multiplier-next) calc(var(--multiplier-progress) * 1turn), rgba(255, 255, 255, 0.12) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
}

.festival-multiplier span,
.festival-multiplier small {
    position: relative;
    z-index: 2;
    display: block;
    line-height: 1;
    text-align: center;
}

.festival-multiplier span {
    color: #fff;
    font-size: 1.34rem;
    font-weight: 700;
    text-shadow:
        0 0 10px color-mix(in srgb, var(--multiplier-main) 48%, transparent),
        0 2px 10px rgba(0, 0, 0, 0.36);
}

.festival-multiplier small {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.5rem;
    text-transform: uppercase;
}

.festival-multiplier.tier-2 {
    --multiplier-main: #ffd166;
    --multiplier-next: #35d0ff;
}

.festival-multiplier.tier-3 {
    --multiplier-main: #35d0ff;
    --multiplier-next: #72ff8f;
}

.festival-multiplier.tier-4 {
    --multiplier-main: #72ff8f;
    --multiplier-next: #d783ff;
}

.festival-multiplier.tier-4 .festival-multiplier-ring {
    background: rgba(255, 255, 255, 0.055);
}

.festival-multiplier.tier-4 .festival-multiplier-ring::after {
    background: conic-gradient(#ff4d6d, #ffd166, #35d0ff, #72ff8f, #d783ff, #ff4d6d);
}

.festival-multiplier.is-upgrading {
    animation: festival-multiplier-upgrade 0.46s cubic-bezier(0.2, 1.35, 0.25, 1) both;
}

.festival-multiplier.is-upgrading::before {
    transform: scale(1.06);
}

@keyframes festival-multiplier-upgrade {
    0% {
        transform: scale(0.92);
    }

    45% {
        transform: scale(1.1);
        box-shadow:
            0 16px 38px rgba(0, 0, 0, 0.28),
            0 0 24px color-mix(in srgb, var(--multiplier-main) 26%, transparent),
            inset 0 0 0 1px rgba(255, 255, 255, 0.07);
    }

    100% {
        transform: scale(1);
    }
}

.festival-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.festival-import {
    display: grid;
    gap: 8px;
}

.festival-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.festival-import-button {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 78px;
    padding: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background:
        radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.18), transparent 5rem),
        rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.festival-import-button:hover {
    background:
        radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.26), transparent 5rem),
        rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.36);
    transform: translateY(-1px);
}

.festival-import-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: linear-gradient(135deg, #ff4d6d, #35d0ff);
    font-size: 1.4rem;
}

.festival-import-button strong,
.festival-import-button small {
    display: block;
}

.festival-import-button strong,
.festival-import-button small {
    display: block;
}

.festival-import-button strong {
    font-size: 1rem;
    line-height: 1.25;
}

.festival-import-button small,
.festival-file-name {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.78rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.festival-file-name {
    padding: 0 4px;
}

.festival-select {
    display: grid;
    gap: 8px;
}

.festival-player-field {
    display: grid;
    gap: 8px;
}

.festival-select[hidden] {
    display: none;
}

.festival-select select,
.festival-player-field input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #fff;
    font: inherit;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.festival-player-field input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.festival-select select:focus,
.festival-player-field input:focus {
    border-color: rgba(255, 255, 255, 0.46);
}

.festival-select.is-loading select {
    border-color: rgba(53, 208, 255, 0.55);
    background:
        linear-gradient(90deg, rgba(53, 208, 255, 0.16), rgba(255, 209, 102, 0.14), rgba(53, 208, 255, 0.16)),
        rgba(255, 255, 255, 0.1);
    background-size: 220% 100%;
    animation: festival-select-loading 1.1s linear infinite;
}

.festival-select option {
    color: #111;
}

.festival-select small {
    color: rgba(255, 255, 255, 0.54);
    font-size: 0.72rem;
    line-height: 1.35;
}

.festival-select.is-loading small {
    color: rgba(255, 255, 255, 0.82);
}

.festival-leaderboard {
    display: grid;
    gap: 10px;
    min-height: 0;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
}

.festival-score .festival-leaderboard {
    margin-top: 4px;
}

.festival-lobby {
    display: grid;
    gap: 10px;
    margin-top: 4px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
}

.festival-lobby-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.festival-lobby h2 {
    margin: 0;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.festival-lobby-head small,
.festival-lobby-status {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.7rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.festival-lobby-list {
    display: grid;
    gap: 7px;
}

.festival-lobby-list-label,
.festival-lobby-empty {
    color: rgba(255, 255, 255, 0.54);
    font-size: 0.66rem;
    line-height: 1.35;
    text-transform: uppercase;
}

.festival-lobby-open {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 48px;
    text-align: left;
    background:
        linear-gradient(90deg, rgba(255, 77, 109, 0.14), rgba(53, 208, 255, 0.08)),
        rgba(255, 255, 255, 0.08);
}

.festival-lobby-open-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #101510;
    background: #72ff8f;
    box-shadow: 0 0 16px rgba(114, 255, 143, 0.18);
}

.festival-lobby-open-copy {
    min-width: 0;
}

.festival-lobby-open strong,
.festival-lobby-open small {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.festival-lobby-open strong {
    font-size: 0.72rem;
}

.festival-lobby-open small {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.62rem;
}

.festival-lobby-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.festival-lobby button {
    min-width: 0;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font: inherit;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.festival-lobby button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.festival-lobby-action {
    aspect-ratio: 1;
    min-height: 42px;
    padding: 0;
}

.festival-lobby-action.is-create {
    background: rgba(53, 208, 255, 0.16);
}

.festival-lobby-action.is-ready-action.is-active {
    color: #101510;
    background: #72ff8f;
}

.festival-lobby-action.is-start:not(:disabled) {
    color: #101510;
    background: #ffd166;
}

.festival-lobby-action.is-leave:not(:disabled) {
    background: rgba(255, 77, 109, 0.18);
}

.festival-lobby button:disabled {
    cursor: default;
    opacity: 0.45;
}

.festival-lobby-players {
    display: grid;
    gap: 6px;
}

.festival-lobby-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 34px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.065);
}

.festival-lobby-player strong,
.festival-lobby-player small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.festival-lobby-player strong {
    font-size: 0.76rem;
}

.festival-lobby-player small,
.festival-lobby-badge {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.62rem;
}

.festival-lobby-badge {
    padding: 5px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.festival-lobby-badge.is-ready {
    color: #101510;
    background: #72ff8f;
}

.festival-leaderboard-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.festival-leaderboard h2 {
    margin: 0;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.festival-leaderboard-head small,
.festival-leaderboard-empty {
    margin: 0;
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.7rem;
    line-height: 1.35;
    text-transform: uppercase;
}

.festival-leaderboard-list {
    display: grid;
    gap: 8px;
    max-height: 390px;
    overflow: auto;
    padding-right: 2px;
}

.festival-leaderboard-entry {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.055);
    overflow: hidden;
}

.festival-leaderboard-button {
    width: 100%;
    min-height: 54px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(60px, auto);
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font: inherit;
    text-align: left;
    background: transparent;
    cursor: pointer;
}

.festival-leaderboard-entry.is-expanded .festival-leaderboard-button,
.festival-leaderboard-button:hover {
    background:
        linear-gradient(90deg, rgba(255, 77, 109, 0.12), rgba(53, 208, 255, 0.08)),
        rgba(255, 255, 255, 0.06);
}

.festival-leaderboard-place {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.7rem;
}

.festival-leaderboard-main {
    min-width: 0;
}

.festival-leaderboard-main strong,
.festival-leaderboard-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.festival-leaderboard-main strong {
    font-size: 0.78rem;
}

.festival-leaderboard-main small {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.68rem;
}

.festival-leaderboard-more {
    justify-self: end;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.64rem;
    text-align: right;
    text-transform: uppercase;
    white-space: nowrap;
}

.festival-leaderboard-details {
    display: grid;
    gap: 6px;
    padding: 0 10px 10px;
}

.festival-leaderboard-details div {
    display: grid;
    grid-template-columns: minmax(82px, 0.9fr) minmax(0, 1.1fr);
    gap: 10px;
    min-height: 24px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.68rem;
}

.festival-leaderboard-details strong {
    color: rgba(255, 255, 255, 0.88);
    font-weight: 700;
    text-align: right;
    overflow-wrap: anywhere;
}

.festival-record-panel {
    width: min(92vw, 520px);
}

.festival-record-head {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.festival-record-grade {
    display: grid;
    place-items: center;
    width: 76px;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    background:
        linear-gradient(135deg, rgba(114, 255, 143, 0.22), rgba(53, 208, 255, 0.12)),
        rgba(255, 255, 255, 0.07);
    color: #fff;
    font-size: 1.7rem;
    font-weight: 700;
}

.festival-record-head h2 {
    margin: 0 0 7px;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.festival-record-head p {
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.78rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.festival-record-list {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.festival-record-list div {
    display: grid;
    grid-template-columns: minmax(100px, 0.9fr) minmax(0, 1.1fr);
    gap: 12px;
    min-height: 34px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.065);
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.72rem;
}

.festival-record-list strong {
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
    overflow-wrap: anywhere;
}

.festival-record-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.festival-record-actions button[hidden] {
    display: none;
}

.festival-record-actions button[hidden] + button {
    grid-column: 1 / -1;
}

#record-replay-button {
    background:
        linear-gradient(135deg, rgba(114, 255, 143, 0.2), rgba(53, 208, 255, 0.14)),
        rgba(255, 255, 255, 0.08);
}

@keyframes festival-select-loading {
    from {
        background-position: 0% 0;
    }

    to {
        background-position: 220% 0;
    }
}

.festival-button-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.festival-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 44px;
    padding-inline: 10px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.festival-button-row button {
    aspect-ratio: 1.35;
    font-size: 1.05rem;
}

.festival-button-row button span,
.festival-tool-row button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.festival-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.festival-controls button:active {
    transform: translateY(1px);
}

.festival-controls .festival-leaderboard-button {
    display: grid;
    justify-content: stretch;
    min-height: 54px;
    background: transparent;
    transform: none;
}

.festival-controls .festival-leaderboard-entry.is-expanded .festival-leaderboard-button,
.festival-controls .festival-leaderboard-button:hover,
.festival-controls .festival-leaderboard-button:active {
    background:
        linear-gradient(90deg, rgba(255, 77, 109, 0.12), rgba(53, 208, 255, 0.08)),
        rgba(255, 255, 255, 0.06);
    transform: none;
}

.festival-range {
    display: grid;
    gap: 10px;
    padding: 10px 0;
}

.festival-range span {
    display: flex;
    justify-content: space-between;
}

.festival-range input {
    width: 100%;
    accent-color: #72ff8f;
}

.festival-secondary-button {
    margin-top: auto;
}

.festival-tool-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: auto;
}

.festival-tool-row .festival-secondary-button {
    margin-top: 0;
}

.festival-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
}

.festival-modal[hidden] {
    display: none;
}

.festival-modal-panel {
    position: relative;
    width: min(500px, 100%);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    background: rgba(11, 12, 18, 0.96);
    color: #f7f7ff;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.festival-modal-panel h2 {
    margin: 0 0 16px;
    font-size: 1.35rem;
    line-height: 1.15;
    letter-spacing: 0.02em;
}

.festival-modal-panel p {
    margin: 0 0 22px;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.7;
    font-size: 0.97rem;
}

.festival-modal-panel button,
.festival-modal-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    font: inherit;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.festival-modal-panel > button:last-child {
    width: 100%;
}

.festival-contact-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 14px;
}

.festival-contact-row button,
.festival-contact-row a {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.festival-contact-row button {
    background: linear-gradient(135deg, rgba(56, 142, 255, 0.24), rgba(118, 52, 255, 0.24));
}

.festival-contact-status {
    min-height: 1.4em;
    margin: 0 0 16px;
    color: #8ff7e0;
    font-size: 0.85rem;
}

.festival-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
}

.festival-modal-panel button:hover,
.festival-modal-link:hover,
.festival-modal-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.festival-keybind-panel {
    width: min(92vw, 580px);
}

.festival-keybind-current {
    margin: 0 0 14px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    line-height: 1.45;
}

.festival-keybind-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 12px;
}

.festival-keybind-tabs button,
.festival-keybind-preset {
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
}

.festival-keybind-tabs button.is-active,
.festival-keybind-preset.is-active {
    border-color: rgba(114, 255, 143, 0.55);
    background:
        linear-gradient(135deg, rgba(114, 255, 143, 0.18), rgba(53, 208, 255, 0.1)),
        rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.festival-keybind-list {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.festival-keybind-preset {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    justify-content: stretch;
    width: 100%;
    min-height: 54px;
    padding: 10px 12px;
    text-align: left;
}

.festival-keybind-preset strong,
.festival-keybind-preset small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.festival-keybind-preset small,
.festival-keybind-pill {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.68rem;
}

.festival-keybind-pill {
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 1180px) {
    .festival-game {
        grid-template-columns: 1fr;
    }

    .festival-board {
        order: 1;
        height: clamp(560px, 72svh, 720px);
        justify-self: center;
        width: min(740px, 100%);
    }

    .festival-score {
        order: 3;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .festival-score-grid {
        grid-column: 1 / -1;
    }

    .festival-controls {
        order: 2;
        width: min(740px, 100%);
        justify-self: center;
    }
}

@media (max-width: 620px) {
    .festival-shell {
        width: min(100% - 18px, 1460px);
        padding-top: 10px;
    }

    .festival-hero {
        align-items: start;
        flex-direction: column;
    }

    .festival-track-status {
        flex: 0 1 auto;
        text-align: left;
    }

    .festival-hero h1 {
        font-size: 1.5rem;
    }

    .festival-top-action-button span {
        display: none;
    }

    .festival-board {
        height: min(76svh, 600px);
        min-height: 520px;
    }

    .festival-summary {
        width: min(94%, 430px);
        padding: 16px;
    }

    .festival-summary-header {
        grid-template-columns: 76px 1fr;
        gap: 12px;
    }

    .festival-summary-grade {
        width: 76px;
        font-size: 1.7rem;
    }

    .festival-progress {
        right: 98px;
    }

    .festival-multiplier {
        right: 14px;
        bottom: 40px;
        width: 68px;
        height: 68px;
    }

    .festival-multiplier span {
        font-size: 1.16rem;
    }

    .festival-multiplier small {
        font-size: 0.47rem;
    }

    .festival-multiplier::after {
        min-width: 30px;
        height: 20px;
        font-size: 0.5rem;
    }

    .festival-score {
        grid-template-columns: 1fr;
    }

    .festival-score-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .festival-button-row {
        grid-template-columns: 1fr;
    }

    .festival-contact-row {
        grid-template-columns: 1fr;
    }

    .festival-keybind-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 390px) {
    .festival-board {
        height: min(74svh, 560px);
        min-height: 500px;
    }

    .festival-summary-grid {
        grid-template-columns: 1fr;
    }

    .festival-progress {
        right: 90px;
    }

    .festival-multiplier {
        width: 64px;
        height: 64px;
        right: 12px;
        bottom: 38px;
    }

    .festival-button-row button span {
        display: none;
    }
}
