:root {
    --stage-w: 2048;
    --stage-h: 3640;
    --stage-ratio: calc(var(--stage-w) / var(--stage-h));
    --bg: #02080e;
    --text: #e8f2fa;
    --accent: #d4af50;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

.stage-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    /* Hardcoded — map.css overwrites :root --bg to #021828 (letterbox blue). */
    background: #02080e;
}

.stage {
    position: relative;
    /* Desktop / wide: contain so the full portrait intro (logo + UI) stays visible. */
    width: min(100vw, calc(100dvh * var(--stage-ratio)));
    height: min(100dvh, calc(100vw / var(--stage-ratio)));
    overflow: hidden;
    background: #02080e;
    flex-shrink: 0;
}

/* Tall/narrow mobile: cover the screen (crop sides slightly) instead of empty bars. */
@media (max-aspect-ratio: 2048 / 3640) {
    .stage {
        width: max(100vw, calc(100dvh * var(--stage-ratio)));
        height: max(100dvh, calc(100vw / var(--stage-ratio)));
    }
}

/*
 * Splash + intro cinema: fill the portrait shell only.
 * Desktop / wide: same contain letterbox as .stage (centered 9:16).
 * Tall phone: cover viewport (no map-blue bars) — see media query below.
 */
.stage.is-splash,
.stage.is-intro-video {
    width: min(100vw, calc(100dvh * var(--stage-ratio)));
    height: min(100dvh, calc(100vw / var(--stage-ratio)));
}

@media (max-aspect-ratio: 2048 / 3640) {
    .stage.is-splash,
    .stage.is-intro-video {
        width: max(100vw, calc(100dvh * var(--stage-ratio)));
        height: max(100dvh, calc(100vw / var(--stage-ratio)));
    }
}

