@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: #dc2626;
    --blue: #1d4ed8;
    --yellow: #eab308;
    --black: #1e293b;
    --okey-gold: #d97706;
    
    /* 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.88);
    --accent-btn: #0284c7;
    --accent-btn-hover: #0369a1;
    --danger-btn: #dc2626;
    --danger-btn-hover: #b91c1c;
    --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(0, 0, 0, 0.35), 0 0 1px rgba(0, 0, 0, 0.2); }
.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: #c2410c;
}

.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: #ffffff;
}

/* 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;
}

/* ==========================================================================
   Phase 1.5: Mode Selection Cards & Layout
   ========================================================================== */
.mode-select-header {
    text-align: center;
    margin: 24px 0 28px 0;
}

.mode-select-header h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mode-select-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
}

.mode-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    max-width: 860px;
    margin: 0 auto;
}

.mode-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    padding: 30px 26px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.mode-card.camera-card {
    border-color: rgba(46, 204, 113, 0.3);
}
.mode-card.camera-card:hover {
    border-color: rgba(46, 204, 113, 0.6);
    box-shadow: 0 14px 38px rgba(46, 204, 113, 0.2);
}

.mode-card-badge {
    position: absolute;
    top: 18px;
    right: 20px;
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.4);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.manual-card .mode-card-badge {
    background: rgba(2, 132, 199, 0.2);
    color: #38bdf8;
    border-color: rgba(2, 132, 199, 0.4);
}

.mode-card-icon {
    font-size: 2.8rem;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.mode-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #ffffff;
}

.mode-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0 0 18px 0;
    line-height: 1.5;
}

.mode-card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.mode-card-features li {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-start-btn {
    width: 100%;
    margin-top: auto;
    padding: 13px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
}

/* ==========================================================================
   Phase 2A: Camera Mode & AR Istaka Viewport
   ========================================================================== */
#step-camera {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

.camera-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 12px;
}

.camera-top-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.camera-indicator-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.88rem;
    font-weight: 600;
}

