/* ==========================================================================
   DRAWTOGETHER — CUSTOM CSS
   ========================================================================== */

/* ——— Base ——— */
body {
    -webkit-tap-highlight-color: transparent;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Prevent mobile bounce/overscroll that can offset getBoundingClientRect readings */
    overscroll-behavior: none;
}

/* ——— Scrollbar (hidden for aesthetic) ——— */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ——— Bouncy interactions ——— */
.bouncy-hover {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.3s ease,
                background-color 0.2s;
}
.bouncy-hover:hover  { transform: scale(1.05); }
.bouncy-active:active { transform: scale(0.95); }

/* ——— Pulse ring (lobby avatar) ——— */
.pulse-ring {
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
@keyframes pulse-ring {
    0%   { transform: scale(0.95); box-shadow: 0 0 0 0   rgba(224,64,160,0.7); }
    70%  { transform: scale(1);    box-shadow: 0 0 0 10px rgba(224,64,160,0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0   rgba(224,64,160,0); }
}

/* ——— Color swatch select animation ——— */
@keyframes swatchSelect {
    0%   { transform: scale(1.2);  }
    50%  { transform: scale(1.38); }
    100% { transform: scale(1.22); }
}

/* ——— Backgrounds & Shadows ——— */
.bg-gradient-playful {
    background: linear-gradient(
        135deg,
        rgba(224,64,160,0.05) 0%,
        rgba(124,82,170,0.05) 50%,
        rgba(0,150,204,0.05)  100%
    );
}
.shadow-primary-tint   { box-shadow: 0 8px 24px rgba(224,64,160,0.2); }
.shadow-secondary-tint { box-shadow: 0 8px 24px rgba(124,82,170,0.2); }
.shadow-tertiary-tint  { box-shadow: 0 8px 24px rgba(0,150,204,0.2);  }

/* ——— Canvas checkered background ——— */
.bg-checkered {
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #ebebeb 25%, transparent 25%, transparent 75%, #ebebeb 75%, #ebebeb),
        linear-gradient(45deg, #ebebeb 25%, transparent 25%, transparent 75%, #ebebeb 75%, #ebebeb);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}



/* ——— Other Player Cursor ——— */
.cursor-indicator {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    display: flex;
    align-items: center;
    transition: top 0.08s ease-out, left 0.08s ease-out;
}

.cursor-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0096cc;
    border: 2.5px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

/* ——— Palette Grid & Panel ——— */
.palette-panel {
    height: 50vh;
    max-height: 400px;
    flex-shrink: 0;
    will-change: transform;
}
@media (min-width: 768px) {
    .palette-panel {
        height: 100%;
        max-height: none;
        flex-shrink: 1;
        will-change: auto;
    }
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 7px;
    align-content: start;
}
@media (min-width: 768px) {
    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
        gap: 9px;
    }
}

.color-swatch {
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: transform 0.2s cubic-bezier(0.175,0.885,0.32,1.275),
                border-color 0.15s,
                box-shadow 0.15s;
    will-change: transform;
}
.color-swatch:hover   { transform: scale(1.16); }
.color-swatch.selected {
    border-color: white;
    transform: scale(1.22);
    box-shadow: 0 0 0 2.5px #e040a0, 0 4px 12px rgba(224,64,160,0.3);
}

/* ——— Zoom Controls ——— */
.zoom-controls {
    position: absolute;
    left: 10px;
    top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #7c52aa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border: 1px solid rgba(220,200,224,0.5);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175,0.885,0.32,1.275),
                background 0.15s,
                box-shadow 0.15s;
}
.zoom-btn:hover  { transform: scale(1.1);  background: rgba(238,220,255,0.95); }
.zoom-btn:active { transform: scale(0.92); }

@media (min-width: 768px) {
    .zoom-btn { width: 40px; height: 40px; }
}

/* ——— Victory Screen — Artwork Container ——— */
.victory-artwork-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.victory-artwork-wrapper {
    display: inline-block;
    max-width: min(82vw, 360px);
    border-radius: 6px;
    overflow: hidden;
    transition: border 0.25s ease, box-shadow 0.25s ease, padding 0.25s ease, background 0.25s ease;
}

.victory-canvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ——— Frame Styles (CSS preview) ——— */
.frame-white {
    border: 18px solid #ffffff;
    box-shadow:
        0 16px 48px rgba(0,0,0,0.14),
        0 0 0 1px rgba(0,0,0,0.05);
}

.frame-wooden {
    border: 24px solid transparent;
    background-image:
        linear-gradient(#fff,#fff),
        linear-gradient(135deg, #5D4037 0%, #8D6E63 30%, #BCAAA4 50%, #8D6E63 70%, #5D4037 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 16px 48px rgba(93,64,55,0.28), inset 0 0 0 1.5px rgba(255,210,160,0.25);
}

.frame-gradient {
    border: 20px solid transparent;
    background-image:
        linear-gradient(#fff,#fff),
        linear-gradient(135deg, #e040a0 0%, #7c52aa 50%, #0096cc 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 16px 48px rgba(224,64,160,0.22);
}

.frame-polaroid {
    border: 14px solid #f2f2f0;
    border-bottom: 64px solid #f2f2f0;
    box-shadow:
        0 16px 48px rgba(0,0,0,0.16),
        0 2px 8px rgba(0,0,0,0.08);
    background: #f2f2f0;
}

.frame-luxury {
    border: 24px solid #12121f;
    box-shadow:
        0 16px 48px rgba(0,0,0,0.35),
        inset 0 0 0 2px  #d4af37,
        inset 0 0 0 5px  #12121f,
        inset 0 0 0 7px  #d4af37,
        inset 0 0 0 10px #12121f;
}

/* ——— Frame Selector Buttons ——— */
.frame-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 2px solid transparent;
    background: rgba(242,232,242,0.6);
    color: #604868;
    cursor: pointer;
    min-width: 52px;
    transition: transform 0.2s cubic-bezier(0.175,0.885,0.32,1.275),
                border-color 0.15s,
                background 0.15s,
                color 0.15s;
}
.frame-btn:hover {
    transform: scale(1.08);
    background: rgba(224,64,160,0.1);
    border-color: rgba(224,64,160,0.3);
}
.frame-btn-active {
    border-color: #e040a0;
    background: rgba(224,64,160,0.12);
    color: #e040a0;
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(224,64,160,0.2);
}

/* ——— Victory Action Buttons ——— */
.action-btn {
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175,0.885,0.32,1.275),
                box-shadow 0.2s ease;
    white-space: nowrap;
}
.action-btn:hover  { transform: scale(1.05); }
.action-btn:active { transform: scale(0.95); }

.action-btn-primary {
    background: #e040a0;
    color: white;
    box-shadow: 0 8px 20px rgba(224,64,160,0.28);
}
.action-btn-secondary {
    background: #7c52aa;
    color: white;
    box-shadow: 0 8px 20px rgba(124,82,170,0.28);
}
.action-btn-tertiary {
    background: #0096cc;
    color: white;
    box-shadow: 0 8px 20px rgba(0,150,204,0.28);
}
.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
