/* Truco Argentino — table, cards and cantos.
   Card faces are CSS in v1. The markup is
   .truco-card[data-card] > .truco-card__face, so a real baraja española SVG
   pack can be dropped in later as a background on [data-card] with no HTML
   change. */

.truco-panel {
    background: #0f5132;
    background-image: radial-gradient(ellipse at 50% 0%, #17724a 0%, #0f5132 55%, #0b3b25 100%);
    border: 1px solid #0b3b25;
    border-radius: 16px;
    padding: 1rem;
    color: #f6fbf8;
}

/* ---------- scoreboard + palitos ---------- */

.truco-score {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.9rem;
}

.truco-score__side {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 0.55rem 0.7rem;
    min-width: 0;
}

.truco-score__side--them { text-align: right; }

.truco-score__name {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b9e4cd;
}

.truco-score__num {
    margin: 0.1rem 0 0;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.truco-score__vs {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #b9e4cd;
}

.truco-palitos {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.4rem;
    min-height: 18px;
}

.truco-score__side--them .truco-palitos { justify-content: flex-end; }

/* One gate = 5 points: four uprights plus a diagonal stroke. */
.truco-gate {
    position: relative;
    display: inline-flex;
    gap: 3px;
    padding: 1px 2px;
}

.truco-gate__stroke {
    display: block;
    width: 2px;
    height: 16px;
    border-radius: 1px;
    background: #ffd24d;
}

.truco-gate--closed::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 50%;
    height: 2px;
    border-radius: 1px;
    background: #ffd24d;
    transform: rotate(-24deg);
}

/* ---------- table ---------- */

.truco-table {
    display: grid;
    gap: 0.8rem;
    background: rgba(0, 0, 0, 0.16);
    border-radius: 14px;
    padding: 0.85rem 0.75rem;
}

.truco-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 96px;
}

.truco-row--history { min-height: 54px; }

.truco-rowlabel {
    margin: 0 0 0.3rem;
    text-align: center;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b9e4cd;
}

.truco-status {
    margin: 0.65rem 0 0;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 800;
    min-height: 1.4em;
}

.truco-status__sub {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: #b9e4cd;
}

.truco-hand {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 0.7rem;
    min-height: 118px;
}

/* ---------- cards ---------- */

.truco-card {
    --truco-ink: #1f2933;
    position: relative;
    display: block;
    width: 74px;
    height: 112px;
    padding: 0;
    border: 0;
    background: none;
    cursor: default;
    flex: 0 0 auto;
}

.truco-card__face {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 9px;
    background: #fdfaf1;
    background-repeat: no-repeat;
    background-position: center 58%;
    background-size: 40px 40px;
    border: 1px solid #d9d2bd;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
}

.truco-card__value {
    position: absolute;
    top: 5px;
    left: 7px;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    color: var(--truco-ink);
    font-family: Montserrat, 'Google Sans', sans-serif;
}

.truco-card__figure {
    position: absolute;
    bottom: 5px;
    right: 7px;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--truco-ink);
    opacity: 0.72;
}

