* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: #111315;
  color: #edf2ee;
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  border-bottom: 1px solid #2d3338;
  background: #181b1e;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 38px;
  border: 2px solid #70c98b;
  border-radius: 7px;
  background: #20332a;
  color: #dff7e6;
  font-weight: 900;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  color: #9aa5a0;
  font-size: 12px;
  margin-top: 2px;
}

.editor-topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

button,
.editor-topbar a {
  border: 1px solid #424b55;
  border-radius: 7px;
  background: #242a2f;
  color: #edf2ee;
  padding: 8px 10px;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.editor-topbar a:hover {
  border-color: #70c98b;
}

#saveProject,
#playLevel {
  background: #244231;
  border-color: #70c98b;
  color: #e6ffed;
  font-weight: 700;
}

.editor-layout {
  display: grid;
  grid-template-columns: 260px minmax(640px, 1fr) 280px;
  gap: 12px;
  padding: 12px;
}

.panel,
.stage-panel {
  border: 1px solid #2d3338;
  border-radius: 8px;
  background: #181b1e;
}

.panel {
  padding: 12px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.level-panel,
.property-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100vh - 90px);
}

label {
  display: grid;
  gap: 5px;
  color: #c9d1cc;
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #394149;
  border-radius: 6px;
  background: #101214;
  color: #edf2ee;
  padding: 7px 8px;
}

select[size] {
  min-height: 142px;
  padding: 5px;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.stage-panel {
  min-width: 0;
  padding: 10px;
}

.tool-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.tool-strip button {
  min-height: 34px;
  padding: 7px 9px;
}

#editorCanvas {
  display: block;
  width: 100%;
  max-height: calc(100vh - 166px);
  aspect-ratio: 16 / 9;
  border: 2px solid #2b2f33;
  background: #8ec7db;
  image-rendering: pixelated;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.status-line {
  min-height: 28px;
  margin-top: 8px;
  color: #aeb8b2;
  font-size: 13px;
}

.selection-title {
  min-height: 36px;
  border: 1px solid #2d3338;
  border-radius: 7px;
  background: #101214;
  color: #dff7e6;
  padding: 9px;
  font-weight: 700;
}

.property-fields {
  display: grid;
  gap: 9px;
  overflow: auto;
  padding-right: 2px;
}

.property-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.import-export {
  display: grid;
  gap: 7px;
  margin-top: auto;
}

#jsonBox {
  min-height: 130px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

@media (max-width: 980px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .level-panel,
  .property-panel {
    min-height: 0;
  }
}
