.clavihero-shell {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.clavihero-game-panel {
    border: 1px solid rgba(8, 119, 242, 0.18);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.clavihero-stage-context {
    margin: 0 0 4px;
    color: var(--ttx-teal-dark, #0f766e);
    font-weight: 800;
    letter-spacing: 0;
}

.clavihero-game-header h3,
.clavihero-results h3 {
    margin: 0;
    color: var(--ttx-azure-dark, #0369a1);
}

.clavihero-layout {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.clavihero-game-panel {
    border-radius: 24px;
}

.clavihero-game-panel {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
}

.clavihero-stage-list {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(54vh, 440px);
    overflow: auto;
    padding: 2px 3px 4px;
}

.clavihero-stage-group {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
    align-items: stretch;
    gap: 9px;
    min-height: 76px;
    padding: 10px;
    border-radius: 15px;
    overflow: hidden;
    isolation: isolate;
}

.clavihero-stage-group::before {
    content: "";
    position: absolute;
    inset: auto 0 0;
    z-index: -2;
    height: 100%;
    background: var(--clavihero-stage-group-image) center / cover no-repeat;
}

.clavihero-stage-group::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.34));
}

.clavihero-stage-button {
    position: relative;
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 12px;
    background: rgba(248, 253, 255, 0.9);
    color: var(--ttx-ink, #0f172a);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    justify-items: center;
    min-height: 58px;
    padding: 10px 28px 10px 9px;
    text-align: center;
    cursor: pointer;
    white-space: normal;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.clavihero-stage-button strong {
    align-self: center;
    font-size: 0.95rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    line-height: 1.1;
}

.clavihero-stage-state {
    position: absolute;
    top: 7px;
    right: 7px;
    min-height: 0;
    border-radius: 999px;
    color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.clavihero-stage-state svg {
    width: 16px;
    height: 16px;
}

.clavihero-stage-button.is-completed {
    border-color: rgba(14, 165, 233, 0.55);
    background: #e0f2fe;
    box-shadow: inset 0 -3px 0 #0284c7;
}

.clavihero-stage-button.is-completed .clavihero-stage-state {
    color: #0284c7;
}

.clavihero-stage-button.is-mastered {
    border-color: rgba(34, 197, 94, 0.55);
    background: #dcfce7;
    box-shadow: inset 0 -3px 0 #16a34a;
}

.clavihero-stage-button.is-mastered .clavihero-stage-state {
    color: #16a34a;
}

.clavihero-stage-button:hover,
.clavihero-stage-button.is-active {
    border-color: var(--ttx-azure, #009dff);
    background: #eaf4ff;
    box-shadow: inset 0 -3px 0 var(--ttx-gold, #f5b301);
}

.clavihero-game-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
}

.clavihero-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.clavihero-menu-button {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid rgba(8, 119, 242, 0.25);
    border-radius: 12px;
    background: #eaf4ff;
    color: var(--ttx-azure-dark, #0369a1);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.clavihero-tool-button.clavihero-menu-button {
    width: 48px;
    height: 48px;
}

.clavihero-tool-button.clavihero-menu-button svg {
    width: 28px;
    height: 28px;
}

.clavihero-menu-button span,
.clavihero-menu-button span::before,
.clavihero-menu-button span::after {
    width: 20px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    display: block;
}

.clavihero-menu-button span {
    position: relative;
}

.clavihero-menu-button span::before,
.clavihero-menu-button span::after {
    content: "";
    position: absolute;
    left: 0;
}

.clavihero-menu-button span::before {
    top: -7px;
}

.clavihero-menu-button span::after {
    top: 7px;
}

.clavihero-menu-button:hover,
.clavihero-menu-button[aria-expanded="true"] {
    border-color: var(--ttx-azure, #009dff);
    background: #dff0ff;
}

.clavihero-stats {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 12;
    width: min(250px, calc(100% - 36px));
    display: grid;
    gap: 8px;
    justify-items: end;
    color: #f8fbff;
    filter: drop-shadow(0 12px 26px rgba(15, 23, 42, 0.24));
}

.clavihero-score-card,
.clavihero-multiplier-card {
    position: relative;
    min-width: 0;
    border: 1px solid rgba(124, 211, 252, 0.48);
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(8, 47, 73, 0.94), rgba(3, 105, 161, 0.84) 48%, rgba(14, 116, 144, 0.9)),
        radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.62), transparent 34%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.14),
        inset 0 -10px 24px rgba(2, 6, 23, 0.24),
        0 0 24px rgba(56, 189, 248, 0.28);
    display: grid;
    gap: 2px;
    padding: 10px 14px;
    text-align: right;
    overflow: hidden;
}

.clavihero-score-card {
    width: 100%;
}

.clavihero-multiplier-card {
    width: 70%;
}

.clavihero-score-card::after,
.clavihero-multiplier-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 0 36%, rgba(255, 255, 255, 0.24) 47%, transparent 58% 100%);
    transform: translateX(-115%);
    pointer-events: none;
}

.clavihero-score-card strong {
    font-size: clamp(2.1rem, 4vw, 3.1rem);
    font-weight: 950;
    line-height: 0.95;
    letter-spacing: 0;
    text-shadow:
        0 2px 0 rgba(2, 6, 23, 0.32),
        0 0 18px rgba(125, 211, 252, 0.64);
}

.clavihero-multiplier-card strong {
    font-size: clamp(2.8rem, 5.8vw, 4.6rem);
    font-weight: 950;
    line-height: 0.9;
    letter-spacing: 0;
    text-align: right;
    text-shadow:
        0 3px 0 rgba(2, 6, 23, 0.36),
        0 0 22px rgba(34, 211, 238, 0.62);
    transform-origin: right center;
}

.clavihero-stat-label {
    color: rgba(226, 246, 255, 0.86);
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}

.clavihero-combo-gauge {
    width: 70%;
    height: 12px;
    border: 1px solid rgba(125, 211, 252, 0.44);
    border-radius: 999px;
    background: rgba(8, 47, 73, 0.62);
    box-shadow: inset 0 0 10px rgba(2, 6, 23, 0.38);
    overflow: hidden;
}

.clavihero-combo-gauge-fill {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background:
        linear-gradient(90deg, #22d3ee, #f8fafc 52%, #facc15),
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent);
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.74);
    transition: width 140ms ease-out;
}

.clavihero-multiplier-card.is-boosted {
    border-color: rgba(226, 232, 240, 0.88);
    background:
        linear-gradient(135deg, rgba(51, 65, 85, 0.96), rgba(226, 232, 240, 0.86) 45%, rgba(71, 85, 105, 0.94)),
        radial-gradient(circle at 16% 0%, rgba(255, 255, 255, 0.96), transparent 38%);
    color: #ffffff;
}

.clavihero-multiplier-card.is-boosted::after {
    animation: clavihero-stat-shine 480ms ease-out;
}

.clavihero-multiplier-card.is-boosted strong {
    animation: clavihero-multiplier-boost 520ms cubic-bezier(0.2, 0.86, 0.22, 1);
}

.clavihero-multiplier-card.is-reset {
    border-color: rgba(248, 113, 113, 0.88);
    background:
        linear-gradient(135deg, rgba(69, 10, 10, 0.96), rgba(185, 28, 28, 0.88), rgba(127, 29, 29, 0.94));
    color: #fee2e2;
}

.clavihero-multiplier-card.is-reset strong {
    animation: clavihero-multiplier-reset 320ms linear;
}

.clavihero-result-grid > span {
    border-radius: 999px;
    background: #eaf4ff;
    color: var(--ttx-azure-dark, #0369a1);
    font-weight: 700;
    padding: 8px 12px;
}

.clavihero-playfield {
    position: relative;
    display: flex;
    flex-direction: column;
}

.clavihero-board {
    --clavihero-lane-angle: 30deg;
    --clavihero-lane-top: -3%;
    --clavihero-lane-x: 4%;
    --clavihero-lane-bottom: -11%;
    --clavihero-board-image: url("../images/fond/Fond_1_16_9.webp");
    position: relative;
    min-height: 624px;
    overflow: hidden;
    border: 1px solid rgba(8, 119, 242, 0.18);
    background: linear-gradient(180deg, #f2fbff 0%, #ffffff 48%, #eaf7ff 100%);
    outline: none;
    perspective: 660px;
    border-radius: 22px 22px 0 0;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.88),
        inset 0 -44px 90px rgba(24, 199, 190, 0.12),
        0 22px 42px rgba(15, 23, 42, 0.18);
}

.clavihero-progress {
    height: 12px;
    border: 1px solid rgba(8, 119, 242, 0.22);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: rgba(226, 232, 240, 0.9);
    overflow: hidden;
}

.clavihero-progress-fill {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--ttx-teal, #18c7be), var(--ttx-gold, #f5b301));
    transition: width 180ms ease;
}

.clavihero-level-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: none;
    place-items: center;
    padding: clamp(18px, 4vw, 42px);
    pointer-events: none;
}

.clavihero-level-overlay.is-open {
    display: grid;
    pointer-events: auto;
}

.clavihero-level-window {
    width: min(620px, 92%);
    max-height: min(82%, 580px);
    border: 1px solid rgba(8, 119, 242, 0.22);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(8px);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.clavihero-level-window-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}

.clavihero-level-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.clavihero-level-window-header p:not(.clavihero-level-title) {
    margin: 0;
    color: var(--ttx-azure-dark, #0369a1);
    font-weight: 900;
}

.clavihero-level-close {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.82);
    color: var(--ttx-ink, #0f172a);
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1;
}

.clavihero-board:focus-visible {
    box-shadow:
        0 0 0 4px var(--ttx-focus-ring, rgba(245, 179, 1, 0.42)),
        inset 0 0 0 1px rgba(255, 255, 255, 0.88),
        inset 0 -44px 90px rgba(24, 199, 190, 0.12),
        0 22px 42px rgba(15, 23, 42, 0.18);
}

.clavihero-board-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 20%, rgba(24, 199, 190, 0.16), transparent 28%),
        radial-gradient(circle at 78% 18%, rgba(8, 119, 242, 0.14), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(224, 247, 255, 0.22) 58%, rgba(255, 247, 214, 0.18)),
        repeating-linear-gradient(180deg, rgba(8, 119, 242, 0.035) 0 1px, transparent 1px 7px),
        var(--clavihero-board-image) center / cover no-repeat;
    animation: clavihero-backdrop-pulse 5.6s ease-in-out infinite;
}

.clavihero-board-bg {
    position: absolute;
    inset: var(--clavihero-lane-top) var(--clavihero-lane-x) var(--clavihero-lane-bottom);
    transform: rotateX(var(--clavihero-lane-angle));
    transform-origin: center bottom;
    background:
        linear-gradient(90deg, rgba(8, 119, 242, 0.28) 1px, transparent 1px),
        linear-gradient(180deg, rgba(24, 199, 190, 0.34) 2px, transparent 2px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(24, 199, 190, 0.12) 54%, rgba(245, 179, 1, 0.14));
    background-size: 12.5% 100%, 100% 72px, 100% 100%;
    animation: clavihero-scroll 2.8s linear infinite;
    opacity: 0.9;
}

.clavihero-board-tools {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 14;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clavihero-tool-button {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(8, 119, 242, 0.28);
    border-radius: 12px;
    background: rgba(248, 253, 255, 0.9);
    color: var(--ttx-azure-dark, #0369a1);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.clavihero-tool-button svg {
    width: 28px;
    height: 28px;
}

.clavihero-tool-button:hover:not(:disabled),
.clavihero-settings-button[aria-expanded="true"],
.clavihero-sound-button[aria-pressed="true"],
.clavihero-pause-button.is-paused {
    border-color: var(--ttx-azure, #009dff);
    background: #dff0ff;
}

.clavihero-tool-button:disabled {
    cursor: default;
    opacity: 0.52;
}

.clavihero-audio-settings {
    position: absolute;
    top: 76px;
    left: 18px;
    z-index: 30;
    width: min(320px, calc(100% - 36px));
    border: 1px solid rgba(8, 119, 242, 0.24);
    border-radius: 16px;
    background: rgba(248, 253, 255, 0.94);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
    display: grid;
    gap: 12px;
    padding: 14px;
    backdrop-filter: blur(8px);
}

.clavihero-audio-settings[hidden] {
    display: none;
}

.clavihero-audio-row,
.clavihero-audio-volume {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    color: var(--ttx-ink, #0f172a);
    font-weight: 850;
}

.clavihero-audio-toggle {
    display: flex;
    align-items: center;
    border: 1px solid rgba(8, 119, 242, 0.2);
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
}

.clavihero-audio-toggle button {
    min-width: 48px;
    border: 0;
    background: transparent;
    color: var(--ttx-muted, #475569);
    cursor: pointer;
    font-weight: 900;
    padding: 8px 10px;
}

.clavihero-audio-toggle button.is-active {
    background: #dff0ff;
    color: var(--ttx-azure-dark, #0369a1);
}

.clavihero-audio-volume {
    grid-template-columns: minmax(0, 1fr) minmax(100px, 150px) 42px;
}

.clavihero-audio-volume input {
    width: 100%;
    accent-color: var(--ttx-azure, #009dff);
}

.clavihero-audio-volume strong {
    color: var(--ttx-azure-dark, #0369a1);
    font-size: 0.88rem;
    text-align: right;
}

.clavihero-pause-overlay {
    position: absolute;
    inset: 0;
    z-index: 24;
    border: 0;
    background: rgba(248, 253, 255, 0.54);
    color: var(--ttx-azure-dark, #0369a1);
    cursor: pointer;
    display: grid;
    place-items: center;
    backdrop-filter: blur(3px);
}

.clavihero-pause-overlay[hidden] {
    display: none;
}

.clavihero-pause-overlay-icon {
    width: clamp(116px, 18vw, 176px);
    height: clamp(116px, 18vw, 176px);
    border: 1px solid rgba(8, 119, 242, 0.22);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.72),
        0 24px 56px rgba(15, 23, 42, 0.2);
    display: grid;
    place-items: center;
}

.clavihero-pause-overlay-icon svg {
    width: 72%;
    height: 72%;
}

.clavihero-board.is-paused .clavihero-board-backdrop,
.clavihero-board.is-paused .clavihero-board-bg,
.clavihero-board.is-paused .clavihero-note-effect,
.clavihero-board.is-paused .clavihero-perfect-burst,
.clavihero-board.is-paused .clavihero-burst-flow,
.clavihero-board.is-paused .clavihero-burst-ray,
.clavihero-board.is-paused .clavihero-burst-particle,
.clavihero-board.is-paused.has-error {
    animation-play-state: paused;
}

.clavihero-columns {
    position: absolute;
    inset: var(--clavihero-lane-top) var(--clavihero-lane-x) var(--clavihero-lane-bottom);
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    transform: rotateX(var(--clavihero-lane-angle));
    transform-origin: center bottom;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 10%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 10%);
}

.clavihero-columns::before,
.clavihero-columns::after {
    content: "";
    position: absolute;
    top: 2%;
    bottom: 0;
    z-index: 2;
    width: 28px;
    pointer-events: none;
    opacity: 1;
    background:
        linear-gradient(180deg, transparent 0%, rgba(125, 211, 252, 0.38) 12%, rgba(34, 211, 238, 0.96) 70%, rgba(255, 255, 255, 0.96) 100%),
        linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.82), transparent);
    filter: blur(0.5px) drop-shadow(0 0 16px rgba(34, 211, 238, 0.8));
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 13%, #000 100%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 13%, #000 100%);
}

.clavihero-columns::before {
    left: -10px;
    clip-path: polygon(76% 0, 104% 0, 30% 100%, 0 100%);
}

.clavihero-columns::after {
    right: -10px;
    clip-path: polygon(-4% 0, 24% 0, 100% 100%, 70% 100%);
}

.clavihero-column {
    position: relative;
    border-inline: 1px solid rgba(15, 23, 42, 0.2);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--clavihero-column-color) 34%, transparent), rgba(255, 255, 255, 0.06) 48%, color-mix(in srgb, var(--clavihero-column-color) 48%, transparent)),
        linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.54), transparent);
}

.clavihero-column::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: 0;
    height: 24%;
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--clavihero-column-color) 68%, transparent));
    filter: blur(10px);
}

