/* style.css - the game screen, the popups and all shared styling.
   The start screen and the training with Pip are in intro.css. */

/* Colours and fonts used everywhere */

:root {
    --space: #0b0b1e;       /* the night sky */
    --shadow: #05060f;      /* the hard shadow under panels, cards and buttons */
    --panel: #0f172a;       /* inside of a panel */
    --raised: #1e293b;      /* things that sit on a panel */
    --line: #334155;        /* borders */
    --ink: #1e293b;         /* dark text on a yellow button */
    --dim: #94a3b8;         /* quiet text */
    --sun: #f0cf4f;         /* yellow: everything the player can do */
    --sun-dark: #b59418;
    --rust: #c2410c;        /* Mars */
    --rust-dark: #7c2d12;
    --pip: #38bdf8;         /* cyan: labels, and everything Pip says */
    --cream: #fff7e0;
    --health: #ff5d73;
    --radiation: #ff9800;
    --mono: 'Courier New', Courier, monospace;
}

/* Screens: only the one with "active" is shown */

.startscreen,
.gamescreen {
    display: none;
}

.startscreen.active {
    display: flex;
}

.gamescreen.active {
    display: flex;
}

body {
    margin: 0;

    /* Stars, with a warm glow from Mars at the bottom */
    background-color: var(--space);
    background-image:
        linear-gradient(to top, rgba(194, 65, 12, 0.28), rgba(194, 65, 12, 0) 40%),
        url("../assets/stars.png");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;

    color: white;
    font-family: Arial, sans-serif;
}

button {
    font-family: inherit;
}

/* Start screen (the rest is in intro.css) */

.startscreen {
    min-height: 100vh;

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

    color: #ffffff;
    text-align: center;

    background-image: url("../assets/background.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Buttons */

.main-button {
    margin-top: 20px;
    padding: 14px 30px;

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

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

    font-family: var(--mono);
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 0.04em;

    cursor: pointer;

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

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

    transform: translateY(-2px);
}

.main-button:active {
    transform: translateY(4px);

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

.main-button:disabled {
    opacity: 0.6;

    cursor: wait;
    transform: none;
}

.small-button {
    padding: 9px 14px;

    border: 2px solid var(--line);
    border-radius: 8px;

    background: var(--raised);
    color: white;

    font-size: 15px;
    font-weight: bold;

    cursor: pointer;

    box-shadow: 0 3px 0 var(--shadow);
}

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

.small-button:active {
    transform: translateY(2px);

    box-shadow: 0 1px 0 var(--shadow);
}

/* Game screen layout */

.gamescreen {
    flex-direction: column;

    width: 100%;
    max-width: 1380px;

    margin: 0 auto;
    padding: 16px 20px 20px 20px;

    box-sizing: border-box;

    position: relative;
}

.game-layout {
    display: flex;
    gap: 20px;
}

/* Middle column: the base and its meters */
.left-panel {
    flex: 0 1 540px;
    min-width: 0;
}

/* Right column: the cards */
.right-panel {
    flex: 0 1 440px;
    min-width: 0;
}

/* Far-left column: the plan and the facts */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;

    flex: 0 1 320px;
    min-width: 0;
}

/* The look of every box on the game screen: a dark console panel with a hard shadow */
.plan-box,
.facts-panel,
.top-row,
.xp-section,
.stat,
.event-box,
.news-box {
    background: rgba(15, 23, 42, 0.94);

    border: 2px solid var(--line);
    border-radius: 10px;

    box-shadow: 0 4px 0 var(--shadow);
}

/* The small label on top of a panel */
.panel-title {
    margin-bottom: 10px;

    color: var(--pip);

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

.small-text {
    margin-top: 6px;

    font-size: 13px;
    color: #cbd5e1;
}

/* Ticker (scrolling line at the top) */

.ticker {
    width: 100%;
    height: 30px;

    background: var(--shadow);

    border: 2px solid var(--line);
    border-radius: 8px;

    box-sizing: border-box;
    overflow: hidden;

    display: flex;
    align-items: center;

    margin-bottom: 12px;

    color: #7dd3fc;

    font-family: var(--mono);
    font-size: 13px;
    font-weight: bold;
}

.ticker-text {
    white-space: nowrap;

    padding-left: 100%;

    animation: scrollText 30s linear infinite;
}

@keyframes scrollText {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-100%);
    }
}

/* Sol, turn, day or night */

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;

    margin-bottom: 14px;
    padding: 8px 10px;

    font-family: var(--mono);
    font-size: 17px;
    font-weight: bold;
}

