/* intro.css - the start screen, the launch and the training with Pip.
   Loaded after style.css, so it can change the old start screen rules.
   The page code for all of this is in js/intro.js. */

/* The colours (--sun, --pip, ...) are set at the top of style.css. */

/* Start screen: space on top, Mars at the bottom */

.startscreen {
    position: relative;

    justify-content: flex-start;

    overflow: hidden;

    font-weight: normal;
}

/* A warm glow where space meets Mars */
.startscreen::before {
    content: '';

    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    height: 55%;

    background: linear-gradient(to top, rgba(194, 65, 12, 0.5), rgba(194, 65, 12, 0));

    pointer-events: none;
}

.landing-main {
    position: relative;
    z-index: 2;

    flex: 1;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    width: 100%;
    padding: 20px 16px 185px 16px;

    box-sizing: border-box;
}

.kicker {
    display: inline-block;

    padding: 6px 14px;

    border: 2px solid var(--pip);
    border-radius: 4px;

    background: rgba(11, 11, 30, 0.7);
    color: var(--pip);

    font-family: var(--mono);
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.startscreen h1 {
    margin: 22px 0 14px 0;
}

/* The title is drawn from little squares by drawLogo() */
#logo svg {
    display: block;

    height: clamp(120px, 26vh, 230px);
    width: auto;
    max-width: 88vw;

    filter: drop-shadow(0 0 18px rgba(240, 207, 79, 0.25));
}

.startscreen p.tagline {
    margin: 0 0 18px 0;

    font-size: clamp(1.1rem, 2.4vw, 1.5rem);
    font-weight: bold;

    text-shadow: 0 2px 0 var(--space);
}

.tagline b {
    color: var(--sun);
}

/* Call sign: a silly astronaut name, rolled with the dice */

.callsign {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 6px;
    padding: 6px 6px 6px 14px;

    border: 2px solid #334155;
    border-radius: 999px;

    background: rgba(15, 23, 42, 0.85);
}

