/* Tile Maze — level editor layout. Reuses tile/board/player styles
   and the color variables from styles.css. */

.ed-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}
@media (max-width: 820px) {
  .ed-stage { grid-template-columns: 1fr; }
}

.ed-boardcol { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ed-status {
  width: 100%; min-height: 1.4em; text-align: center;
  background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px; padding: 8px 12px; font-size: 0.9rem; color: var(--ink);
}
.ed-status.good { color: #bff7c4; border-color: rgba(87, 216, 106, 0.5); }
.ed-status.bad { color: #ffc2bd; border-color: rgba(176, 57, 47, 0.7); }

.ed-frame { touch-action: none; }
#edBoard { touch-action: none; }
#edBoard .tile { cursor: crosshair; }
#edBoard.testing .tile { cursor: default; }

.ed-dpad { margin-top: 4px; }

/* side controls */
.ed-side h3 {
  margin: 16px 0 8px; font-size: 0.78rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.ed-side h3:first-child { margin-top: 0; }

.palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.swatch-btn {
  position: relative; aspect-ratio: 1; border-radius: 10px; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.12); background: var(--void);
  display: flex; align-items: flex-end; justify-content: center; padding: 3px;
  font-size: 0.6rem; font-weight: 700; color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); overflow: hidden;
}
.swatch-btn .ico {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}
.swatch-btn.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.35); }
.sw-pink { background: var(--pink); } .sw-green { background: var(--green); }
.sw-yellow { background: var(--yellow); color: #4a3a00; }
.sw-orange { background: var(--orange); }
.sw-purple { background: linear-gradient(135deg, var(--purple), #c79bef); }
.sw-start { background: var(--pink); } .sw-goal { background: var(--pink); }
.sw-void { background: var(--void); border-style: dashed; }
/* match the in-game tiles: red is striped, blue is rippling water */
.sw-red { background: repeating-linear-gradient(45deg, var(--red) 0 6px, #962f26 6px 12px); }
.sw-blue {
  background-image:
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='16'%3E%3Cpath%20d='M0%205%20q6%20-4%2012%200%20t12%200'%20fill='none'%20stroke='rgba(255,255,255,.40)'%20stroke-width='1.6'/%3E%3Cpath%20d='M0%2012%20q6%20-4%2012%200%20t12%200'%20fill='none'%20stroke='rgba(255,255,255,.22)'%20stroke-width='1.6'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #4fb4f0, var(--blue));
  background-size: 24px 16px, cover;
  background-repeat: repeat, no-repeat;
}

.ed-pal-desc { font-size: 0.8rem; color: var(--muted); min-height: 2.4em; margin: 8px 2px 0; line-height: 1.35; }

.ed-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.ed-row label { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ed-row input[type="number"] { width: 56px; }
.ed-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; }
input[type="number"], input[type="text"], textarea {
  background: var(--bg2); color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 0.9rem;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.ed-saved { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.ed-saved .saved-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px; padding: 6px 8px;
}
.ed-saved .saved-item .nm { flex: 1; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-saved .mini { padding: 4px 8px; font-size: 0.78rem; }
.ed-saved .empty { color: var(--muted); font-size: 0.84rem; padding: 4px 2px; }

/* import/export drawer */
.ed-io { margin-top: 20px; background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 14px; }
.ed-io-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; }
.ed-io-btns { display: flex; gap: 8px; }
#ioText { width: 100%; min-height: 200px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.82rem; line-height: 1.45; resize: vertical; white-space: pre; }
.ed-io-note { font-size: 0.82rem; color: var(--muted); margin: 8px 2px 0; }

.ed-overlay { position: fixed; inset: 0; }