#solText {
    color: var(--sun);

    text-transform: uppercase;
    white-space: nowrap;
}

.turn-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* "Turn 1 / 5" is shown by the squares. The text stays for screen readers. */
#turnText {
    position: absolute;

    width: 1px;
    height: 1px;

    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* One square for every turn of the sol. The last one is the night. */
.turn-track {
    display: flex;
    gap: 4px;
}

.turn-pip {
    width: 28px;
    height: 28px;

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

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

    box-sizing: border-box;

    background: var(--shadow);
    color: #475569;

    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1;
}

/* Turns that are over */
.turn-pip.done {
    border-color: var(--sun-dark);

    background: #4a3f12;
    color: var(--sun-dark);
}

/* The turn that is being played */
.turn-pip.now {
    border-color: #ffffff;

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

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

.turn-pip.night.now {
    background: #818cf8;
}

/* "Day" or "Night" */
#timeText {
    padding: 4px 10px;

    border-radius: 6px;

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

    font-family: Arial, sans-serif;
    font-size: 15px;
    white-space: nowrap;
}

.gamescreen.night #timeText {
    background: #4338ca;
    color: white;
}

/* Picture of the base: it looks like a camera screen */

.scene {
    width: 100%;
    height: 290px;

    background: #16213e;

    border: 3px solid var(--shadow);
    border-radius: 10px;

    outline: 2px solid var(--line);

    box-sizing: border-box;

    position: relative;

    overflow: hidden;

    margin-bottom: 16px;
}

/* The small "BASE CAM" label in the corner */
.scene::before {
    content: '● BASE CAM';

    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;

    padding: 3px 8px;

    border-radius: 4px;

    background: rgba(5, 6, 15, 0.75);
    color: #fca5a5;

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

.gamescreen.night .scene::before {
    content: '● NIGHT CAM';
}

.background {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

/* A see-through layer over the picture for storms and dust */
.scene-effect {
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;
}

.dust-layer {
    position: absolute;
    inset: 0;

    overflow: hidden;

    pointer-events: none;

    opacity: 0;
}

.dust {
    position: absolute;
    left: -10%;
    height: 1px;
    background: rgba(255, 220, 150, 0.5);
    filter: blur(0.5px);
    animation: sandMove linear infinite;
}

.dust-layer.fierce .dust {
    animation-duration: 0.9s !important;
}

@keyframes sandMove {
    0%   { 
        left: -10%; 
        transform: translateY(0) rotate(-15deg); 
        opacity: 0; 
    }

    15%  { 
        opacity: 0.6;
    }

    85%  { 
        opacity: 0.6;
    }

    100% { 
        left: 110%; 
        transform: translateY(40px) rotate(-15deg); 
        opacity: 0; 
    }
}

.scene-effect.dust + .dust-layer{
    background: rgba(180, 110, 50, 0.45);
    opacity: 1;
}

/* A slow pulse (one every 2 seconds) so it is safe to look at */
.scene-effect.storm {
    background: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.10) 0px,
        rgba(255, 255, 255, 0.10) 2px,
        rgba(255, 152, 0, 0.18) 2px,
        rgba(255, 152, 0, 0.18) 6px
    );

    animation: stormPulse 2s ease-in-out infinite;
}

@keyframes stormPulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

.badges {
    position: absolute;
    left: 8px;
    bottom: 8px;

    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    padding: 4px 8px;

    background: rgba(5, 6, 15, 0.88);

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

    font-size: 13px;
    font-weight: bold;
}

/* Event box and last-turn box */

.event-box,
.news-box {
    padding: 10px 14px 12px 14px;

    margin-bottom: 14px;
}

