@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Nunito', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: #f4f9ff; color: #333; display: flex; flex-direction: column; min-height: 100vh; overscroll-behavior-y: none; }

/* Header */
header { background: #ffffff; box-shadow: 0 4px 6px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; }
.logo-area { cursor: pointer; color: #ff5e5e; }
.logo-area h2 { font-size: 1.5rem; }
nav a { text-decoration: none; color: #555; margin-left: 20px; font-weight: 600; transition: color 0.3s; }
nav a:hover { color: #ff5e5e; }

/* Main Section */
.page-section { display: none; flex: 1; max-width: 1200px; margin: 0 auto; padding: 20px; width: 100%; }
.page-section.active { display: block; }
.workspace-container, .legal-container { background: #ffffff; border-radius: 20px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); max-width: 600px; margin: 0 auto; }

/* App Header */
.app-header { text-align: center; margin-bottom: 15px; }
.app-header h1 { font-size: 1.8rem; color: #222; }
.app-header p { color: #666; font-size: 1rem; }

/* Perfect Square Canvas (For PC) */
.canvas-wrapper {
    width: 100%;
    margin: 0 auto;
    background: #fff;
    border: 3px solid #c1d3fe;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1; 
    touch-action: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
canvas { width: 100%; height: 100%; cursor: crosshair; display: block; }

/* Tools: Colors & Size */
.drawing-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-top: 15px; padding: 10px 15px; background: #f8fbff; border-radius: 12px; }
.colors { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.color-btn { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; display: flex; justify-content: center; align-items: center; font-size: 14px; }
.color-btn.active { transform: scale(1.15); border: 2px solid #333; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.brush-size { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #555; margin-top: 5px; }
.brush-size input { cursor: pointer; }

/* Action Controls (Boxes) */
.action-controls { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; gap: 10px; }
.small-boxes { display: flex; gap: 10px; }

/* Chote Box (Undo, Redo, Clear) */
.box-btn {
    width: 45px; height: 45px;
    font-size: 1.2rem;
    background: #eef2f6;
    border: 2px solid #dce4ec;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    display: flex; justify-content: center; align-items: center;
}
.box-btn:active { transform: scale(0.90); background: #dce4ec; }
.box-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Blue Download Box */
.blue-box-btn {
    flex-grow: 1;
    background: #0066ff;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    padding: 12px 10px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 10px rgba(0, 102, 255, 0.3);
    text-align: center;
}
.blue-box-btn:active { transform: scale(0.97); box-shadow: 0 2px 5px rgba(0, 102, 255, 0.3); }

footer { background: #2b2b2b; color: #fff; padding: 15px; margin-top: auto; text-align: center; font-size: 0.9rem; }


/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
    .nav-container { padding: 10px 15px; }
    .logo-area h2 { font-size: 1.2rem; }
    nav a { font-size: 0.9rem; margin-left: 10px; }
    
    .page-section { padding: 10px; }
    .workspace-container { padding: 12px; border-radius: 15px; }
    
    /* Shrink Header to save space */
    .app-header { margin-bottom: 5px; padding: 5px 0; }
    .app-header h1 { font-size: 1.4rem; margin-bottom: 5px; }
    .app-header p { display: none; } /* Hide subtext on mobile */
    
    /* BIG CANVAS FOR MOBILE */
    .canvas-wrapper {
        width: 100%;
        height: 60vh !important; /* Mobile screen ki 60% height lega */
        aspect-ratio: auto !important; /* Purana square setting hata diya */
    }

    /* Make tools compact */
    .drawing-tools { padding: 10px; margin-top: 10px; flex-direction: column; gap: 10px; }
    .color-btn { width: 28px; height: 28px; }
    .brush-size { margin-top: 0; font-size: 0.9rem; }
    
    /* Shrink bottom buttons slightly */
    .action-controls { margin-top: 12px; gap: 8px; }
    .box-btn { width: 40px; height: 40px; font-size: 1.1rem; }
    .blue-box-btn { padding: 10px; font-size: 1rem; }
}