/* ==========================================================
   Delta-V Dilemma — draw your own sprites and backgrounds
   (js/drawings.js, used by the level editor). Kept in its own
   file; it reuses tokens and the .thumb tiles from style.css.
   ========================================================== */

/* ---------- Palette tiles ---------- */

.thumb-wrap { position: relative; display: flex; }
.thumb-wrap > .thumb { flex: 1; min-width: 0; }
.thumb-edit {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 209, 102, 0.6);
  border-radius: 50%;
  background: rgba(10, 14, 30, 0.85);
  color: var(--gold);
  font-size: 0.8rem;
  cursor: pointer;
}
.thumb-edit:hover { background: var(--gold); color: #1a1202; }
.thumb--draw { justify-content: center; border-style: dashed; border-color: rgba(255, 209, 102, 0.55); color: var(--gold); }
.thumb--draw__plus { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; font-size: 1.6rem; line-height: 1; }

/* ---------- Drawing dialog ---------- */

.draw-dialog {
  width: min(1040px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  padding: 18px 20px;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: var(--panel-solid);
  color: var(--text);
}
.draw-dialog::backdrop { background: rgba(2, 4, 10, 0.75); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.draw-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.draw-dialog__head h3 { margin: 0; font-family: var(--font-display); font-size: 1.1rem; letter-spacing: 0.06em; }
.draw-dialog__head .part-dialog__close { position: static; }

.draw-name { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.draw-name span { font-family: var(--font-display); font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); }
.draw-name input {
  flex: 1;
  max-width: 340px;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(4, 8, 20, 0.6);
  color: var(--text);
  font: inherit;
}
.draw-name input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.draw-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.draw-stage { display: grid; place-items: center; padding: 8px; border-radius: 12px; background: #070a16; }
.draw-canvas {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  image-rendering: pixelated;
  cursor: crosshair;
  touch-action: none; /* drawing with a finger must not scroll the page */
  border-radius: 4px;
}
.draw-dialog[data-kind="background"] .draw-canvas { max-width: 640px; }

.draw-side { display: flex; flex-direction: column; gap: 10px; }
.draw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.draw-label { margin: 0; font-family: var(--font-display); font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-dim); }
.draw-tool {
  padding: 7px 11px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(20, 29, 58, 0.6);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.draw-tool:hover:not(:disabled) { border-color: rgba(140, 170, 255, 0.5); }
.draw-tool[aria-pressed="true"] { border-color: var(--gold); background: var(--gold); color: #1a1202; }
.draw-tool:disabled { opacity: 0.4; cursor: not-allowed; }
.draw-tool--small { min-width: 34px; padding: 6px 8px; font-family: var(--font-mono); }

.draw-current { width: 30px; height: 30px; border: 2px solid #fff; border-radius: 8px; box-shadow: 0 0 0 1px #000; }
.draw-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-dim); cursor: pointer; }
.draw-custom input { width: 34px; height: 28px; padding: 0; border: 1px solid var(--panel-border); border-radius: 6px; background: none; cursor: pointer; }

.draw-palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.draw-swatch { aspect-ratio: 1; padding: 0; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 6px; cursor: pointer; }
.draw-swatch[aria-pressed="true"] { outline: 2px solid var(--gold); outline-offset: 2px; }

.draw-preview { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; image-rendering: pixelated; background: #000; }
.draw-note { margin: 0; font-size: 0.78rem; color: var(--text-dim); }
.draw-message { min-height: 1.2em; margin: 10px 0 0; color: #ff9aa9; font-size: 0.88rem; }
.draw-dialog__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
#draw-delete { margin-right: auto; }

@media (max-width: 760px) {
  .draw-body { grid-template-columns: minmax(0, 1fr); }
  .draw-dialog { padding: 14px; }
}
