.action-card img {
    aspect-ratio: 1.6/1;
    object-fit: cover;
    border-radius: 0;
}

/* New action card wrapper with 3D effect */
.action-card-wrapper {
    position: relative;
    perspective: 1000px;
    cursor: pointer;
}

/* Die Ecke kommt aus der Zeichnung, nicht aus dem Theme: die Karte ist ein
   250x350er Blatt mit `rx="15"`, und Sketchys `--bs-border-radius-lg` legte
   35 Pixel darueber — auf einer 130 Pixel breiten Kachel mehr als ein Viertel
   der Breite. Der Prozentwert ist dasselbe Verhaeltnis und waechst mit der
   Kachel mit, also stimmt er auch auf dem 56 Pixel breiten Marktbild (#730). */
.action-card-image {
    width: 100%;
    height: auto;
    border-radius: 6% / 4.286%;
    /* transform: rotateX(-5deg) rotateY(-3deg); */
    box-shadow: 0 10px 30px rgba(var(--app-black-rgb), 0.2),
    0 5px 15px rgba(var(--app-black-rgb), 0.15),
    -5px 10px 20px rgba(var(--app-black-rgb), 0.1);
    transition: transform 0.3s ease,
    box-shadow 0.3s ease;
}

.action-card-wrapper:hover .action-card-image {
    transform: rotateX(0deg) rotateY(0deg) scale(1.05);
    box-shadow: 0 20px 40px rgba(var(--app-black-rgb), 0.5),
    0 10px 20px rgba(var(--app-black-rgb), 0.4),
    0 0 30px rgba(var(--app-star-rgb), 0.2);
}

.action-card-wrapper:active .action-card-image {
    transform: rotateX(2deg) rotateY(-1deg) scale(0.98);
    box-shadow: 0 5px 15px rgba(var(--app-black-rgb), 0.3),
    0 2px 8px rgba(var(--app-black-rgb), 0.2);
}


/* Die Merge-Plakette haengt schraeg in der oberen Ecke des Stapels. Eine
   Plakette ist sie seit #706 selbst (`Badge`, `warning` — derselbe Bernstein,
   den ihr Schein immer schon hatte); hier steht nur noch, wo sie haengt. */
.action-card-merge-badge {
    position: absolute;
    top: 10px;
    right: -8px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(var(--app-merge-glow-rgb), 0.4);
    z-index: 10;
    transform: rotate(45deg);
}

/* The per-type card limit in the Actions page subtitle, stressed with a faux
   bold that follows the text colour in both themes. */
.action-cards-limit-hint {
    color: var(--bs-emphasis-color);
    text-shadow: 0 0 1px currentcolor;
}


/* Der Streifen selbst ist `d-flex flex-nowrap gap-3 overflow-x-auto` — hier
   steht nur, was Bootstrap nicht sagt: der Innenabstand, der den ausladenden
   Rand der Stapel aufnimmt, und das Scrollverhalten der WebView. */
.action-cards-scroll {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 16px 30px 24px;
}

.action-cards-container {
    margin: 0 -2rem;
}

.action-card-item {
    flex: 0 0 auto;
    width: 130px;
}

/* Card stack container. `isolation` keeps the cards' z-indices (10, the counter's 20) inside the
   stack — otherwise they compete with the docked sub-tab bar (z-index 5) and
   slide over it while the page scrolls. */
.action-card-stack {
    position: relative;
    isolation: isolate;
    aspect-ratio: 175 / 260;
    cursor: pointer;
}

.action-card-stack .action-card-wrapper {
    position: absolute;
    opacity: calc(1 - var(--stack-index, 0) * 0.18);
    top: calc(var(--stack-index, 0) * 4px);
    left: calc(var(--stack-index, 0) * 4px);
    width: calc(100% + 3rem);
    padding: 1.5rem;
    margin: -1.5rem;
    z-index: calc(10 - var(--stack-index, 0));
    transition: transform 0.2s ease,
    top 0.2s ease,
    left 0.2s ease;
}

