/* ==============================================
   BJ TRAINING HUB — Premium Casino UI
   ============================================== */

:root {
    --tr-bg: #0d0d1a;
    --tr-surface: rgba(15, 12, 40, 0.85);
    --tr-border: rgba(255, 255, 255, 0.1);
    --tr-accent: #7c3aed;
    --tr-accent2: #2563eb;
    --tr-gold: #f59e0b;
    --tr-gold-soft: rgba(245, 158, 11, 0.15);
    --tr-green: #10b981;
    --tr-red: #ef4444;
    --tr-text: #f1f5f9;
    --tr-text-sub: #94a3b8;
    --tr-felt: radial-gradient(ellipse at 50% 30%, #1a5c36 0%, #0f3d22 55%, #081f12 100%);
    --tr-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    --card-w: 90px;
    --card-h: 126px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--tr-bg);
    color: var(--tr-text);
    overflow-x: hidden;
}

/* ── Layout ── */
.training-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 16px;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Header ── */
.training-header {
    background: var(--tr-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--tr-border);
    border-radius: 18px;
    padding: 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--tr-shadow);
}

.training-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.training-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.training-title h1 {
    font-size: 1.45rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.badge-training {
    background: linear-gradient(135deg, var(--tr-accent), #4f46e5);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 99px;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.4);
    white-space: nowrap;
}

/* ── Tutorial Selector Cards ── */
.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 1100px) {
    .tutorial-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .tutorial-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

.tut-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--tr-border);
    border-radius: 14px;
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tut-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--tr-accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.tut-card:hover {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.4);
    transform: translateY(-3px);
}

.tut-card.active {
    background: rgba(124, 58, 237, 0.18);
    border-color: var(--tr-accent);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.tut-card.active::before {
    transform: scaleX(1);
}

.tut-card .tut-icon {
    font-size: 1.7rem;
    margin-bottom: 6px;
    display: block;
}

.tut-card .tut-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--tr-text-sub);
    line-height: 1.3;
}

.tut-card.active .tut-name {
    color: #fff;
}

/* ── Main Workspace ── */
.training-workspace {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 16px;
    flex: 1;
}

@media (max-width: 960px) {
    .training-workspace {
        grid-template-columns: 1fr;
    }
}

/* ── Casino Table Stage ── */
.table-stage {
    background: var(--tr-felt);
    border: 8px solid #1c1007;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6), var(--tr-shadow);
}

.table-stage::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px solid rgba(212, 170, 80, 0.2);
    border-radius: 16px;
    pointer-events: none;
}

.table-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.025);
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 6px;
    text-transform: uppercase;
}

.scene-canvas {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* ── Info / Control Panel ── */
.info-panel {
    background: var(--tr-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--tr-border);
    border-radius: 18px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--tr-shadow);
    overflow-y: auto;
}

.panel-step-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--tr-border);
}

.step-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid var(--tr-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.step-title h2 {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
}

.step-title p {
    font-size: 0.8rem;
    color: var(--tr-gold);
    font-weight: 600;
    margin-top: 3px;
}

/* ── Step Counter ── */
.step-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--tr-text-sub);
    font-weight: 600;
}

.step-dots {
    display: flex;
    gap: 5px;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.3s;
}

.step-dot.active {
    background: var(--tr-accent);
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.6);
}

.step-dot.done {
    background: var(--tr-green);
}

/* ── Content Body ── */
.step-body {
    flex: 1;
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--tr-text-sub);
}

.step-body strong {
    color: #fff;
    font-weight: 700;
}

.step-body ul {
    margin: 10px 0 0 18px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.step-body li {
    color: #e2e8f0;
}

.step-body .highlight-box {
    background: var(--tr-gold-soft);
    border-left: 4px solid var(--tr-gold);
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    color: #fde68a;
    font-size: 0.88rem;
    font-weight: 600;
    margin-top: 12px;
}

.step-body .danger-box {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--tr-red);
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    color: #fca5a5;
    font-size: 0.88rem;
    font-weight: 600;
    margin-top: 12px;
}

.step-body .success-box {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--tr-green);
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    color: #6ee7b7;
    font-size: 0.88rem;
    font-weight: 600;
    margin-top: 12px;
}

/* ── Controls ── */
.panel-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--tr-border);
}

.control-row {
    display: flex;
    gap: 10px;
}

