/* ═══════════════════════════════════════════════════════
   COMPONENT: LÁ BÀI CSS THUẦN — Casino Grade v3.0
   Chống Force Dark Mode trên mọi trình duyệt Android
   ═══════════════════════════════════════════════════════ */

/*
  Ba lớp bảo vệ:
  1. color-scheme: light  → trình duyệt không đảo màu
  2. forced-color-adjust: none → chặn Forced Colors mode
  3. background: gradient với !important → đè mọi override
*/

.card {
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
    width: 64px;
    height: 96px;
    padding: 4px 6px;
    border-radius: 9px;
    border: 1px solid #d0d0d0;

    /* ── CHỐNG DARK MODE ── */
    background: linear-gradient(170deg, #ffffff 0%, #f8f4ee 100%) !important;
    color-scheme: light !important;
    forced-color-adjust: none !important;
    -webkit-forced-color-adjust: none !important;

    box-shadow:
        2px 4px 8px rgba(0,0,0,0.55),
        inset 0 1px 0 rgba(255,255,255,0.9),
        inset 0 0 8px rgba(0,0,0,0.03);
    position: relative;
    user-select: none;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    margin: 0 -15px;
    flex-shrink: 0;
}

/* Subtle paper texture line at top */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.8) 50%, transparent 100%);
    border-radius: 9px 9px 0 0;
    pointer-events: none;
}

@media (hover: hover) {
    .card:not(.tl-fan-card):hover {
        transform: translateY(-12px) !important;
        box-shadow:
            0 20px 40px rgba(0,0,0,0.65),
            0 6px 12px rgba(0,0,0,0.4),
            inset 0 1px 0 rgba(255,255,255,0.9) !important;
        z-index: 100 !important;
    }
}

/* ── SIZES ── */

.card.small {
    width: 44px;
    height: 66px;
    padding: 3px 4px;
    border-radius: 6px;
    margin: 0 -12px;
}

.card.large {
    width: 80px;
    height: 120px;
    margin: 0 10px;
}

/* ── CORNER (rank + suit) ── */

.card .corner {
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    color: #111111 !important;
    text-shadow: none;
    text-align: left !important;
    width: 100%;
    forced-color-adjust: none;
    letter-spacing: -0.5px;
}

.card.small .corner { font-size: 11px; }
.card.large .corner { font-size: 20px; }

/* Red cards */
.card.red .corner {
    color: #cc1111 !important;
}

.card .corner-bottom {
    transform: rotate(180deg);
    align-self: flex-end;
}

/* ── CENTER SUIT (decorative watermark) ── */

.card .suit-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 34px;
    color: #111111 !important;
    opacity: 0.07;
    pointer-events: none;
    forced-color-adjust: none;
}

.card.small .suit-center { font-size: 22px; }
.card.large .suit-center { font-size: 46px; }
.card.red   .suit-center { color: #cc1111 !important; opacity: 0.09; }

/* ── HIDDEN CARD (face-down) ── */

.card.hidden {
    background:
        repeating-linear-gradient(
            45deg,
            rgba(255,255,255,0.05) 0px,
            rgba(255,255,255,0.05) 2px,
            transparent 2px,
            transparent 6px
        ),
        repeating-linear-gradient(
            -45deg,
            rgba(255,255,255,0.05) 0px,
            rgba(255,255,255,0.05) 2px,
            transparent 2px,
            transparent 6px
        ),
        linear-gradient(155deg, #b71c1c 0%, #8b0000 50%, #6a0000 100%) !important;

    border: 2px solid rgba(255,255,255,0.18) !important;
    box-shadow:
        2px 4px 10px rgba(0,0,0,0.6),
        inset 0 0 20px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.15) !important;
    align-items: center;
    justify-content: center;
    color-scheme: light !important;
}

.card.hidden .corner,
.card.hidden .suit-center { display: none; }

/* Small diamond pattern on back */
.card.hidden::after {
    content: '◆';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: rgba(255,255,255,0.2);
    pointer-events: none;
}
.card.small.hidden::after { font-size: 12px; }
.card.large.hidden::after { font-size: 24px; }

/* ── SELECTED state (non-fan cards only) ── */

.card.selected:not(.tl-fan-card) {
    transform: translateY(-14px) scale(1.06) !important;
    box-shadow:
        0 0 0 3px #22c55e,
        0 14px 28px rgba(0,0,0,0.55),
        inset 0 1px 0 rgba(255,255,255,0.9) !important;
    z-index: 50 !important;
}

/* Fan card selected: nhô lên qua JS inline transform, chỉ thêm viền + shadow + z-index cao */
.tl-fan-card.selected {
    box-shadow:
        0 0 0 3px #22c55e,
        0 16px 32px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.9);
    z-index: 200 !important;
    outline: none;
}

/* ── Dark-mode override (belt-and-suspenders) ── */

@media (prefers-color-scheme: dark) {
    .card:not(.hidden) {
        background: linear-gradient(170deg, #ffffff 0%, #f8f4ee 100%) !important;
        color: #111111 !important;
        border-color: #d0d0d0 !important;
    }
    .card:not(.hidden) .corner     { color: #111111 !important; }
    .card:not(.hidden) .suit-center{ color: #111111 !important; }
    .card.red:not(.hidden) .corner      { color: #cc1111 !important; }
    .card.red:not(.hidden) .suit-center { color: #cc1111 !important; }
}