.callsign-label {
    color: #94a3b8;

    font-family: var(--mono);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.callsign-name {
    min-width: 9.5em;

    color: var(--sun);

    font-family: var(--mono);
    font-size: 1.15rem;
    font-weight: bold;
    text-transform: uppercase;
}

.callsign-name.rolled {
    animation: rollName 0.3s ease-out;
}

.roll-button {
    width: 40px;
    height: 40px;

    border: 2px solid var(--sun);
    border-radius: 50%;

    background: var(--panel);

    font-size: 20px;
    line-height: 1;

    cursor: pointer;
}

.roll-button:hover {
    background: var(--sun);

    transform: rotate(20deg);
}

/* The big launch button */

.launch-button {
    position: relative;

    margin-top: 18px;
    padding: 20px 54px;

    border: 4px solid var(--space);
    border-radius: 8px;

    background: var(--sun);
    color: var(--ink);

    font-family: var(--mono);
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    font-weight: bold;
    letter-spacing: 0.16em;

    cursor: pointer;

    box-shadow: 0 8px 0 var(--sun-dark), 0 0 0 0 rgba(240, 207, 79, 0.6);

    animation: launchPulse 1.8s ease-out infinite;
}

.launch-button:hover {
    background: #ffe169;

    transform: translateY(-2px);
}

.launch-button:active {
    transform: translateY(6px);

    box-shadow: 0 2px 0 var(--sun-dark);
}

.launch-hint {
    margin-top: 22px;

    font-size: 1rem;
    font-weight: bold;

    text-shadow: 0 2px 0 var(--space);
}

/* A button that looks like a link */
.text-button {
    margin-top: 8px;
    padding: 6px 8px;

    border: none;

    background: none;
    color: #cbd5e1;

    font-size: 14px;
    text-decoration: underline;

    cursor: pointer;
}

.text-button:hover {
    color: var(--sun);
}

button:focus-visible {
    outline: 3px solid var(--pip);
    outline-offset: 3px;
}

/* Mars at the bottom, with Pip standing on it */

.landing-ground {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;

    height: 150px;
}

.landing-ground svg {
    display: block;

    width: 100%;
    height: 100%;
}

/* Pip hovers on the left. hoverPip() in intro.js moves and turns it. */
.landing-pip {
    position: absolute;
    left: max(40px, calc(50% - 590px));
    top: 54%;
    z-index: 3;

    width: 120px;
    padding: 0;

    border: none;

    background: none;

    overflow: visible;
    cursor: pointer;

    will-change: transform;
}

/* Pip's six mini rockets. One is a small flame that points down.
   The others are the same flame, turned. "on" lights a flame. */
.pip-jet {
    position: absolute;

    width: 8%;
    height: 15%;

    margin-left: -4%;

    background: linear-gradient(to bottom, #ffffff 0, #ffffff 25%, #ffd166 25%, #ffd166 60%, #f97316 60%, #f97316 100%);

    /* a flame made of squares: wide at the nozzle, narrow at the tip */
    clip-path: polygon(0 0, 100% 0, 100% 50%, 75% 50%, 75% 100%, 25% 100%, 25% 50%, 0 50%);

    transform-origin: 50% 0;

    opacity: 0;
    pointer-events: none;
}

.pip-jet.on {
    animation: jetFlicker 0.1s steps(2) infinite;
}

/* Under the feet, pointing down */
.pip-jet.foot-left {
    left: 28%;
    top: 100%;
}

.pip-jet.foot-right {
    left: 66%;
    top: 100%;
}

/* On top of the head, pointing up */
.pip-jet.head-left {
    left: 22%;
    top: 12%;

    transform: rotate(180deg);
}

.pip-jet.head-right {
    left: 78%;
    top: 12%;

    transform: rotate(180deg);
}

/* In the hands, pointing sideways */
.pip-jet.hand-left {
    left: 4%;
    top: 75%;

    transform: rotate(90deg);
}

.pip-jet.hand-right {
    left: 96%;
    top: 75%;

    transform: rotate(-90deg);
}

/* Pip is drawn by drawPip() */
.pip svg {
    display: block;

    width: 100%;
    height: auto;
}

.pip-eye {
    transform-box: fill-box;
    transform-origin: center;

    animation: pipBlink 4s infinite;
}

.pip-light {
    animation: pipLight 1.2s steps(2) infinite;
}

/* The landing module. It stands on Mars here; flyLander() in intro.js lifts it into the sky
   and lets it come down. */
.lander {
    position: absolute;
    right: max(60px, calc(50% - 520px));
    bottom: 56px;
    z-index: 5;             /* in front of its own dust, so it never disappears in it */

    width: 132px;
    padding: 0;

    border: none;

    background: none;

    overflow: visible;
    cursor: pointer;

    will-change: transform;
}

.lander svg {
    display: block;

    width: 100%;
    height: auto;
}

/* The flame of the engine, under the module. Its length is set by flyLander(). */
.lander-flame {
    position: absolute;
    left: 35%;
    top: 88%;

    width: 30%;
    height: 85%;

    background: linear-gradient(to bottom, #ffffff 0, #ffffff 15%, #fff3b0 15%, #fff3b0 35%, #ffd166 35%, #ffd166 65%, #f97316 65%, #f97316 100%);

    /* a flame made of squares: wide at the engine, narrow at the tip */
    clip-path: polygon(0 0, 100% 0, 100% 40%, 84% 40%, 84% 70%, 67% 70%, 67% 100%, 33% 100%, 33% 70%, 16% 70%, 16% 40%, 0 40%);

    transform: scaleY(0);
    transform-origin: 50% 0;

    pointer-events: none;
}

/* The dust and smoke of the landing. The puffs are added by addPuff(). */
.landing-dust {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 4;

    width: 100%;
    height: 100%;

    overflow: hidden;
    pointer-events: none;
}

/* What Pip says. The bubble sits above Pip and does not turn with it. */
.pip-bubble {
    position: absolute;
    left: max(16px, calc(50% - 630px));
    bottom: calc(46% + 26px);
    z-index: 6;             /* in front of the dust, so it can always be read */

    max-width: 220px;
    padding: 10px 14px;

    border: 3px solid var(--space);
    border-radius: 12px;

    background: var(--cream);
    color: var(--ink);

    font-size: 15px;
    font-weight: bold;
    text-align: left;
}

/* The little tail of the speech bubble, pointing down at Pip */
.pip-bubble::before {
    content: '';

    position: absolute;
    left: 84px;
    bottom: -11px;

    width: 14px;
    height: 14px;

    border-right: 3px solid var(--space);
    border-bottom: 3px solid var(--space);

    background: var(--cream);

    transform: rotate(45deg);
}

.landing-foot {
    position: absolute;
    right: 16px;
    bottom: 10px;
    z-index: 3;

    display: flex;
    align-items: center;
    gap: 6px;

    color: #fed7aa;

    font-size: 13px;
}

.landing-foot .text-button {
    margin: 0;

    color: #fed7aa;

    font-size: 13px;
}

.startscreen .landing-foot a {
    color: #fed7aa;
    text-decoration: underline;
}

/* Small stars that twinkle. They are added by addStars(). */
.star {
    position: absolute;
    z-index: 0;

    width: 3px;
    height: 3px;

    background: white;

    animation: twinkle 3s ease-in-out infinite;
}

/* The launch: the airlock */
/* The steps are explained at launch() in js/intro.js. The classes on #airlock follow them:
   active (shown) -> shut -> locked -> filling -> ready (bolts out, green) -> opening */

/* Covers the whole window, above both screens. Hidden until Launch is pressed. */
.airlock {
    display: none;

    position: fixed;
    inset: 0;
    z-index: 50;

    overflow: hidden;
    cursor: pointer;
}

.airlock.active {
    display: block;
}

/* While the doors are shut, a dark wall behind them hides the gaps when they shake */
.airlock.shut {
    background: var(--shadow);
}

.airlock.opening {
    background: transparent;
}

.airlock-body {
    position: absolute;
    inset: 0;
}

/* The two doors. Each one is half the window. */
.airlock-door {
    position: absolute;
    top: 0;
    z-index: 1;

    width: 50%;
    height: 100%;
    box-sizing: border-box;     /* the striped edge is inside the half, so the doors meet exactly */

    /* rivets in two rows, metal panels, and the steel colour */
    background:
        radial-gradient(circle at 50% 50%, #cbd5e1 0 3px, #1e293b 4px, transparent 5px) 22px 0 / 100% 46px repeat-y,
        repeating-linear-gradient(0deg, transparent 0 118px, rgba(5, 6, 15, 0.55) 118px 122px),
        linear-gradient(90deg, #3b4a5e, #56677d 45%, #3b4a5e);
}

.airlock-door.left {
    left: 0;
    transform: translateX(-100%);
    border-right: 18px solid transparent;
    border-image: repeating-linear-gradient(45deg, var(--sun) 0 16px, #111 16px 32px) 18;
    box-shadow: inset -6px 0 0 var(--shadow), inset 8px 0 0 rgba(5, 6, 15, 0.4);
}

.airlock-door.right {
    right: 0;
    transform: translateX(100%);
    border-left: 18px solid transparent;
    border-image: repeating-linear-gradient(45deg, var(--sun) 0 16px, #111 16px 32px) 18;
    box-shadow: inset 6px 0 0 var(--shadow), inset -8px 0 0 rgba(5, 6, 15, 0.4);
}

/* A round window with thick glass */
.door-window {
    position: absolute;
    top: 9%;
    left: 50%;

    width: min(130px, 18vw);
    aspect-ratio: 1;

    transform: translateX(-50%);

    border: 10px solid #94a3b8;
    border-radius: 50%;
    box-shadow: 0 0 0 4px #1e293b, inset 0 0 0 4px #1e293b, 4px 4px 0 6px rgba(5, 6, 15, 0.5);

    /* dark glass with a shine, and a little red Mars glow at the bottom */
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0 18%, transparent 18% 30%, rgba(255, 255, 255, 0.15) 30% 36%, transparent 36%),
        radial-gradient(circle at 50% 110%, rgba(194, 65, 12, 0.8), #0b1120 65%);
}

/* Big stencil letters on the door, under the control panel */
.door-label {
    position: absolute;
    top: 68%;
    left: 0;
    right: 0;

    color: rgba(240, 207, 79, 0.75);
    font-family: var(--mono);
    font-size: clamp(1.2rem, 4vw, 2.4rem);
    font-weight: bold;
    letter-spacing: 0.25em;
    text-align: center;
    text-shadow: 3px 3px 0 rgba(5, 6, 15, 0.5);
}

/* On a phone the panel covers the letters, so they are left out */
@media (max-width: 600px) {
    .door-label {
        display: none;
    }
}

/* The scratched kick plate at the bottom, where boots hit the door */
.door-plate {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;

    height: 12%;

    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 6px, transparent 6px 14px),
        #2b3646;
    border-top: 4px solid #1e293b;
}

/* The locking bolts */
/* Each bolt sits in the left door. "locked" slides it across the gap into the right door.
   The 0.7s is the same as lockTime in AIRLOCK. */
.lock-bolt {
    position: absolute;
    left: 50%;
    z-index: 2;

    width: min(220px, 30vw);
    height: 34px;

    transform: translate(-100%, -50%);

    background:
        repeating-linear-gradient(90deg, transparent 0 22px, rgba(5, 6, 15, 0.25) 22px 25px),
        linear-gradient(180deg, #e2e8f0, #94a3b8 45%, #475569);
    border: 3px solid #1e293b;
    border-radius: 6px;
    box-shadow: 4px 4px 0 rgba(5, 6, 15, 0.5);

    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.7, 0, 0.3, 1), opacity 0.2s;
}

.lock-bolt.top {
    top: 6%;
}

.lock-bolt.bottom {
    top: 82%;
}

.airlock.shut .lock-bolt {
    opacity: 1;
}

.airlock.locked .lock-bolt {
    transform: translate(-25%, -50%);
}

.airlock.opening .lock-bolt {
    opacity: 0;
}

/* A lamp on each bolt: red while locked, green when it is safe */
.bolt-lamp {
    position: absolute;
    top: 50%;
    left: 12px;

    width: 14px;
    height: 14px;

    transform: translateY(-50%);

    background: #475569;
    border: 2px solid #1e293b;
    border-radius: 50%;
}

.airlock.locked .bolt-lamp {
    background: var(--health);
    box-shadow: 0 0 10px var(--health);
}

.airlock.ready .bolt-lamp {
    background: #4ade80;
    box-shadow: 0 0 10px #4ade80;
}

/* The vents in the walls */
.airlock-vent {
    position: absolute;
    z-index: 2;

    width: 26px;
    height: 70px;

    transform: translateY(-50%);

    background: repeating-linear-gradient(180deg, #1e293b 0 5px, #64748b 5px 9px);
    border: 3px solid #1e293b;

    opacity: 0;
    transition: opacity 0.2s;
}

.airlock-vent.left {
    left: 0;
    border-radius: 0 6px 6px 0;
}

.airlock-vent.right {
    right: 0;
    border-radius: 6px 0 0 6px;
}

.airlock-vent.top {
    top: 20%;
}

.airlock-vent.bottom {
    top: 80%;
}

.airlock.shut .airlock-vent {
    opacity: 1;
}

.airlock.opening .airlock-vent {
    opacity: 0;
}

/* The fog */
/* A soft mist over everything that gets thicker while the air comes in.
   The 0.9s is the same as countTime in AIRLOCK. */
.airlock-fog {
    position: absolute;
    inset: 0;
    z-index: 3;

    background: linear-gradient(to top, rgba(226, 232, 240, 0.6), rgba(226, 232, 240, 0.25) 55%, rgba(226, 232, 240, 0.12));

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.9s ease-out;
}

.airlock.filling .airlock-fog {
    opacity: 1;
}

.airlock.opening .airlock-fog {
    opacity: 0;
    transition: opacity 0.9s ease-out;
}

/* The puffs out of the vents are added by addFog() */
.airlock-smoke {
    position: absolute;
    inset: 0;
    z-index: 4;

    overflow: hidden;
    pointer-events: none;
    transition: opacity 1s ease-out;
}

.airlock.opening .airlock-smoke {
    opacity: 0;
}

.fog-puff {
    position: absolute;

    border-radius: 50%;
    will-change: transform, opacity;
}

/* The control panel */
.airlock-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 5;

    width: min(300px, 80vw);
    padding: 14px 18px 12px;

    transform: translate(-50%, -50%);

    background: rgba(15, 23, 42, 0.95);
    border: 3px solid var(--line);
    border-radius: 14px;
    box-shadow: 6px 6px 0 var(--shadow);

    color: var(--cream);
    font-family: var(--mono);
    text-align: center;

    opacity: 0;
    transition: opacity 0.2s;
}

.airlock.shut .airlock-panel {
    opacity: 1;
}

.airlock.opening .airlock-panel {
    opacity: 0;
}

.airlock-status {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;

    min-height: 1.4em;

    color: var(--pip);
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.airlock.locked .airlock-status {
    color: var(--health);
}

.airlock.ready .airlock-status {
    color: #4ade80;
}

/* Grey while closing, blinking red while locked, green when it is safe */
.airlock-light {
    width: 14px;
    height: 14px;

    border-radius: 50%;
    background: #475569;
}

.airlock.locked .airlock-light {
    background: var(--health);
    box-shadow: 0 0 12px var(--health);
    animation: blink 0.5s steps(2, jump-none) infinite;
}

.airlock.ready .airlock-light {
    background: #4ade80;
    box-shadow: 0 0 16px #4ade80;
}

/* The lock wheel. It turns when the bolts go in, and back when they come out. */
.lock-dial {
    position: relative;

    width: min(190px, 30vh);
    aspect-ratio: 1;
    margin: 10px auto;
}

.lock-wheel {
    position: absolute;
    inset: 0;

    border: 14px solid #94a3b8;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #1e293b, inset 0 0 0 3px #1e293b, 4px 4px 0 5px rgba(5, 6, 15, 0.5);

    /* four spokes */
    background:
        linear-gradient(0deg, transparent 44%, #94a3b8 44% 56%, transparent 56%),
        linear-gradient(90deg, transparent 44%, #94a3b8 44% 56%, transparent 56%);

    transition: transform 0.7s cubic-bezier(0.7, 0, 0.3, 1);
}

/* Two yellow grips on the rim, so you can see the wheel turn */
.lock-wheel::before,
.lock-wheel::after {
    content: '';
    position: absolute;
    left: 50%;

    width: 26px;
    height: 26px;

    transform: translateX(-50%);

    background: var(--sun);
    border: 3px solid #1e293b;
    border-radius: 50%;
}

.lock-wheel::before {
    top: -27px;
}

.lock-wheel::after {
    bottom: -27px;
}

.airlock.locked .lock-wheel {
    transform: rotate(135deg);
}

/* The middle of the wheel does not turn. It shows the number. */
.lock-hub {
    position: absolute;
    top: 50%;
    left: 50%;

    display: flex;
    justify-content: center;
    align-items: center;

    width: 64%;
    aspect-ratio: 1;

    transform: translate(-50%, -50%);

    background: radial-gradient(circle at 35% 30%, #1e293b, var(--panel) 70%);
    border: 4px solid #1e293b;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px var(--line);
}

/* The number gently floats up and down */
#airlockNumber {
    color: var(--sun);
    font-size: clamp(1.8rem, 6vh, 2.6rem);
    font-weight: bold;
    text-shadow: 3px 3px 0 var(--rust);

    animation: floatNumber 1.4s ease-in-out infinite;
}

.airlock.ready #airlockNumber {
    color: #4ade80;
    text-shadow: 3px 3px 0 #166534;
}

/* The air gauge fills while the air comes in */
.airlock-gauge {
    height: 14px;

    background: var(--raised);
    border: 2px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
}

.airlock-gauge-fill {
    width: 0%;
    height: 100%;

    background: repeating-linear-gradient(90deg, var(--pip) 0 10px, #0ea5e9 10px 14px);
}

.airlock-skip {
    margin-top: 8px;

    color: var(--dim);
    font-size: 0.75rem;
}

/* "MISSION BEGINS" floats up while the doors open */
.airlock-title {
    display: none;

    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 6;

    flex-direction: column;
    align-items: center;
    gap: 8px;

    width: 100%;
    padding: 0 16px;
    box-sizing: border-box;

    transform: translate(-50%, -50%);

    color: var(--sun);
    font-family: var(--mono);
    font-size: clamp(2rem, 8vw, 4.5rem);
    font-weight: bold;
    letter-spacing: 0.08em;
    text-align: center;
    text-shadow: 5px 5px 0 var(--rust), 0 0 30px rgba(5, 6, 15, 0.8);

    pointer-events: none;
}

.airlock-title small {
    color: var(--pip);
    font-size: clamp(0.9rem, 2.4vw, 1.2rem);
    letter-spacing: 0.1em;
    text-shadow: 2px 2px 0 var(--shadow);
}

.airlock.opening .airlock-title {
    display: flex;
    animation: beginTitle 1.65s ease-out forwards;
}

/* One puff of dust or smoke (the landing module). Added by addPuff() in js/intro.js. */
.smoke-puff {
    position: absolute;

    border-radius: 50%;

    /* a darker edge at the bottom makes the puff look round */
    box-shadow: inset -8px -10px 0 rgba(15, 23, 42, 0.18);

    will-change: transform, opacity;
}

/* The page must not get scroll bars while the airlock is shown */
body.launch-lock {
    overflow: hidden;
}

/* Training: the spotlight and Pip's speech box */

/* A frame around the thing Pip talks about. Its huge shadow darkens the rest. */
.coach-ring {
    display: none;

    position: fixed;
    z-index: 20;

    border: 4px solid var(--sun);
    border-radius: 14px;

    box-sizing: border-box;

    box-shadow: 0 0 0 200vmax rgba(5, 8, 25, 0.74), 0 0 24px 4px rgba(240, 207, 79, 0.7);

    pointer-events: none;
}

.coach-ring.active {
    display: block;

    animation: ringPulse 1.1s ease-in-out infinite;
}

.coach {
    display: none;

    position: fixed;
    z-index: 22;

    gap: 12px;
    align-items: flex-start;

    padding: 14px;

    box-sizing: border-box;

    border: 3px solid var(--pip);
    border-radius: 14px;

    background: var(--panel);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);

    text-align: left;
}

.coach.active {
    display: flex;
}

/* Pip shakes its head when the player clicks somewhere else */
.coach.nudge {
    animation: shake 0.3s ease-in-out;
}

.coach-pip {
    flex-shrink: 0;

    width: 76px;

    animation: pipBob 2.4s ease-in-out infinite;
}

.coach-body {
    flex: 1;
    min-width: 0;
}

.coach-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coach-name {
    color: var(--pip);

    font-family: var(--mono);
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.15em;
}

/* How far the training is */
.coach-progress {
    flex: 1;

    height: 8px;

    border-radius: 4px;

    background: #1e293b;

    overflow: hidden;
}

.coach-progress div {
    width: 0;
    height: 100%;

    background: var(--pip);

    transition: width 0.3s;
}

.coach-text {
    margin: 8px 0 10px 0;

    font-size: 18px;
    font-weight: bold;
    line-height: 1.4;
}

.coach-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.coach-actions .text-button {
    margin: 0;
    padding-left: 0;

    font-size: 13px;
    white-space: nowrap;
}

.coach-actions .main-button {
    margin-top: 0;
    padding: 10px 20px;

    white-space: nowrap;
}

.coach-wait {
    color: var(--sun);

    font-weight: bold;

    animation: waitBlink 1s ease-in-out infinite;
}

/* Training complete */

#gradPopup {
    z-index: 30;
}

.popup.grad {
    border-color: var(--pip);
}

.grad-badge {
    position: relative;

    width: 150px;
    height: 150px;

    margin: 0 auto 14px auto;

    display: flex;
    justify-content: center;
    align-items: center;

    border: 6px solid var(--sun);
    border-radius: 50%;

    background: radial-gradient(circle, var(--rust) 0%, var(--rust-dark) 100%);

    box-shadow: 0 0 0 6px var(--panel), 0 0 0 9px var(--sun-dark), 0 0 40px rgba(240, 207, 79, 0.5);

    animation: badgeIn 0.7s ease-out;
}

.grad-badge .pip {
    width: 92px;
}

.popup.grad h2 {
    margin: 12px 0 4px 0;
}

.grad-name {
    color: var(--sun);

    font-family: var(--mono);
    font-size: 1.3rem;
    font-weight: bold;
    text-transform: uppercase;
}

.popup.grad .launch-button {
    padding: 16px 28px;

    font-size: 1.2rem;
    letter-spacing: 0.08em;
}

/* Small screens */

@media (max-width: 760px) {
    .landing-ground {
        height: 110px;
    }

    .landing-main {
        padding-bottom: 170px;
    }

    /* On a phone there is no room on the left: Pip floats just above the ground */
    .landing-pip {
        left: 14px;
        top: auto;
        bottom: 52px;

        width: 72px;
    }

    .pip-bubble {
        left: 106px;
        bottom: 66px;

        max-width: 42vw;

        font-size: 13px;
    }

    .lander {
        right: 8px;
        bottom: 40px;

        width: 66px;
    }

    /* Here the bubble is next to Pip, so its tail points left */
    .pip-bubble::before {
        left: -11px;
        bottom: 14px;

        border-right: none;
        border-left: 3px solid var(--space);
    }

    .landing-foot {
        left: 0;
        right: 0;
        bottom: 6px;

        justify-content: center;
    }

    .kicker {
        font-size: 11px;
        letter-spacing: 0.12em;
    }

    .callsign-label {
        display: none;
    }

    .coach-pip {
        width: 54px;
    }

    .coach-text {
        font-size: 16px;
    }
}

/* Animations */

@keyframes launchPulse {
    0% {
        box-shadow: 0 8px 0 var(--sun-dark), 0 0 0 0 rgba(240, 207, 79, 0.6);
    }

    70% {
        box-shadow: 0 8px 0 var(--sun-dark), 0 0 0 22px rgba(240, 207, 79, 0);
    }

    100% {
        box-shadow: 0 8px 0 var(--sun-dark), 0 0 0 0 rgba(240, 207, 79, 0);
    }
}

@keyframes rollName {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pipBob {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes jetFlicker {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.65;
    }
}

@keyframes pipBlink {
    0% {
        transform: scaleY(1);
    }

    94% {
        transform: scaleY(1);
    }

    97% {
        transform: scaleY(0.1);
    }

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

@keyframes pipLight {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.25;
    }
}

@keyframes twinkle {
    0% {
        opacity: 0.2;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.2;
    }
}

@keyframes blink {
    0% { opacity: 1; }
    100% { opacity: 0.25; }
}

@keyframes floatNumber {
    0%, 100% { transform: translateY(2px); }
    50% { transform: translateY(-4px); }
}

/* The title pops in, stays a moment, then floats up and fades */
@keyframes beginTitle {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    28% { transform: translate(-50%, -50%) scale(1); }
    70% { opacity: 1; transform: translate(-50%, -60%); }
    100% { opacity: 0; transform: translate(-50%, -110%); }
}

@keyframes countPop {
    from {
        opacity: 0;
        transform: scale(2.2);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ringPulse {
    0% {
        border-color: var(--sun);
    }

    50% {
        border-color: #ffffff;
    }

    100% {
        border-color: var(--sun);
    }
}

@keyframes waitBlink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }

    100% {
        opacity: 1;
    }
}

@keyframes badgeIn {
    0% {
        opacity: 0;
        transform: scale(0.2) rotate(-180deg);
    }

    70% {
        opacity: 1;
        transform: scale(1.12) rotate(8deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Sound button on the start screen (js/sound.js) */
.start-sound {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
}

/* The sound button: a pixel satellite dish (js/sound.js) */
.sound-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;

    padding: 6px 8px;
}

.sound-button svg {
    display: block;

    width: 26px;
    height: 26px;
}

/* The radio waves pulse outwards, and the light on the dish blinks */
.dish-wave {
    animation: dishWave 1.2s ease-in-out infinite;
}

.dish-light {
    animation: blink 1.2s steps(2, jump-none) infinite;
}

.sound-button.off svg {
    opacity: 0.8;
}

@keyframes dishWave {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
