:root {
    --horse-shell: #fff9ef;
    --horse-ink: #17324d;
    --horse-blue: #3d7df0;
    --horse-blue-deep: #2554b8;
    --horse-gold: #f4bf4f;
    --horse-green: #2f9e63;
    --horse-danger: #d9485a;
    --horse-success: #2ea56f;
    --horse-shadow: 0 26px 56px rgba(23, 50, 77, 0.14);
}

.horse-game-shell {
    background:
        radial-gradient(circle at top right, rgba(61, 125, 240, 0.16), transparent 28%),
        radial-gradient(circle at top left, rgba(255, 200, 77, 0.24), transparent 24%),
        linear-gradient(180deg, #fffef9 0%, #fff7ea 100%);
    border-radius: 30px;
    box-shadow: var(--horse-shadow);
    color: var(--horse-ink);
    overflow: hidden;
    padding: 1.5rem;
}

.horse-game-topbar,
.horse-game-actions,
.horse-status-grid,
.horse-progress-track,
.answer-panel,
.mode-panel,
.mode-switcher {
    display: flex;
    gap: 1rem;
}

.horse-game-topbar {
    align-items: flex-start;
    justify-content: space-between;
}

.horse-game-kicker,
.horse-question-kicker,
.horse-status-label,
.celebration-kicker,
.mode-panel-label {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.horse-game-kicker,
.horse-question-kicker,
.celebration-kicker,
.mode-panel-label {
    color: var(--horse-blue);
}

.horse-game-title {
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 900;
    line-height: 1;
    margin: 0.35rem 0 0.6rem;
}

.horse-game-copy {
    margin: 0;
    max-width: 48rem;
}

.horse-game-actions {
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.horse-game-button {
    background: linear-gradient(135deg, var(--horse-blue), var(--horse-blue-deep));
    border: 0;
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    padding: 0.85rem 1.2rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.horse-game-button:hover,
.horse-game-button:focus-visible,
.horse-game-button-secondary:hover,
.horse-game-button-secondary:focus-visible,
.mode-button:hover,
.mode-button:focus-visible {
    box-shadow: 0 14px 24px rgba(37, 84, 184, 0.2);
    transform: translateY(-1px);
}

.horse-game-button-secondary {
    background: #fff;
    border: 2px solid rgba(37, 84, 184, 0.18);
    color: var(--horse-blue-deep);
}

.mode-panel {
    align-items: center;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.mode-switcher {
    flex-wrap: wrap;
}

.mode-button {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(23, 50, 77, 0.12);
    border-radius: 999px;
    color: var(--horse-ink);
    cursor: pointer;
    font-weight: 800;
    padding: 0.7rem 1rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.mode-button.is-active {
    background: linear-gradient(135deg, #ffffff, #eaf2ff);
    border-color: var(--horse-blue);
    color: var(--horse-blue-deep);
}

.horse-status-grid {
    flex-wrap: wrap;
    margin: 1rem 0;
}

.horse-status-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72));
    border: 1px solid rgba(23, 50, 77, 0.08);
    border-radius: 22px;
    box-shadow: 0 14px 26px rgba(23, 50, 77, 0.06);
    flex: 1 1 180px;
    padding: 1rem 1.2rem;
}

.horse-status-card strong {
    display: block;
    font-size: 1.5rem;
    margin-top: 0.25rem;
}

.horse-question-panel {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.12), transparent 28%),
        linear-gradient(135deg, #12345b, #3d7df0);
    border-radius: 26px;
    box-shadow: 0 20px 34px rgba(18, 52, 91, 0.18);
    color: #fff;
    margin: 1rem 0;
    padding: 1.3rem 1.5rem;
}

.horse-question-panel h2 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 900;
    margin: 0.3rem 0 0.45rem;
}

.horse-feedback-text {
    margin: 0;
    min-height: 1.5rem;
}

.horse-feedback-text.is-success { color: #dcffe9; }
.horse-feedback-text.is-error { color: #ffd8de; }

.horse-progress-track {
    align-items: center;
    background: rgba(23, 50, 77, 0.08);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    height: 18px;
    margin-bottom: 1.3rem;
    overflow: hidden;
    position: relative;
}

.horse-progress-fill {
    background: linear-gradient(90deg, #30bf8a, #53c6ff, #7fe1ff);
    border-radius: inherit;
    height: 100%;
    transition: width 0.45s ease;
    width: 0;
}

.horse-progress-markers {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    inset: 0;
    position: absolute;
}

.horse-progress-markers span {
    border-right: 1px solid rgba(255, 255, 255, 0.5);
}

.horse-progress-markers span:last-child {
    border-right: 0;
}

.horse-arena-shell {
    background:
        linear-gradient(180deg, #d6eeff 0 20%, #bbe0ff 20% 34%, #86cb78 34% 46%, #c79a63 46% 100%);
    border-radius: 30px;
    box-shadow: inset 0 -18px 36px rgba(114, 73, 36, 0.18);
    min-height: 520px;
    overflow: hidden;
    position: relative;
}

.horse-arena-shell::before {
    background:
        radial-gradient(circle at 12% 100%, rgba(130, 176, 112, 0.9) 0 18%, transparent 19%),
        radial-gradient(circle at 28% 100%, rgba(116, 168, 101, 0.92) 0 20%, transparent 21%),
        radial-gradient(circle at 48% 100%, rgba(147, 188, 120, 0.92) 0 16%, transparent 17%),
        radial-gradient(circle at 70% 100%, rgba(117, 164, 97, 0.95) 0 22%, transparent 23%),
        radial-gradient(circle at 86% 100%, rgba(144, 184, 119, 0.92) 0 18%, transparent 19%);
    content: "";
    height: 34%;
    inset: 7% 0 auto;
    opacity: 0.42;
    position: absolute;
}

.horse-arena-shell::after {
    background:
        linear-gradient(180deg, transparent 0 72%, rgba(255, 255, 255, 0.18) 72% 73%, transparent 73% 100%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 18px, transparent 18px 36px);
    content: "";
    inset: 46% 0 0;
    opacity: 0.36;
    position: absolute;
}

.horse-sky-decor {
    inset: 0 0 auto;
    min-height: 38%;
    position: absolute;
}

.horse-sky-decor::before {
    background: radial-gradient(circle, rgba(255, 247, 201, 0.95) 0%, rgba(255, 211, 92, 0.7) 38%, rgba(255, 211, 92, 0) 72%);
    border-radius: 50%;
    content: "";
    height: 110px;
    position: absolute;
    right: 11%;
    top: 10%;
    width: 110px;
}

.cloud {
    background: rgba(255, 255, 255, 0.88);
    border-radius: 999px;
    height: 28px;
    position: absolute;
    transform: scale(var(--cloud-scale, 1));
    width: 90px;
    animation: cloudDrift 16s linear infinite;
}

.cloud::before,
.cloud::after {
    background: inherit;
    border-radius: inherit;
    content: "";
    position: absolute;
}

.cloud::before {
    height: 44px;
    left: 12px;
    top: -16px;
    width: 42px;
}

.cloud::after {
    height: 34px;
    right: 12px;
    top: -10px;
    width: 34px;
}

.cloud-a { left: 7%; top: 12%; }
.cloud-b { --cloud-scale: 0.9; animation-duration: 18s; left: 40%; top: 7%; }
.cloud-c { --cloud-scale: 1.05; animation-duration: 20s; right: 10%; top: 16%; }

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

.arena-tent {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 240, 211, 0.9));
    border: 4px solid #c78c3b;
    border-radius: 0 0 18px 18px;
    bottom: 38%;
    height: 54px;
    position: absolute;
    width: 88px;
}

.arena-tent::before {
    border-bottom: 32px solid #ffefcf;
    border-left: 44px solid transparent;
    border-right: 44px solid transparent;
    content: "";
    left: -4px;
    position: absolute;
    top: -34px;
}

.arena-tent::after {
    background: linear-gradient(180deg, #ff8f4d, #f4bf4f);
    border-radius: 999px;
    bottom: 0;
    content: "";
    left: 50%;
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    width: 10px;
}

.arena-tent-left {
    left: 5%;
    opacity: 0.78;
    transform: scale(0.92);
}

.arena-tent-right {
    opacity: 0.86;
    right: 18%;
}

.arena-flag {
    height: 92px;
    position: absolute;
    width: 16px;
}

.arena-flag::before {
    background: linear-gradient(180deg, #fff5da, #e9cf9d);
    border-radius: 999px;
    bottom: 0;
    content: "";
    left: 6px;
    position: absolute;
    top: 0;
    width: 4px;
}

.arena-flag::after {
    background: linear-gradient(135deg, #3d7df0, #8b5cf6);
    clip-path: polygon(0 0, 100% 20%, 78% 50%, 100% 80%, 0 100%);
    content: "";
    height: 24px;
    left: 10px;
    position: absolute;
    top: 8px;
    width: 34px;
}

.arena-flag-a {
    left: 19%;
    top: 20%;
}

.arena-flag-b {
    right: 9%;
    top: 22%;
}

.arena-flag-b::after {
    background: linear-gradient(135deg, #ff8f4d, #f4bf4f);
}

.arena-marker {
    background: linear-gradient(180deg, #fff7e6, #e7cb8b);
    border: 3px solid #a16a28;
    border-radius: 12px 12px 8px 8px;
    bottom: 14%;
    height: 48px;
    position: absolute;
    width: 20px;
}

.arena-marker::before {
    background: linear-gradient(180deg, #d95b59, #b42e35);
    border-radius: 999px;
    content: "";
    height: 14px;
    left: 50%;
    position: absolute;
    top: 8px;
    transform: translateX(-50%);
    width: 14px;
}

.arena-marker::after {
    background: linear-gradient(180deg, #2f9e63, #217547);
    border-radius: 999px;
    content: "";
    height: 18px;
    left: 50%;
    position: absolute;
    top: 22px;
    transform: translateX(-50%);
    width: 8px;
}

.arena-marker-a {
    left: 12%;
}

.arena-marker-b {
    right: 7%;
}

.arena-fence {
    left: 0;
    position: absolute;
    right: 0;
}

.arena-fence-back {
    background:
        repeating-linear-gradient(90deg, #fef6de 0 14px, transparent 14px 72px),
        linear-gradient(180deg, #fff8e6 0%, #efd9b0 100%);
    border-top: 6px solid #f6f0df;
    border-bottom: 6px solid #f6f0df;
    bottom: 37%;
    height: 46px;
    opacity: 0.92;
}

.arena-fence-front {
    background:
        repeating-linear-gradient(90deg, #fdf2dc 0 16px, transparent 16px 74px),
        linear-gradient(180deg, #fff3da 0%, #e8c58b 100%);
    border-top: 8px solid #f6ead0;
    border-bottom: 8px solid #f6ead0;
    bottom: 10%;
    height: 68px;
}

.horse-course-viewport {
    inset: 0;
    overflow: hidden;
    position: absolute;
}

.horse-course-track {
    bottom: 14%;
    height: 240px;
    left: 0;
    position: absolute;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    width: 100%;
}

.jump-course {
    align-items: flex-end;
    display: flex;
    gap: 84px;
    height: 100%;
    left: 51%;
    padding-right: 340px;
    position: absolute;
}

.jump-obstacle {
    filter: drop-shadow(0 14px 16px rgba(23, 50, 77, 0.12));
    height: 154px;
    position: relative;
    width: 178px;
    z-index: 1;
}

.jump-obstacle-image {
    bottom: 6px;
    display: block;
    height: auto;
    left: 6px;
    object-fit: contain;
    position: absolute;
    width: 166px;
}

.jump-flower-box {
    bottom: -2px;
    display: block;
    height: 36px;
    object-fit: contain;
    position: absolute;
    width: 54px;
}

.jump-flower-box-left { left: 6px; }
.jump-flower-box-right { right: 6px; }

.jump-badge {
    align-items: center;
    background: #fff;
    border: 3px solid #d7c08b;
    border-radius: 999px;
    color: #7d5a12;
    display: flex;
    font-size: 0.88rem;
    font-weight: 900;
    height: 36px;
    justify-content: center;
    left: 50%;
    position: absolute;
    top: -44px;
    transform: translateX(-50%);
    width: 36px;
}

.jump-obstacle.is-cleared {
    filter: saturate(0.78) brightness(0.98);
    opacity: 0.58;
}

.jump-obstacle.is-next .jump-badge,
.jump-obstacle.is-next .jump-obstacle-image {
    filter: drop-shadow(0 0 0 rgba(0,0,0,0)) drop-shadow(0 0 22px rgba(255, 200, 77, 0.55));
}

.horse-runner {
    bottom: 21%;
    height: 182px;
    left: 10%;
    position: absolute;
    transform: translateX(0) translateY(0);
    width: 252px;
    z-index: 4;
    filter: drop-shadow(0 16px 18px rgba(23, 50, 77, 0.18));
}

.horse-runner::after {
    background:
        radial-gradient(circle, rgba(208, 177, 126, 0.55) 0 18%, transparent 20%),
        radial-gradient(circle, rgba(208, 177, 126, 0.42) 0 16%, transparent 18%);
    bottom: 8px;
    content: "";
    height: 28px;
    left: 18px;
    opacity: 0;
    position: absolute;
    width: 64px;
}

.horse-runner.is-galloping { animation: horseGallop 0.34s ease-in-out infinite alternate; }
.horse-runner.is-galloping::after {
    animation: dustPulse 0.42s ease-out infinite;
}
.horse-runner.is-jumping { animation: horseJump 1.05s cubic-bezier(0.28, 0.9, 0.24, 1) forwards; }
.horse-runner.is-jumping .horse-shadow {
    animation: shadowShrink 1.05s ease-in-out forwards;
}
.horse-runner.is-failing { animation: horseFail 0.55s ease-in-out 2; }

.horse-shadow {
    background: rgba(23, 50, 77, 0.18);
    border-radius: 50%;
    bottom: 8px;
    height: 20px;
    left: 44px;
    position: absolute;
    width: 108px;
}

.horse-art {
    height: 100%;
    position: relative;
    width: 100%;
    z-index: 2;
}

.horse-art-image {
    bottom: 10px;
    display: block;
    height: 168px;
    left: 0;
    object-fit: contain;
    opacity: 1;
    position: absolute;
    transform-origin: 46% 72%;
    transition: opacity 0.12s ease, visibility 0.12s ease;
    visibility: visible;
    width: 100%;
}

.horse-art-jump {
    bottom: 24px;
    opacity: 0;
    transform: scale(1.02);
    visibility: hidden;
    z-index: 3;
}

.horse-art-idle {
    z-index: 2;
}

.horse-runner.is-jumping .horse-art-idle {
    opacity: 0 !important;
    visibility: hidden;
}

.horse-runner.is-jumping .horse-art-jump {
    opacity: 1 !important;
    visibility: visible;
}

.horse-runner.is-galloping .horse-art-idle {
    animation: horseImageGallop 0.34s ease-in-out infinite alternate;
}

.horse-runner.is-failing .horse-art-idle {
    animation: horseImageFail 0.24s ease-in-out 2;
}

.answer-panel {
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.4rem;
}

.answer-choice {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.98));
    border: 4px solid rgba(23, 50, 77, 0.1);
    border-radius: 24px;
    box-shadow: 0 18px 28px rgba(23, 50, 77, 0.08);
    color: var(--horse-ink);
    cursor: pointer;
    flex: 1 1 180px;
    font-size: clamp(1.35rem, 2.2vw, 2rem);
    font-weight: 900;
    min-height: 88px;
    padding: 1rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.answer-choice:hover,
.answer-choice:focus-visible {
    border-color: var(--horse-blue);
    box-shadow: 0 16px 26px rgba(23, 50, 77, 0.12);
    transform: translateY(-2px);
}

.answer-choice.is-disabled {
    cursor: default;
    opacity: 0.8;
    pointer-events: none;
}

.answer-choice.is-correct {
    border-color: var(--horse-success);
    box-shadow: 0 0 0 6px rgba(46, 165, 111, 0.18);
}

.answer-choice.is-wrong {
    border-color: var(--horse-danger);
    box-shadow: 0 0 0 6px rgba(217, 72, 90, 0.18);
}

.celebration-layer {
    align-items: center;
    backdrop-filter: blur(2px);
    background: rgba(23, 50, 77, 0.22);
    display: flex;
    inset: 0;
    justify-content: center;
    position: absolute;
    z-index: 10;
}

.celebration-layer.hidden {
    display: none;
}

.celebration-card {
    background: #fffdf8;
    border-radius: 24px;
    box-shadow: var(--horse-shadow);
    padding: 2rem;
    position: relative;
    text-align: center;
    z-index: 2;
}

.celebration-card h3 {
    font-size: 2.6rem;
    font-weight: 900;
    margin: 0.3rem 0;
}

.streamer {
    animation: streamerFall 1.8s linear infinite;
    border-radius: 999px;
    height: 18px;
    position: absolute;
    top: -8%;
    width: 18px;
}

.streamer-a { background: #ff7a45; left: 10%; animation-delay: 0s; }
.streamer-b { background: #3d7df0; left: 22%; animation-delay: 0.2s; }
.streamer-c { background: #ffc84d; left: 38%; animation-delay: 0.55s; }
.streamer-d { background: #2ea56f; left: 57%; animation-delay: 0.15s; }
.streamer-e { background: #d9485a; left: 73%; animation-delay: 0.8s; }
.streamer-f { background: #8b5cf6; left: 88%; animation-delay: 1.05s; }

@keyframes horseGallop {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(12px) translateY(-8px); }
}

@keyframes horseJump {
    0% { transform: translateX(0) translateY(0) rotate(0deg); }
    16% { transform: translateX(52px) translateY(-24px) rotate(-1deg); }
    40% { transform: translateX(142px) translateY(-176px) rotate(-4deg); }
    68% { transform: translateX(232px) translateY(-70px) rotate(2deg); }
    100% { transform: translateX(0) translateY(0) rotate(0deg); }
}

@keyframes horseFail {
    0%, 100% { transform: translateX(0) translateY(0); }
    20% { transform: translateX(-8px) translateY(2px) rotate(-2deg); }
    40% { transform: translateX(8px) translateY(-2px) rotate(2deg); }
    60% { transform: translateX(-6px) translateY(1px) rotate(-1deg); }
    80% { transform: translateX(6px) translateY(-1px) rotate(1deg); }
}

@keyframes shadowShrink {
    0%, 100% { transform: scaleX(1); opacity: 1; }
    50% { transform: scaleX(0.68); opacity: 0.6; }
}

@keyframes horseImageGallop {
    0% { transform: translateY(0) rotate(-1deg) scaleX(1); }
    100% { transform: translateY(-6px) rotate(1deg) scaleX(1.01); }
}

@keyframes horseImageFail {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-2deg) translateY(2px); }
}

@keyframes dustPulse {
    0% { opacity: 0; transform: translateX(0) scale(0.8); }
    35% { opacity: 0.52; transform: translateX(-8px) scale(1); }
    100% { opacity: 0; transform: translateX(-18px) scale(1.18); }
}

@keyframes streamerFall {
    0% { opacity: 0; transform: translateY(0) rotate(0deg); }
    10% { opacity: 1; }
    100% { opacity: 0.95; transform: translateY(110vh) rotate(540deg); }
}

@keyframes cloudDrift {
    0% { transform: translateX(0) scale(var(--cloud-scale, 1)); }
    50% { transform: translateX(16px) scale(var(--cloud-scale, 1)); }
    100% { transform: translateX(0) scale(var(--cloud-scale, 1)); }
}

@media (max-width: 920px) {
    .horse-game-topbar {
        flex-direction: column;
    }

    .horse-game-actions {
        justify-content: flex-start;
    }

    .horse-runner {
        left: 5%;
        transform: scale(0.88);
        transform-origin: left bottom;
    }
}

@media (max-width: 680px) {
    .horse-game-shell {
        border-radius: 22px;
        padding: 1rem;
    }

    .horse-arena-shell {
        min-height: 460px;
    }

    .jump-course {
        gap: 60px;
        left: 58%;
    }

    .jump-obstacle {
        transform: scale(0.88);
        transform-origin: bottom center;
    }


    .answer-choice {
        min-height: 74px;
    }

}
