/* styles/main.css */
:root {
    --bg-color: #f0f8ff;
    --header-height: 60px;
    --toolbar-height: 100px;
    --primary-color: #8b4513; /* SaddleBrown */
    --accent-color: #ff69b4; /* HotPink */
}

* {
    box-sizing: border-box;
    user-select: none; /* Prevent text selection during drag */
    touch-action: none; /* Prevent default touch scrolling on game area */
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif; /* Kid-friendly font */
    overflow: hidden;
    background-color: var(--bg-color);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
}

h1 {
    font-size: 1.2rem;
    margin: 0;
}

.controls {
    display: flex;
    gap: 10px;
}

#reset-btn, #delete-btn {
    background-color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s, background-color 0.1s;
}

#delete-btn {
    background-color: #ffcccc;
    color: #cc0000;
}

#reset-btn:active, #delete-btn:active {
    background-color: #eee;
    transform: scale(0.95);
}

#delete-btn:active {
    background-color: #ffbbbb;
}

#game-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #e0f7fa; /* Light snow/sky */
    overflow: hidden;
}

canvas {
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    background-color: white; /* Fallback */
    border-radius: 8px;
}

#trash-zone {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 3rem;
    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 2px dashed #ccc;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    user-select: none;
}

#trash-zone.drag-over {
    transform: scale(1.2);
    background-color: #ffcccc;
    border-color: #ff0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}

#challenge-notification {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: white;
    border: 3px solid var(--accent-color);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 100;
    transition: opacity 0.3s, transform 0.3s;
}

#challenge-notification p {
    margin: 0 0 10px 0;
    font-weight: bold;
    color: #333;
}

.controls.vertical {
    flex-direction: column;
}

#start-challenge-btn, #start-defense-btn {
    width: 100%;
    margin-bottom: 5px;
}

#start-defense-btn {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.1s;
}

#start-defense-btn:active {
    transform: scale(0.9);
}

.hidden {
    display: none !important;
}

#toolbar {
    min-height: var(--toolbar-height);
    background-color: white;
    border-top: 4px solid var(--accent-color);
    display: flex;
    padding: 10px;
    z-index: 10;
    gap: 20px;
    overflow-x: auto;
}

.toolbar-section {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eee;
    padding-right: 20px;
}

.toolbar-section:last-child {
    border-right: none;
}

#toolbar h2 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    text-align: center;
    color: #555;
    text-transform: uppercase;
}

.palette {
    display: flex;
    gap: 10px;
    padding: 5px;
    align-items: center;
}

.base-section {
    position: relative;
    display: flex;
    align-items: center;
}

.accordion-header {
    background: none;
    border: 2px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    font-family: inherit;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: white;
}

.accordion-header:hover {
    background-color: #f0f0f0;
}

.accordion-content {
    position: fixed; /* Break out of overflow container */
    bottom: 110px; /* Approximate height of toolbar + gap */
    left: 20px; /* Align with left side */
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    gap: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    transition: opacity 0.2s, transform 0.2s;
    opacity: 1;
    transform: translateY(0);
    width: max-content;
    z-index: 1000;
}

.accordion-content.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    visibility: hidden;
}

.arrow {
    font-size: 0.8em;
    transition: transform 0.2s;
}

.accordion-content:not(.hidden) ~ .accordion-header .arrow { 
    /* This selector won't work because content is usually after header. 
       We'll toggle a class on the header via JS instead. */
}

.base-section.open .arrow {
    transform: rotate(180deg);
}

.palette-item, .base-item, .tool-item {
    width: 50px;
    height: 50px;
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    background-color: #f9f9f9;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    font-size: 1.5rem;
}

.palette-item {
    border-radius: 50%;
}

.tool-item {
    border-radius: 12px;
    background-color: #fff;
}

.tool-item.selected {
    background-color: #e0f7fa;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    transform: scale(1.1);
}

.tool-item.active {
    border-color: #f44336;
    background-color: #ffebee;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1.1); }
}

.palette-item:hover, .base-item:hover, .tool-item:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.palette-item:active, .base-item:active {
    transform: scale(0.9);
}

.base-item.selected {
    border-color: var(--accent-color);
    background-color: #fff0f5;
}