.truco-card[data-suit="oros"] { --truco-ink: #9a6b00; }
.truco-card[data-suit="copas"] { --truco-ink: #a11d16; }
.truco-card[data-suit="espadas"] { --truco-ink: #14417f; }
.truco-card[data-suit="bastos"] { --truco-ink: #1f5d24; }

.truco-card[data-suit="oros"] .truco-card__face {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10.5' fill='%23e0a516' stroke='%239a6b00' stroke-width='1.2'/%3E%3Ccircle cx='12' cy='12' r='6' fill='none' stroke='%23fdfaf1' stroke-width='1.6'/%3E%3Ccircle cx='12' cy='12' r='2.2' fill='%239a6b00'/%3E%3C/svg%3E");
}

.truco-card[data-suit="copas"] .truco-card__face {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3h14l-1.4 6.2A5.9 5.9 0 0 1 13 13.7V17h4v3H7v-3h4v-3.3A5.9 5.9 0 0 1 6.4 9.2z' fill='%23c62d24' stroke='%23a11d16' stroke-width='1.1' stroke-linejoin='round'/%3E%3Cpath d='M7.6 5.2h8.8' stroke='%23fdfaf1' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
}

.truco-card[data-suit="espadas"] .truco-card__face {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.6 14.4 6v8.4h-4.8V6z' fill='%23c8d4e8' stroke='%2314417f' stroke-width='1.1' stroke-linejoin='round'/%3E%3Crect x='5.2' y='14.4' width='13.6' height='2.4' rx='1.2' fill='%231d5bb0' stroke='%2314417f' stroke-width='1'/%3E%3Crect x='10.6' y='16.8' width='2.8' height='5.6' rx='1.2' fill='%231d5bb0' stroke='%2314417f' stroke-width='1'/%3E%3C/svg%3E");
}

.truco-card[data-suit="bastos"] .truco-card__face {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='9.4' y='2.4' width='5.2' height='19.2' rx='2.6' fill='%23367d3b' stroke='%231f5d24' stroke-width='1.1' transform='rotate(18 12 12)'/%3E%3Cpath d='M8.4 9.4 4.6 7.2M15.6 14.6l3.8 2.2' stroke='%231f5d24' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.truco-card--back .truco-card__face {
    background-color: #7a1d1d;
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.11) 0 6px, transparent 6px 12px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.16) 0 6px, transparent 6px 12px);
    background-size: auto;
    border-color: #4d1010;
}

.truco-card--sm { width: 44px; height: 66px; }
.truco-card--sm .truco-card__face { background-size: 24px 24px; border-radius: 6px; }
.truco-card--sm .truco-card__value { font-size: 0.68rem; top: 3px; left: 4px; }
.truco-card--sm .truco-card__figure { display: none; }

.truco-card--faded { opacity: 0.55; }

.truco-card--won .truco-card__face { box-shadow: 0 0 0 2px #ffd24d, 0 3px 10px rgba(0, 0, 0, 0.35); }

.truco-card--playable { cursor: pointer; transition: transform 0.12s ease; }
.truco-card--playable:hover,
.truco-card--playable:focus-visible { transform: translateY(-8px); outline: none; }
.truco-card--playable:focus-visible .truco-card__face { box-shadow: 0 0 0 3px #ffd24d; }

.truco-empty {
    width: 74px;
    height: 112px;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 9px;
}

/* ---------- actions ---------- */

.truco-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.9rem;
}

.truco-btn {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
}

.truco-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.truco-btn--canto { background: #ffd24d; color: #3d2c00; }
.truco-btn--canto:not(:disabled):hover { background: #ffdf7d; }
.truco-btn--mazo { background: rgba(255, 255, 255, 0.14); color: #f6fbf8; }
.truco-btn--mazo:not(:disabled):hover { background: rgba(255, 255, 255, 0.24); }
.truco-btn--primary { background: #0a6e30; color: #fff; }
.truco-btn--ghost { background: #eef2f5; color: #202124; }
.truco-btn--wa { background: #25d366; color: #06331a; }

/* ---------- canto overlay ---------- */

.truco-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(6, 22, 14, 0.72);
}

.truco-overlay.is-open { display: flex; }

.truco-modal {
    background: #fdfaf1;
    color: #202124;
    border-radius: 16px;
    padding: 1.4rem 1.25rem;
    width: min(420px, 100%);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.truco-modal__title {
    margin: 0 0 0.3rem;
    font-family: Montserrat, 'Google Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
}

.truco-modal__sub {
    margin: 0 0 1rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: #5f6368;
}

.truco-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

/* The table's --mazo variant is near-white on translucent white: correct on
   the green felt, invisible on the modal. This is its light-background twin. */
.truco-btn--modalmazo {
    background: transparent;
    color: #5f6368;
    border: 1px solid #d9d2bd;
}

.truco-btn--modalmazo:not(:disabled):hover {
    background: #efe9d8;
    color: #202124;
}

/* ---------- feed ---------- */

.truco-feed {
    margin: 0.8rem 0 0;
    padding: 0;
    list-style: none;
    max-height: 132px;
    overflow-y: auto;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #d7ede0;
}

.truco-feed li { padding: 0.12rem 0; }
.truco-feed li b { color: #ffd24d; }

/* ---------- room waiting / share ---------- */

.truco-wait {
    text-align: center;
    padding: 1.2rem 0.6rem;
}

.truco-code {
    display: inline-block;
    margin: 0.5rem 0 0.9rem;
    padding: 0.5rem 1.1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-family: Montserrat, monospace;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0.22em;
}

.truco-share {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.truco-share a.truco-btn { text-decoration: none; display: inline-block; }

.truco-spinner {
    width: 26px;
    height: 26px;
    margin: 0.8rem auto 0;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #ffd24d;
    animation: truco-spin 0.9s linear infinite;
}

@keyframes truco-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .truco-spinner { animation: none; }
    .truco-card--playable { transition: none; }
}

/* ---------- mode select + result ---------- */

.truco-modes {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
    margin: 0.4rem 0 0.2rem;
}

@media (min-width: 620px) {
    .truco-modes { grid-template-columns: 1fr 1fr; }
}

.truco-mode {
    display: block;
    text-align: left;
    text-decoration: none;
    color: #f6fbf8;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 1rem;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
}

.truco-mode:hover { background: rgba(0, 0, 0, 0.34); }
.truco-mode__title { margin: 0; font-size: 1.05rem; font-weight: 800; }
.truco-mode__desc { margin: 0.25rem 0 0; font-size: 0.82rem; color: #b9e4cd; }

.truco-result {
    display: none;
    margin-top: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 1rem;
    text-align: center;
}

.truco-result.is-open { display: block; }
.truco-result__title { margin: 0 0 0.25rem; font-size: 1.3rem; font-weight: 800; }
.truco-result__sub { margin: 0 0 0.85rem; font-size: 0.85rem; color: #b9e4cd; }

.truco-bridge {
    margin-top: 0.9rem;
    background: #fff8e1;
    border: 1px solid #f0d999;
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    color: #4a3608;
    font-size: 0.86rem;
    font-weight: 600;
    text-align: center;
}

.truco-bridge a { color: #8a5b00; font-weight: 800; }

@media (max-width: 520px) {
    .truco-card { width: 62px; height: 94px; }
    .truco-card__face { background-size: 32px 32px; }
    .truco-empty { width: 62px; height: 94px; }
    .truco-code { font-size: 1.35rem; letter-spacing: 0.18em; }
}