.action-card-stack .action-card-image {
    width: 100%;
    height: auto;
}


/* Der Zaehler in der unteren Ecke des Stapels. Die Scheibe und ihre Farbe
   bringt `CardCountBadge` mit; hier steht, wo sie sitzt und dass sie ueber
   den Karten liegt. */
.action-card-count {
    position: absolute;
    bottom: -8px;
    right: -8px;
    box-shadow: 0 2px 8px rgba(var(--app-black-rgb), 0.3);
    z-index: 20;
}

/* Adjust merge badge position for stacks */
.action-card-stack .action-card-merge-badge {
    top: -5px;
    right: -12px;
    transform: rotate(15deg);
}

/* Card use animation */
@keyframes action-card-use {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1) translateY(-20px);
        filter: brightness(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-100px);
        filter: brightness(2);
    }
}

.action-card-wrapper.card-used {
    animation: action-card-use 0.5s ease-out forwards;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .action-card-image {
        transform: rotateX(3deg) rotateY(-2deg);
    }
}

/* ==========================================================================
   Card Claim Overlay
   ========================================================================== */

.card-claim-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Darker than the shared overlay backdrop on purpose: the hint and the
       reward message sit directly on this layer with no panel behind them, so
       a light page showing through cost them their contrast. */
    background-color: rgba(var(--app-ground-rgb), 0.88);
    backdrop-filter: blur(5px);
    animation: overlay-fade-in-1 0.3s ease-in-out;
}

.card-claim-overlay.fade-out {
    animation: overlay-fade-out-1 0.3s ease-in-out forwards;
}

/* Flip container */
.card-claim-flip-container {
    perspective: 1000px;
    width: 220px;
    height: 308px;
    cursor: pointer;
    animation: card-claim-pulsate 2s ease-in-out infinite;
}

.card-claim-flip-container.flipped {
    animation: none;
}

.card-claim-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
}

.card-claim-flip-container.flipped .card-claim-flipper {
    transform: rotateY(180deg);
}

.card-claim-front,
.card-claim-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--bs-border-radius-xl);
    box-shadow: 0 10px 40px rgba(var(--app-black-rgb), 0.4),
    0 0 20px rgba(var(--app-claim-glow-rgb), 0.3);
}

.card-claim-front img,
.card-claim-back img,
.card-claim-front svg,
.card-claim-back svg {
    width: 100%;
    height: 100%;
    border-radius: var(--bs-border-radius-xl);
}

.card-claim-back {
    transform: rotateY(180deg);
}

/* Hint text */
/* The line saying what the reward was for (#615). Sits above the tap hint and
   stays calm — the hint below it is the one that pulses. */
.card-claim-message {
    color: var(--app-ink-on-accent);
    text-align: center;
    max-width: 22rem;
    /* Same 24px the hint used to keep from the card — the message now sits
       in that slot, and the hint keeps its own 24px below it. */
    margin: 24px auto 0;
    padding: 0 1rem;
    font-size: 1rem;
    line-height: 1.4;
}

.card-claim-hint {
    color: rgba(var(--app-white-rgb), 0.8);
    font-size: 16px;
    margin-top: 24px;
    animation: card-claim-hint-pulse 1.5s ease-in-out infinite;
}

/* Card title after reveal */
.card-claim-title {
    color: var(--app-claim-gold);
    font-size: 20px;
    font-weight: bold;
    margin-top: 24px;
    opacity: 0;
    animation: card-claim-title-fade-in 0.5s ease-in-out 0.4s forwards;
}

/* Skip / redeem button positioning (visual style comes from Bootstrap .btn
   classes). It stays in the overlay's flex column instead of being absolutely
   positioned: pinned to the bottom it drifted over the hint and the revealed
   card title, which sit right below the card in the vertically centred stack.
   The redeem button of a must-claim overlay (#618) sits in the same slot — it
   replaces the skip button rather than joining it. */
