* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f0f0;
}

#toolbar {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    user-select: none;
    max-width: 280px;
}

#zoom-display {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.toolbar-section {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.toolbar-section:last-of-type {
    border-bottom: none;
}

.toolbar-section label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.tool-buttons {
    display: flex;
    gap: 6px;
}

.tool-btn {
    min-width: 40px;
    height: 40px;
    padding: 6px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

.tool-btn.active {
    border-color: #007bff;
    background: #007bff;
    color: white;
}

.brush-buttons {
    display: flex;
    gap: 6px;
}

.brush-btn {
    min-width: 40px;
    height: 40px;
    padding: 6px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brush-btn:hover {
    border-color: #28a745;
    background: #f0fff4;
}

.brush-btn.active {
    border-color: #28a745;
    background: #28a745;
    color: white;
}

#brush-section {
    display: none;
}

#brush-section.visible {
    display: block;
}

.color-palette {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.color-btn {
    width: 32px;
    height: 32px;
    border: 3px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
    border-color: #999;
}

.color-btn.active {
    border-color: #007bff;
    border-width: 4px;
    transform: scale(1.15);
}

#color-picker {
    width: 32px;
    height: 32px;
    border: 3px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    overflow: visible;
    transition: all 0.2s;
    background: conic-gradient(
        from 0deg,
        #ff0000 0deg,
        #ffff00 60deg,
        #00ff00 120deg,
        #00ffff 180deg,
        #0000ff 240deg,
        #ff00ff 300deg,
        #ff0000 360deg
    );
    position: relative;
}

#color-picker:hover {
    transform: scale(1.1);
    border-color: #999;
}

#color-picker.active {
    border-color: #007bff;
    border-width: 4px;
    transform: scale(1.15);
}

#color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    opacity: 0;
}

#color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
    opacity: 0;
}

#color-picker::-moz-color-swatch {
    border: none;
    border-radius: 50%;
    opacity: 0;
}

#stroke-width {
    width: 100%;
    height: 6px;
    cursor: pointer;
}

#width-value {
    font-weight: 700;
    color: #007bff;
}

#fill-section {
    display: none;
}

#fill-section.visible {
    display: block;
}

#fill-controls {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

#fill-controls label {
    font-size: 11px;
    margin-top: 6px;
}

#fill-color-picker {
    width: 100%;
    height: 32px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 6px;
}

#fill-opacity-value {
    font-weight: 700;
    color: #28a745;
}

#opacity-value {
    font-weight: 700;
    color: #007bff;
}

#fill-section label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

#fill-toggle {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: #007bff;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
    flex: 1;
}

button:hover {
    background: #0056b3;
}

button:active {
    background: #004085;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    background: white;
}

#canvas.panning {
    cursor: grab;
}

#canvas.panning:active {
    cursor: grabbing;
}

#ad-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: #f5f5f5;
    display: none; /* Hidden until AdSense is implemented */
    z-index: 900;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Shapes Section */
#shapes-section {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s, opacity 0.3s;
}

#shapes-section.visible {
    max-height: 400px;
    opacity: 1;
}

#shape-search {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
}

#shape-search:focus {
    outline: none;
    border-color: #007bff;
}

#shape-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    padding: 2px;
}

.shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 70px;
}

.shape-btn:hover {
    border-color: #007bff;
    background: #f0f8ff;
}

.shape-btn.active {
    border-color: #007bff;
    background: #007bff;
}

.shape-btn.active .shape-name {
    color: white;
}

.shape-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
}

.shape-name {
    font-size: 10px;
    text-align: center;
    color: #555;
    word-break: break-word;
    max-width: 100%;
}