.camera-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.btn-mini {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

.btn-camera-source {
    background: rgba(124, 58, 237, 0.35);
    border-color: rgba(167, 139, 250, 0.5);
    color: #ede9fe;
}

.camera-viewport-wrap {
    position: relative;
    width: 100%;
    min-height: 280px;
    max-height: 52vh;
    background: #06090e;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

#camera-feed {
    width: 100%;
    height: 100%;
    max-height: 52vh;
    object-fit: contain;
    display: block;
}

/* Shutter Flash Animation */
.camera-flash {
    position: absolute;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 25;
}
.camera-flash.flash-active {
    animation: cameraShutterFlash 0.35s ease-out;
}
@keyframes cameraShutterFlash {
    0% { opacity: 0.85; }
    100% { opacity: 0; }
}

/* Detected Hand Summary Card */
.camera-hand-summary {
    margin-top: 12px;
    background: rgba(18, 26, 38, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeInSlide 0.3s ease;
}
.hand-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.hand-summary-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    color: #f1f5f9;
}
.hand-summary-title strong {
    color: #38bdf8;
}
.hand-summary-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.hand-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.hand-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.hand-chip.chip-red { color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.18); }
.hand-chip.chip-blue { color: #93c5fd; border-color: rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.18); }
.hand-chip.chip-yellow { color: #fde047; border-color: rgba(234, 179, 8, 0.4); background: rgba(234, 179, 8, 0.18); }
.hand-chip.chip-black { color: #cbd5e1; border-color: rgba(148, 163, 184, 0.4); background: rgba(15, 23, 42, 0.7); }
.hand-chip.chip-okey { color: #d8b4fe; border-color: rgba(168, 85, 247, 0.5); background: rgba(168, 85, 247, 0.25); font-weight: 700; }

.camera-scan-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 20;
}

.camera-scan-overlay p {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 600;
    margin: 0;
}

/* ==========================================================================
   Digital Dual-Tier Istaka Rack (As seen in Screenshot 2026-09-02 211850.png)
   ========================================================================== */
.camera-ar-rack-wrapper {
    margin-top: 14px;
    background: linear-gradient(180deg, #422110 0%, #291409 60%, #1c0d05 100%);
    border: 2px solid #5a2f17;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.18), 0 8px 24px rgba(0, 0, 0, 0.55);
}

.camera-rack-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.camera-rack-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-pill {
    background: var(--accent-btn);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.badge-pill.badge-success {
    background: #16a34a;
}
.badge-pill.badge-warning {
    background: #d97706;
}

.camera-info-note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
}

.btn-mini {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-mini:hover {
    background: rgba(255, 255, 255, 0.3);
}



.camera-live-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 52vh;
    object-fit: contain;
    pointer-events: none;
    z-index: 12;
}

.camera-rack-shelf-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.camera-rack-tier {
    display: grid;
    grid-template-columns: repeat(var(--rack-cols, 13), minmax(0, 1fr));
    gap: 5px;
    min-height: 52px;
}
.camera-rack-tier.top-tier {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding-bottom: 6px;
}

.camera-slot {
    background: rgba(0, 0, 0, 0.4);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    position: relative;
    min-width: 0;
}

.camera-slot:hover {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
}

.camera-slot .tile-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: tilePop 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tilePop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.camera-slot .tile {
    width: 100% !important;
    height: 48px !important;
    min-width: 0 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4) !important;
    border-radius: 5px !important;
}

/* Instructional hint under digital rack slots */
.camera-correction-text {
    text-align: center;
    color: #cbd5e1;
    font-size: 0.88rem;
    font-weight: 500;
    margin-top: 10px;
    padding: 7px 14px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
}

.camera-correction-text .correction-icon {
    font-size: 1rem;
}

.step2-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   Camera Mode Bottom Dock Controls
   ========================================================================== */
.camera-bottom-dock {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn-dock {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-dock:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-dock:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* Retake Photo Button */
.btn-retake {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}
.btn-retake:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.35) !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-gallery {
    background: rgba(2, 132, 199, 0.2);
    border-color: rgba(2, 132, 199, 0.4);
    color: #38bdf8;
}
.btn-gallery:hover {
    background: rgba(2, 132, 199, 0.35) !important;
}

.btn-reset-scan {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.35);
    color: #fca5a5;
}
.btn-reset-scan:hover {
    background: rgba(220, 38, 38, 0.3) !important;
}

/* Prominent "Hesapla" Calculate Button */
.btn-calculate {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: rgba(16, 185, 129, 0.7);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.45);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-calculate:hover:not(:disabled) {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.65);
    transform: translateY(-2px);
}

.btn-calculate:active:not(:disabled) {
    transform: translateY(0);
}

.btn-calculate:disabled {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.4);
    box-shadow: none;
}

.btn-calculate .calc-icon {
    font-size: 1.15rem;
    display: inline-block;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
}

/* "+ Taş Ekle" Toolbar Button */
.btn-add-tile {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #6ee7b7;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-tile:hover {
    background: rgba(16, 185, 129, 0.35);
    border-color: #10b981;
    color: #ffffff;
    transform: scale(1.03);
}

/* Step 3: Results 3-Tab Switcher */
.results-tabs-bar {
    display: flex;
    gap: 10px;
    margin: 16px 0 20px 0;
    padding: 6px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    width: 100%;
    box-sizing: border-box;
}

.btn-result-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn-result-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.btn-result-tab.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Custom Tab Themes for Active State */
.btn-result-tab#tab-result-optimal.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(5, 150, 105, 0.25) 100%);
    border-color: rgba(16, 185, 129, 0.55);
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.3);
}

.btn-result-tab#tab-result-optimal-okey.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35) 0%, rgba(109, 40, 217, 0.25) 100%);
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 4px 18px rgba(139, 92, 246, 0.3);
}

.btn-result-tab#tab-result-double.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35) 0%, rgba(217, 119, 6, 0.25) 100%);
    border-color: rgba(245, 158, 11, 0.55);
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.3);
}

.btn-result-tab .tab-icon {
    font-size: 1.15rem;
}

.btn-result-tab .tab-badge {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #cbd5e1;
}

