/* ===== HI-LO (Royale Violet) — chain game, real card faces, 3D flip ===== */

.hilo-stage {
    --acc: #5eead4;
    width: 100%;
    max-width: 356px;
    margin: 0 auto;
    background:
        radial-gradient(120% 60% at 50% 0%, rgba(94, 234, 212, 0.12), transparent 60%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(245, 196, 81, 0.22);
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    padding: 12px;
}

/* stats — same pill shell as mines */
.hilo-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

/* the board: current card, VS, next (face-down) card */
.hilo-board {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}
.hilo-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.hilo-tag {
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #a79fc2;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(245, 196, 81, 0.18);
    border-radius: 999px;
    padding: 3px 12px;
}
.hilo-vs {
    align-self: center;
    font-weight: 900;
    font-size: 0.8rem;
    color: #ffd76a;
    background: rgba(245, 196, 81, 0.12);
    border: 1px solid rgba(245, 196, 81, 0.4);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 26px;
    box-shadow: 0 0 14px rgba(245, 196, 81, 0.25);
}

/* stats pill shell (same as mines) */
.mstat {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(245, 196, 81, 0.16);
    border-radius: 12px;
    padding: 6px 4px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mstat-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #a79fc2;
}
.mstat-value {
    font-size: 0.98rem;
    font-weight: 800;
    color: #f5f0ff;
    font-variant-numeric: tabular-nums;
}
.mstat-gold {
    background: linear-gradient(180deg, #ffe9a8, #f5c451 55%, #c98f1f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* playing card */
.hilo-card-wrap { width: 100px; height: 142px; perspective: 700px; }
.pcard {
    position: relative;
    width: 100px;
    height: 142px;
    border-radius: 10px;
    background: linear-gradient(145deg, #ffffff, #dfe3ea);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    font-family: Georgia, 'Times New Roman', serif;
    overflow: hidden;
}
.pcard.red { color: #d61f3f; }
.pcard.black { color: #1c2333; }
.pcard-corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.pcard-corner b { font-size: 1.2rem; font-weight: 700; }
.pcard-corner i { font-style: normal; font-size: 0.9rem; }
.pcard-corner.tl { top: 7px; left: 8px; }
.pcard-corner.br { bottom: 7px; right: 8px; transform: rotate(180deg); }
.pcard-pip {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0.92;
}
/* face-down card back — violet felt with gold frame */
.pcard.facedown {
    background:
        radial-gradient(circle at 50% 42%, rgba(139, 92, 246, 0.5), transparent 60%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 6px, transparent 6px 12px),
        linear-gradient(150deg, #2c1a52, #150a28);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 0 0 3px rgba(245, 196, 81, 0.45);
}

/* 3D flip on the next-card slot */
.hilo-flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.3, 1); }
.hilo-flip.flipped { transform: rotateY(180deg); }
.hilo-flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.hilo-flip .face.back { transform: rotateY(180deg); }
.pcard.won { box-shadow: 0 0 0 3px #f5c451, 0 0 26px rgba(245, 196, 81, 0.6), 0 10px 24px rgba(0, 0, 0, 0.45); }
.pcard.lost { animation: hilo-shake 0.4s ease; filter: saturate(0.5); }
@keyframes hilo-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
}
.pcard.deal-in { animation: hilo-deal 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes hilo-deal {
    0% { transform: translateY(-14px) scale(0.9); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* guess buttons with live chance% + step multiplier */
.hilo-guess-row { display: flex; gap: 8px; }
.hilo-guess {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 10px 6px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.hg-label { font-size: 0.85rem; font-weight: 900; letter-spacing: 0.03em; }
.hg-meta { font-size: 0.68rem; font-weight: 700; color: #a79fc2; font-variant-numeric: tabular-nums; }
.hilo-guess.lo:not(:disabled) {
    background: linear-gradient(160deg, rgba(239, 68, 68, 0.85), rgba(127, 29, 29, 0.9));
    border-color: rgba(252, 165, 165, 0.6);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.35), 0 4px 0 rgba(0, 0, 0, 0.4);
}
.hilo-guess.hi:not(:disabled) {
    background: linear-gradient(160deg, rgba(34, 197, 94, 0.85), rgba(20, 83, 45, 0.9));
    border-color: rgba(134, 239, 172, 0.6);
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.35), 0 4px 0 rgba(0, 0, 0, 0.4);
}
.hilo-guess:not(:disabled):active { transform: scale(0.96); }
.hilo-guess:disabled { opacity: 0.45; cursor: default; }
.hilo-guess:disabled .hg-meta { color: #6f6794; }

/* chain trail */
.hilo-chain {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    min-height: 30px;
    overflow-x: auto;
    padding: 2px;
}
.chain-card {
    flex-shrink: 0;
    width: 34px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(145deg, #f4f6fa, #c9cfda);
    color: #1c2333;
    font-size: 0.66rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    animation: chain-in 0.3s ease both;
}
.chain-card.red { color: #d61f3f; }
.chain-card.last { outline: 2px solid #f5c451; outline-offset: 1px; }
@keyframes chain-in {
    0% { transform: translateX(10px) scale(0.8); opacity: 0; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}

@media (max-height: 700px) {
    .hilo-card-wrap, .pcard { width: 88px; height: 124px; }
    .pcard-pip { font-size: 2.5rem; }
    .hilo-board { margin-bottom: 8px; }
    .hilo-chain { margin-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
