:root {
  color-scheme: dark;
  font-family: "Noto Sans SC", system-ui, sans-serif;
  --ink: #10161d;
  --panel: #17212a;
  --panel-strong: #202c35;
  --line: #34434d;
  --line-soft: #27343d;
  --paper: #f4f3ed;
  --muted: #91a0a8;
  --pink: #ff4f91;
  --cyan: #35d6dd;
  --yellow: #ffd04a;
  --danger: #ff715d;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0b1016;
  color: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.editor-shell {
  width: 100vw;
  height: 100vh;
  min-width: 1100px;
  min-height: 640px;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  background: var(--ink);
}

.editor-topbar {
  z-index: 5;
  display: grid;
  grid-template-columns: 246px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #131c24;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.28);
}

.editor-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  border: 2px solid var(--cyan);
  color: var(--cyan);
  font: 400 13px "Black Ops One", sans-serif;
}

.editor-brand div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.editor-brand strong {
  font: 400 16px "Black Ops One", sans-serif;
}

.editor-brand div span {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.map-name-field {
  justify-self: center;
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.map-name-field input,
.search-field input,
.field-row input,
.field-row select {
  width: 100%;
  height: 32px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: 0;
  background: #0f171e;
  color: var(--paper);
}

.map-name-field input {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.map-name-field input:focus,
.search-field input:focus,
.field-row input:focus,
.field-row select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(53, 214, 221, 0.13);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.square-button,
.tool-button,
.zoom-control button,
.layer-action {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #18232c;
  color: var(--paper);
  cursor: pointer;
}

.square-button {
  width: 34px;
  height: 34px;
  font-size: 20px;
}

.command-button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #22303a;
  color: var(--paper);
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.play-button {
  border-color: #bd3e70;
  background: var(--pink);
  color: white;
}

.subtle-button,
.game-link {
  background: #121b22;
  color: #b8c3c8;
}

.file-button {
  user-select: none;
}

.square-button:hover,
.tool-button:hover,
.zoom-control button:hover,
.command-button:hover,
.layer-action:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.play-button:hover {
  border-color: #ff9bc0;
  color: white;
  background: #ff679e;
}

button:focus-visible,
a:focus-visible,
label[for="importInput"]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.34;
  cursor: default;
}

.editor-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 282px;
}

.asset-panel,
.property-panel {
  min-height: 0;
  background: var(--panel);
}

.asset-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  border-right: 1px solid var(--line);
}

.property-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border-left: 1px solid var(--line);
}

.panel-heading {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-heading div {
  display: grid;
  gap: 2px;
}

.panel-heading span {
  color: var(--cyan);
  font: 400 9px "Black Ops One", sans-serif;
}

.panel-heading strong {
  font-size: 15px;
}

.panel-heading output {
  min-width: 28px;
  color: var(--yellow);
  font: 400 12px "Black Ops One", sans-serif;
  text-align: right;
}

.compact-heading {
  min-height: 52px;
  padding-block: 9px;
}

.search-field {
  height: 46px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}

.search-field input {
  height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  max-height: 112px;
  overflow-y: auto;
  border-bottom: 1px solid var(--line-soft);
  scrollbar-width: thin;
}

.category-tabs::-webkit-scrollbar {
  width: 6px;
}

.category-tab {
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border: 0;
  background: #131c23;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.category-tab.is-active {
  color: var(--paper);
  background: var(--panel-strong);
  box-shadow: inset 0 -3px 0 var(--pink);
}

.asset-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 7px;
  padding: 10px;
  overflow-y: auto;
}

.asset-item {
  min-width: 0;
  min-height: 96px;
  display: grid;
  grid-template-rows: 61px auto;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #121b22;
  color: #d8dfe1;
  cursor: pointer;
}

.asset-item:hover {
  border-color: #5e7984;
  background: #1a252d;
}

.asset-item.is-active {
  border-color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
  color: white;
}

.asset-item canvas {
  width: 100%;
  height: 61px;
  display: block;
  background: #0c1319;
  image-rendering: pixelated;
}

.asset-item span {
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #090e13;
}

#editorCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  image-rendering: pixelated;
  touch-action: none;
}