/* The small label on top of the event */
.event-box::before {
    content: 'This turn on Mars';

    display: block;

    margin-bottom: 4px;

    color: var(--pip);

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

/* The flare warning and the storm: orange, with warning stripes on top */
.event-box.danger {
    border-color: var(--radiation);

    background:
        repeating-linear-gradient(-45deg, var(--radiation) 0 10px, var(--shadow) 10px 20px) top / 100% 6px no-repeat,
        rgba(40, 20, 8, 0.96);

    padding-top: 16px;
}

.event-box.danger::before {
    content: 'Alert';

    color: var(--radiation);
}

.event-title {
    font-size: 20px;
    font-weight: bold;
}

#eventIcon {
    margin-right: 4px;

    font-size: 24px;
}

.data-label {
    margin-left: 8px;

    color: var(--dim);

    font-family: var(--mono);
    font-size: 12px;
}

.event-box p {
    margin: 6px 0 0 0;
}

.event-box ul,
.news-box ul {
    margin: 6px 0 0 0;
    padding-left: 20px;
}

.event-box ul:empty,
.news-box ul:empty {
    display: none;
}

/* The log of the last turn is quieter than the rest */
.news-box {
    font-size: 14px;
    color: #cbd5e1;
}

.news-title {
    color: var(--dim);

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

.news-box ul + .news-title {
    margin-top: 8px;
}

/* Meters */

/* The three meters sit side by side so they are always in view */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;

    margin-bottom: 14px;
}

.stat {
    padding: 8px 10px 10px 10px;

    min-width: 0;
}

.stat-header {
    display: flex;
    flex-wrap: wrap;

    justify-content: space-between;
    align-items: center;
    gap: 2px 6px;

    margin-bottom: 6px;

    font-size: 14px;
    font-weight: bold;
}

/* The numbers */
.stat-header span + span,
.xp-header span + span {
    font-family: var(--mono);
}

/* In a meter the number always gets its own line, so the three bars line up */
.stat-header span + span {
    flex-basis: 100%;
}

.stat-icon {
    width: 24px;
    height: 24px;

    vertical-align: middle;
    image-rendering: pixelated;
}

/* A meter that is in trouble: see renderMeters() in index.js */
.stat.danger {
    border-color: var(--health);

    animation: dangerPulse 1.2s ease-in-out infinite;
}

.stat.danger .stat-header span + span {
    color: #fca5a5;
}

/* The science bar */
.xp-section {
    padding: 8px 10px 10px 10px;

    margin-bottom: 14px;
}

.xp-header {
    display: flex;
    justify-content: space-between;

    margin-bottom: 6px;

    font-weight: bold;
}

.xp-section .small-text {
    color: var(--sun);

    font-weight: bold;
    letter-spacing: 0.05em;
}

/* The frame of a bar. The dark lines cut it into 10 blocks. */
.xp-bar {
    position: relative;

    width: 100%;
    height: 18px;

    background: var(--shadow);

    border: 2px solid var(--line);
    border-radius: 5px;

    box-sizing: border-box;
    overflow: hidden;
}

.xp-bar::after {
    content: '';

    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background: repeating-linear-gradient(
        90deg,
        rgba(5, 6, 15, 0) 0,
        rgba(5, 6, 15, 0) calc(10% - 2px),
        rgba(5, 6, 15, 0.7) calc(10% - 2px),
        rgba(5, 6, 15, 0.7) 10%
    );
}

/* The coloured part of a bar, with a line of shine on top */
.xp-fill,
.life-fill,
.energy-fill,
.radiation-fill {
    width: 0%;
    height: 100%;

    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0, rgba(255, 255, 255, 0.4) 30%, rgba(255, 255, 255, 0) 30%);

    transition: width 0.3s;
}

.xp-fill {
    background-color: var(--pip);
}

.life-fill {
    background-color: var(--health);
}

.energy-fill {
    background-color: var(--sun);
}

.radiation-fill {
    background-color: var(--radiation);
}

/* Cards */

/* The six cards are tiles, two in a row */
.cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

    margin-bottom: 18px;
}

