@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
    --border: #e2e8f0;
    --shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
    --active-border: #0f172a;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

body {
    background: #ffffff;
    overflow: hidden;
    font-family: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

#drawCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    cursor: crosshair;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

.reset-btn {
    position: fixed;
    bottom: clamp(10px, 2vw, 18px);
    left: clamp(10px, 2vw, 18px);
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.9);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 120ms ease, box-shadow 120ms ease, background 150ms ease;
    touch-action: manipulation;
}

.reset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.22);
    background: rgba(15, 23, 42, 0.95);
}

.reset-btn:active {
    transform: translateY(1px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.reset-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

.palette {
    position: fixed;
    bottom: clamp(10px, 2vw, 18px);
    right: clamp(10px, 2vw, 18px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 10px 10px 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    user-select: none;
}

.palette__label {
    font-size: 0.8rem;
    margin: 0 0 6px 2px;
    color: #475569;
    letter-spacing: 0.04em;
}

.palette__grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(24px, 1fr));
    grid-auto-rows: 32px;
    gap: 6px;
    width: min(94vw, 360px);
}

.swatch {
    width: 100%;
    height: 100%;
    border-radius: 9px;
    border: 2px solid var(--border);
    background: var(--swatch-color);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
    padding: 0;
}

.swatch:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.swatch:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}

.swatch.is-active {
    border-color: var(--active-border);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px) scale(1.02);
}

@media (max-width: 540px) {
    .palette {
        padding: 8px 8px 6px;
    }

    .palette__grid {
        grid-auto-rows: 28px;
    }

    .swatch {
        border-radius: 8px;
    }
}