.card-claim-skip-btn,
.card-claim-redeem-btn {
    margin-top: 2rem;
    margin-bottom: env(safe-area-inset-bottom, 0);
    z-index: 201;
}

/* Pulsate animation for unclaimed card */
@keyframes card-claim-pulsate {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
}

/* Hint pulse */
@keyframes card-claim-hint-pulse {
    0%,
    100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* Title fade in */
@keyframes card-claim-title-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Spy ("Spion") action-card overlay ===== */

/* Die Auswahlliste ist eine Bootstrap-Listengruppe (#706): Zeile, Hover und
   die Auswahl (`active`) kommen von dort. Eigen bleibt nur, dass sie nach
   einem Drittel Bildschirm zu scrollen anfaengt. */
.spy-team-list {
    max-height: 320px;
}

.spy-team-row__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fake analysis loader: a rotating magnifier. Die Spalte darum ist
   `d-flex flex-column align-items-center justify-content-center py-5`. */

.spy-loader__glass {
    font-size: 64px;
    color: var(--bs-info);
    animation: spy-magnifier-spin 1.4s linear infinite;
    transform-origin: 50% 50%;
}

@keyframes spy-magnifier-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Eine Kachel des Taktik-Rasters. Das Raster selbst ist `row g-2`, die
   Kachel sitzt in einer `col-6` — eigen ist nur die leise Flaeche. */
.spy-tactic {
    padding: 8px 12px;
    border-radius: var(--bs-border-radius-lg);
    background: rgba(var(--app-accent-rgb), 0.08);
}

.spy-tactic__label {
    font-size: 12px;
    color: var(--bs-secondary);
}

.spy-tactic__value {
    font-weight: 700;
}

/* The revealed lineup is read-only — ignore the pitch's swap-player clicks. */
.spy-lineup {
    pointer-events: none;
}

/* ===== Action-card marketplace (#476) ===== */

.card-market-thumb {
    display: inline-block;
    width: 56px;
    flex-shrink: 0;
}

/* Die Ecke steht einmal auf `.action-card-image` und waechst mit — hier
   bleibt nur der leisere Schatten des Miniaturbildes (#730). */
.card-market-thumb .action-card-image {
    width: 100%;
    height: auto;
    box-shadow: 0 2px 6px rgba(var(--app-black-rgb), 0.2);
}

.card-market-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 84px;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: var(--bs-border-radius-lg);
    background: transparent;
    cursor: pointer;
    text-align: center;
}

.card-market-pick:hover {
    background-color: rgba(var(--app-accent-rgb), 0.08);
}

.card-market-pick--selected {
    border-color: var(--bs-info);
    background-color: rgba(var(--app-accent-rgb), 0.12);
}

.card-market-pick .card-market-thumb {
    width: 64px;
}

/* A bundle of card thumbnails shown side by side (offers, bids, trades). Die
   Reihe selbst ist `d-inline-flex flex-wrap align-items-center gap-1`; die
   Klasse haengt nur noch die kleinere Daumennagelbreite daran. */
.card-market-thumbs .card-market-thumb {
    width: 40px;
}

/* On mobile the "My offers" cancel button wraps to its own right-aligned row. */
@media (max-width: 576px) {
    .card-market-offer-main {
        min-width: 100%;
    }
}

/* "Actions" icon (client/lib/actionCardsIcon.js) — sits inline next to the
   Font Awesome glyphs in the info bar and the tab navs, so it is sized off the
   font size and nudged onto their baseline. */
.action-cards-icon {
    width: 1.26em;
    height: 1.26em;
    vertical-align: -0.24em;
}

/* Position switch (#641): the picked player above the options — portrait,
   name, and the facts a manager weighs before paying for the move. Layout is
   Bootstrap's flex utilities; only the portrait box needs a size of its own,
   because the SVG inside is drawn at 64px and would otherwise stretch the row. */
.position-switch-player__portrait {
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
}

.position-switch-player__portrait svg {
    width: 100%;
    height: 100%;
}