.card {
    position: relative;

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

    padding: 6px;

    background: linear-gradient(to bottom, #233047, #172033);

    border: 3px solid var(--line);
    border-radius: 10px;

    box-sizing: border-box;

    cursor: pointer;

    box-shadow: 0 5px 0 var(--shadow);

    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.cards .card {
    flex-direction: column;
    gap: 4px;

    padding: 10px 8px 10px 8px;

    text-align: center;
}

.card img {
    width: 76px;
    height: 76px;

    flex-shrink: 0;

    object-fit: contain;
    image-rendering: pixelated;
}

.card-info {
    padding-right: 10px;

    min-width: 0;
}

.cards .card-info {
    padding-right: 0;
}

.card-name {
    font-size: 17px;
    font-weight: bold;
}

.card-cost {
    margin-top: 3px;

    font-size: 14px;
    font-weight: bold;
    color: var(--sun);

    white-space: pre-wrap;
}

.card-note {
    margin-top: 3px;

    font-size: 13px;
    color: #cbd5e1;
}

.card:hover {
    border-color: var(--sun);

    transform: translateY(-3px);

    box-shadow: 0 8px 0 var(--shadow);
}

.card:active {
    transform: translateY(3px);

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

/* A card that cannot be played right now */
.card.disabled {
    opacity: 0.5;

    cursor: not-allowed;
}

.card.disabled img {
    filter: grayscale(1);
}

.card.disabled:hover,
.card.disabled:active {
    border-color: var(--line);

    transform: none;

    box-shadow: 0 5px 0 var(--shadow);
}

/* The End turn button stays in view while the page scrolls */
.end-turn {
    width: 100%;

    padding: 16px 12px;

    position: sticky;
    bottom: 12px;

    font-size: 17px;

    box-shadow: 0 6px 0 var(--sun-dark), 0 0 0 4px rgba(11, 11, 30, 0.85);
}

/* Popups */

.overlay {
    display: none;

    position: fixed;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    padding: 16px;

    box-sizing: border-box;

    background: rgba(5, 6, 15, 0.82);

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

    z-index: 10;
}

.overlay.active {
    display: flex;
}

.popup {
    width: 100%;
    max-width: 520px;
    max-height: 100%;

    padding: 22px 24px 24px 24px;

    box-sizing: border-box;

    overflow-y: auto;

    background: var(--panel);

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

    box-shadow: 0 8px 0 var(--shadow), 0 0 40px rgba(240, 207, 79, 0.15);

    text-align: center;
}

.popup a {
    color: var(--pip);
    text-decoration: none;
    font-weight: bold;
}

.popup a:hover {
    color: var(--sun);
    text-decoration: underline;
}

.popup h2 {
    margin-top: 0;

    color: var(--sun);

    font-family: var(--mono);
    font-size: 1.7rem;
}

.popup h3 {
    color: var(--pip);

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

.popup ul {
    padding-left: 22px;

    text-align: left;
    line-height: 1.6;
}

/* The sol report: one row for each line, no dots */
#reportList {
    padding-left: 0;

    list-style: none;
}

#reportList li {
    padding: 6px 10px;

    background: var(--raised);

    border-radius: 6px;

    margin-bottom: 5px;

    font-weight: bold;
}

.forecast {
    padding: 10px;

    background: var(--shadow);

    border: 2px solid var(--line);
    border-radius: 8px;

    font-weight: bold;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;

    margin: 15px 0;
}

.choice-list .main-button {
    margin-top: 0;
}

.choice {
    padding: 14px;

    border: 3px solid var(--line);
    border-radius: 8px;

    background: var(--raised);
    color: white;

    font-size: 16px;
    font-weight: bold;
    text-align: left;

    cursor: pointer;

    box-shadow: 0 4px 0 var(--shadow);
}

.choice:hover {
    border-color: var(--sun);

    transform: translateY(-2px);
}

.choice:active {
    transform: translateY(3px);

    box-shadow: 0 1px 0 var(--shadow);
}

/* Upgrade rarity. The rarity is also written in the text. */
.choice.rare {
    border-color: var(--pip);

    background: #12304a;
}

.choice.epic {
    border-color: #a78bfa;

    background: #2a1f52;

    box-shadow: 0 4px 0 var(--shadow), 0 0 16px rgba(167, 139, 250, 0.5);
}

.popup .fact-list {
    list-style: none;
    padding-left: 0;
}

.fact-list li {
    padding: 10px;

    background: var(--raised);

    border-radius: 8px;

    margin-bottom: 8px;
}

.fact {
    margin-top: 4px;

    color: var(--sun);
}

.source {
    font-size: 12px;
    color: var(--dim);
}

.end-stats {
    padding: 10px;

    background: var(--shadow);

    border: 2px solid var(--line);
    border-radius: 8px;

    font-weight: bold;

    white-space: pre-wrap;
}

.story-box {
    margin-top: 12px;
    padding: 12px;

    border: 2px solid var(--radiation);
    border-radius: 8px;

    background: rgba(40, 20, 8, 0.9);

    text-align: left;
    line-height: 1.5;
}

.end-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.end-buttons .small-button {
    margin-top: 20px;
}

/* Small screens: cards go under the meters */

@media (max-width: 860px) {
    .gamescreen {
        padding: 10px;
    }

    .game-layout {
        flex-direction: column;
    }

    .left-panel,
    .right-panel {
        flex: none;
        width: 100%;
    }

    .side-panel {
        flex: none;
        width: 100%;
        order: 3;
    }

    .scene {
        height: 190px;
    }

    /* The top bar must fit on a phone */
    .top-row {
        flex-wrap: wrap;
        gap: 6px;

        padding: 6px;

        font-size: 14px;
    }

    #solText {
        font-family: Arial, sans-serif;
    }

    .turn-track {
        gap: 2px;
    }

    .turn-pip {
        width: 20px;
        height: 20px;

        font-size: 11px;
    }

    #timeText {
        padding: 4px 7px;

        font-size: 13px;
    }

    .top-row .small-button {
        padding: 6px 7px;

        font-size: 13px;
    }

    .stat {
        padding: 6px;
    }

    .stat-header {
        font-size: 13px;
    }
}

