/* =================================================================
   CONSTRUCTION SPEED-UPS — the discovery card and the SPEED UP block
   =================================================================

   speedups.js draws both. The card reports a stash found by a deployment
   that cleared a deposit, and goes by itself; the block, inside the building
   panel, spends one.

   The card is the player's gain, so it wears the self gold the HUD already
   uses for "yours" -- never the enemy red, which on this game means a threat
   and nothing else. The warning on a wasteful use is the HUD's orange, for
   the same reason.
   ================================================================= */

/* -----------------------------------------------------------------
   THE DISCOVERY CARD
   Centred, under the top HUD and clear of the Overseer's box, so his comment
   is read alongside it. No scrim: it blocks nothing, and a tap on the card
   dismisses it.
   ----------------------------------------------------------------- */

.speedup-found {
    position: fixed;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    z-index: var(--z-flash);
    width: min(340px, calc(100vw - 32px));
    padding: 16px 18px 14px;
    background: rgba(10, 15, 26, 0.94);
    border: 1px solid var(--color-accent-gold);
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(10, 15, 26, 0.9), 0 10px 36px rgba(0, 0, 0, 0.55),
                0 0 24px rgba(244, 208, 63, 0.18);
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.speedup-found.hidden { display: none; }

.speedup-found.is-in {
    animation: sf-in 260ms ease-out both;
}

@keyframes sf-in {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.sf-kicker {
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 2px;
    color: var(--color-accent-gold-light);
    margin-bottom: 8px;
}

.sf-text {
    margin: 0 0 10px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.4;
    color: var(--color-text-primary);
}

.sf-gains {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

.sf-gains li {
    font-family: var(--font-heading);
    font-weight: var(--font-bold);
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    color: var(--color-accent-gold-light);
}

/* How long it will stay, as a line that empties. Decorative: the card goes
   whether or not this is seen, and a tap ends it sooner. */
.sf-timer {
    height: 2px;
    background: rgba(244, 208, 63, 0.18);
    border-radius: 1px;
    overflow: hidden;
}

.sf-timer span {
    display: block;
    height: 100%;
    background: var(--color-accent-gold);
    transform-origin: left center;
    animation: sf-drain linear both;
}

@keyframes sf-drain {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Reduced motion: no entrance and no draining line. The card still goes on
   the same clock -- that is timing, not motion. */
html.reduce-motion .speedup-found.is-in,
html.reduce-motion .sf-timer span { animation: none; }
html.reduce-motion .sf-timer { display: none; }

@media (prefers-reduced-motion: reduce) {
    .speedup-found.is-in,
    .sf-timer span { animation: none; }
    .sf-timer { display: none; }
}

/* -----------------------------------------------------------------
   THE SPEED UP BLOCK (building panel)
   ----------------------------------------------------------------- */

.bp-speedup-block {
    padding: 10px 4px 4px;
    border-top: 1px solid var(--color-primary-700);
}

.bp-speedup-head-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* The shared .hp-help button (wikiHelp.css): the same circle and 44px tap
   target as every panel header's, in the block's head. */
.bp-speedup-help { margin: -10px -10px -10px 0; }

.bp-speedup-held {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    letter-spacing: 0.4px;
    color: var(--color-accent-gold);
}

.bp-speedups {
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
    display: grid;
    gap: 6px;
}

.bp-speedup {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(26, 39, 68, 0.5);
    border: 1px solid var(--color-primary-700);
    border-radius: 5px;
}

.bp-speedup.is-over { border-color: rgba(251, 146, 60, 0.55); }
.bp-speedup.is-armed { border-color: var(--color-accent-orange-light); }

.bp-speedup-size {
    font-family: var(--font-heading);
    font-weight: var(--font-bold);
    font-size: 1rem;
    color: var(--color-accent-gold-light);
    min-width: 2.6em;
}

.bp-speedup-count {
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.bp-speedup-note {
    font-family: var(--font-body);
    font-size: 0.76rem;
    line-height: 1.3;
    color: var(--color-text-secondary);
    min-width: 0;
}

.bp-speedup.is-over .bp-speedup-note { color: var(--color-accent-orange-light); }

/* The warning has a shape as well as a hue: a "!" badge. */
.bp-speedup-warn {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    margin-right: 4px;
    border-radius: 50%;
    background: var(--color-accent-orange-light);
    color: var(--color-primary-900);
    font-weight: var(--font-bold);
    font-size: 0.7rem;
    line-height: 1.2em;
    text-align: center;
    vertical-align: 1px;
}

.bp-speedup-use {
    min-height: 36px;
    padding: 4px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
}

.bp-speedup-use:focus-visible {
    outline: 2px solid var(--color-accent-gold);
    outline-offset: 2px;
}
