/* The two-game switch and "Llená el carrito" on juego.html (js/juego-carrito.js). Uses css/tokens.css
   and the .jg-page variables of css/juego.css, so both themes work. Mobile first (390 px). */
.jg-switch {
    display: flex;
    gap: 0.25rem;
    max-width: 420px;
    margin: 0 auto 1rem;
    padding: 0.25rem;
    background: var(--surface-control);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
}

.jg-switch-btn {
    flex: 1;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.jg-switch-btn[aria-pressed="true"] {
    background: var(--brand-primary);
    color: #fff;
}

/* one game at a time; without JS, the jugada */
.jg-main:not([data-game="carrito"]) > .jc,
.jg-main[data-game="carrito"] > :not(.jg-switch):not(.jc) {
    display: none;
}

.jc {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}

.jc-how {
    margin: 0 0 0.5rem;
}

.jc[data-state="over"] #jcDrop {
    visibility: hidden;  /* "Jugar de nuevo" is on the canvas */
}

.jc-score {
    min-height: 1.5em;
    margin: 0 0 0.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* one line: a longer name is cut, never the price or the -%, and never moves the canvas */
.jc-now {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.45em;
    min-height: 1.6em;
    margin: -0.3rem 0 0.5rem;
    font-size: 0.92rem;
    line-height: 1.3;
    color: var(--text-primary);
    white-space: nowrap;
}

.jc-now > :first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.jc-now > #jcDeal {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.jc-pct {
    padding: 0.05em 0.4em;
    border-radius: 3px;
    background: var(--jg-accent);
    color: #120d1f;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.jc-now > :empty {
    display: none;
}

/* narrower on a short screen, so the cart and "Soltar" fit below the fixed header and the text; never
   under 15rem, where the end card no longer fits */
.jc-stage {
    position: relative;
    width: min(100%, max(15rem, calc((100vh - 21.5rem) * 3 / 4)));
    width: min(100%, max(15rem, calc((100svh - 21.5rem) * 3 / 4)));
    margin: 0 auto;
}

/* pixel art: js/juego-carrito.js sets the height to a whole zoom of its 108 x 144 frame */
.jc-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 108 / 144;
    background: #120d1f;
    border-radius: 4px;
    box-shadow: 0 0 0 2px #120d1f, 0 0 0 3px var(--border-medium);
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    touch-action: manipulation;
    cursor: pointer;
}

.jc-canvas:focus-visible {
    outline: 3px solid var(--jg-accent);
    outline-offset: 4px;
}

.jc-end {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.25rem;
    border-radius: 4px;
    background: var(--surface-card);
    background: color-mix(in srgb, var(--surface-card) 92%, transparent);
}

.jc-end[hidden] {
    display: none;
}

.jc-end-why {
    margin: 0 0 0.4rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-heading);
}

.jc-end-total {
    margin: 0 0 0.3rem;
    font-weight: 600;
    color: var(--text-primary);
}
