/* ==========================================
   MINION 2D FULLSCREEN DRAWING - STYLESHEET
   ========================================== */

:root {
    --primary-yellow: #FFE838;
    --dark-yellow: #F7C910;
    --denim-blue: #2365BF;
    --dark-blue: #164387;
    --accent-red: #FF4757;
    --card-bg: rgba(15, 23, 42, 0.92);
    --card-border: rgba(255, 232, 56, 0.5);
    --text-color: #f8fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Baloo 2', 'Be Vietnam Pro', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    min-height: 100vh;
    width: 100vw;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    overflow: hidden;
    position: relative;
    color: var(--text-color);
}

/* Fullscreen Canvases */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

#mainArtCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2000;
}

/* Request Card Overlay */
.main-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 200;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.main-wrapper.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transform: scale(0.9);
}

.card {
    pointer-events: auto !important;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 32px;
    padding: 38px 30px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
                0 0 35px rgba(255, 232, 56, 0.3);
    border: 2px solid var(--card-border);
    max-width: 440px;
    width: 100%;
    position: relative;
    z-index: 210;
}

.card-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-yellow), var(--dark-yellow));
    color: var(--dark-blue);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(255, 232, 56, 0.4);
    margin-bottom: 20px;
}

.preview-avatar {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px auto;
    background: radial-gradient(circle, var(--primary-yellow) 0%, var(--dark-yellow) 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(255, 232, 56, 0.6);
    animation: pulseGlow 2s infinite ease-in-out;
}

.dot-icon {
    font-size: 1.8rem;
}

.card-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-yellow);
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(255, 232, 56, 0.3);
}

.card-subtitle {
    font-size: 1rem;
    color: #94a3b8;
    margin-bottom: 28px;
    line-height: 1.5;
}

.btn-group {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
    min-height: 55px;
    position: relative;
    z-index: 220;
    pointer-events: auto !important;
}

.btn {
    pointer-events: auto !important;
    position: relative;
    z-index: 230;
    padding: 13px 26px;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer !important;
    transition: all 0.25s ease;
    outline: none;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.btn-yes {
    background: linear-gradient(135deg, #FFE838 0%, #F7C910 100%);
    color: var(--dark-blue);
    box-shadow: 0 8px 20px rgba(247, 201, 16, 0.5);
}

.btn-yes:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 25px rgba(247, 201, 16, 0.8);
}

.btn-no {
    background: rgba(255, 255, 255, 0.15);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-no:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Bút Chì Di Chuyển Trên Màn Hình */
.pencil-tool {
    position: fixed;
    z-index: 1500;
    width: 48px;
    height: 48px;
    pointer-events: none;
    top: 0;
    left: 0;
    transition: transform 0.04s linear;
}

.pencil-tool.hidden {
    display: none !important;
}

.pencil-icon {
    font-size: 2.6rem;
    display: block;
    transform: rotate(-35deg);
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.8));
    animation: wigglePencil 0.18s infinite alternate ease-in-out;
}

.pencil-lead-glow {
    position: absolute;
    bottom: 0px;
    left: 0px;
    width: 10px;
    height: 10px;
    background: #FFE838;
    border-radius: 50%;
    box-shadow: 0 0 14px 4px #FFE838, 0 0 24px 8px #FF4757;
}

/* Floating Reset Button */
.floating-reset-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    pointer-events: auto !important;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(8px);
    color: var(--primary-yellow);
    border: 1px solid rgba(255, 232, 56, 0.5);
    padding: 10px 22px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}

.floating-reset-btn:hover {
    background: var(--denim-blue);
    color: white;
    transform: scale(1.06);
}

.floating-reset-btn.hidden {
    display: none !important;
}

/* Badge Tien Trinh Phac Chi Tren Cung */
.draw-status-badge {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1600;
    min-width: 280px;
    padding: 10px 18px 12px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 232, 56, 0.35);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.draw-status-badge.hidden {
    display: none !important;
}

.badge-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-color);
}

.badge-content .pencil-indicator {
    font-size: 1.1rem;
    animation: wigglePencil 0.18s infinite alternate ease-in-out;
}

