/* ============================================================
   GeoLogo — Tema oscuro tipo editor
   ============================================================ */
:root {
  --bg: #0d0f12;
  --bg-2: #14171c;
  --panel: #16191f;
  --panel-2: #1c2026;
  --border: #262b33;
  --border-2: #313842;
  --text: #e7eaee;
  --text-dim: #9aa3ad;
  --text-mute: #6b7480;
  --accent: #f5f5f5;
  --accent-ink: #0d0f12;
  --primary: #4b8dff;
  --primary-ink: #06122b;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}
.gl-html {
  background: var(--bg);
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-mark {
  width: 16px;
  height: 16px;
  align-self: center;
  background: var(--text);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.brand-name {
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand-sub {
  color: var(--text-mute);
  font-size: 12px;
}
.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Botones ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover {
  background: #232932;
  border-color: #3a424d;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: #5e9bff;
  border-color: #5e9bff;
}
.btn-block {
  width: 100%;
}
.ico {
  font-size: 15px;
  line-height: 1;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  height: calc(100vh - 57px);
  min-height: 0;
}

/* ---------- Lienzo ---------- */
.canvas-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
}
.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
}
.seed-label code {
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--panel-2);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.stage-bg {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  position: relative;
  background-image: radial-gradient(circle at center, #1a1e24 0, var(--bg) 70%);
}
.stage {
  width: min(72vh, 100%);
  aspect-ratio: 1 / 1;
  max-width: 760px;
  background: #fff;
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stage svg {
  display: block;
  width: 100%;
  height: 100%;
}
.grid-overlay {
  position: absolute;
  width: min(72vh, calc(100% - 64px));
  aspect-ratio: 1/1;
  max-width: 760px;
  pointer-events: none;
  background-image: linear-gradient(
      to right,
      rgba(75, 141, 255, 0.25) 1px,
      transparent 1px
    ),
    linear-gradient(to bottom, rgba(75, 141, 255, 0.25) 1px, transparent 1px);
  background-size: 10% 10%;
  border-radius: 6px;
}

/* ---------- Panel ---------- */
.panel {
  background: var(--panel);
  overflow-y: auto;
  padding: 4px 0 24px;
}
.group {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.group h2 {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-mute);
}
.control {
  margin-bottom: 14px;
}
.control:last-child {
  margin-bottom: 0;
}
.control > label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.control > label em {
  font-style: normal;
  font-family: var(--font-mono);
  color: var(--text);
  font-size: 12px;
}
.control-input {
  display: flex;
  gap: 8px;
  align-items: center;
}
.control-input > select,
.control-input > input[type="text"],
.control-input > input[type="number"] {
  flex: 1;
}

select,
input[type="text"],
input[type="number"] {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
select:focus,
input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Range */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-2);
  border-radius: 999px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--border-2);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--panel);
}

/* Lock / dado pequeño */
.lock {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text-mute);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.lock:hover {
  color: var(--text);
}
.lock.locked {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Checkbox */
.chk {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 0 !important;
}
.chk input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Export */
.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Presets */
.preset-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preset-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
.preset-list .pname {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-list .pacts {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.preset-list button {
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-dim);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}
.preset-list button:hover {
  color: var(--text);
  border-color: #3a424d;
}
.preset-list button.del:hover {
  color: #ff7676;
  border-color: #5a2a2a;
}
.preset-msg {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-mute);
  min-height: 16px;
}

.panel-foot {
  padding: 16px;
  font-size: 11px;
  color: var(--text-mute);
  text-align: center;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--accent-ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 50;
}

/* Oculto por estado */
[data-hidden="true"] {
  display: none !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .canvas-wrap {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .stage-bg {
    padding: 20px;
  }
  .stage {
    width: min(80vw, 420px);
  }
  .panel {
    max-height: none;
  }
}
/* Modal de Sugerencias */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 12, 16, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #14171f;
  border: 1px solid #2a2f3d;
  border-radius: 8px;
  width: 90%;
  max-width: 440px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: #717888;
  font-size: 18px;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body label {
  font-size: 12px;
  color: #a0a6b5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-body input[type="email"],
.modal-body textarea {
  background: #1a1d24;
  border: 1px solid #333844;
  color: #fff;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

.modal-body textarea {
  resize: vertical;
  min-height: 90px;
}

.modal-body input:focus,
.modal-body textarea:focus {
  border-color: #00bfa5;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}