/* ============================================
   editor.css —— 地图编辑器
   ============================================ */

body {
  background: #efe6d8;
}

#editor-app {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  text-align: left;
}

header h1 {
  font-size: 22px;
  margin-bottom: 2px;
}

.sub {
  color: #a08a70;
  font-size: 13px;
  margin: 0 0 14px;
}

.sub code {
  background: #ece1d2;
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---- 关卡信息 ---- */
.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  margin-bottom: 14px;
}

.meta label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #8a6f55;
}

.meta input {
  border: 1px solid #d9cbb8;
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  width: 150px;
}

.meta input#meta-id   { width: 110px; }
.meta input#meta-line { width: 280px; }

/* ---- 主区 ---- */
.workspace {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

/* ---- 工具面板 ---- */
.palette {
  width: 172px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.palette-title {
  font-size: 12px;
  color: #a08a70;
  margin: 12px 0 6px;
  letter-spacing: 1px;
}

.palette-title:first-child { margin-top: 0; }

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

.tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f4ede3;
  color: #3b2a1d;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 13px;
}

.tool-btn:hover { background: #ece1d2; }

.tool-btn.active {
  background: #6b4f3a;
  color: #fff;
}

.tool-emoji { font-size: 16px; }

.palette select {
  width: 100%;
  padding: 5px;
  border: 1px solid #d9cbb8;
  border-radius: 6px;
  font: inherit;
  background: #faf7f1;
}

.size-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.size-inputs label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #8a6f55;
}

.size-inputs input {
  width: 52px;
  border: 1px solid #d9cbb8;
  border-radius: 6px;
  padding: 4px;
  font: inherit;
}

/* ---- 画布 ---- */
.canvas-wrap {
  flex: 1;
  background: #e8dccb;
  border-radius: 16px;
  padding: 12px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
  min-height: 300px;
}

#canvas {
  display: grid;
  gap: 3px;
  width: fit-content;
  margin: 0 auto;
  --cell-size: 44px;
}

#canvas .cell {
  cursor: crosshair;
  border: 1px dashed transparent;
}

#canvas .cell:hover { border-color: #6b4f3a; }

/* 编辑器画布里：物品缩到左下角，玩家居中，避免重叠遮挡 */
#canvas .cell .item {
  position: absolute;
  left: 2px;
  bottom: 2px;
  font-size: 15px;
  width: auto;
  height: auto;
  display: block;
  z-index: 2;
}

/* 检查门在编辑器里的要求物品 emoji */
#canvas .cell .gate-req-editor {
  font-size: 15px;
}

#canvas .cell .player {
  font-size: 24px;
  animation: none;
}

/* ---- 导出区 ---- */
.export {
  margin-top: 14px;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.export-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.warnings { margin-bottom: 8px; }

.warning {
  font-size: 13px;
  color: #b4561e;
  background: #fdf0e6;
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 4px;
}

#output {
  width: 100%;
  height: 200px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  border: 1px solid #d9cbb8;
  border-radius: 8px;
  padding: 8px;
  resize: vertical;
}

/* 试玩模式 */
#test-mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 16px 40px;
  min-height: 60vh;
}
.test-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.test-title {
  font-size: 20px;
  color: #8a6f55;
  font-weight: 700;
}
.test-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
#test-board {
  display: grid;
  gap: 5px;
  justify-content: center;
  width: fit-content;
  padding: 12px;
  background: #e8dccb;
  border-radius: 16px;
}
.test-btn {
  background: #6b4f3a;
  color: #fff;
  font-weight: 700;
}

/* 试玩 HUD：编辑器是浅色背景，需覆盖深色文字 */
#test-mode .hud {
  background: #fff;
  color: #3b2a1d;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 试玩触屏按键：浅色背景适配（深色主题样式在 style.css，这里覆盖配色） */
#test-mode .touch-controls .tbtn {
  background: rgba(107, 79, 58, 0.12);
  color: #3b2a1d;
  border-color: rgba(107, 79, 58, 0.3);
}
#test-mode .touch-controls .tbtn:active {
  background: rgba(107, 79, 58, 0.25);
}
#test-mode .touch-controls {
  max-width: 420px;
  margin-top: 0; /* 编辑器里不需要贴底，避免挤压 hana 台词 */
}
