/* Gensokyo Origins Chapter 3: scene artwork and Breaker Style revelation. */
.chapter4-scene {
    aspect-ratio: 16 / 9;
    background: #08080a;
}

.chapter4-scene .auth-chara-intro-scene-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chapter4-scene img[data-scene-src] {
    background: linear-gradient(135deg, #17131d, #08080a);
    color: var(--muted);
}

.chapter4-boss {
    background: #08080a;
}

.chapter4-revelation-trigger {
    cursor: pointer;
}

.chapter4-revelation-trigger:focus-visible {
    outline: 2px solid white;
    outline-offset: 4px;
}

.chapter4-revelation-trigger[aria-disabled="true"] {
    cursor: default;
}

.chapter4-revelation-screen {
    position: relative;
    margin: 1.5rem 0;
    transform-origin: center;
}

.chapter4-revelation-screen[hidden] {
    display: none;
}

.chapter4-revelation-screen.is-revealing {
    animation: chapter4-style-reveal 180ms ease-out;
}

.chapter4-revelation-screen video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.chapter4-status:empty {
    display: none;
}

@keyframes chapter4-style-reveal {
    from {
        transform: scaleY(0.03);
    }
    to {
        transform: scaleY(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .chapter4-revelation-screen.is-revealing {
        animation: none;
    }
}

/* Hold a black end screen over the video until the next revelation. */
.chapter4-revelation-replay {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 1rem;
    border: 0;
    border-radius: 0;
    background: #000;
    color: #fff;
    font-family: "Edo SZ", Georgia, serif;
    font-size: clamp(1.5rem, 5vw, 3rem);
    cursor: pointer;
}

.chapter4-revelation-replay[hidden] {
    display: none;
}

.chapter4-revelation-replay:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -8px;
}

.chapter4-revelation-replay:disabled {
    cursor: wait;
}

.chapter4-recruit .mission-mission-kind-box {
    border: 0;
    border-radius: 0;
    border-top: 2px solid var(--murasaki);
    border-bottom: 2px solid var(--murasaki);
    display: grid;
    gap: 0.4rem 1rem;
    grid-template-columns: 6rem minmax(0, 1fr);
}

.chapter4-recruit-card > img {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 6rem;
    height: 6rem;
    object-fit: cover;
}

.chapter4-recruit-card > .mission-mission-kind-title {
    grid-column: 2;
    grid-row: 1;
}

.chapter4-recruit-card > .mission-mission-kind-blurb {
    grid-column: 2;
    grid-row: 2;
}

.chapter4-recruit-card > .mission-mission-kind-title::before {
    display: none;
}

.chapter4-recruit .mission-mission-kind-trigger {
    max-width: 100%;
    white-space: normal;
}

.chapter4-artwork {
    aspect-ratio: 16 / 9;
    background: #08080a;
}

.chapter4-artwork > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

img[data-scene-src] {
    visibility: hidden;
}

.chapter4-sound {
    cursor: pointer;
}

.chapter4-sound:focus-visible {
    outline: 2px solid white;
    outline-offset: 4px;
}

@media (max-width: 480px) {
    .chapter4-recruit .mission-mission-kind-box {
    border: 0;
    border-radius: 0;
    border-top: 2px solid var(--murasaki);
    border-bottom: 2px solid var(--murasaki);
        gap: 0.6rem;
        grid-template-columns: 4rem minmax(0, 1fr);
    }
    .chapter4-recruit-card > img {
        width: 4rem;
        height: 4rem;
    }
}

/* Recruitment result text sits below the card without stage-direction brackets. */
.chapter4-recruit-notice {
    display: none;
    margin: 0.55rem 0 0;
    color: #ffffff;
    font-family: "Tojo Captioner", Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
}

.chapter4-recruit.is-revealed .chapter4-recruit-notice {
    display: block;
}

/* Citrus' shooting match. Art stays in a clipped 16:9 viewport. */
.bullseye {
    margin: 2.5rem 0;
    border-top: 2px solid var(--murasaki);
    border-bottom: 2px solid var(--murasaki);
    padding: 1rem 0;
    background: #0b0b0e;
}

.bullseye-heading {
    text-align: center;
}

.bullseye-heading p {
    margin: 0.3rem;
}

.bullseye-heading h2 {
    margin: 0;
    color: #FF6A00;
    font-family: "Edo SZ", Georgia, serif;
    font-size: clamp(2rem, 7vw, 4rem);
}

.bullseye-scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem;
    text-align: center;
}

.bullseye-scores strong {
    display: block;
    color: #f3c567;
    font-size: 2rem;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.bullseye-scores span {
    display: block;
    color: #bbb;
    font-size: 0.85rem;
}

.bullseye-viewport {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    isolation: isolate;
    background: #000;
    touch-action: pan-y;
    user-select: none;
    cursor: crosshair;
}

.bullseye[data-state="player"] .bullseye-viewport {
    touch-action: none;
}

.bullseye-viewport:focus-visible,
.bullseye button:focus-visible {
    outline: 2px solid #f3c567;
    outline-offset: -3px;
}

.bullseye-world {
    position: absolute;
    width: 165%;
    height: 165%;
    left: -20%;
    top: -30%;
}

.bullseye-world > img,
.bullseye-hits,
.bullseye-eyepatch {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    pointer-events: none;
}

.bullseye-gun {
    position: absolute;
    width: 125%;
    height: 125%;
    max-width: none;
    left: 1.25%;
    bottom: -12%;
    z-index: 2;
    pointer-events: none;
}

.bullseye-reticle {
    position: absolute;
    left: 65%;
    top: 42%;
    width: 14px;
    height: 14px;
    border: 1px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 2px 1px #000;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;
}

.bullseye-reticle::after {
    content: "";
    position: absolute;
    width: 2px;
    height: 2px;
    top: 5px;
    left: 5px;
    background: #fff;
}

.bullseye-eyepatch {
    z-index: 4;
}

.bullseye [hidden],
#chapter4-after-bullseye[hidden] {
    display: none;
}

.bullseye-turn,
.bullseye-shot {
    position: absolute;
    z-index: 5;
    padding: 0.2rem 0.6rem;
    background: #000c;
    color: #fff;
    font-family: "Edo SZ", Georgia, serif;
    font-size: clamp(0.85rem, 3vw, 1.5rem);
    pointer-events: none;
}

.bullseye-turn {
    top: 0.5rem;
    right: 0.5rem;
}

.bullseye-shot {
    bottom: 0.5rem;
    right: 0.5rem;
    color: #f3c567;
}

.bullseye-shot:empty {
    display: none;
}

.bullseye-hit {
    position: absolute;
    width: 0.55%;
    aspect-ratio: 1;
    background: #16100c;
    border: 1px solid #f3c567;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.bullseye-hit.is-citrus {
    border-color: #ed8e2e;
}

.bullseye-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.7rem;
    margin: 1rem;
}

