@import url("https://fonts.cdnfonts.com/css/monster-chiller");
@import url("https://fonts.cdnfonts.com/css/youmurderer-bb");
@import url("https://fonts.cdnfonts.com/css/streetmark");
@import url("https://fonts.cdnfonts.com/css/germania-one");
@import url("https://fonts.cdnfonts.com/css/konstruktor");
@import url("https://fonts.cdnfonts.com/css/better-vcr");
@import url("https://fonts.cdnfonts.com/css/flapdoodle");
@import url("https://fonts.cdnfonts.com/css/londrina-solid");
@import url("https://fonts.cdnfonts.com/css/pill-gothic-600mg");
@import url("https://fonts.cdnfonts.com/css/segoe-ui-4");
@import url("https://fonts.cdnfonts.com/css/lemondrop");
@import url("https://fonts.cdnfonts.com/css/brighton-sans-nbp");
:root {
  --shell: #282828;
  --panel: #222;
  --lift: #3b3b3b;
  --line: #4a4a4a;
  --text: #e6e6e6;
  --muted: #9a9a9a;
  --cyan: #00FFFF;
  --magenta: #FF00FF;
  --r: 3px;
  font-family: Segoe UI, sans-serif;
  color: var(--text);
  background: var(--shell);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--shell); color: var(--text);
}
body.studio {
  height: 100vh;
  display: grid; grid-template-rows: 48px 1fr; grid-template-columns: 260px 1fr 260px;
  user-select: none;
}
body.land {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.land-card {
  width: 100%; max-width: 420px; padding: 24px 24px 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 40px #000a;
}
.land-card h1 { font-size: 18px; margin: 0 0 12px; }
.land-card p { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 16px; }
.land-card form { display: flex; flex-direction: column; gap: 8px; }
.land-card label { color: var(--muted); font-size: 12px; }
.land-card input[type=password] {
  background: #222; border: 1px solid var(--line); border-radius: var(--r);
  padding: 6px 8px; width: 100%; color: var(--text); font: inherit;
}
.land-err { color: #ff8aa0; }
.land-card #dl { width: 100%; justify-content: center; }
body.studio header {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--shell); border-bottom: 1px solid var(--line); font-size: 13px;
}
header h1 { font-size: 13px; margin: 0; font-weight: 700; }
.ep-pick {
  flex: 0 1 180px; min-width: 120px; max-width: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 4px 6px; color: var(--text); font: inherit; font-size: 12px;
}
.ep {
  flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 4px 8px; color: var(--muted); font: inherit; font-size: 12px;
  user-select: text; cursor: text;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.grids {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: 12px; padding-left: 12px; border-left: 1px solid var(--line);
}
.grids label { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.grids input { width: auto; }
body.studio main { display: flex; align-items: center; justify-content: center; padding: 16px; background: #1a1a1a; min-width: 0; min-height: 0; position: relative; cursor: grab; }
body.studio main.drop { outline: 2px dashed var(--cyan); outline-offset: -8px; }
body.studio canvas { max-width: calc(100% - 48px); max-height: calc(100% - 48px); background: #000; cursor: inherit; box-shadow: 0 8px 32px #0008; }
body.studio main.grabbing, body.studio main.grabbing canvas { cursor: grabbing; }
/* Selection sits on the board so a handle can live past the 1280×720 frame. */
#selbox {
  position: absolute; border: 2px solid var(--cyan); pointer-events: none; box-sizing: border-box;
}
#selbox i {
  position: absolute; width: 10px; height: 10px; background: #fff; border: 2px solid var(--cyan);
  box-sizing: border-box; transform: translate(-50%, -50%);
}
aside { background: var(--panel); border-left: 1px solid var(--line); overflow: auto; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 8px; user-select: text; }
#assets { border-left: 0; border-right: 1px solid var(--line); overflow: hidden; min-height: 0; }
#assets .libs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#assets #layers { flex: 0 0 auto; max-height: 40%; overflow: auto; }
button, input, select, label { font: inherit; color: inherit; }
label { color: var(--muted); font-size: 12px; }
button, input[type=text], input[type=password], input[type=number], input[type=range], select {
  background: var(--lift); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; width: 100%; color: var(--text);
}
input[type=text], input[type=number], select { background: #222; }
button { cursor: pointer; }
button:hover { border-color: var(--cyan); }
#dl {
  width: auto; font-weight: 700; color: #282828;
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(to bottom right, var(--cyan), var(--magenta));
  border-color: transparent;
}
#dl:hover { border-color: transparent; }
h2 { font-size: 11px; margin: 6px 0 2px; color: var(--cyan); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.hint { color: var(--muted); font-size: 11px; }
.wells { display: flex; gap: 6px; }
.well { flex: 1; height: 28px; border: 2px solid var(--line); cursor: pointer; }
.well.on { border-color: var(--cyan); }
/* Keep layout (not display:none) so iro can measure the wheel before first open. */
#iroPop {
  position: fixed; inset: 0; z-index: 30;
  visibility: hidden; pointer-events: none;
}
#iroPop.open { visibility: visible; }
.iro-card {
  pointer-events: auto; position: absolute;
  display: flex; flex-direction: column; gap: 8px;
  width: 236px; padding: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 40px #000a;
}
#picker { align-self: center; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { width: 18px; height: 18px; border: 1px solid var(--line); cursor: pointer; padding: 0; }
.swatch.add { width: auto; padding: 0 6px; font-size: 12px; }
#layers { display: flex; flex-direction: column; gap: 0; }
.layer { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 8px; background: var(--lift); border-bottom: 1px solid var(--line); font-size: 12px; cursor: pointer; user-select: none; }
.layer:nth-child(odd) { background: #363636; }
.layer.on { background: color-mix(in srgb, var(--cyan) 18%, var(--lift)); color: var(--cyan); }
.layer.over { outline: 1px solid var(--cyan); }
.layer .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer .grip { cursor: grab; color: var(--muted); padding: 2px 4px; }
.layer .grip:active { cursor: grabbing; }
.layer button { width: auto; padding: 2px 5px; flex: 0; }
input[type=file] { font-size: 11px; }
input[type=range] { padding: 0; }
.img-size { display: flex; align-items: center; gap: 8px; }
.img-size input[type="range"] { flex: 1; min-width: 0; padding: 0; accent-color: var(--cyan); }
.img-size input[type="number"] { width: 5em; }
.lib { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lib-cell { position: relative; }
.lib-cell > button.place { padding: 0; background: #1a1a1a; aspect-ratio: 16 / 9; overflow: hidden; }
.lib-cell img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.lib-del { position: absolute; top: 2px; right: 2px; width: auto; padding: 0 6px; z-index: 1; font-size: 12px; }
.hidden { display: none; }
.fx-item { margin: 0 0 8px; padding: 6px; background: var(--lift); border: 1px solid var(--line); border-radius: var(--r); }
.fx-row { display: flex; gap: 6px; align-items: center; }
.fx-row .well { flex: 0; width: 40px; height: 28px; }
.fx-del { width: auto; flex: 0; padding: 2px 8px; }
#addStroke { width: auto; display: flex; align-items: center; gap: 6px; }
[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  user-select: text;
}
.dlg-card {
  width: 100%; max-width: 420px; padding: 20px 20px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 40px #000a;
}
.dlg-card.text-card { max-width: 560px; }
#dlg-title, #textDlg-title { margin: 0 0 10px; font-size: 16px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
#editText { width: auto; display: flex; align-items: center; gap: 6px; }
.align-row { display: flex; gap: 6px; }
.align-row button { width: auto; flex: 1; display: flex; align-items: center; justify-content: center; }
.align-row button.on { border-color: var(--cyan); color: var(--cyan); }
#textBlob {
  width: 100%; min-height: 140px; resize: vertical; font: inherit;
  background: #222; border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px; color: var(--text);
}
.ph-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; max-height: 180px; overflow: auto; }
.ph-chip {
  width: auto; text-align: left; display: flex; flex-direction: column; gap: 2px;
  padding: 6px 8px; max-width: 100%;
}
.ph-chip code { color: var(--cyan); font-size: 12px; }
.ph-chip span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.lib-cell > button.place.text-place {
  aspect-ratio: auto; min-height: 56px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; padding: 8px 6px;
  font-size: 11px; color: var(--text);
}
.lib-cell > button.place.text-place i { color: var(--cyan); font-size: 16px; }
.dlg-card p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.dlg-actions {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}
.dlg-actions button { min-width: 88px; width: auto; }
#textDlg-reset { margin-right: auto; }
#dlg-ok.dlg-danger { background: #b42318; border-color: #b42318; color: #fff; }
#dlg-ok.dlg-danger:hover { filter: brightness(1.08); border-color: #b42318; }
