@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

/* --- Design System & CSS Variables --- */
:root {
    /* Emerald Felt Theme (Default) */
    --bg-gradient: radial-gradient(circle at 50% 30%, #155734 0%, #0a331e 70%, #051d11 100%);
    --panel-bg: rgba(18, 53, 36, 0.7);
    --panel-border: rgba(255, 255, 255, 0.12);
    --rack-bg: rgba(7, 24, 16, 0.65);
    
    /* Tile Colors */
    --tile-bg: linear-gradient(180deg, #ffffff 0%, #f7f5ed 80%, #ebe7d8 100%);
    --tile-border: #d5d0bf;
    --tile-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 #ffffff, inset 0 -3px 0 #d8d3c3;
    
    /* Tile Text Colors */
    --red: #ef4444;
    --blue: #2563eb;
    --yellow: #f59e0b;
    --black: #1e293b;
    --okey-gold: #f59e0b;
    
    /* Typography & Accents */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --accent-btn: #00a8ff;
    --accent-btn-hover: #0097e6;
    --danger-btn: #e84118;
    --danger-btn-hover: #c23616;
    --gold-glow: 0 0 15px rgba(241, 196, 15, 0.7);
}

/* Midnight Luxury Dark Theme */
body.theme-midnight {
    --bg-gradient: radial-gradient(circle at 50% 30%, #1e293b 0%, #0f172a 70%, #090d16 100%);
    --panel-bg: rgba(30, 41, 59, 0.75);
    --panel-border: rgba(255, 255, 255, 0.1);
    --rack-bg: rgba(15, 23, 42, 0.75);
}

/* Royal Velvet Theme */
body.theme-velvet {
    --bg-gradient: radial-gradient(circle at 50% 30%, #3b1d5a 0%, #210d35 70%, #12051e 100%);
    --panel-bg: rgba(45, 22, 69, 0.75);
    --panel-border: rgba(255, 255, 255, 0.12);
    --rack-bg: rgba(26, 11, 41, 0.75);
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.3s ease;
}

/* --- Header Layout --- */
header {
    width: 100%;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10;
}

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

.header-title h1 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #ffffff 0%, #dcdde1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-selector {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.theme-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
    margin: 0 4px;
}

.theme-dot:hover {
    transform: scale(1.15);
}

.theme-dot.active {
    border-color: #ffffff;
    transform: scale(1.1);
}

.theme-dot.felt { background: #155734; }
.theme-dot.midnight { background: #1e293b; }
.theme-dot.velvet { background: #3b1d5a; }

.lang-toggle {
    display: flex;
    gap: 6px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.lang-btn.active-lang {
    background: var(--accent-btn);
    border-color: var(--accent-btn);
    box-shadow: 0 2px 8px rgba(0, 168, 255, 0.4);
}

/* --- Container & Step Cards --- */
.container {
    width: 95%;
    max-width: 1240px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px 0 40px;
}

.step-container {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    transition: all 0.3s ease;
}

.hidden {
    display: none !important;
}

h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin-top: 0;
    font-size: 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- 3D Tile Component --- */
.tile-wrapper {
    position: relative;
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s ease;
}

.tile-wrapper:hover {
    transform: translateY(-5px) scale(1.04);
}

.tile-wrapper:active {
    transform: translateY(-1px) scale(0.98);
}

.tile {
    width: 46px;
    height: 68px;
    background: var(--tile-bg);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    color: var(--black);
    box-shadow: var(--tile-shadow);
    border: 1px solid var(--tile-border);
    position: relative;
    overflow: hidden;
}

/* Glossy top sheen on tiles */
.tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 100%);
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    pointer-events: none;
}

.text-red { color: var(--red); text-shadow: 0 1px 0 rgba(0,0,0,0.12); }
.text-blue { color: var(--blue); text-shadow: 0 1px 0 rgba(0,0,0,0.12); }
.text-yellow { color: var(--yellow); text-shadow: 0 1px 1px rgba(180, 83, 9, 0.4); }
.text-black { color: var(--black); text-shadow: 0 1px 0 rgba(0,0,0,0.12); }

.tile.fake-okey {
    font-size: 15px;
    text-align: center;
    line-height: 1.1;
    padding: 4px;
}

.tile.fake-okey .fake-star {
    font-size: 22px;
    color: #e67e22;
}

.pool-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger-btn);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    z-index: 3;
    border: 1.5px solid #ffffff;
}

.is-okey .tile,
.tile.is-okey-tile {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.9), var(--tile-shadow), inset 0 0 8px rgba(245, 158, 11, 0.6);
    border: 2px solid #f59e0b !important;
}

.is-okey-num {
    margin-bottom: 8px;
}

.okey-badge-tag {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9.5px;
    color: #000000;
    background: #f59e0b;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 900;
    letter-spacing: 1px;
    z-index: 5;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.fake-badge-tag {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #ffffff;
    background: #d35400;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 900;
    letter-spacing: 0.5px;
    z-index: 5;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* --- Tile Pool Grid --- */
.pool-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 12px;
    border-left: 4px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.pool-row.pool-color-red { border-left-color: var(--red); }
.pool-row.pool-color-blue { border-left-color: var(--blue); }
.pool-row.pool-color-yellow { border-left-color: var(--yellow); }
.pool-row.pool-color-black { border-left-color: #94a3b8; }
.pool-row.pool-fake-row { border-left-color: #e67e22; justify-content: center; }

/* --- Dual-Tier Player Hand Rack --- */
.hand-rack-wrapper {
    background: var(--rack-bg);
    border-radius: 14px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.4);
    margin-bottom: 20px;
}

.rack-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.rack-count {
    font-size: 1.1rem;
    font-weight: 700;
}

.sort-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-sort {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-sort:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.hand-rack-grid {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 8px;
    justify-items: center;
}

.hand-slot {
    width: 46px;
    height: 68px;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s;
}

/* --- Buttons & Controls --- */
.btn {
    background: var(--accent-btn);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.btn:hover {
    background: var(--accent-btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: #636e72 !important;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none !important;
    box-shadow: none !important;
}

.btn-danger {
    background: var(--danger-btn);
}

.btn-danger:hover {
    background: var(--danger-btn-hover);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.action-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-card p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* --- Results Section --- */
.groups-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.group-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.group-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--okey-gold);
    display: flex;
    justify-content: space-between;
}

.group-tiles {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.score-card {
    background: rgba(0, 0, 0, 0.35);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.score-main {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.score-val {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    color: #2ecc71;
}

.calc-breakdown {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.unused-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Suggested drop tile highlight */
.suggested-drop .tile {
    border: 2px solid var(--danger-btn);
    box-shadow: 0 0 16px var(--danger-btn);
    animation: dropPulse 1.5s infinite;
}

@keyframes dropPulse {
    0% { box-shadow: 0 0 0 0 rgba(232, 65, 24, 0.8); }
    70% { box-shadow: 0 0 0 12px rgba(232, 65, 24, 0); }
    100% { box-shadow: 0 0 0 0 rgba(232, 65, 24, 0); }
}

.drop-prompt {
    color: #ff6b6b;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

/* --- Indicator & Header Bar Helpers --- */
.indicator-header-bar,
.results-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.indicator-header-info {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-tile {
    transform: scale(0.85);
    margin: -5px;
}

.header-divider {
    font-size: 1.4rem;
    opacity: 0.3;
    margin: 0 4px;
}

.btn-clear {
    background: rgba(232, 65, 24, 0.2);
    border-color: rgba(232, 65, 24, 0.4);
}

.btn-optimal-okey {
    background: var(--blue);
}

.btn-double-pairs {
    background: var(--yellow);
    color: #000000;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column;
    gap: 16px;
}

.spinner {
    width: 54px;
    height: 54px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: var(--accent-btn);
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

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

/* Mobile & Tablet Responsiveness */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .header-title h1 {
        font-size: 1.4rem;
    }

    .container {
        width: 100%;
        padding: 10px 8px 30px;
    }

    .step-container {
        padding: 14px 10px;
        border-radius: 14px;
    }

    .indicator-header-bar,
    .results-header-bar {
        gap: 10px;
        flex-direction: column;
        align-items: stretch;
    }

    .indicator-header-info {
        font-size: 0.95rem;
        gap: 8px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .hand-rack-wrapper {
        padding: 12px 8px;
        border-radius: 12px;
    }

    .rack-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .sort-btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .btn-sort {
        flex: 1 1 calc(33.33% - 6px);
        min-width: 65px;
        padding: 8px 4px;
        font-size: 0.82rem;
        justify-content: center;
        text-align: center;
    }

    /* Hand rack on mobile: 6 columns per row for large 48px x 70px touchable tiles */
    .hand-rack-grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
        width: 100%;
        justify-items: center;
    }

    .hand-rack-grid .tile-wrapper,
    .hand-rack-grid .hand-slot {
        width: 100%;
        max-width: 52px;
        aspect-ratio: 46 / 68;
        height: auto;
    }

    .hand-rack-grid .tile {
        width: 100%;
        height: 100%;
        font-size: clamp(18px, 5vw, 24px);
        border-radius: 6px;
    }

    .hand-rack-grid .tile.fake-okey {
        font-size: clamp(10px, 2.8vw, 13px);
        padding: 2px;
    }

    .hand-rack-grid .tile.fake-okey .fake-star {
        font-size: clamp(14px, 4vw, 18px);
    }

    /* Tile Pool Grid on mobile: 7 columns (7 tiles top subrow, 6 tiles bottom subrow per color) */
    .pool-grid {
        gap: 12px;
    }

    .pool-row {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 8px 6px;
        justify-items: center;
        padding: 8px 6px;
        background: rgba(0, 0, 0, 0.25);
        border-radius: 12px;
        border-left: 4px solid rgba(255, 255, 255, 0.2);
    }

    .pool-row.pool-color-red { border-left-color: var(--red); }
    .pool-row.pool-color-blue { border-left-color: var(--blue); }
    .pool-row.pool-color-yellow { border-left-color: var(--yellow); }
    .pool-row.pool-color-black { border-left-color: #94a3b8; }
    .pool-row.pool-fake-row {
        display: flex;
        justify-content: center;
        border-left-color: #e67e22;
        padding: 10px;
    }

    .pool-row .tile-wrapper {
        width: 100%;
        max-width: 48px;
        aspect-ratio: 46 / 68;
        height: auto;
    }

    .pool-row .tile {
        width: 100%;
        height: 100%;
        font-size: clamp(17px, 4.8vw, 23px);
        border-radius: 6px;
    }

    .pool-row .tile.fake-okey {
        font-size: clamp(10px, 2.8vw, 13px);
        padding: 2px;
    }

    .pool-badge {
        width: 18px;
        height: 18px;
        font-size: 10px;
        top: -4px;
        right: -4px;
        border-width: 1.5px;
    }

    .okey-badge-tag,
    .fake-badge-tag {
        font-size: clamp(7px, 2.2vw, 9.5px);
        padding: 1px 3px;
        bottom: 2px;
        letter-spacing: 0;
    }

    .is-okey-num {
        margin-bottom: 4px;
    }

    .action-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .score-val {
        font-size: 1.8rem;
    }

    .group-tiles .tile-wrapper {
        width: 42px;
        aspect-ratio: 46 / 68;
        height: auto;
    }

    .group-tiles .tile {
        width: 100%;
        height: 100%;
        font-size: 20px;
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .btn-sort {
        flex: 1 1 calc(50% - 6px);
    }
    .header-title h1 {
        font-size: 1.25rem;
    }
    .pool-row {
        gap: 6px 4px;
        padding: 6px 4px;
    }
    .hand-rack-grid {
        gap: 4px;
    }
}

/* --- Scan Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
}
.scan-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    margin-top: 16px;
    transition: all 0.2s ease;
    background: rgba(0, 0, 0, 0.2);
}
.scan-dropzone.dragover {
    border-color: var(--accent-btn);
    background: rgba(0, 168, 255, 0.1);
}
.scan-preview-container {
    margin-top: 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.cropper-wrapper {
    width: 100%;
    max-height: 420px;
    min-height: 200px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    background: #090c10;
}
.cropper-wrapper img {
    max-width: 100%;
    max-height: 420px;
    display: block;
}
/* CropperJS container override to ensure high visibility & smooth responsive bounding box */
.cropper-container {
    max-height: 420px !important;
    border-radius: 8px;
}
.crop-toolbar {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}
.btn-crop-tool {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-crop-tool:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}
.scan-compare-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}
.scanned-image-preview {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}
.scanned-image-preview h4, .detected-tiles-preview h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
}
.scanned-image-preview img {
    max-width: 100%;
    max-height: 260px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
#scan-hand-grid {
    background: transparent;
    border: none;
    padding: 0;
}