.layer,
.layer-wrap {
    position: absolute;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.layer--bg {
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.layer-wrap--mast {
    z-index: 3;
}

.wind-group {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    transform-origin: 50% 8%;
    will-change: transform;
}

.wind-group.is-animating {
    animation: sailWind 4.8s ease-in-out infinite;
}

.layer-wrap--sail {
    z-index: 1;
    container-type: inline-size;
}

.sail-aboard-title {
    position: absolute;
    left: 50%;
    top: 55%;
    z-index: 2;
    width: min(78%, 100%);
    max-width: 78%;
    margin: 0;
    transform: translateX(-50%);
    color: #f3e2c0;
    font-family: "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
    font-size: clamp(0.9rem, 7.8cqw, 2.25rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(20, 10, 4, 0.35);
    pointer-events: none;
    user-select: none;
}

.layer-wrap--logo {
    z-index: 2;
}

.layer-wrap--deck {
    z-index: 5;
}

.layer-wrap--welcome {
    z-index: 6;
    container-type: inline-size;
}

.welcome-title,
.welcome-question {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    margin: 0;
    color: #2c170c;
    text-align: center;
    text-transform: none;
    pointer-events: none;
}

.welcome-title {
    top: var(--welcome-title-top, 23%);
    width: min(88%, 100%);
    max-width: 88%;
    font-family: "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
    font-size: clamp(0.8rem, calc(var(--welcome-title-size, 6.55) * 1cqw), 2.25rem);
    font-weight: 700;
    line-height: var(--welcome-title-lh, 1);
    letter-spacing: 0.01em;
    white-space: nowrap;
    transform: translate(-50%, 2px);
}

.welcome-question {
    top: var(--welcome-question-top, 46%);
    width: min(82%, 100%);
    max-width: 82%;
    font-family: "Libre Baskerville", "Playfair Display", Georgia, "Times New Roman", serif;
    font-size: clamp(0.64rem, calc(var(--welcome-question-size, 4.8) * 1cqw), 1.5rem);
    font-weight: 700;
    line-height: var(--welcome-question-lh, 1.08);
    letter-spacing: 0.005em;
}

.layer-wrap--crew {
    z-index: 7;
    overflow: visible;
}

/* Subtle desynced pirate idle — feet anchored, near-imperceptible */
.layer-wrap--crew.is-idle > .layer,
.layer-wrap--crewCenter.is-idle > .layer,
.layer-wrap--crewRight.is-idle > .layer {
    transform-origin: 50% 94%;
    will-change: transform;
}

.layer-wrap--crew.is-idle > .layer {
    animation: leftPirateIdle 3.8s ease-in-out infinite;
    animation-delay: -1.1s;
}

.layer-wrap--crewCenter.is-idle > .layer {
    animation: centerPirateIdle 4.6s ease-in-out infinite;
    animation-delay: -2.3s;
}

.layer-wrap--crewRight.is-idle > .layer {
    animation: rightPirateIdle 5.2s ease-in-out infinite;
    animation-delay: -0.6s;
}

@keyframes leftPirateIdle {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    38% {
        transform: translateY(-1px) rotate(-0.22deg) scale(1.002);
    }
    72% {
        transform: translateY(0) rotate(0.14deg) scale(1.001);
    }
}

@keyframes centerPirateIdle {
    0%, 100% {
        transform: translateY(0) scale(1, 1);
    }
    46% {
        transform: translateY(-1px) scale(1.0015, 1.004);
    }
    75% {
        transform: translateY(0) scale(1.0005, 1.002);
    }
}

@keyframes rightPirateIdle {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    52% {
        transform: translateY(-1px) rotate(0.18deg) scale(1.002);
    }
    82% {
        transform: translateY(0) rotate(-0.1deg) scale(1.001);
    }
}


.layer-wrap--crewRight {
    z-index: 8;
    overflow: visible;
}

.layer-wrap--crewCenter {
    z-index: 9;
    overflow: visible;
}

.layer-wrap--deckFg {
    z-index: 10;
}

.fx-dust {
    position: absolute;
    inset: 0;
    z-index: 11;
    pointer-events: none;
    overflow: hidden;
}

.fx-dust__particle {
    position: absolute;
    left: var(--dust-left, 50%);
    top: var(--dust-top, 50%);
    width: var(--dust-size, 2px);
    height: var(--dust-size, 2px);
    border-radius: 50%;
    background: rgba(232, 196, 110, 0.95);
    opacity: var(--dust-opacity, 0.2);
    box-shadow: 0 0 0.08em rgba(255, 220, 140, 0.35);
    animation: introDustDrift var(--dust-duration, 11s) linear infinite;
    animation-delay: var(--dust-delay, 0s);
    will-change: transform, opacity;
}

.fx-dust.is-static .fx-dust__particle {
    animation: none;
}

@keyframes introDustDrift {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    12% {
        opacity: var(--dust-opacity, 0.2);
    }
    88% {
        opacity: var(--dust-opacity, 0.2);
    }
    100% {
        transform: translate(var(--dust-drift, 10px), calc(var(--dust-rise, 48px) * -1));
        opacity: 0;
    }
}

.name-ui-group {
    position: absolute;
    inset: 0;
    z-index: 12;
    pointer-events: none;
    container-type: inline-size;
}

.name-ui-group.is-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none !important;
}

/* —— Start screen: clickable full-stage intro (no auto-timer) —— */
.intro-splash {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    width: 100%;
    height: 100%;
    background: #02080e;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    opacity: 1;
    transition: opacity 400ms ease;
}

.intro-splash:focus {
    outline: none;
}

.intro-splash:focus-visible {
    outline: 2px solid rgba(233, 189, 99, 0.75);
    outline-offset: -6px;
}

.intro-splash.is-hidden {
    display: none !important;
}

.intro-splash.is-leaving {
    opacity: 0;
    pointer-events: none !important;
    cursor: default;
}

.intro-splash.is-activated {
    pointer-events: none !important;
    cursor: default;
}

.intro-splash-bg-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0;
    animation: introSplashBgIn 500ms ease forwards;
}

.intro-splash-bg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    /* Overscan playfield so subpixel / safe-area never flash shell blue */
    transform: translate(-50%, -50%) scale(1.08);
    animation: introSplashBgZoom 5.5s ease-out 500ms forwards;
}

