:root {
    --bg-0: #0f1f2b;
    --bg-1: #0b141d;
    --panel-bg: rgba(10, 18, 26, 0.88);
    --panel-border: rgba(157, 194, 214, 0.32);
    --panel-glow: rgba(122, 199, 169, 0.18);
    --text-main: #f0f6fb;
    --text-subtle: #bfd3e2;
    --accent: #7ec09e;
    --accent-strong: #93d3b1;
    --danger: #ff8f8f;
    --canvas-grid: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background:
        radial-gradient(1200px 900px at 10% -10%, #1d3345 0%, transparent 45%),
        radial-gradient(1200px 900px at 85% 110%, #182738 0%, transparent 42%),
        linear-gradient(160deg, var(--bg-0), var(--bg-1));
    color: var(--text-main);
    font-family: "Trebuchet MS", "Gill Sans", "Century Gothic", sans-serif;
}

.editor-shell {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr min(470px, 42vw);
}

#editor-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background-image:
        linear-gradient(var(--canvas-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--canvas-grid) 1px, transparent 1px);
    background-size: 36px 36px;
}

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    overflow: auto;
    background:
        linear-gradient(180deg, rgba(6, 14, 21, 0.91), rgba(10, 17, 24, 0.86));
    border-left: 1px solid rgba(125, 173, 198, 0.27);
    backdrop-filter: blur(8px);
}

.panel {
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 10px 11px;
    background:
        linear-gradient(165deg, var(--panel-bg), rgba(12, 21, 31, 0.88));
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 12px 28px rgba(0, 0, 0, 0.22);
    animation: panel-in 0.45s ease both;
}

.panel h1,
.panel h2,
.panel h3 {
    margin: 0;
}

.panel h1 {
    font-size: 20px;
    letter-spacing: 0.02em;
    color: var(--accent-strong);
}

.panel h2 {
    font-size: 14px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #d0e4f2;
    margin-bottom: 8px;
}

.panel h3 {
    font-size: 12px;
    margin-bottom: 6px;
    color: #dceef8;
}

.panel-header {
    border-color: rgba(126, 192, 158, 0.5);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 14px 34px rgba(0, 0, 0, 0.3),
        0 0 26px var(--panel-glow);
}

#editor-status {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--text-subtle);
}

.to-game-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 9px;
    width: max-content;
    min-width: 118px;
    padding: 6px 10px;
    border-radius: 8px;
    color: #f4fff8;
    text-decoration: none;
    background: linear-gradient(160deg, #2f6c54, #22533f);
    border: 1px solid rgba(180, 243, 209, 0.34);
    transition: transform 120ms ease, filter 120ms ease;
}

.to-game-link:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-subtle);
}

input,
select,
button {
    font: inherit;
}

input,
select {
    width: 100%;
    border: 1px solid rgba(150, 190, 212, 0.38);
    border-radius: 7px;
    padding: 6px 8px;
    background: rgba(17, 29, 40, 0.95);
    color: #ecf7ff;
    outline: none;
}

input:focus,
select:focus {
    border-color: rgba(126, 192, 158, 0.95);
    box-shadow: 0 0 0 2px rgba(126, 192, 158, 0.18);
}

input[type="color"] {
    padding: 2px;
    height: 34px;
}

button {
    border: 1px solid rgba(180, 234, 205, 0.35);
    border-radius: 8px;
    background: linear-gradient(160deg, #2a5f49, #214b3a);
    color: #eefbf4;
    padding: 7px 10px;
    cursor: pointer;
    transition: transform 110ms ease, filter 110ms ease;
}

button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

button:active {
    transform: translateY(0);
}

button.danger {
    background: linear-gradient(160deg, #7c3131, #602424);
    border-color: rgba(255, 175, 175, 0.45);
}

.row-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 2px;
}

.tool-group {
    margin-top: 10px;
    padding: 8px;
    border: 1px solid rgba(138, 178, 201, 0.28);
    border-radius: 9px;
    background: rgba(12, 21, 30, 0.75);
}

.hint {
    margin: 4px 0 0;
    font-size: 11px;
    color: #9bc0d8;
}

.checkbox-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--accent);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.entity-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.entity-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.entity-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: #d6e8f4;
    padding: 5px 6px;
    border: 1px solid rgba(122, 164, 188, 0.26);
    border-radius: 7px;
    background: rgba(17, 29, 39, 0.82);
}

.entity-item button {
    padding: 4px 7px;
    font-size: 11px;
}

@keyframes panel-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .editor-shell {
        grid-template-columns: 1fr min(430px, 48vw);
    }
}

@media (max-width: 900px) {
    .editor-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 42vh 58vh;
    }

    .editor-sidebar {
        border-left: 0;
        border-top: 1px solid rgba(125, 173, 198, 0.27);
    }

    .settings-grid,
    .entity-columns {
        grid-template-columns: 1fr;
    }
}