/* Picked cards: highlight, counter and minus button */

.card.selected {
    border-color: var(--sun);

    background: linear-gradient(to bottom, #4a3f12, #2b2610);

    box-shadow: 0 5px 0 var(--sun-dark), 0 0 14px rgba(240, 207, 79, 0.45);
}

/* "×2" in the top right corner of a picked card */
.card-count {
    position: absolute;
    top: -10px;
    right: -8px;

    padding: 2px 8px;

    border: 2px solid var(--space);
    border-radius: 999px;

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

    font-family: var(--mono);
    font-size: 16px;
    font-weight: bold;
}

.card-count:empty {
    display: none;
}

/* The minus button takes one copy of the card back */
.card-minus {
    display: none;

    position: absolute;
    top: 6px;
    left: 6px;

    width: 32px;
    height: 32px;

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

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

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

    cursor: pointer;
}

.card-minus:hover {
    background: var(--sun);
    color: var(--panel);
}

/* The plan (cards picked for this turn) */

.plan-box {
    padding: 12px;

    border-style: dashed;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plan-header .panel-title {
    margin-bottom: 0;
}

.plan-header .small-button {
    padding: 3px 10px;

    font-size: 13px;

    box-shadow: none;
}

.plan-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;

    margin-top: 10px;

    font-size: 14px;
    color: #cbd5e1;
}

.plan-chip {
    padding: 4px 8px;

    background: #4a3f12;

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

    font-weight: bold;
    color: white;

    animation: popIn 0.2s ease-out;
}

/* A card of the plan that has already been played */
.plan-chip.done {
    border-color: var(--line);

    background: var(--panel);
    color: var(--dim);
    text-decoration: line-through;
}

/* Fun facts panel: Pip tells a fact in a speech bubble */

.facts-panel {
    padding: 12px;
}

.facts-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.facts-head .panel-title {
    margin: 0;
}

.facts-pip {
    width: 52px;

    flex-shrink: 0;
}

.facts-bubble {
    position: relative;

    margin: 12px 0 12px 0;
    padding: 10px 12px;

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

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

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

    position: absolute;
    left: 18px;
    top: -10px;

    width: 14px;
    height: 14px;

    border-left: 3px solid var(--space);
    border-top: 3px solid var(--space);

    background: var(--cream);

    transform: rotate(45deg);
}

#factTitle {
    margin: 0 0 6px 0;

    color: var(--rust);

    font-size: 15px;
}

#factText {
    margin: 0;

    font-size: 14px;
    line-height: 1.45;
}

#randomFactBtn {
    width: 100%;
}

/* Message that floats up over the picture when a card is played */