.canvas-toolbar {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(106, 128, 139, 0.64);
  border-radius: 4px;
  background: rgba(18, 28, 36, 0.94);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.tool-button {
  width: 34px;
  height: 34px;
  font-size: 17px;
}

.tool-button.is-active {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #071419;
}

.tool-separator {
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: var(--line);
}

.zoom-control {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  height: 36px;
  display: grid;
  grid-template-columns: 34px 58px 34px;
  align-items: center;
  border: 1px solid rgba(106, 128, 139, 0.64);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(18, 28, 36, 0.94);
}

.zoom-control button {
  width: 34px;
  height: 34px;
  border-width: 0;
  border-radius: 0;
  font-size: 17px;
}

.zoom-control output {
  color: var(--paper);
  font: 400 10px "Black Ops One", sans-serif;
  text-align: center;
}

.canvas-status {
  position: absolute;
  z-index: 3;
  left: 12px;
  bottom: 12px;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(106, 128, 139, 0.55);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(14, 22, 29, 0.93);
  color: #b8c4c9;
  font-size: 9px;
  font-weight: 900;
  pointer-events: none;
}

.canvas-status span {
  min-width: 98px;
  padding: 0 10px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.canvas-status span:last-child {
  min-width: 118px;
  border-right: 0;
}

.minimap-shell {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 12px;
  width: 242px;
  border: 1px solid rgba(106, 128, 139, 0.62);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(13, 20, 27, 0.95);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.minimap-title {
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  color: var(--cyan);
  font: 400 8px "Black Ops One", sans-serif;
}

.minimap-title output {
  color: var(--muted);
}

#minimapCanvas {
  width: 240px;
  height: 132px;
  display: block;
  border-top: 1px solid var(--line-soft);
  cursor: crosshair;
}

.play-badge {
  position: absolute;
  z-index: 4;
  top: 64px;
  left: 50%;
  width: 330px;
  min-height: 50px;
  display: grid;
  place-content: center;
  gap: 3px;
  border: 2px solid var(--yellow);
  background: rgba(15, 22, 28, 0.94);
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.play-badge[hidden],
.editor-toast[hidden] {
  display: none;
}

.play-badge strong {
  color: var(--yellow);
  font: 400 14px "Black Ops One", sans-serif;
}

.play-badge span {
  color: #c6d0d4;
  font-size: 9px;
  font-weight: 800;
}

.editor-toast {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 58px;
  min-width: 180px;
  max-width: 430px;
  padding: 9px 14px;
  border: 1px solid var(--cyan);
  border-radius: 3px;
  background: rgba(10, 20, 26, 0.96);
  color: var(--paper);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
}

.property-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.inspector {
  min-height: 0;
  padding: 11px 12px 18px;
  overflow-y: auto;
}

.inspector-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed #40505a;
  color: #6f7e85;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.field-group {
  display: grid;
  gap: 8px;
  margin-bottom: 15px;
}

.field-group-title {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
}

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

.field-row {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.field-row.full {
  grid-column: 1 / -1;
}

.field-row input,
.field-row select {
  height: 31px;
  padding: 0 7px;
  font-size: 11px;
}

.field-row input[type="color"] {
  padding: 3px;
}

.checkbox-row {
  min-height: 31px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #c1cbcf;
  font-size: 10px;
  font-weight: 800;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--pink);
}

.combat-wave-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.combat-wave-heading,
.combat-wave-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.combat-wave-heading {
  padding-top: 3px;
  color: #ffc37c;
  font-size: 10px;
  font-weight: 900;
}

.combat-wave-heading small {
  color: var(--muted);
  font: 400 9px "Black Ops One", sans-serif;
}

.combat-wave-list {
  display: grid;
  gap: 7px;
}

.combat-wave-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #554535;
  border-left: 3px solid #ff9f43;
  border-radius: 3px;
  background: #181d21;
}

.combat-wave-card header strong {
  color: #f2f0e9;
  font-size: 10px;
}

.combat-wave-card header button {
  width: 25px;
  height: 25px;
  padding: 0;
  border-color: #70483c;
  color: #ff9e90;
  background: #2a1d1d;
  font-size: 17px;
  line-height: 1;
}

.combat-wave-card header button:disabled,
.combat-wave-add:disabled {
  cursor: default;
  opacity: 0.35;
}

.combat-wave-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.combat-wave-counts label {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: center;
  gap: 5px;
  color: #aebac0;
  font-size: 9px;
  font-weight: 800;
}

.combat-wave-counts input {
  width: 46px;
  height: 28px;
  padding: 0 5px;
  font-size: 10px;
}

.combat-wave-add {
  width: 100%;
  min-height: 32px;
  border: 1px dashed #8b673e;
  border-radius: 3px;
  color: #ffc37c;
  background: #211d19;
  font-size: 10px;
  font-weight: 900;
}

.inspector-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.inspector-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #22303a;
  color: var(--paper);
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.inspector-actions .danger-button {
  border-color: #71443e;
  color: #ff9e90;
  background: #2a1d1d;
}

.inspector-actions .snap-surface-button {
  grid-column: 1 / -1;
  border-color: #397b80;
  color: #b9f4ee;
  background: #173039;
}

.layer-section {
  border-top: 1px solid var(--line);
}

.layer-list {
  display: grid;
  padding: 7px 9px 10px;
}

.layer-row {
  min-height: 35px;
  display: grid;
  grid-template-columns: 30px 30px 1fr auto;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line-soft);
}

.layer-row:last-child {
  border-bottom: 0;
}

.layer-action {
  width: 26px;
  height: 26px;
  color: #95a4aa;
  font-size: 12px;
}

.layer-action.is-active {
  border-color: #48606b;
  color: var(--cyan);
  background: #1b2b33;
}

.layer-name {
  overflow: hidden;
  color: #d2dade;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-count {
  color: var(--muted);
  font: 400 9px "Black Ops One", sans-serif;
}

@media (max-width: 1320px) {
  .editor-topbar {
    grid-template-columns: 210px minmax(170px, 1fr) auto;
    gap: 10px;
  }

  .editor-workspace {
    grid-template-columns: 226px minmax(0, 1fr) 254px;
  }

  .command-button {
    padding-inline: 9px;
  }

  .game-link {
    display: none;
  }
}