.btn-result-tab.active .tab-badge {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
}

@media (max-width: 680px) {
    .results-tabs-bar {
        flex-direction: column;
        gap: 6px;
    }
    .btn-result-tab {
        justify-content: space-between;
        padding: 10px 14px;
        width: 100%;
    }
}

/* Quick Result Modal & Groups Styling */
.quick-result-modal-content {
    max-width: 620px;
    background: linear-gradient(180deg, #182333 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.quick-score-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.quick-score-stat {
    display: flex;
    flex-direction: column;
}
.quick-score-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.quick-score-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: #2ecc71;
    font-family: var(--font-heading);
}
.quick-score-side {
    text-align: right;
}
.quick-side-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: block;
}
.quick-side-formula {
    font-size: 1.15rem;
    font-weight: 700;
    color: #38bdf8;
}
.quick-groups-wrap, .quick-unused-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Prominent Apply Hand Button */
.btn-apply-hand {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.4);
}
.btn-apply-hand:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    box-shadow: 0 6px 22px rgba(22, 163, 74, 0.6);
}

/* Shutter Button */
.btn-shutter {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ffffff;
    border: 4px solid rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    padding: 0;
}

.btn-shutter:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(255, 255, 255, 0.3);
}

.btn-shutter:active {
    transform: scale(0.92);
}

.shutter-inner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #000000;
}

/* ==========================================================================
   Tile Edit Modal (Interactive Quick-Correction for Digital Rack)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: modalFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.tile-edit-modal-content {
    background: rgba(18, 24, 34, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    max-width: 480px;
    width: 92%;
    padding: 22px;
    color: #ffffff;
}

.tile-edit-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-edit-color {
    flex: 1 1 calc(33.333% - 8px);
    min-width: 100px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-edit-color:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.btn-edit-color.active {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.25);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.btn-edit-color.color-red { color: #f87171; }
.btn-edit-color.color-blue { color: #60a5fa; }
.btn-edit-color.color-yellow { color: #fbbf24; }
.btn-edit-color.color-black { color: #e2e8f0; }
.btn-edit-color.color-fake { color: #c084fc; }

.tile-edit-numbers-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.btn-edit-num {
    height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit-num:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.06);
}

.btn-edit-num.active {
    background: #2563eb;
    border-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.5);
}

.camera-slot {
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.camera-slot:hover {
    transform: scale(1.06);
    border-color: rgba(56, 189, 248, 0.7) !important;
    background: rgba(56, 189, 248, 0.12) !important;
}

.camera-slot:empty::after {
    content: '+';
    color: rgba(255, 255, 255, 0.25);
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

@media (max-width: 600px) {
    .camera-rack-tier {
        gap: 3px;
    }
    .camera-slot .tile {
        height: 38px !important;
    }
    .camera-bottom-dock {
        gap: 8px;
    }
    .btn-dock {
        padding: 8px 12px;
        font-size: 0.82rem;
    }
    .btn-shutter {
        width: 52px;
        height: 52px;
    }
    .shutter-inner {
        width: 38px;
        height: 38px;
    }
}

/* ==========================================================================
   Header Scoreboard Trigger Button
   ========================================================================== */
.btn-header-action {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.35));
    border: 1px solid rgba(96, 165, 250, 0.4);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.btn-header-action:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.45), rgba(37, 99, 235, 0.55));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ==========================================================================
   Camera Error / Permission Overlay
   ========================================================================== */
.camera-error-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    z-index: 25;
    animation: fadeInSlide 0.25s ease;
}

.camera-error-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.camera-error-overlay h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: #f87171;
    margin: 0 0 10px 0;
}

.camera-error-overlay p {
    font-size: 0.92rem;
    color: #cbd5e1;
    max-width: 420px;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.camera-error-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ==========================================================================
   Share Watermark & Trademark
   ========================================================================== */
.share-watermark-card {
    margin-top: 30px;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.watermark-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
}
.watermark-badge {
    font-weight: 700;
    color: #f1f5f9;
}
.watermark-trademark {
    color: #38bdf8;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}