.badge-content .status-title {
    flex: 1;
    white-space: nowrap;
}

.badge-content .status-percent {
    color: var(--primary-yellow);
    font-variant-numeric: tabular-nums;
}

.progress-bar-mini {
    margin-top: 8px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    overflow: hidden;
}

.progress-fill-mini {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-yellow), var(--dark-yellow));
    box-shadow: 0 0 10px rgba(255, 232, 56, 0.7);
    transition: width 0.12s linear;
}

/* Keyframes */
@keyframes wigglePencil {
    0% { transform: rotate(-30deg) translateY(0); }
    100% { transform: rotate(-44deg) translateY(-6px); }
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 232, 56, 0.6); }
    50% { transform: scale(1.08); box-shadow: 0 0 35px rgba(255, 232, 56, 0.9); }
}

/* ==========================================
   RESPONSIVE - DIEN THOAI & MAY TINH BANG
   ========================================== */

/* Chieu cao dong cua trinh duyet di dong (thanh dia chi an/hien) */
body {
    min-height: 100dvh;
}

#particle-canvas,
#confetti-canvas,
#mainArtCanvas {
    height: 100dvh;
}

/* Tranh khung xanh nhay khi cham tren mobile */
.btn,
.floating-reset-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (max-width: 600px) {
    .main-wrapper {
        padding: 16px;
    }

    .card {
        padding: 26px 18px 24px;
        border-radius: 24px;
        border-width: 1.5px;
    }

    .card-badge {
        font-size: 0.82rem;
        padding: 6px 14px;
        margin-bottom: 14px;
    }

    .preview-avatar {
        width: 58px;
        height: 58px;
        margin-bottom: 12px;
    }

    .dot-icon {
        font-size: 1.5rem;
    }

    .card-title {
        font-size: 1.4rem;
        line-height: 1.3;
    }

    .card-subtitle {
        font-size: 0.92rem;
        margin-bottom: 22px;
    }

    /* Hai nut xep doc, moi nut tran chieu ngang cho de bam */
    .btn-group {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 18px;
        font-size: 1rem;
    }

    /* Badge tien trinh: tran ngang, khong con de chong len nut Thu Lai */
    .draw-status-badge {
        left: 12px;
        right: 12px;
        min-width: 0;
        width: auto;
        transform: none;
        top: calc(12px + env(safe-area-inset-top, 0px));
        padding: 9px 14px 11px;
        border-radius: 14px;
    }

    .badge-content {
        font-size: 0.82rem;
        gap: 8px;
    }

    .badge-content .status-title {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Nut Thu Lai xuong goc duoi phai, khoi dam vao badge */
    .floating-reset-btn {
        top: auto;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        right: 16px;
        padding: 11px 20px;
        font-size: 0.9rem;
    }

    .pencil-icon {
        font-size: 2rem;
    }

    .pencil-tool {
        width: 38px;
        height: 38px;
    }
}

/* May rat hep (iPhone SE, Galaxy A...) */
@media (max-width: 360px) {
    .card-title {
        font-size: 1.24rem;
    }

    .btn {
        font-size: 0.94rem;
        padding: 13px 14px;
    }

    .badge-content .status-percent {
        font-size: 0.8rem;
    }
}

/* Dien thoai xoay ngang: man hinh thap, cat bot chieu cao */
@media (max-height: 520px) and (orientation: landscape) {
    .card {
        padding: 18px 22px;
        max-width: 520px;
    }

    .preview-avatar,
    .card-badge {
        display: none;
    }

    .card-title {
        font-size: 1.25rem;
        margin-bottom: 6px;
    }

    .card-subtitle {
        font-size: 0.88rem;
        margin-bottom: 14px;
    }

    .btn-group {
        flex-direction: row;
        gap: 12px;
    }

    .btn {
        width: auto;
        padding: 10px 20px;
    }

    .draw-status-badge {
        padding: 7px 14px 9px;
    }
}

/* Nguoi dung tat hieu ung chuyen dong */
@media (prefers-reduced-motion: reduce) {
    .pencil-icon,
    .preview-avatar {
        animation: none !important;
    }
}
