:root {
    --bg-color: #FFFBF0;
    --text-color: #5D5D5D;
    --card-bg: #FFFFFF;

    /* Cozy Palette */
    --primary-color: #B5EAD7; /* Pastel Green */
    --secondary-color: #FFDAC1; /* Peach */
    --accent-color: #FFB7B2; /* Pastel Pink */
    --btn-bg: #E2F0CB;
    --btn-hover: #C5E1A5;
    
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

body {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    width: 100%;
    max-width: 1000px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

header {
    text-align: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

h1 {
    margin: 10px 0 5px 0;
    color: var(--secondary-color);
    font-size: 2.5rem;
    text-shadow: 2px 2px 0px var(--accent-color);
    letter-spacing: 1px;
}

.subtitle {
    margin-top: 0;
    color: var(--primary-color);
    font-weight: bold;
    letter-spacing: 1px;
}

#canvas-container {
    flex-grow: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    position: relative;
    border: 2px dashed #E0E0E0;
}

canvas {
    touch-action: none; /* prevent scrolling when dragging pieces */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* UI Controls in Game */
.controls-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    flex-shrink: 0;
}

button, .btn {
    font-family: inherit;
    font-weight: bold;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    background-color: var(--btn-bg);
    color: #444;
    font-size: 1rem;
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    display: inline-block;
    text-align: center;
    box-sizing: border-box;
}

button:active, .btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

button:hover, .btn:hover {
    background-color: var(--btn-hover);
}

/* Modal and Overlays */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

.hidden {
    display: none !important;
}

.overlay-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 90%;
    width: 450px;
    animation: popIn 0.3s ease;
    box-sizing: border-box;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lobby-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.settings-section {
    background: var(--bg-color);
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
    border: 2px solid #EEE;
    text-align: left;
}

.settings-section label {
    font-weight: bold;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

input[type="file"] {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
}

input[type="text"] {
    padding: 15px;
    font-size: 1.2rem;
    border: 3px solid #EEE;
    border-radius: 12px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    color: #555;
    font-weight: bold;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
}

.join-section {
    display: flex;
    gap: 10px;
}

.join-section input {
    margin-bottom: 0;
    flex: 1;
    text-transform: uppercase;
}

.join-section button {
    flex: 1;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #444;
}

.btn-secondary {
    background-color: #EEE;
    color: #333;
}

/* File upload preview */
#image-preview-container {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    display: none;
    justify-content: center;
    align-items: center;
    background-color: #eee;
}

#image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Message toast */
#message-container {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
    pointer-events: none;
}

.message {
    background-color: #555;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.message.show {
    opacity: 1;
}
