/* ==========================================================================
   NovaUI web editor — the canvas fills the window; dialogs, the drop hint and
   the phone note are HTML in the editor's theme (editor/ui/Theme.java).
   --u = one canvas unit in CSS pixels (set by editor.js: window height / 1080).
   ========================================================================== */

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0B0C10;
  color: #E6E8EE;
}

.nd-app {
  --u: 1px;
  position: fixed;
  inset: 0;
  font-family: "NovaUI Pixel", ui-monospace, "Cascadia Code", Consolas, monospace;
}

#screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
  user-select: none;
}

/* ---------- dialogs (the game's dialog screens, in NovaUI's colours) ---------- */
.nd-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.65);
}
.nd-panel {
  box-sizing: border-box;
  width: calc(var(--u) * 680);
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  overflow: auto;
  padding: calc(var(--u) * 26) calc(var(--u) * 28) calc(var(--u) * 24);
  border: calc(var(--u) * 2) solid #2A2F3D;
  border-radius: calc(var(--u) * 16);
  background: #14161D;
  color: #E6E8EE;
  font-size: calc(var(--u) * 20);
  line-height: 1.25;
  scrollbar-width: thin;
  scrollbar-color: #2A2F3D transparent;
}
.nd-title {
  margin: 0 0 calc(var(--u) * 12);
  font-size: calc(var(--u) * 30);
  font-weight: normal;
  overflow-wrap: anywhere;
}
.nd-body {
  margin: 0 0 calc(var(--u) * 8);
  color: #8A90A2;
  overflow-wrap: anywhere;
}
.nd-row {
  display: grid;
  gap: calc(var(--u) * 8);
  margin-top: calc(var(--u) * 16);
}
.nd-label { color: #8A90A2; }
.nd-input {
  box-sizing: border-box;
  width: 100%;
  min-height: calc(var(--u) * 40);
  padding: calc(var(--u) * 7) calc(var(--u) * 12);
  border: 0;
  border-radius: calc(var(--u) * 6);
  background: #1C1F29;
  color: #E6E8EE;
  font: inherit;
  line-height: 1.25;
  outline: none;
  box-shadow: inset 0 0 0 calc(var(--u) * 2) transparent;
}
.nd-input:hover { background: #262A37; }
.nd-input:focus { box-shadow: inset 0 0 0 calc(var(--u) * 2) #7B6CFF; }
.nd-input--area { resize: vertical; min-height: calc(var(--u) * 110); }
.nd-select { cursor: pointer; }
.nd-select option { background: #14161D; color: #E6E8EE; }

.nd-toggle {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 12);
  cursor: pointer;
}
.nd-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nd-switch {
  position: relative;
  flex: 0 0 auto;
  width: calc(var(--u) * 44);
  height: calc(var(--u) * 24);
  border-radius: calc(var(--u) * 12);
  background: #2A2F3D;
}
.nd-switch::after {
  content: "";
  position: absolute;
  top: calc(var(--u) * 2);
  left: calc(var(--u) * 2);
  width: calc(var(--u) * 20);
  height: calc(var(--u) * 20);
  border-radius: 50%;
  background: #FFFFFF;
}
.nd-toggle:hover .nd-switch { background: #262A37; }
.nd-toggle input:checked + .nd-switch { background: #7B6CFF; }
.nd-toggle input:checked + .nd-switch::after { left: calc(var(--u) * 22); }
.nd-toggle input:focus-visible + .nd-switch { box-shadow: 0 0 0 calc(var(--u) * 2) #9488FF; }
.nd-toggle .nd-label { color: #E6E8EE; }

.nd-slider { display: flex; align-items: center; gap: calc(var(--u) * 12); }
.nd-slider input { flex: 1 1 auto; accent-color: #7B6CFF; cursor: pointer; }
.nd-slider__value { min-width: calc(var(--u) * 48); text-align: right; }

.nd-error {
  min-height: 1.25em;
  margin: calc(var(--u) * 14) 0 0;
  color: #FF5C6C;
  overflow-wrap: anywhere;
}
.nd-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: calc(var(--u) * 12);
  margin-top: calc(var(--u) * 10);
}
.nd-btn {
  min-width: calc(var(--u) * 150);
  height: calc(var(--u) * 48);
  padding: 0 calc(var(--u) * 24);
  border: calc(var(--u) * 2) solid #2A2F3D;
  border-radius: calc(var(--u) * 12);
  background: #14161D;
  color: #E6E8EE;
  font: inherit;
  cursor: pointer;
}
.nd-btn:hover { background: #262A37; border-color: #262A37; }
.nd-btn:focus-visible { outline: calc(var(--u) * 2) solid #9488FF; outline-offset: calc(var(--u) * 2); }
.nd-btn--primary { background: #7B6CFF; border-color: #7B6CFF; color: #FFFFFF; }
.nd-btn--primary:hover { background: #9488FF; border-color: #9488FF; }

/* ---------- dropping files ---------- */
.nd-drop {
  position: absolute;
  inset: 12px;
  z-index: 4;
  display: grid;
  place-items: center;
  border: 2px dashed #9488FF;
  border-radius: 16px;
  background: rgba(59, 52, 112, 0.55);
  color: #FFFFFF;
  font-size: calc(var(--u) * 20);
  text-align: center;
  pointer-events: none;
}
.nd-drop[hidden] { display: none; }
.nd-drop div { max-width: calc(var(--u) * 520); padding: 16px; }

/* ---------- phones: the editor still shows, with a note on top ---------- */
.nd-mobile {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #3B3470;
  border-bottom: 1px solid #7B6CFF;
  color: #FFFFFF;
  font: 13.5px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.nd-mobile[hidden] { display: none; }
.nd-mobile p { flex: 1 1 auto; margin: 0; }
.nd-mobile button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #7B6CFF;
  color: #FFFFFF;
  font: inherit;
  font-weight: 600;
}
@media (max-width: 899px) {
  /* the editor keeps its 1080-unit layout and is letterboxed under the note */
  .nd-mobile { font-size: 13px; }
}
@media (max-width: 560px) {
  .nd-mobile { padding: 8px 10px; gap: 8px; }
  .nd-mobile button { height: 30px; padding: 0 12px; }
}