.toast {
    position: absolute;
    left: 50%;
    top: 40%;
    z-index: 2;

    max-width: 90%;

    padding: 8px 14px;

    background: rgba(5, 6, 15, 0.92);

    border: 3px solid var(--sun);
    border-radius: 8px;

    font-weight: bold;
    text-align: center;

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

    pointer-events: none;
}

.toast.show {
    animation: floatUp 1.4s ease-out;
}

/* Animations */

/* A card that was just picked gives a small bounce */
.card.picked {
    animation: bounce 0.25s ease-out;
}

/* A card that is being played lights up */
.card.played {
    animation: cardPlayed 0.6s ease-out;
}

/* A card that cannot be picked shakes its head */
.card.refused {
    animation: shake 0.3s ease-in-out;
}

/* A meter that just changed */
.changed {
    animation: bounce 0.35s ease-out;
}

/* A new event slides in */
.appear {
    animation: slideIn 0.35s ease-out;
}

/* The picture fades when day turns into night */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Popups pop in */
.overlay.active {
    animation: fadeIn 0.2s ease-out;
}

.overlay.active .popup {
    animation: popIn 0.25s ease-out;
}

/* The title on the start screen floats gently */
.startscreen h1 {
    animation: hover 4s ease-in-out infinite;
}

@keyframes bounce {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.06);
    }

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

@keyframes cardPlayed {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(240, 207, 79, 0);
    }

    40% {
        transform: scale(1.06);
        box-shadow: 0 0 24px rgba(240, 207, 79, 0.9);
        border-color: #ffffff;
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(240, 207, 79, 0);
    }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }

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

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    75% {
        opacity: 1;
        transform: translate(-50%, -10px);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -30px);
    }
}

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

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

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

@keyframes pipNow {
    0% {
        box-shadow: 0 0 0 0 rgba(240, 207, 79, 0.7);
    }

    70% {
        box-shadow: 0 0 0 7px rgba(240, 207, 79, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(240, 207, 79, 0);
    }
}

@keyframes dangerPulse {
    0% {
        box-shadow: 0 4px 0 var(--shadow), 0 0 0 0 rgba(255, 93, 115, 0.7);
    }

    60% {
        box-shadow: 0 4px 0 var(--shadow), 0 0 0 8px rgba(255, 93, 115, 0);
    }

    100% {
        box-shadow: 0 4px 0 var(--shadow), 0 0 0 0 rgba(255, 93, 115, 0);
    }
}

/* People who switched off animations on their computer get none */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }

    /* Without scrolling, the ticker text starts at the left edge */
    .ticker-text {
        padding-left: 12px;
    }
}

/* Game screen polish
   Loaded last on purpose: these rules make the panels above
   brighter and easier to read. Nothing here changes the layout. */

/* Panels: a thin light line on top, like the edge of a metal console */
.plan-box,
.facts-panel,
.top-row,
.xp-section,
.stat,
.event-box,
.news-box {
    background:
        linear-gradient(to bottom, rgba(148, 163, 184, 0.10), rgba(148, 163, 184, 0) 40px),
        rgba(15, 23, 42, 0.94);
    box-shadow: 0 4px 0 var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Meters: each one has its own colour (--meter) */
#healthStat { --meter: var(--health); }
#powerStat  { --meter: var(--sun); }
#doseStat   { --meter: var(--radiation); }

.stat {
    position: relative;

    padding: 10px 12px 12px 12px;

    border-top: 4px solid var(--meter);
}

/* The big number of the meter, in the meter's colour */
.stat-header span + span {
    color: var(--meter);

    font-size: 20px;
    text-shadow: 2px 2px 0 var(--shadow);
}

/* Taller bars that glow a little in their colour */
.stat .xp-bar {
    height: 22px;

    box-shadow: 0 0 10px color-mix(in srgb, var(--meter) 25%, transparent);
}

.stat-icon {
    width: 28px;
    height: 28px;
}

/* Science: a cyan line on top and bright gold stars */
.xp-section {
    border-top: 4px solid var(--pip);
}

.xp-section .xp-bar {
    height: 20px;

    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

#discoveryText {
    font-size: 15px;
}

/* This turn's event: the most important message of the turn */
.event-box {
    position: relative;

    padding: 12px 16px 14px 16px;

    border-left: 6px solid var(--pip);
}

.event-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 10px;

    font-size: 22px;
}

