/* Shared stylesheet for the standalone debug editors (city / world-roads). */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #14171d;
  color: #e8eaed;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

.de-app {
  display: grid;
  grid-template-columns: 1fr 348px;
  grid-template-rows: auto 1fr;
  height: 100vh;
}

.de-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 16px;
  background: #10131a;
  border-bottom: 1px solid #2a3140;
}

.de-header__title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.de-header__subtitle {
  margin: 0;
  color: #8b95a8;
  font-size: 12px;
}

.de-header__links {
  margin-left: auto;
  display: flex;
  gap: 10px;
  font-size: 12px;
}

.de-header__links a {
  color: #7ea6f0;
  text-decoration: none;
}

.de-header__links a:hover {
  text-decoration: underline;
}

.de-status {
  margin: 0;
  color: #8b95a8;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.de-status.is-error {
  color: #f07178;
}

.de-status.is-busy {
  color: #e8c478;
}

/* ---- viewport -------------------------------------------------------- */

.de-main {
  position: relative;
  overflow: hidden;
  background: #0c0e12;
}

.de-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.de-canvas.is-panning {
  cursor: grabbing;
}

.de-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid #2a3140;
  border-radius: 6px;
  background: rgba(16, 19, 26, 0.88);
  backdrop-filter: blur(2px);
  z-index: 4;
}

.de-coords {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: rgba(16, 19, 26, 0.88);
  color: #b8c0cc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  pointer-events: none;
  z-index: 4;
  white-space: pre;
}

/* ---- floating segment editors (ice dungeon) -------------------------- */

.de-float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}

.de-float-marker {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.de-float-marker__tag {
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(120, 200, 255, 0.35);
  background: rgba(12, 18, 28, 0.88);
  color: #b8d4ff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.25;
  white-space: nowrap;
  text-transform: lowercase;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  user-select: none;
}

.de-float-marker--room.is-active .de-float-marker__tag,
.de-float-marker--room:has(.de-float-cog.is-active) .de-float-marker__tag {
  border-color: rgba(232, 196, 120, 0.55);
  color: #ffe9b8;
}

.de-float-cog {
  position: relative;
  top: auto;
  left: auto;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(140, 180, 255, 0.45);
  border-radius: 50%;
  background: rgba(16, 22, 34, 0.92);
  color: #9ec0ff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  pointer-events: auto;
  transition: border-color 0.12s, background 0.12s, color 0.12s, transform 0.05s;
}

.de-float-cog:hover {
  border-color: #7ea6f0;
  background: rgba(36, 48, 72, 0.96);
  color: #cfe0ff;
}

.de-float-cog.is-active {
  border-color: #e8c478;
  background: rgba(56, 44, 24, 0.95);
  color: #ffe9b8;
}

.de-float-cog--room {
  border-color: rgba(120, 200, 255, 0.5);
}

.de-float-cog--corridor {
  width: 22px;
  height: 22px;
  border-color: rgba(180, 140, 255, 0.45);
  color: #c9b0ff;
}

.de-float-hud {
  position: absolute;
  z-index: 8;
  width: min(288px, calc(100% - 16px));
  border: 1px solid #3a4a68;
  border-radius: 8px;
  background: rgba(14, 18, 28, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.de-float-hud.is-dragging {
  user-select: none;
}

.de-float-hud.is-dragging .de-float-hud__head {
  cursor: grabbing;
}

.de-float-hud__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #2a3140;
  cursor: grab;
  user-select: none;
}

.de-float-hud__head:active {
  cursor: grabbing;
}

.de-float-hud__title {
  flex: 1;
  font-size: 12px;
  font-weight: 650;
  color: #e8eaed;
  line-height: 1.3;
}

.de-float-hud__close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #8b95a8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.de-float-hud__close:hover {
  background: #2a3140;
  color: #fff;
}

.de-float-hud__body {
  padding: 8px 10px 12px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
}

/* ---- sidebar --------------------------------------------------------- */

.de-sidebar {
  border-left: 1px solid #2a3140;
  background: #10131a;
  overflow-y: auto;
  padding: 12px 12px 40px;
  scrollbar-width: thin;
  scrollbar-color: #3a4458 transparent;
}

.de-section {
  margin-bottom: 14px;
  border: 1px solid #222938;
  border-radius: 6px;
  background: #131722;
}

.de-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #8b95a8;
  user-select: none;
}