.bullseye button {
    min-height: 44px;
    padding: 0.6rem 1rem;
    border: 1px solid #ffffff;
    background: #211923;
    color: white;
    font: inherit;
    cursor: pointer;
}

.bullseye button:disabled {
    opacity: 0.45;
    cursor: default;
}

.bullseye-status,
#bullseye-help,
.bullseye-legend,
.bullseye-results {
    margin: 0.8rem 1rem;
}

.bullseye-status {
    min-height: 3em;
    color: #f3c567;
    text-align: center;
}

#bullseye-help,
.bullseye-legend {
    color: #bbb;
    font-size: 0.9rem;
}

.chapter-nav-next[aria-disabled="true"] {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Wide turn-change strip above the gun and eyepatch layers. */
.bullseye-turn-banner {
    position: absolute;
    top: 50%;
    left: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 30%;
    padding: 1rem;
    background: #000;
    color: #fff;
    font-family: "Edo SZ", Georgia, serif;
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    text-align: center;
    transform: translateY(-50%);
    pointer-events: none;
    animation: bullseye-turn-in 250ms ease-out;
}

@keyframes bullseye-turn-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .bullseye-turn-banner { animation: none; }
}

/* The firing flash affects only the target background, below gun and eyepatch. */
.bullseye-world.is-firing > img {
    animation: bullseye-target-flash 85ms linear;
}