.intro-splash-logo-stack {
    position: absolute;
    left: 50%;
    top: 43.5%;
    z-index: 2;
    width: 74%;
    transform: translate(-50%, -50%) scale(0.94);
    opacity: 0;
    animation: introSplashLogoIn 800ms cubic-bezier(0.22, 0.61, 0.36, 1) 180ms forwards;
    pointer-events: none;
}

.intro-splash-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 140%;
    height: 140%;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        ellipse at center,
        rgba(255, 190, 70, 0.30) 0%,
        rgba(255, 150, 30, 0.12) 35%,
        rgba(0, 0, 0, 0) 70%
    );
    opacity: 0.75;
    animation: introSplashGlowPulse 3s ease-in-out 1s infinite;
    pointer-events: none;
}

.intro-splash-logo {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.intro-splash-slogan {
    position: absolute;
    left: 50%;
    top: 84%;
    z-index: 3;
    width: 92%;
    margin: 0;
    padding: 0;
    transform: translate(-50%, -50%);
    color: #e9bd63;
    font-family: "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
    font-size: clamp(12px, 3.2vw, 18px);
    font-weight: 700;
    letter-spacing: 0.20em;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.85),
        0 0 10px rgba(0, 0, 0, 0.55);
    opacity: 0;
    animation: introSplashSloganIn 400ms ease 900ms forwards;
    pointer-events: none;
    user-select: none;
}

.intro-splash-hint {
    position: absolute;
    left: 50%;
    top: 91%;
    z-index: 3;
    width: 90%;
    margin: 0;
    padding: 0;
    transform: translate(-50%, -50%);
    color: #e9bd63;
    font-family: "Libre Baskerville", "Playfair Display", Georgia, "Times New Roman", serif;
    font-size: clamp(10px, 2.6vw, 14px);
    font-weight: 700;
    letter-spacing: 0.18em;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.8),
        0 0 8px rgba(0, 0, 0, 0.45);
    opacity: 0;
    animation:
        introSplashHintIn 350ms ease 1200ms forwards,
        introSplashHintPulse 2s ease-in-out 1550ms infinite;
    pointer-events: none;
    user-select: none;
}

@keyframes introSplashBgIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes introSplashBgZoom {
    from { transform: translate(-50%, -50%) scale(1.08); }
    to { transform: translate(-50%, -50%) scale(1.04); }
}

@keyframes introSplashLogoIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes introSplashGlowPulse {
    0%, 100% { opacity: 0.75; }
    50% { opacity: 1; }
}

@keyframes introSplashSloganIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes introSplashHintIn {
    from { opacity: 0; }
    to { opacity: 0.45; }
}

@keyframes introSplashHintPulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 0.9; }
}

.stage.is-splash .fx-dust,
.stage.is-intro-video .fx-dust {
    visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .intro-splash {
        transition-duration: 150ms;
    }

    .intro-splash-bg-wrap {
        opacity: 1;
        animation: none;
    }

    .intro-splash-bg {
        transform: translate(-50%, -50%) scale(1.04);
        animation: none;
    }

    .intro-splash-logo-stack {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        animation: none;
    }

    .intro-splash-glow {
        opacity: 0.85;
        animation: none;
    }

    .intro-splash-slogan {
        opacity: 1;
        animation: none;
    }

    .intro-splash-hint {
        opacity: 0.7;
        animation: none;
    }
}

/* —— Intro cinema inside portrait stage frame —— */
.intro-video-overlay {
    position: absolute;
    inset: 0;
    z-index: 45;
    background: #02080e;
    pointer-events: none;
}

/* Cinema above fading splash (splash z=50) so Skip stays visible + tappable */
.stage.is-intro-video .intro-video-overlay {
    z-index: 55;
    pointer-events: none;
}

.intro-video-overlay.is-hidden {
    display: none !important;
}

.intro-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    background: #02080e;
    display: none;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.intro-video.is-active {
    display: block;
}

/*
 * v305: Skip restored — clearly visible during intro cinema (not nearly invisible).
 * Smaller than the old loud SKIP INTRO, but solid contrast + tap target.
 * Overlay z-index rises above splash while cinema plays (see .is-intro-video).
 */