.de-section > summary::-webkit-details-marker {
  display: none;
}

.de-section > summary::before {
  content: '▸ ';
  color: #5b8def;
}

.de-section[open] > summary::before {
  content: '▾ ';
}

.de-section__body {
  padding: 4px 10px 10px;
}

.de-group {
  margin-bottom: 9px;
}

.de-hud-section {
  margin: 12px 0 6px;
  padding-top: 8px;
  border-top: 1px solid #2e3544;
  color: #8fa3c4;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.de-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
  color: #b8c0cc;
  font-size: 12px;
}

.de-label .de-value {
  color: #9ec0ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.de-input,
.de-select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #3a4458;
  border-radius: 4px;
  background: #1a1d24;
  color: #e8eaed;
  font: inherit;
  font-size: 13px;
}

.de-input:focus,
.de-select:focus {
  outline: none;
  border-color: #5b8def;
}

.de-range {
  width: 100%;
  accent-color: #5b8def;
  margin: 0;
}

.de-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.de-row > * {
  flex: 1;
  min-width: 0;
}

.de-row > .de-btn {
  flex: 0 0 auto;
}

.de-btn {
  padding: 5px 10px;
  border: 1px solid #3a4458;
  border-radius: 4px;
  background: #1e2430;
  color: #e8eaed;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.de-btn:hover {
  background: #2a3140;
}

.de-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.de-btn.is-active {
  border-color: #5b8def;
  background: #243048;
  color: #9ec0ff;
}

.de-btn--primary {
  border-color: #4a7fd4;
  background: #2a4470;
  font-weight: 600;
}

.de-btn--primary:hover {
  background: #335291;
}

.de-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.de-checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12.5px;
  color: #c6cdd9;
  padding: 2px 0;
  user-select: none;
}

.de-checkbox input {
  accent-color: #5b8def;
  margin: 0;
}

.de-checkbox .de-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.de-readout {
  padding: 8px;
  border: 1px solid #222938;
  border-radius: 4px;
  background: #0f1115;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 48px;
  color: #c6cdd9;
}

.de-hint {
  margin: 5px 0 0;
  color: #6b7588;
  font-size: 11px;
  line-height: 1.4;
}

.de-app--city {
  grid-template-columns: 1fr 372px;
}

.de-app--city .de-sidebar {
  width: auto;
}

.de-settlement-bar {
  position: absolute;
  left: 12px;
  bottom: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(10, 12, 16, 0.82);
  border: 1px solid #2a3140;
  font-size: 12px;
  color: #c6cdd9;
  pointer-events: none;
}

.de-tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.de-tier-badge--starter {
  background: #1e3a2f;
  color: #8fd4a8;
}

.de-tier-badge--town {
  background: #1e2a3a;
  color: #8bb8f0;
}

.de-tier-badge--city {
  background: #2e1e3a;
  color: #c8a0f0;
}

.de-controls--locked {
  opacity: 0.55;
  pointer-events: none;
}

.de-controls--locked.is-active {
  opacity: 1;
  pointer-events: auto;
}

.de-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 220px;
  overflow-y: auto;
}

.de-list__item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid #222938;
  border-radius: 4px;
  background: #161a24;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  cursor: pointer;
  color: #c6cdd9;
}

.de-list__item:hover {
  border-color: #5b8def;
  color: #fff;
}

.de-list__item.is-selected {
  border-color: #e8c478;
  color: #ffe9b8;
}

.de-list__item .dim {
  color: #6b7588;
}