@keyframes bullseye-target-flash {
    0%, 25% { filter: brightness(0) invert(1); }
    100% { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    .bullseye-world.is-firing > img { animation: none; }
}

/* This preference suppresses flashes immediately, including an active flash. */
.bullseye[data-no-flash="true"] .bullseye-world > img {
    animation: none !important;
    filter: none !important;
}

.bullseye-options,
.bullseye-meters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.7rem 1.2rem;
    margin: 1rem;
    font-size: 0.9rem;
}

.bullseye-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    cursor: pointer;
}

.bullseye-options input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #ffffff;
}

.bullseye-meters meter {
    width: 6rem;
    vertical-align: middle;
}

#bullseye-clock {
    min-width: 4rem;
    color: #f3c567;
    font-variant-numeric: tabular-nums;
}

#bullseye-breath[aria-pressed="true"] {
    background: #4a3a20;
    border-color: #fff;
}

/* Independent vertical translation leaves horizontal aiming transforms intact. */
.bullseye-gun {
    translate: 0 110%;
    transition: translate var(--reload-duration, 1000ms) cubic-bezier(0.2, 0.7, 0.3, 1);
}

.bullseye-gun.is-aim-ready {
    translate: 0 0;
}

.bullseye-gun.is-stowed {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .bullseye-gun { transition: none; }
}

/* Practice-mode warning covers the whole minigame until acknowledged. */
.bullseye {
    position: relative;
}

.bullseye-practice-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.94);
}

.bullseye-practice-dialog {
    width: 100%;
    max-width: 42rem;
    padding: clamp(1rem, 3vw, 2rem);
    border: 1px solid #555;
    background: #0b0b0e;
    color: #fff;
}

.bullseye-practice-dialog h3 {
    margin: 0 0 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--murasaki);
    font-family: "Edo SZ", Georgia, serif;
    font-size: clamp(1.3rem, 4vw, 2rem);
    text-align: center;
}

.bullseye-practice-copy p {
    padding: 0.9rem;
    background: #17121b;
    line-height: 1.6;
}

.bullseye-practice-dialog .bullseye-controls {
    margin: 1.2rem 0 0;
}

/* Player-specific score colors. */
#bullseye-murasaki-score {
    color: #B200FF;
}

#bullseye-citrus-score {
    color: #FF6A00;
}

/* Bubble-era image selection follows Chapter 2's tattoo flashbacks. */
.chapter4-bubble-cue {
    font: inherit;
    color: inherit;
    padding: 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: none;
    cursor: pointer;
}

.chapter4-bubble-cue[aria-pressed="true"] {
    color: #fff;
    border-bottom: 2px solid var(--murasaki, #b200ff);
}

.chapter4-bubble-cue:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.chapter4-bubble-display {
    position: relative;
    aspect-ratio: 16 / 9;
    margin: 1.5rem 0 0;
    overflow: hidden;
    background: #111;
}

.chapter4-bubble-display img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chapter4-bubble-empty,
.chapter4-bubble-white {
    position: absolute;
    inset: 0;
}

.chapter4-bubble-empty {
    display: grid;
    place-items: center;
    font: clamp(1.5rem, 5vw, 3rem) "Tojo Captioner", sans-serif;
}

.chapter4-bubble-display [hidden] { display: none; }

.chapter4-bubble-white {
    background: #fff;
    opacity: 0;
    pointer-events: none;
}

.chapter4-bubble-display.is-flashing .chapter4-bubble-white {
    animation: chapter4-bubble-dip 420ms ease-out;
}

@keyframes chapter4-bubble-dip {
    0%, 100% { opacity: 0; }
    25%, 45% { opacity: 1; }
}

.chapter4-bubble-status { color: #aaa; font-size: 0.85rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
    .chapter4-bubble-display.is-flashing .chapter4-bubble-white { animation: none; }
}