.btn-tr {
    flex: 1;
    padding: 13px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-tr-prev {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--tr-border);
    color: var(--tr-text);
}

.btn-tr-prev:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(-2px);
}

.btn-tr-next {
    background: linear-gradient(135deg, var(--tr-accent), #4f46e5);
    color: #fff;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

.btn-tr-next:hover:not(:disabled) {
    background: linear-gradient(135deg, #9333ea, #6366f1);
    transform: translateX(2px);
    box-shadow: 0 6px 22px rgba(124, 58, 237, 0.5);
}

.btn-tr-replay {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-tr-replay:hover {
    background: linear-gradient(135deg, #14b8a6, #2dd4bf);
    transform: scale(1.02);
}

.btn-tr:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
}

/* ──────────────────────────────
   PURE CSS PLAYING CARDS
   ────────────────────────────── */
.card {
    width: var(--card-w);
    height: var(--card-h);
    background: #fff;
    border-radius: 10px;
    position: absolute;
    box-shadow: -2px 5px 16px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 7px;
    transition:
        left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.4s ease;
    cursor: pointer;
    user-select: none;
    z-index: 10;
}

.card.face-down {
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 50%, #1e3a8a 100%);
    background-image:
        linear-gradient(135deg, #1e40af 25%, transparent 25%),
        linear-gradient(225deg, #1e40af 25%, transparent 25%),
        linear-gradient(315deg, #1e40af 25%, transparent 25%),
        linear-gradient(45deg, #1e40af 25%, transparent 25%);
    background-color: #1e3a8a;
    background-size: 16px 16px;
}

.card:hover:not(.face-down) {
    transform: translateY(-10px) scale(1.06) !important;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.65), 0 0 18px rgba(124, 58, 237, 0.3) !important;
    z-index: 100 !important;
}

.card[data-suit="♥"],
.card[data-suit="♦"] {
    color: #dc2626;
}

.card[data-suit="♠"],
.card[data-suit="♣"] {
    color: #0f172a;
}

/* Corner values */
.card-corner {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0.9;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 6px;
}

.card-corner.top-left {
    top: 0;
    left: 0;
}

.card-corner.top-right {
    top: 0;
    right: 0;
}

.card-corner.bottom-left {
    bottom: 0;
    left: 0;
    transform: rotate(180deg);
}

.card-corner.bottom-right {
    bottom: 0;
    right: 0;
    transform: rotate(180deg);
}

.card-corner .val {
    font-size: 2.2rem;
    letter-spacing: -1px;
    font-family: 'Inter', sans-serif;
}

.card-corner .suit {
    font-size: 2.5rem;
    font-family: 'Segoe UI', 'Segoe UI Symbol', sans-serif;
}

.card-center-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.6rem;
    opacity: 0.08;
    pointer-events: none;
    font-family: 'Segoe UI', 'Segoe UI Symbol', sans-serif;
}

/* Value pop label */
.card-value-label {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: var(--tr-gold);
    color: #000;
    font-size: 0.78rem;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 99px;
    white-space: nowrap;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    opacity: 0;
}

.card-value-label.show {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* Chip */
.chip {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    position: absolute;
    border: 3px dashed rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 900;
    color: #fff;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    user-select: none;
    z-index: 20;
}

.chip-red {
    background: radial-gradient(circle at 35% 35%, #ef4444, #991b1b);
}

.chip-blue {
    background: radial-gradient(circle at 35% 35%, #3b82f6, #1e40af);
}

.chip-black {
    background: radial-gradient(circle at 35% 35%, #374151, #111827);
}

.chip-green {
    background: radial-gradient(circle at 35% 35%, #10b981, #065f46);
}

.chip-purple {
    background: radial-gradient(circle at 35% 35%, #8b5cf6, #5b21b6);
}

/* Zone label */
.zone-label {
    position: absolute;
    background: rgba(0, 0, 0, 0.6);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 5px 10px;
    text-align: center;
}

/* Hand gesture illustration */
.hand-gesture {
    position: absolute;
    font-size: 4.5rem;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

/* Payout arrow */
.payout-arrow {
    position: absolute;
    color: var(--tr-gold);
    font-size: 2rem;
    font-weight: 900;
    transition: all 0.5s ease;
    pointer-events: none;
}

/* Celebration */
.celebration {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 500;
    border-radius: 16px;
}

.celebration.show {
    opacity: 1;
    pointer-events: auto;
}

.celebration-box {
    background: rgba(10, 8, 30, 0.97);
    border: 2px solid var(--tr-gold);
    border-radius: 20px;
    padding: 28px 44px;
    text-align: center;
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.5);
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration.show .celebration-box {
    transform: scale(1);
}

.celebration-box h3 {
    font-size: 1.8rem;
    color: var(--tr-gold);
    margin-bottom: 8px;
}

.celebration-box p {
    font-size: 1rem;
    color: #fff;
}

/* Progress bar */
.progress-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tr-accent), #06b6d4);
    border-radius: 99px;
    transition: width 0.5s ease;
}

/* --- Card Sorting Specifics --- */
.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 54%;
    height: 42%;
    border: 1px dashed rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    padding: 2px;
    background: rgba(248, 250, 252, 0.85);
}

.barcode {
    width: 100%;
    height: 32px;
    background: repeating-linear-gradient(90deg, #000 0px, #000 2px, transparent 2px, transparent 3px, #000 3px, #000 6px,
            transparent 6px, transparent 8px, #000 8px, #000 9px, transparent 9px, transparent 11px,
            #000 11px, #000 14px, transparent 14px, transparent 15px, #000 15px, #000 18px);
    border-radius: 2px;
}

.card-center-suit {
    position: absolute;
    font-size: 3.5rem;
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
    font-family: 'Segoe UI', 'Segoe UI Symbol', sans-serif;
}

.card-deck-badge {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #000000;
    color: #ffffff;
    border: 1.5px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 900;
    line-height: 1;
    z-index: 10;
}

.zone-box {
    border: 2px dashed rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 12px;
    position: absolute;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.zone-box.highlight {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.deck-box-3d {
    position: absolute;
    width: 120px;
    height: 160px;
    background: linear-gradient(135deg, #334155, #1e293b);
    border: 2px solid #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.deck-box-3d.horizontal {
    transform: rotate(90deg);
}

.deck-box-3d.vertical {
    transform: rotate(0deg);
}

/* --- Casino Table Props (Scanner, Boxes, Guide Lines) --- */
.table-scanner {
    position: absolute;
    width: 60px;
    height: 120px;
    background: linear-gradient(145deg, #1f1f1f, #0a0a0a);
    border: 2px solid #333;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.1);
    z-index: 5;
}

.table-scanner::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 10px;
    right: 10px;
    height: 4px;
    background: #ef4444;
    /* red laser */
    box-shadow: 0 0 10px #ef4444;
    border-radius: 2px;
}

.betting-box {
    position: absolute;
    width: 140px;
    height: 80px;
    border: 3px solid rgba(212, 170, 80, 0.4);
    border-radius: 50% 50% 10px 10px / 100% 100% 10px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(212, 170, 80, 0.5);
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.guide-line {
    position: absolute;
    background: transparent;
    border-top: 2px dashed rgba(255, 255, 255, 0.4);
    pointer-events: none;
    z-index: 8;
    transform-origin: left center;
}

.status-badge {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: dropIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.status-badge.correct {
    background: rgba(16, 185, 129, 0.85);
    border: 2px solid #34d399;
}

.status-badge.incorrect {
    background: rgba(239, 68, 68, 0.85);
    border: 2px solid #f87171;
}

@keyframes dropIn {
    from {
        transform: translate(-50%, -40px) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
    }
}

/* Connectors for Tooltips */
.anatomy-connector {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, #38bdf8, transparent);
    transform-origin: left center;
    z-index: 15;
    pointer-events: none;
}

.anatomy-connector::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    width: 10px;
    height: 10px;
    background: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 10px #38bdf8;
}

.glass-panel {
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Dealer Module Styles */
.dm-container {
    position: absolute;
    inset: 0;
    background: #080808; /* Very dark, almost black */
    display: flex;
    font-family: Arial, sans-serif;
    color: #fff;
    overflow: hidden;
    z-index: 50; /* Ensure it stays above canvas elements */
}

.dm-sidebar {
    width: 220px;
    background: #0d0d0d;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: 15px 10px;
}

.dm-menu-btn {
    border: 1px solid #cba239;
    color: #cba239;
    background: transparent;
    text-align: center;
    padding: 3px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100px;
    align-self: center;
}

.dm-sb-item {
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-family: monospace;
}

.dm-sb-item.yellow {
    color: #cba239;
}
.dm-sb-item.grey {
    color: #999;
}
.dm-sb-label {
    color: #999;
    display: inline-block;
    width: 60px;
}

.dm-status-icons {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dm-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-family: monospace;
}

.dm-status-row .icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.dm-status-row .state.ok {
    color: #22c55e;
    font-weight: bold;
}
.dm-status-row .state.off {
    color: #777;
}

.dm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dm-header {
    height: 60px;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #0d0d0d;
}

.dm-header-img {
    height: 45px;
    width: 45px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    background: #333;
}
.dm-header-dash {
    color: #cba239;
    font-weight: bold;
    font-size: 1.5rem;
}

.dm-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* Exactly equal 7 columns */
}

.dm-col {
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
    position: relative;
}
.dm-col:last-child {
    border-right: none;
}

.dm-col-top {
    display: flex;
    justify-content: space-between;
    padding: 10px;
}

.dm-col-num {
    font-size: 4rem;
    font-weight: normal;
    font-family: Arial, sans-serif;
    line-height: 0.9;
    color: #fff;
}

.dm-sidebet-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
    opacity: 0.3;
    padding-top: 5px;
}
.dm-sidebet-icon .sb-card {
    border: 1px solid #fff;
    border-radius: 3px;
    font-size: 0.6rem;
    padding: 1px 4px;
    text-align: center;
    font-weight: bold;
    transform: rotate(5deg);
}

.dm-center-dash {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #cba239;
    font-size: 2.5rem;
    font-weight: bold;
}

.dm-player-wrap {
    position: absolute;
    top: 35%;
    left: 10%;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}
.dm-player-wrap.show {
    opacity: 1;
}
.dm-player-icon {
    color: #fff;
    font-size: 1.2rem;
    transform: scaleX(-1); /* mirror arrow */
}
.dm-player-name {
    color: #cba239;
    font-size: 1.1rem;
    font-family: Arial, sans-serif;
}

.dm-footer {
    height: 90px;
    border-top: 1px solid #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #0d0d0d;
}

.dm-timer-bar-wrap {
    width: 300px;
    height: 18px;
    border: 2px solid #fff;
    position: relative;
    background: #000;
}
.dm-timer-fill {
    height: 100%;
    background: #60a5fa; /* Pragmatic light blue */
    width: 100%;
}
.dm-timer-text {
    position: absolute;
    right: -30px;
    top: -4px;
    font-size: 1.2rem;
    font-weight: normal;
    color: #fff;
}
.dm-timer-label {
    font-size: 1.8rem;
    font-weight: normal;
    color: #fff;
}

/* ==============================================
   📱 MOBILE OPTIMIZATIONS (Max: 768px)
   ============================================== */
@media (max-width: 768px) {
    /* Global Layout Adjustments */
    .training-app {
        padding: 8px;
        gap: 8px;
    }
    
    .training-header {
        padding: 12px;
    }

    .training-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    /* Swipeable Tutorial Tabs Instead of Stacked Grid */
    .tutorial-grid {
        display: flex !important;
        overflow-x: auto;
        padding-bottom: 8px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch; /* Smooth iOS scroll */
    }
    
    .tutorial-grid::-webkit-scrollbar {
        height: 4px;
    }
    .tutorial-grid::-webkit-scrollbar-thumb {
        background: var(--tr-accent);
        border-radius: 4px;
    }

    .tut-card {
        flex: 0 0 130px !important;
        scroll-snap-align: start;
        padding: 8px !important;
    }
    
    /* Casino Table Stage */
    .table-stage {
        min-height: 75vh; /* Massive height so it dominates the mobile screen */
        border-width: 4px;
        border-radius: 16px;
    }

    .info-panel {
        padding: 16px;
    }
    
    .panel-step-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .control-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-tr-next, .btn-tr-prev {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* ── Dealer Module Mobile Fixes ── */
    .dm-container {
        flex-direction: column;
        overflow-y: auto;
    }

    .dm-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid #333;
        padding: 10px;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
    }

    .dm-menu-btn {
        margin-bottom: 0;
        width: auto;
        padding: 4px 12px;
        order: -1;
    }

    .dm-status-icons {
        flex-direction: row;
        margin-top: 0;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        width: 100%;
    }

    /* Horizontal scroll for 7 columns */
    .dm-main {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .dm-grid {
        min-width: 700px; /* Forces boxes to maintain size so user can scroll left/right */
    }

    .dm-footer {
        min-width: 700px; /* Align footer width with grid */
    }
}

/* ==============================================
   DEALER MODULE NEW UI COMPONENTS
   ============================================== */

/* Fast fade-in animation (0.1s as requested) */
.fast-fade-in {
    animation: fastFadeIn 0.1s ease-out forwards;
}
@keyframes fastFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Popup (Beige Box) */
.dm-popup-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 100;
}
.dm-popup {
    background: #c5bba8; /* Beige/sand color from screenshot */
    color: #000;
    font-size: 2.5rem;
    padding: 60px 100px;
    border-radius: 12px;
    font-weight: normal;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    pointer-events: auto;
}

/* Floating Action Button & Menu */
.dm-fab-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
.dm-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #cba239;
    color: #000;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.dm-fab:hover { transform: scale(1.1); }
.dm-fab-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.2s;
}
.dm-fab-menu.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.dm-fab-btn {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.dm-fab-btn:hover { background: #555; color: #cba239; }
.dm-btn-black:hover { background: #111; }

.dm-dropdown-menu {
    position: absolute;
    top: 35px;
    left: 0;
    width: 190px;
    background: #3a3a3a;
    padding: 6px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 12px 28px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
}
.dm-dropdown-menu .dm-btn-group-black {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.dm-dropdown-menu .dm-btn-black {
    background: #0d0d0d;
    color: #cba239;
    border: none;
    border-radius: 5px;
    padding: 8px 10px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s, transform 0.1s;
}
.dm-dropdown-menu .dm-btn-black:hover {
    background: #262626;
    transform: scale(1.02);
}
.dm-dropdown-menu .dm-btn-black.dm-btn-disabled {
    color: #555;
    background: #111;
    cursor: default;
}
.dm-dropdown-menu .dm-btn-black.dm-btn-disabled:hover {
    background: #111;
    transform: none;
}

/* Dealer Area Top */
.dm-dealer-area {
    position: absolute;
    top: 0;
    left: 0;
    height: 60px;
    display: flex;
    align-items: center;
    padding-left: 20px;
    gap: 10px;
    z-index: 20;
}
.dm-dealer-total {
    color: #cba239;
    font-size: 1.5rem;
    font-weight: normal;
}
.dm-dealer-cards {
    display: flex;
    margin-top: 0;
}

/* Player Cards Column */
.dm-player-score {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 900;
    text-shadow: 0 2px 6px rgba(0,0,0,0.8);
    color: #cba239;
    margin-top: 15px;
    margin-bottom: 25px;
    min-height: 50px;
    position: relative;
    z-index: 10;
}
.dm-player-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 5px;
}

/* The real card scaled down for Dealer Module */
.dm-scaled-card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transition: none !important;
    transform: scale(1.3) !important;
    transform-origin: top center;
    margin-bottom: 38px !important;
    box-shadow: 0 -3px 15px rgba(0,0,0,0.8) !important;
    pointer-events: none !important; /* Prevents shrink on hover */
}
/* Stack them vertically in player columns */
.dm-player-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 5px;
    min-height: 150px;
}
.dm-player-cards .dm-scaled-card {
    margin-bottom: -55px !important;
}
.dm-player-cards .dm-scaled-card:last-child {
    margin-bottom: 38px !important;
}
/* Stack them horizontally in dealer area */
.dm-dealer-cards .dm-scaled-card {
    transform: scale(0.42) !important;
    transform-origin: left top;
    margin-right: -62px !important;
    margin-bottom: -73px !important;
    box-shadow: -3px 0 10px rgba(0,0,0,0.8) !important;
}
.dm-dealer-cards .dm-scaled-card:last-child {
    margin-right: -52px !important;
}

/* Outcome Icons */
.dm-outcome-container {
    position: absolute;
    bottom: 25px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 30;
}
.dm-outcome-icon {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.9rem;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9);
    gap: 6px;
    letter-spacing: 0.5px;
}
.dm-icon-graphic {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dm-icon-graphic svg {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
}
.txt-badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 900;
    text-shadow: none;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 0.5px;
}
.bg-win { background: #facc15; color: #000; }
.bg-lose { background: #ef4444; }
.bg-bj { background: #22c55e; color: #000; }
.bg-push { background: #3b82f6; }
.bg-bust { background: #f97316; }