.de-divider {
  height: 1px;
  margin: 8px 0;
  background: #222938;
  border: 0;
}

.de-modal {
  position: fixed;
  inset: 0;
  z-index: 10200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.de-modal[hidden] {
  display: none;
}

.de-modal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 10, 14, 0.72);
  cursor: pointer;
}

.de-modal__panel {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  border: 1px solid #2f3848;
  background: #161a24;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.de-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #222938;
}

.de-modal__title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: #b8f0c8;
}

.de-modal__close {
  border: 1px solid #2f3848;
  border-radius: 4px;
  background: transparent;
  color: #8b95a8;
  font-size: 18px;
  line-height: 1;
  padding: 2px 8px;
  cursor: pointer;
}

.de-modal__close:hover {
  color: #fff;
  border-color: #5b8def;
}

.de-modal__subtitle {
  margin: 0;
  padding: 8px 14px 0;
  font-size: 11px;
  color: #8b95a8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.de-modal__body {
  margin: 8px 14px 14px;
  max-height: min(60vh, 520px);
  overflow: auto;
}

/* Wild spawn chunk modal (portrait cards) */
.wsm-root {
  padding: 0 2px 4px;
}

.wsm {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 13px;
  color: #d8dde8;
}

.wsm-header__biome {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.wsm-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(110, 212, 160, 0.18);
  border: 1px solid rgba(110, 212, 160, 0.45);
  color: #b8f0c8;
}

.wsm-badge--muted {
  background: rgba(91, 141, 239, 0.12);
  border-color: rgba(91, 141, 239, 0.35);
  color: #a8c4f8;
}

.wsm-header__meta {
  margin: 0;
  font-size: 11px;
  color: #8b95a8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.45;
}

.wsm-status {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #2a3140;
  background: #12161e;
}

.wsm-status__icon {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}

.wsm-status p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #9aa3b5;
  line-height: 1.45;
}

.wsm-status strong {
  color: #e8eaed;
  font-size: 13px;
}

.wsm-status--family {
  border-color: rgba(110, 212, 160, 0.35);
  background: rgba(80, 160, 110, 0.08);
}

.wsm-status--family .wsm-status__icon {
  color: #6ed4a0;
}

.wsm-status--empty {
  border-color: rgba(139, 149, 168, 0.3);
}

.wsm-status--water {
  border-color: rgba(91, 141, 239, 0.35);
  background: rgba(60, 100, 180, 0.08);
}

.wsm-section__title {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b95a8;
}

.wsm-section__hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: #7a8498;
  line-height: 1.4;
}

.wsm-members {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wsm-member {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #2a3140;
  background: #10141c;
}

.wsm-portrait {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  image-rendering: pixelated;
  background: rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.wsm-portrait--lg {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

.wsm-portrait--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.85);
}

.wsm-member__name {
  font-weight: 650;
  font-size: 14px;
  color: #f0f2f6;
}

.wsm-member__dex {
  font-size: 11px;
  color: #6b7588;
  font-family: ui-monospace, monospace;
}

.wsm-member__meta {
  margin-top: 2px;
  font-size: 12px;
  color: #9aa3b5;
}

.wsm-member__pos {
  margin-top: 2px;
  font-size: 11px;
  color: #6b7588;
  font-family: ui-monospace, monospace;
}

.wsm-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wsm-pool-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid #2a3140;
  background: #10141c;
  max-width: 100%;
}

.wsm-pool-chip .wsm-portrait {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.wsm-pool-chip__name {
  font-size: 11px;
  color: #c6cdd9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 88px;
}

.wsm-pool-more {
  margin: 8px 0 0;
  font-size: 11px;
  color: #6b7588;
}

.wsm-footer {
  padding-top: 4px;
  border-top: 1px solid #222938;
}

.wsm-footer p {
  margin: 0 0 4px;
  font-size: 11px;
  color: #6b7588;
  line-height: 1.45;
}

.wsm-footer__note {
  font-style: italic;
}
