/* The action ticker (web/js/ticker.js): one compact line under the hint
   narrating the latest actions; a click opens the game log. And the
   nemesis turn's look in the phase tracker and hint (guide.js). */

:root {
    --ticker-bg: rgba(12, 12, 18, 0.72);
    --ticker-text: #b9b4a4;
    --ticker-new: #f0dfa6;
    --nem-turn: #b0306a;
    --nem-turn-ink: #fff4f8;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --ticker-bg: rgba(250, 248, 244, 0.86);
        --ticker-text: #57544c;
        --ticker-new: #6a5418;
        --nem-turn: #8e1f52;
        --nem-turn-ink: #fff;
    }
}

:root[data-theme="dark"] {
    --ticker-bg: rgba(12, 12, 18, 0.72);
    --ticker-text: #b9b4a4;
    --ticker-new: #f0dfa6;
    --nem-turn: #b0306a;
    --nem-turn-ink: #fff4f8;
}

.action-ticker {
    position: absolute;
    top: 2.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 16;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    max-width: min(44rem, calc(100% - 2 * 13.75rem));
    min-width: 0;
    padding: 0.18rem 0.75rem 0.18rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--ticker-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--ticker-text);
    font: inherit;
    font-size: 0.74rem;
    line-height: 1.3;
    cursor: pointer;
    box-shadow: 0 0.2rem 0.75rem rgba(0, 0, 0, 0.25);
}

.action-ticker[hidden] { display: none; }
.action-ticker:hover, .action-ticker:focus-visible { border-color: var(--accent); color: var(--text); }

.ticker-icon { flex: none; width: 0.85rem; height: 0.85rem; opacity: 0.7; }

.ticker-text {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ticker-tail { color: var(--ticker-new); font-weight: 600; }
.ticker-head:not(:empty) + .ticker-tail { margin-left: 0; }
.ticker-tail.is-new { animation: ticker-in 0.35s ease; }

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

@media (prefers-reduced-motion: reduce) {
    .ticker-tail.is-new { animation: none; }
}

/* As the hint: hidden behind the card reveal (its title sits there), and
   between the other players' cards and a docked tile card. */
body:has(#card-reveal:not([hidden])) #action-ticker { visibility: hidden; }

@media (min-width: 769px) {
    .board-viewport:has(#tile-closeup:not([hidden]):not(.is-suppressed)) .action-ticker {
        left: calc((14.25rem + 100% - var(--tc-room)) / 2);
        max-width: calc(100% - 14.25rem - var(--tc-room) - var(--gutter));
    }
}

@media (max-width: 768px) {
    /* Between the other players' avatars (left) and the folded scenario
       strip (right). */
    .action-ticker {
        left: 3.5rem;
        transform: none;
        max-width: calc(100% - 3.5rem - 8.5rem);
        font-size: 0.7rem;
        padding: 0.15rem 0.6rem 0.15rem 0.45rem;
    }
}

/* --- A nemesis's turn in the phase tracker --- */

.phase-who {
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--nem-turn);
    color: var(--nem-turn-ink);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.phase-track--nemesis .phase-step--current {
    background: var(--nem-turn);
    color: var(--nem-turn-ink);
    box-shadow: 0 0 0.75rem color-mix(in srgb, var(--nem-turn) 45%, transparent);
}
.phase-track--nemesis .phase-step--current .phase-dot { background: var(--nem-turn-ink); border-color: var(--nem-turn-ink); }
.phase-track--nemesis .phase-step--done { color: color-mix(in srgb, var(--nem-turn) 60%, var(--text-muted)); }

.guide-hint--nemesis { border-color: var(--nem-turn); }

.phase-who-short { display: none; }

@media (max-width: 480px) {
    .phase-who { font-size: 0.58rem; padding: 0.125rem 0.35rem; max-width: 5.5rem; overflow: hidden; text-overflow: ellipsis; }
    .phase-who-long { display: none; }
    .phase-who-short { display: inline; }
}

/* A nemesis you play: pick its move on the board (nemesis.js). */
.nem-move-bar {
    position: absolute;
    left: 50%;
    bottom: 0.75rem;
    transform: translateX(-50%);
    z-index: 35;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    max-width: calc(100% - 2 * var(--gutter));
    padding: 0.4rem 0.5rem 0.4rem 0.85rem;
    border: 1px solid var(--nem-turn);
    border-radius: var(--radius-lg);
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text);
    font-size: 0.82rem;
    box-shadow: 0 0.4rem 1.25rem rgba(0, 0, 0, 0.35);
}

.nem-move-bar .btn { width: auto; white-space: nowrap; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.nem-move-bar-text { font-weight: 600; }