/* The event icon sits in a round badge */
#eventIcon {
    display: inline-flex;
    justify-content: center;
    align-items: center;

    width: 44px;
    height: 44px;
    margin-right: 0;

    background: var(--raised);
    border: 2px solid var(--line);
    border-radius: 50%;
    box-shadow: 0 3px 0 var(--shadow);

    font-size: 24px;
}

#eventText {
    font-size: 16px;
    line-height: 1.4;
}

.event-box.danger {
    border-left-color: var(--radiation);
}

.event-box.danger #eventIcon {
    border-color: var(--radiation);

    animation: dangerPulse 1.2s ease-in-out infinite;
}

/* The plan: a solid panel with the power left as a clear label */
.plan-box {
    border-style: solid;
    border-left: 6px solid var(--sun);
}

#planPower {
    display: inline-block;

    margin-top: 10px;
    padding: 5px 10px;

    background: var(--raised);
    border: 2px solid var(--line);
    border-radius: 999px;

    color: var(--sun);
    font-weight: bold;
}

/* Not enough power left for life support: see renderPlan() in index.js */
#planPower.warn {
    border-color: var(--health);

    color: #fca5a5;

    animation: dangerPulse 1.2s ease-in-out infinite;
}

/* Cards: the picture sits on a little lit pad */
.cards .card img {
    padding: 4px;

    background: radial-gradient(circle at 50% 40%, rgba(148, 163, 184, 0.22), rgba(148, 163, 184, 0) 70%);
    border-radius: 12px;
}

.card:hover:not(.disabled) {
    box-shadow: 0 8px 0 var(--shadow), 0 0 16px rgba(240, 207, 79, 0.3);
}

/* End turn glows once cards are picked: see renderPlan() in index.js */
.end-turn.ready {
    animation: endTurnGlow 1.6s ease-in-out infinite;
}

@keyframes endTurnGlow {
    0%, 100% { box-shadow: 0 6px 0 var(--sun-dark), 0 0 0 4px rgba(11, 11, 30, 0.85), 0 0 0 rgba(240, 207, 79, 0); }
    50%      { box-shadow: 0 6px 0 var(--sun-dark), 0 0 0 4px rgba(11, 11, 30, 0.85), 0 0 24px rgba(240, 207, 79, 0.65); }
}

@media (prefers-reduced-motion: reduce) {
    .end-turn.ready,
    #planPower.warn,
    .event-box.danger #eventIcon {
        animation: none;
    }
}

/* On a phone the three meters are narrow: smaller numbers that stay on one line */
@media (max-width: 600px) {
    .stat {
        padding: 8px 8px 10px 8px;
    }

    .stat-header span + span {
        font-size: 15px;
        white-space: nowrap;
    }
}

/* Pixel icons (js/icons.js)
   An icon is as tall as the text around it and sits on the same line. */
.px-icon {
    display: inline-block;

    width: 1.05em;
    height: 1.05em;

    vertical-align: -0.15em;
}

.px-icon svg {
    display: block;

    width: 100%;
    height: 100%;
}

/* The event icon in its round badge */
#eventIcon .px-icon {
    width: 26px;
    height: 26px;
}

/* The sun and moon in the turn squares */
.turn-pip .px-icon {
    width: 70%;
    height: 70%;
    vertical-align: middle;
}

/* The satellite dish of the sound button */
.sound-button .px-icon {
    width: 26px;
    height: 26px;
}

/* A little space between an icon and the words after it */
.px-icon + * {
    margin-left: 0.15em;
}

/* Only the turn you are in shows a bright sun or moon */
.turn-pip:not(.now) .px-icon {
    opacity: 0.4;
}

/* On a yellow background a yellow icon would disappear: draw it dark instead */
.turn-pip.now .px-icon,
#timeText .px-icon,
.main-button .px-icon,
.launch-button .px-icon {
    filter: brightness(0);
    opacity: 0.75;
}

/* At night the label is blue, so the pale moon keeps its own colours */
.gamescreen.night #timeText .px-icon {
    filter: none;
    opacity: 1;
}
