body {
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: #eee;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.game-header {
    padding: 10px;
    text-align: center;
}

/* Toolbar and button styles */
.toolbar {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn {
    background: #2e2e2e;
    color: #eee;
    border: 1px solid #666;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}
.btn:hover { background: #3a3a3a; }

/* Editor overlay (used by overlay mode, kept for compatibility) */
.editor-overlay {
    position: fixed;
    top: 60px;
    right: 20px;
    width: min(720px, 95vw);
    max-height: calc(100vh - 90px);
    overflow: auto;
    background: rgba(10, 10, 10, 0.95);
    border: 2px solid #555;
    border-radius: 6px;
    padding: 12px;
    z-index: 1000;
    display: none; /* hidden by default */
    pointer-events: auto; /* interactive */
}

/* Standalone editor page */
body.editor-page {
    overflow: auto;
}

.editor-page__main {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.editor-page__editor {
    width: min(980px, 98vw);
    background: rgba(10, 10, 10, 0.95);
    border: 2px solid #555;
    border-radius: 6px;
    padding: 12px;
    box-sizing: border-box;
}

/* Editor layout */
.editor__header {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 8px;
}

.editor__label {
    font-size: 13px;
    color: #ccc;
}

.editor__input {
    background: #1f1f1f;
    color: #eee;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 6px;
    width: 80px;
}

.editor__tools {
    display: flex;
    gap: 8px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.editor__canvas {
    border: 2px solid #444;
    background: #000;
    display: block;
    max-width: 100%;
    /* better drawing UX on touch devices */
    touch-action: none;
    /* crisp pixels when the canvas is scaled */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.editor__palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, 28px);
    gap: 6px;
    margin-top: 10px;
}

.palette__swatch {
    width: 24px;
    height: 24px;
    border: 2px solid #444;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0,0,0,0.6);
}

.palette__swatch--selected {
    border-color: #fff;
}

.editor__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.editor__layers {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.editor__layer--selected {
    outline: 2px solid #7dd3fc;
}

.editor__section {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.editor__toolset {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.editor__pill {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    background: #1f1f1f;
    border: 1px solid #555;
    border-radius: 18px;
    padding: 4px 8px;
    font-size: 13px;
}

.editor__help {
    margin-top: 16px;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 10px;
}
.editor__help h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
}
.editor__help ol {
    margin: 0;
    padding-left: 18px;
}
.editor__help p {
    margin-top: 10px;
    color: #ccc;
    font-size: 13px;
}

.editor__toast {
    margin-top: 10px;
    color: #80ff80;
    transition: opacity 0.3s ease;
    opacity: 0;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 600px) {
    .editor__input { width: 64px; }
}

#game-container {
    border: 4px solid #444;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.ui-overlay {
    position: absolute;
    top: 60px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border: 2px solid #888;
    border-radius: 5px;
    pointer-events: none;
    font-size: 18px;
    line-height: 1.5;
}

.ui-overlay span {
    font-weight: bold;
}