.clavihero-target-keys {
    position: absolute;
    inset: var(--clavihero-lane-top) var(--clavihero-lane-x) var(--clavihero-lane-bottom);
    z-index: 7;
    pointer-events: none;
    transform: rotateX(var(--clavihero-lane-angle));
    transform-origin: center bottom;
    transform-style: preserve-3d;
}

.clavihero-target-key {
    --clavihero-key-border-left: 2px;
    --clavihero-key-border-right: 2px;
    --clavihero-key-border-bottom: 10px;
    --clavihero-key-border-top: 1.5px;
    --clavihero-key-border-color: color-mix(in srgb, var(--clavihero-column-color) 58%, #0f172a);
    --clavihero-key-border-light: color-mix(in srgb, var(--clavihero-key-border-color) 72%, #ffffff);
    --clavihero-key-border-edge: color-mix(in srgb, var(--clavihero-column-color) 38%, #020617);
    --clavihero-key-face-light: color-mix(in srgb, var(--clavihero-column-color) 72%, #ffffff);
    --clavihero-key-border-gradient: linear-gradient(to bottom, var(--clavihero-key-border-light), var(--clavihero-key-border-color));
    --clavihero-key-lining: rgba(255, 255, 255, 0.78);
    position: absolute;
    left: var(--target-center);
    bottom: calc(11% + 18px);
    width: 52px;
    height: 44px;
    border-radius: 9px;
    border-top: var(--clavihero-key-border-top) solid transparent;
    border-right: var(--clavihero-key-border-right) solid transparent;
    border-bottom: var(--clavihero-key-border-bottom) solid transparent;
    border-left: var(--clavihero-key-border-left) solid transparent;
    background: var(--clavihero-key-border-gradient) border-box;
    display: grid;
    place-items: center;
    color: transparent;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1;
    isolation: isolate;
    overflow: visible;
    outline: 1px solid var(--clavihero-key-border-edge);
    outline-offset: -1px;
    text-align: center;
    transform: translateX(-50%) translateZ(10px);
}

.clavihero-target-key.is-current {
    color: #fff;
}

.clavihero-target-key.is-current {
    --clavihero-key-lining: rgba(255, 255, 255, 0.9);
}

.clavihero-key-face {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-width: 0;
    border-radius: 7px;
    background:
        linear-gradient(
            180deg,
            var(--clavihero-column-color) 0%,
            var(--clavihero-key-face-light) 50%,
            var(--clavihero-column-color) 100%
    );
    box-shadow: inset 0 0 0 1px var(--clavihero-key-lining);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.clavihero-notes {
    position: absolute;
    inset: var(--clavihero-lane-top) var(--clavihero-lane-x) var(--clavihero-lane-bottom);
    z-index: 4;
    transform: rotateX(var(--clavihero-lane-angle));
    transform-origin: center bottom;
}

.clavihero-effects {
    position: absolute;
    inset: var(--clavihero-lane-top) var(--clavihero-lane-x) var(--clavihero-lane-bottom);
    z-index: 8;
    pointer-events: none;
    transform: rotateX(var(--clavihero-lane-angle));
    transform-origin: center bottom;
    overflow: visible;
}

.clavihero-note {
    position: absolute;
    left: var(--note-left);
    top: calc(var(--note-progress) * 78%);
    width: var(--note-width);
    display: flex;
    justify-content: center;
    pointer-events: none;
    transform: translateY(-50%) scale(calc(0.68 + var(--note-progress) * 0.32));
}

.clavihero-note-key {
    --clavihero-key-border-left: 2px;
    --clavihero-key-border-right: 2px;
    --clavihero-key-border-bottom: 10px;
    --clavihero-key-border-top: 1.5px;
    --clavihero-key-face-color: #d8dee8;
    --clavihero-key-border-color: #9aa4b2;
    --clavihero-key-border-light: #c6ced8;
    --clavihero-key-border-edge: #596475;
    --clavihero-key-face-light: #f8fafc;
    --clavihero-key-border-gradient: linear-gradient(to bottom, var(--clavihero-key-border-light), var(--clavihero-key-border-color));
    --clavihero-key-lining: rgba(255, 255, 255, 0.82);
    box-sizing: border-box;
    min-width: 48px;
    height: 44px;
    border-radius: 8px;
    border-top: var(--clavihero-key-border-top) solid transparent;
    border-right: var(--clavihero-key-border-right) solid transparent;
    border-bottom: var(--clavihero-key-border-bottom) solid transparent;
    border-left: var(--clavihero-key-border-left) solid transparent;
    background: var(--clavihero-key-border-gradient) border-box;
    color: #334155;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    outline: 1px solid var(--clavihero-key-border-edge);
    outline-offset: -1px;
    text-align: center;
    display: grid;
    place-items: center;
}

.clavihero-note-key .clavihero-key-face {
    --clavihero-column-color: var(--clavihero-key-face-color);
    border-radius: 6px;
    padding: 0 10px;
}

.clavihero-note-space {
    justify-content: center;
}

.clavihero-note-space .clavihero-note-key {
    min-width: min(380px, 78%);
    color: #334155;
}

.clavihero-note-effect,
.clavihero-perfect-burst {
    position: absolute;
    left: var(--note-left);
    top: calc(var(--note-progress) * 78%);
    width: var(--note-width);
    display: flex;
    justify-content: center;
    pointer-events: none;
    transform: translateY(-50%) scale(calc(0.68 + var(--note-progress) * 0.32));
    transform-origin: center center;
}

.clavihero-note-effect {
    z-index: 2;
}

.clavihero-note-effect .clavihero-note-key {
    --clavihero-key-face-color: color-mix(in srgb, var(--clavihero-column-color) 72%, #ffffff);
    --clavihero-key-face-light: #ffffff;
    --clavihero-key-lining: rgba(255, 255, 255, 0.95);
    position: relative;
    color: #ffffff;
    text-shadow: 0 2px 0 rgba(15, 23, 42, 0.26);
}

.clavihero-note-effect .clavihero-note-key::before,
.clavihero-note-effect .clavihero-note-key::after {
    content: "";
    position: absolute;
    inset: -12px;
    z-index: -1;
    border-radius: 18px;
    background:
        radial-gradient(circle, color-mix(in srgb, var(--clavihero-column-color) 78%, #ffffff) 0%, color-mix(in srgb, var(--clavihero-column-color) 58%, transparent) 38%, transparent 72%);
    filter: blur(9px);
    opacity: 0.9;
}

.clavihero-note-effect .clavihero-note-key::after {
    inset: -26px -34px;
    filter: blur(18px);
    opacity: 0.5;
}

.clavihero-note-effect.is-hit {
    animation: clavihero-note-hit-fade 500ms cubic-bezier(0.16, 0.84, 0.28, 1) forwards;
}

.clavihero-note-effect.is-miss {
    animation: clavihero-note-miss-shake 560ms ease-out forwards;
}

.clavihero-note-effect.is-miss .clavihero-note-key {
    filter: saturate(0.78) brightness(0.92);
}

.clavihero-miss-cross {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 66px;
    height: 66px;
    border-radius: 16px;
    transform: translate(-50%, -50%) rotateX(18deg) rotateZ(-12deg);
    filter:
        drop-shadow(0 8px 0 rgba(127, 29, 29, 0.35))
        drop-shadow(0 0 18px rgba(239, 68, 68, 0.78));
    animation: clavihero-miss-cross-pop 560ms ease-out forwards;
}

.clavihero-miss-cross::before,
.clavihero-miss-cross::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 86%;
    height: 14px;
    border-radius: 999px;
    background:
        linear-gradient(180deg, #fecaca 0%, #ef4444 44%, #7f1d1d 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.62),
        0 0 16px rgba(239, 68, 68, 0.72);
}

.clavihero-miss-cross::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.clavihero-miss-cross::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.clavihero-perfect-burst {
    z-index: 1;
    height: 1px;
    overflow: visible;
}

.clavihero-burst-flow {
    position: absolute;
    left: 50%;
    bottom: -8px;
    width: 58px;
    height: 172px;
    border-radius: 999px 999px 42px 42px;
    transform-origin: center bottom;
    opacity: 0;
    background:
        radial-gradient(ellipse at 50% 96%, rgba(255, 255, 255, 0.96) 0%, color-mix(in srgb, var(--clavihero-column-color) 68%, transparent) 28%, transparent 66%),
        linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--clavihero-column-color) 28%, transparent) 22%, color-mix(in srgb, var(--clavihero-column-color) 76%, #ffffff) 72%, rgba(255, 255, 255, 0.94) 100%);
    filter: blur(14px);
    mix-blend-mode: screen;
    animation: clavihero-perfect-flow 760ms cubic-bezier(0.14, 0.76, 0.22, 1) forwards;
}

.clavihero-burst-flow-core {
    width: 74px;
    height: 204px;
    transform: translateX(-50%) scaleX(0.72);
}

.clavihero-burst-flow-left {
    height: 144px;
    width: 48px;
    animation-delay: 30ms;
    transform: translateX(-50%) rotate(-34deg);
}

.clavihero-burst-flow-right {
    height: 144px;
    width: 48px;
    animation-delay: 46ms;
    transform: translateX(-50%) rotate(34deg);
}

.clavihero-burst-ray,
.clavihero-burst-particle {
    position: absolute;
    left: 50%;
    bottom: 0;
    background: color-mix(in srgb, var(--clavihero-column-color) 72%, #ffffff);
    box-shadow:
        0 0 18px color-mix(in srgb, var(--clavihero-column-color) 84%, transparent),
        0 0 36px color-mix(in srgb, var(--clavihero-column-color) 64%, transparent),
        0 0 58px rgba(255, 255, 255, 0.36);
}

.clavihero-burst-ray {
    width: 18px;
    height: 148px;
    border-radius: 999px;
    transform-origin: center bottom;
    opacity: 0;
    filter: blur(1.5px);
    mix-blend-mode: screen;
    animation: clavihero-perfect-ray 720ms cubic-bezier(0.14, 0.76, 0.22, 1) forwards;
}

.clavihero-burst-ray-main {
    transform: translateX(-50%) rotate(0deg);
}

.clavihero-burst-ray-left {
    height: 108px;
    width: 14px;
    animation-delay: 24ms;
    transform: translateX(-50%) rotate(-42deg);
}

.clavihero-burst-ray-right {
    height: 108px;
    width: 14px;
    animation-delay: 42ms;
    transform: translateX(-50%) rotate(42deg);
}

.clavihero-burst-particle {
    --particle-x: 0px;
    --particle-y: -70px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    opacity: 0;
    transform: translate(-50%, 0);
    filter: blur(0.3px);
    animation: clavihero-perfect-particle 680ms cubic-bezier(0.14, 0.76, 0.22, 1) forwards;
}

.clavihero-burst-particle-1 { --particle-x: -54px; --particle-y: -102px; animation-delay: 10ms; }
.clavihero-burst-particle-2 { --particle-x: -30px; --particle-y: -142px; animation-delay: 40ms; }
.clavihero-burst-particle-3 { --particle-x: 34px; --particle-y: -128px; animation-delay: 26ms; }
.clavihero-burst-particle-4 { --particle-x: 62px; --particle-y: -88px; animation-delay: 62ms; }
.clavihero-burst-particle-5 { --particle-x: -74px; --particle-y: -52px; animation-delay: 80ms; }
.clavihero-burst-particle-6 { --particle-x: 78px; --particle-y: -58px; animation-delay: 96ms; }

.clavihero-note-effect-space .clavihero-note-key {
    min-width: min(380px, 78%);
}

.clavihero-perfect-burst-space .clavihero-burst-ray-left {
    transform: translateX(-50%) rotate(-54deg);
}

.clavihero-perfect-burst-space .clavihero-burst-ray-right {
    transform: translateX(-50%) rotate(54deg);
}

.clavihero-hit-line {
    position: absolute;
    left: 3%;
    right: 3%;
    bottom: 78px;
    z-index: 5;
    height: 18px;
    background:
        linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.48) 45%, rgba(255, 214, 102, 0.22) 58%, transparent 100%),
        linear-gradient(90deg, transparent 0%, rgba(245, 179, 1, 0.06) 8%, rgba(255, 255, 255, 0.46) 50%, rgba(245, 179, 1, 0.06) 92%, transparent 100%);
    box-shadow:
        0 0 10px rgba(255, 255, 255, 0.42),
        0 0 24px rgba(245, 179, 1, 0.22),
        0 0 44px rgba(34, 211, 238, 0.14);
    clip-path: polygon(4% 38%, 96% 38%, 100% 62%, 0 62%);
    opacity: 0.72;
}

.clavihero-hit-line::before {
    content: "";
    position: absolute;
    inset: 2px -6%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.36), rgba(245, 179, 1, 0.1) 38%, transparent 72%);
    filter: blur(10px);
    opacity: 0.54;
}

.clavihero-board.has-error {
    animation: clavihero-error 180ms ease-in-out 2;
}

.clavihero-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.clavihero-status {
    margin: 0;
    color: var(--ttx-muted, #475569);
    font-weight: 700;
}

.clavihero-results {
    position: absolute;
    inset: 0;
    z-index: 32;
    display: grid;
    place-items: center;
    padding: clamp(18px, 4vw, 42px);
    background: rgba(6, 18, 34, 0.32);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.clavihero-results.is-open {
    opacity: 1;
    pointer-events: auto;
}

.clavihero-results[hidden] {
    display: none;
}

.clavihero-result-window {
    width: min(620px, 94%);
    border: 1px solid rgba(125, 211, 252, 0.55);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(248, 253, 255, 0.98), rgba(236, 253, 245, 0.97)),
        radial-gradient(circle at 50% 0%, rgba(250, 204, 21, 0.22), transparent 42%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.82),
        0 28px 70px rgba(15, 23, 42, 0.32);
    overflow: hidden;
    transform: translateY(24px) scale(0.94);
    opacity: 0;
}

.clavihero-results.is-open .clavihero-result-window {
    animation: clavihero-result-pop 560ms cubic-bezier(0.18, 0.86, 0.2, 1) forwards;
}

.clavihero-result-ribbon {
    background: linear-gradient(90deg, #0284c7, #14b8a6, #f5b301);
    color: #ffffff;
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1;
    padding: 15px 20px;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 2px 0 rgba(15, 23, 42, 0.24);
}

.clavihero-final-score {
    display: grid;
    gap: 2px;
    justify-items: center;
    padding: 22px 20px 12px;
    color: #075985;
}

.clavihero-final-score span {
    font-size: 0.82rem;
    font-weight: 950;
    text-transform: uppercase;
}

.clavihero-final-score strong {
    color: #0f172a;
    font-size: clamp(3.2rem, 9vw, 6.4rem);
    font-weight: 950;
    line-height: 0.9;
    text-shadow:
        0 4px 0 rgba(245, 179, 1, 0.42),
        0 0 28px rgba(56, 189, 248, 0.36);
}

.clavihero-reward-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0 20px 14px;
}

.clavihero-reward-badge {
    --clavihero-reward-color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: #f8fafc;
    color: #475569;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 12px;
}

.clavihero-reward-badge.is-bronze {
    --clavihero-reward-color: #b45309;
    background: #fff7ed;
    color: #9a3412;
}

.clavihero-reward-badge.is-silver {
    --clavihero-reward-color: #64748b;
    background: #f8fafc;
    color: #475569;
}

.clavihero-reward-badge.is-gold {
    --clavihero-reward-color: #f5b301;
    background: #fef9c3;
    color: #92400e;
    box-shadow: inset 0 -3px 0 rgba(245, 179, 1, 0.45);
}

.clavihero-reward-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent),
        var(--clavihero-reward-color);
    color: #ffffff;
    display: grid;
    place-items: center;
}

.clavihero-reward-icon svg {
    width: 30px;
    height: 30px;
}

.clavihero-reward-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.clavihero-reward-copy span,
.clavihero-reward-copy small {
    color: #475569;
    font-weight: 800;
}

.clavihero-reward-copy strong {
    font-size: 1.25rem;
    font-weight: 950;
    line-height: 1;
}

.clavihero-result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 0 20px 18px;
}

.clavihero-result-grid > span {
    border-radius: 14px;
    background: #eaf4ff;
    color: var(--ttx-azure-dark, #0369a1);
    display: grid;
    gap: 5px;
    font-weight: 800;
    min-width: 0;
    padding: 10px 12px;
    text-align: center;
}

.clavihero-result-metric {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    text-align: left;
}

.clavihero-result-metric-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #ffffff;
    color: var(--ttx-azure-dark, #0369a1);
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(8, 119, 242, 0.16);
}

.clavihero-result-metric-icon svg {
    width: 24px;
    height: 24px;
}

.clavihero-result-metric-copy {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.clavihero-result-grid strong {
    color: #0f172a;
    font-size: 1.25rem;
    line-height: 1;
}

.clavihero-result-actions {
    border-top: 1px solid rgba(148, 163, 184, 0.24);
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 20px 20px;
}

.clavihero-result-action {
    width: 54px;
    height: 54px;
    border: 1px solid rgba(8, 119, 242, 0.24);
    border-radius: 14px;
    background: #ffffff;
    color: var(--ttx-azure-dark, #0369a1);
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.clavihero-result-action:hover:not(:disabled) {
    border-color: var(--ttx-azure, #009dff);
    background: #eaf4ff;
    transform: translateY(-1px);
}

.clavihero-result-action:disabled {
    cursor: default;
    opacity: 0.42;
}

.clavihero-result-action svg {
    width: 28px;
    height: 28px;
}

.clavihero-result-next {
    background: #dcfce7;
    color: #166534;
}

.ttx-course-clavihero-button {
    border-color: #f59e0b;
    background: linear-gradient(180deg, #fff7ed 0%, #e0f2fe 100%);
    color: var(--ttx-azure-dark, #0369a1);
    box-shadow: 0 5px 0 #f59e0b, 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.ttx-course-clavihero-button:hover {
    box-shadow: 0 7px 0 #f59e0b, 0 0 0 3px rgba(14, 165, 233, 0.22);
}

.ttx-course-clavihero-button .ttx-course-exercise-icon,
.ttx-course-clavihero-button .ttx-course-exercise-number {
    color: var(--ttx-azure-dark, #0369a1);
}

@keyframes clavihero-scroll {
    from { background-position: 0 0, 0 0, 0 0; }
    to { background-position: 0 0, 0 78%, 0 0; }
}

@keyframes clavihero-backdrop-pulse {
    0%, 100% { filter: brightness(1) saturate(1); }
    50% { filter: brightness(1.15) saturate(1.22); }
}

@keyframes clavihero-error {
    50% { filter: saturate(1.5); box-shadow: 0 0 0 5px rgba(229, 72, 77, 0.28); }
}

@keyframes clavihero-result-pop {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.94);
    }
    58% {
        opacity: 1;
        transform: translateY(-4px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes clavihero-note-hit-fade {
    0% {
        opacity: 1;
        transform: translateY(-50%) scale(calc(0.68 + var(--note-progress) * 0.32));
        filter: brightness(1.35) saturate(1.28);
    }
    42% {
        opacity: 0.74;
        transform: translateY(-58%) scale(calc(0.84 + var(--note-progress) * 0.34));
        filter: brightness(1.58) saturate(1.42);
    }
    100% {
        opacity: 0;
        transform: translateY(-72%) scale(calc(0.96 + var(--note-progress) * 0.36));
        filter: brightness(1.08) saturate(1);
    }
}

@keyframes clavihero-note-miss-shake {
    0% {
        opacity: 1;
        transform: translateY(-50%) translateX(0) rotateZ(0deg) scale(calc(0.68 + var(--note-progress) * 0.32));
    }
    14% {
        transform: translateY(-50%) translateX(-10px) rotateZ(-3deg) scale(calc(0.7 + var(--note-progress) * 0.32));
    }
    28% {
        transform: translateY(-50%) translateX(10px) rotateZ(3deg) scale(calc(0.7 + var(--note-progress) * 0.32));
    }
    42% {
        transform: translateY(-50%) translateX(-7px) rotateZ(-2deg) scale(calc(0.69 + var(--note-progress) * 0.32));
    }
    62% {
        opacity: 0.86;
        transform: translateY(-50%) translateX(5px) rotateZ(2deg) scale(calc(0.68 + var(--note-progress) * 0.32));
    }
    100% {
        opacity: 0;
        transform: translateY(-44%) translateX(0) rotateZ(0deg) scale(calc(0.62 + var(--note-progress) * 0.28));
    }
}

@keyframes clavihero-miss-cross-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) rotateX(18deg) rotateZ(-12deg) scale(0.38);
    }
    22% {
        opacity: 1;
        transform: translate(-50%, -50%) rotateX(18deg) rotateZ(-12deg) scale(1.12);
    }
    78% {
        opacity: 1;
        transform: translate(-50%, -50%) rotateX(18deg) rotateZ(-12deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) rotateX(18deg) rotateZ(-12deg) scale(0.9);
    }
}

@keyframes clavihero-perfect-flow {
    0% {
        opacity: 0;
        clip-path: inset(100% 0 0);
        filter: blur(22px);
    }
    18% {
        opacity: 0.9;
        clip-path: inset(18% 0 0);
        filter: blur(13px);
    }
    46% {
        opacity: 0.58;
        clip-path: inset(0 0 0);
        filter: blur(18px);
    }
    100% {
        opacity: 0;
        clip-path: inset(0 0 68%);
        filter: blur(28px);
    }
}

@keyframes clavihero-perfect-ray {
    0% {
        opacity: 0;
        clip-path: inset(100% 0 0);
        filter: blur(8px);
    }
    18% {
        opacity: 0.96;
        clip-path: inset(0 0 0);
        filter: blur(1px);
    }
    100% {
        opacity: 0;
        clip-path: inset(0 0 72%);
        filter: blur(14px);
    }
}

@keyframes clavihero-perfect-particle {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.45);
    }
    16% {
        opacity: 1;
        transform: translate(-50%, -18px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--particle-x)), var(--particle-y)) scale(0.18);
    }
}

@keyframes clavihero-stat-shine {
    from { transform: translateX(-115%); }
    to { transform: translateX(115%); }
}

@keyframes clavihero-multiplier-boost {
    0% { transform: scale(1); filter: brightness(1); }
    34% { transform: scale(1.95); filter: brightness(1.36); }
    100% { transform: scale(1); filter: brightness(1); }
}

@keyframes clavihero-multiplier-reset {
    0%, 100% { transform: translateX(0); }
    18% { transform: translateX(-5px); }
    36% { transform: translateX(5px); }
    54% { transform: translateX(-4px); }
    72% { transform: translateX(4px); }
}

@media (max-width: 860px) {
    .clavihero-board {
        min-height: 552px;
    }
}

@media (max-width: 680px) {
    .clavihero-game-header,
    .clavihero-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .clavihero-stage-button {
        min-width: 0;
    }

    .clavihero-stats {
        top: 12px;
        right: 12px;
        width: min(190px, calc(100% - 24px));
    }

    .clavihero-board-tools {
        top: 12px;
        left: 12px;
        gap: 6px;
    }

    .clavihero-tool-button {
        width: 40px;
        height: 40px;
    }

    .clavihero-tool-button svg {
        width: 24px;
        height: 24px;
    }

    .clavihero-audio-settings {
        top: 60px;
        left: 12px;
        width: calc(100% - 24px);
    }

    .clavihero-audio-row,
    .clavihero-audio-volume {
        grid-template-columns: minmax(0, 1fr);
        justify-items: stretch;
    }

    .clavihero-score-card strong {
        font-size: 2rem;
    }

    .clavihero-multiplier-card strong {
        font-size: 2.8rem;
    }

    .clavihero-reward-row,
    .clavihero-result-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .clavihero-result-actions {
        padding-inline: 14px;
    }

    .clavihero-result-action {
        width: 50px;
        height: 50px;
    }
}