.intro-video-skip {
    position: absolute;
    right: 3.2%;
    top: calc(env(safe-area-inset-top, 0px) + 2.2%);
    z-index: 6;
    margin: 0;
    padding: 0.42em 0.85em;
    min-height: 32px;
    border: 1px solid rgba(232, 198, 120, 0.42);
    border-radius: 999px;
    background: rgba(2, 16, 28, 0.62);
    color: rgba(247, 224, 170, 0.92);
    font-family: Georgia, "Palatino Linotype", Palatino, serif;
    font-size: clamp(0.68rem, 2.6vw, 0.88rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    opacity: 1;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    transition: opacity 160ms ease, color 160ms ease, background 160ms ease,
        border-color 160ms ease;
}

.intro-video-skip.is-hidden {
    display: none !important;
    pointer-events: none !important;
}

.intro-video-skip:hover,
.intro-video-skip:focus-visible {
    opacity: 1;
    color: #ffe9b0;
    background: rgba(2, 20, 34, 0.78);
    border-color: rgba(247, 209, 122, 0.7);
    outline: none;
}

.intro-video-skip:active {
    opacity: 1;
    filter: none;
    color: #ffe9b0;
    background: rgba(4, 24, 40, 0.88);
}

.confirm-reaction {
    position: absolute;
    left: 10%;
    right: 10%;
    top: 58%;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4em;
    margin: 0;
    padding: 0.95em 1.1em 1.05em;
    pointer-events: none;
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 200ms ease, transform 200ms ease;
    border-radius: 0.35em;
    background:
        linear-gradient(
            180deg,
            rgba(28, 58, 92, 0.94) 0%,
            rgba(14, 36, 64, 0.96) 55%,
            rgba(10, 28, 52, 0.97) 100%
        );
    border: 1.5px solid rgba(212, 175, 80, 0.72);
    box-shadow:
        0 0 0 1px rgba(8, 20, 40, 0.85),
        0 0.35em 0.9em rgba(4, 12, 28, 0.55),
        inset 0 1px 0 rgba(180, 210, 245, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.confirm-reaction::before {
    content: "";
    position: absolute;
    inset: 0.35em;
    border-radius: 0.2em;
    border: 1px solid rgba(212, 175, 80, 0.28);
    pointer-events: none;
}

.confirm-reaction.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.confirm-reaction__line {
    position: relative;
    z-index: 1;
    margin: 0;
    font-family: "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
    font-weight: 700;
    line-height: 1.2;
    color: #fff6d8;
    text-shadow:
        0 0.05em 0.1em rgba(4, 12, 28, 0.9),
        0 0 0.4em rgba(80, 140, 200, 0.25);
}

.confirm-reaction__line--primary {
    font-size: clamp(0.95rem, 5.6cqw, 1.5rem);
    letter-spacing: 0.015em;
}

.confirm-reaction__line--secondary {
    font-size: clamp(0.76rem, 4.2cqw, 1.1rem);
    font-family: "Libre Baskerville", "Playfair Display", Georgia, serif;
    font-weight: 700;
    color: #d4e4f7;
    letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
    .confirm-reaction {
        transition: none;
        transform: none;
    }
}

.layer-wrap--namePanel {
    z-index: 1;
}

.layer-wrap--nameHeader {
    z-index: 2;
    container-type: inline-size;
}

.intro-name-caption {
    position: absolute;
    left: 50%;
    top: 18%;
    bottom: 28%;
    width: min(78%, 100%);
    max-width: 78%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    transform: translate(-50%, 1px);
    color: #fff4d4;
    font-family: "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
    font-size: clamp(0.56rem, 7.1cqw, 1.2rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    text-align: center;
    text-transform: none;
    -webkit-text-stroke: 0;
    text-shadow:
        0 0.05em 0 #3a1c0a,
        0.035em 0 0 #3a1c0a,
        -0.035em 0 0 #3a1c0a,
        0 0.06em 0.1em rgba(20, 8, 2, 0.55);
    pointer-events: none;
}

.layer-wrap--inputFrame {
    z-index: 3;
    container-type: inline-size;
}

.intro-name-input {
    position: absolute;
    left: 10%;
    top: 38%;
    width: 80%;
    height: 26%;
    z-index: 2;
    margin: 0;
    padding: 0 6%;
    border: 1px solid transparent;
    outline: none;
    box-shadow: none;
    border-radius: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    color: #3a2414;
    font-family: "Libre Baskerville", "Playfair Display", Georgia, serif;
    font-size: clamp(13px, 5.2cqw, 20px);
    font-weight: 700;
    font-style: normal;
    line-height: normal;
    text-align: center;
    transform: translateY(-2px);
    caret-color: #5a3514;
    pointer-events: auto;
    transition: text-shadow 180ms ease, color 180ms ease;
}

.intro-name-input::placeholder {
    color: #6e4a2e;
    opacity: 0.92;
    font-style: normal;
    font-weight: 600;
    font-size: 0.92em;
    line-height: inherit;
    text-align: center;
    text-shadow: none;
    position: relative;
    top: 0;
}

.intro-name-input:focus {
    outline: none;
    border-color: rgba(235, 184, 69, 0.95);
    box-shadow:
        0 0 0 2px rgba(235, 184, 69, 0.16),
        0 0 10px rgba(235, 184, 69, 0.12);
}

.intro-name-input.has-value {
    color: #4a2c12;
    text-shadow:
        0 0 0.08em rgba(255, 220, 140, 0.95),
        0 0 0.22em rgba(255, 190, 80, 0.75),
        0 0 0.45em rgba(230, 150, 40, 0.55),
        0 0 0.7em rgba(180, 100, 20, 0.35);
    animation: nameGlow 2.4s ease-in-out infinite;
}

@keyframes nameGlow {
    0%, 100% {
        text-shadow:
            0 0 0.08em rgba(255, 220, 140, 0.9),
            0 0 0.2em rgba(255, 190, 80, 0.65),
            0 0 0.4em rgba(230, 150, 40, 0.45),
            0 0 0.65em rgba(180, 100, 20, 0.28);
    }
    50% {
        text-shadow:
            0 0 0.12em rgba(255, 235, 170, 1),
            0 0 0.28em rgba(255, 205, 100, 0.9),
            0 0 0.55em rgba(240, 170, 50, 0.7),
            0 0 0.85em rgba(200, 120, 30, 0.45);
    }
}

.layer-wrap--buttonPrimary {
    z-index: 4;
    container-type: inline-size;
    overflow: visible;
}

.intro-primary-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    /* Single art layer via <img> — never stack CSS fills under the PNG */
    background: none;
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    pointer-events: auto;
    /* Keep absolute so layer left/top/width vars position the control */
    position: absolute;
    overflow: visible;
}

.intro-primary-btn:focus {
    outline: none;
}

.intro-primary-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.intro-primary-btn:disabled,
.intro-primary-btn.is-inactive {
    cursor: default;
    animation: none;
    /* Opacity only — filter/brightness was reading as a dual-tone pressed face */
    opacity: 0.78;
}

.intro-primary-btn.is-ready {
    animation: confirmButtonBreath 2.8s ease-in-out infinite;
    will-change: transform;
    opacity: 1;
}

.intro-primary-btn.is-ready::after {
    animation: confirmButtonShine 5.5s ease-in-out infinite;
}

.intro-primary-btn::after {
    content: "";
    position: absolute;
    top: 8%;
    bottom: 8%;
    left: -40%;
    width: 22%;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 245, 205, 0.22) 45%,
        transparent 100%
    );
    transform: none;
}

.intro-primary-btn.is-ready:active,
.intro-primary-btn.is-pressed {
    animation: none;
    transform: rotate(var(--layer-rotation, 0deg)) translateY(2px) scale(0.992);
}

.intro-primary-btn.is-glow {
    animation: introButtonConfirmGlow 220ms ease-out;
}

@keyframes confirmButtonBreath {
    0%, 100% {
        transform: rotate(var(--layer-rotation, 0deg)) scale(1);
    }
    50% {
        transform: rotate(var(--layer-rotation, 0deg)) scale(1.008);
    }
}

@keyframes confirmButtonShine {
    0%, 70% {
        left: -40%;
        opacity: 0;
    }
    74% {
        opacity: 0.7;
    }
    90% {
        left: 118%;
        opacity: 0;
    }
    100% {
        left: 118%;
        opacity: 0;
    }
}

@keyframes introButtonConfirmGlow {
    0% {
        transform: rotate(var(--layer-rotation, 0deg)) scale(1);
    }
    40% {
        transform: rotate(var(--layer-rotation, 0deg)) scale(1.02);
    }
    100% {
        transform: rotate(var(--layer-rotation, 0deg)) scale(1.01);
    }
}

.intro-primary-btn__label {
    position: absolute;
    left: 50%;
    top: 18%;
    bottom: 18%;
    width: min(76%, 100%);
    max-width: 76%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    transform: translateX(-50%);
    pointer-events: none;
    background: none;
    font-family: "Playfair Display", "Libre Baskerville", Georgia, "Times New Roman", serif;
    font-size: clamp(0.77rem, 5.9cqw, 1.7rem);
    font-weight: 800;
    letter-spacing: 0.015em;
    line-height: 1;
    text-transform: none;
    color: #fff3cf;
    /* Outline via shadow only — text-stroke can paint a dark band on some GPUs */
    -webkit-text-stroke: 0;
    text-shadow:
        0 0.06em 0 #3a1c0a,
        0.04em 0 0 #3a1c0a,
        -0.04em 0 0 #3a1c0a,
        0 -0.03em 0 #3a1c0a,
        0 0.08em 0.12em rgba(30, 12, 4, 0.55);
}

.layer-wrap {
    left: var(--layer-left, 0%);
    top: var(--layer-top, 0%);
    width: var(--layer-width, 100%);
    opacity: var(--layer-opacity, 1);
    transform: rotate(var(--layer-rotation, 0deg));
    transform-origin: center center;
    will-change: transform, opacity;
}

.layer-wrap.is-hidden {
    visibility: hidden;
    opacity: 0 !important;
}

.layer--bg.is-hidden {
    visibility: hidden;
    opacity: 0 !important;
}

.layer--fit {
    position: relative;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    display: block;
}

.intro-primary-btn > .layer--fit {
    display: block;
    width: 100%;
    height: auto;
    background: none;
    /* Avoid UA/image filters stacking a second tone on the ornate face */
    filter: none;
    -webkit-filter: none;
}

@keyframes sailWind {
    0%, 100% {
        transform: translate(-1.4px, 0) rotate(-0.45deg);
    }
    50% {
        transform: translate(1.6px, 2.8px) rotate(0.45deg);
    }
}

@keyframes sailWindMobile {
    0%, 100% {
        transform: translate(-2.4px, 0) rotate(-0.7deg);
    }
    50% {
        transform: translate(2.8px, 4.5px) rotate(0.7deg);
    }
}

/* Stronger sway on phones — tiny px motion was nearly invisible there */
@media (max-width: 720px), (pointer: coarse) {
    .wind-group.is-animating {
        animation-name: sailWindMobile;
        animation-duration: 4.2s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fx-dust__particle,
    .wind-group.is-animating,
    .intro-name-input.has-value,
    .intro-primary-btn.is-glow,
    .intro-primary-btn.is-ready,
    .intro-primary-btn.is-ready::after,
    .layer-wrap--crew.is-idle > .layer,
    .layer-wrap--crewCenter.is-idle > .layer,
    .layer-wrap--crewRight.is-idle > .layer {
        animation: none !important;
    }
}

/* Pause intro motion when tab/view is hidden */
.intro-motion-paused .layer-wrap--crew.is-idle > .layer,
.intro-motion-paused .layer-wrap--crewCenter.is-idle > .layer,
.intro-motion-paused .layer-wrap--crewRight.is-idle > .layer,
.intro-motion-paused .intro-primary-btn.is-ready,
.intro-motion-paused .intro-primary-btn.is-ready::after,
.intro-motion-paused .intro-name-input.has-value,
.intro-motion-paused .wind-group.is-animating,
.intro-motion-paused .fx-dust__particle {
    animation: none !important;
}

