:root {
  --bg: #0b0d10;
  --panel: #11151b;
  --panel-2: #0f1318;
  --line: rgba(220, 228, 238, 0.12);
  --text: #ebeef2;
  --muted: #a9b0ba;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.14);
  --steel: #76a9b8;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #0b0d10;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-weight: 800;
}

.mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #f97316, #ff9a4a);
}

.status-pill {
  padding: 0.42rem 0.75rem;
  border: 1px solid rgba(249, 115, 22, 0.32);
  border-radius: 999px;
  color: #ffd8bd;
  background: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.shell {
  width: min(100% - 2rem, 1440px);
  margin: 0 auto;
  padding: 1rem 0 1.6rem;
}

.intro {
  max-width: 980px;
  margin-bottom: 0.9rem;
  padding: 0.2rem 0 0.4rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 900;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(1.65rem, 2.4vw, 2.65rem);
  max-width: 840px;
}

h2 {
  font-size: clamp(1.2rem, 2vw, 1.65rem);
}

.intro p:last-child {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.controls {
  position: sticky;
  top: 5.3rem;
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  max-height: calc(100vh - 6.2rem);
  overflow: auto;
  scrollbar-color: rgba(249, 115, 22, 0.5) rgba(255, 255, 255, 0.04);
}

label {
  display: grid;
  gap: 0.45rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.45rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  font-weight: 900;
}

.section-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

label span {
  color: #d7cfc7;
  font-size: 0.82rem;
  font-weight: 800;
}

.check-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 10, 15, 0.52);
}

.check-row input {
  width: 1rem;
  min-height: 1rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
}

.check-row span {
  display: grid;
  gap: 0.25rem;
}

.check-row small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
}

.account-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem;
  border: 1px solid rgba(249, 115, 22, 0.26);
  border-radius: 8px;
  background: rgba(249, 115, 22, 0.08);
}

.account-panel strong,
.account-panel small {
  display: block;
}

.account-panel strong {
  color: #fff2e7;
  font-size: 0.9rem;
}

.account-panel small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.account-panel.muted-panel {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.account-action {
  display: grid;
  place-items: center;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid rgba(249, 115, 22, 0.34);
  border-radius: 8px;
  color: #ffd8bd;
  background: rgba(249, 115, 22, 0.12);
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.account-action:not([href]) {
  cursor: not-allowed;
  opacity: 0.72;
}

select,
input,
button {
  width: 100%;
  min-height: 2.35rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
}

select,
input,
textarea {
  color: var(--text);
  background: #090c11;
  padding: 0 0.75rem;
}

label > small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
}

.inline-search {
  min-height: 2.15rem;
}

textarea {
  min-height: 15rem;
  padding: 0.75rem;
  resize: vertical;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
}

.compact-textarea {
  min-height: 7.5rem;
}

.project-builder {
  display: grid;
  gap: 0.85rem;
}

.project-builder[hidden] {
  display: none;
}

.mini-panel {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1016;
}

.mini-title {
  color: #dceaf0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mini-copy {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.bulk-entry {
  border: 1px solid rgba(118, 169, 184, 0.28);
  border-radius: 8px;
  background: rgba(118, 169, 184, 0.07);
}

.bulk-entry summary {
  cursor: pointer;
  padding: 0.65rem 0.75rem;
  color: #dceaf0;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bulk-entry label,
.bulk-entry button {
  margin: 0 0.75rem 0.75rem;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.compact-grid.two {
  grid-template-columns: 1fr 1fr;
}

.compact-grid label:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

input[type="color"] {
  min-height: 2.65rem;
  padding: 0.25rem;
}

.item-list {
  display: grid;
  gap: 0.45rem;
  max-height: 12rem;
  overflow: auto;
}

.item-list.tall {
  max-height: 18rem;
}

.list-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: #d9d0c7;
  font-size: 0.78rem;
}

.list-item.stacked {
  grid-template-columns: minmax(0, 1fr) auto;
}

.list-item.stacked span {
  grid-column: 1 / -1;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.swatch {
  width: 1rem;
  height: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
}

.empty-list,
.inline-error,
.inline-notice {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.inline-error {
  color: var(--danger);
}

.inline-notice {
  color: var(--steel);
}

button.tiny {
  width: auto;
  min-height: 1.8rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f7c7a4;
  background: rgba(249, 115, 22, 0.1);
  box-shadow: none;
  font-size: 0.72rem;
}

.inline-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.4rem;
  gap: 0.5rem;
}

.download-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.download-chip {
  display: grid;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid rgba(118, 169, 184, 0.34);
  border-radius: 8px;
  color: #dceaf0;
  background: rgba(118, 169, 184, 0.1);
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
}

.file-button {
  display: grid;
  place-items: center;
  min-height: 2.4rem;
  border-radius: 8px;
  cursor: pointer;
  color: #ffd8bd;
  border: 1px solid rgba(249, 115, 22, 0.34);
  background: rgba(249, 115, 22, 0.12);
  font-weight: 900;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.advanced-json {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 10, 15, 0.42);
}

.advanced-json summary {
  cursor: pointer;
  padding: 0.75rem;
  color: #f9d8c0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.advanced-json textarea {
  width: 100%;
  min-height: 12rem;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, #f97316, #ff8a2a);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.18);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

button.secondary {
  min-height: 2.4rem;
  color: #ffd8bd;
  border: 1px solid rgba(249, 115, 22, 0.34);
  background: rgba(249, 115, 22, 0.12);
  box-shadow: none;
}

button.danger {
  color: #ffd3d3;
  border-color: rgba(255, 107, 107, 0.36);
  background: rgba(255, 107, 107, 0.12);
}

.note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.result {
  min-height: 680px;
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.download {
  flex: 0 0 auto;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  color: white;
  background: rgba(249, 115, 22, 0.22);
  border: 1px solid rgba(249, 115, 22, 0.42);
  text-decoration: none;
  font-weight: 800;
  box-shadow: none;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.hidden {
  display: none !important;
}

.preview {
  display: grid;
  min-height: 560px;
  background: #f6f1ea;
}

.map-frame {
  width: 100%;
  height: min(74vh, 900px);
  border: 0;
  background: white;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  min-height: 560px;
  color: #433b34;
  text-align: center;
}

.empty-state.error {
  color: var(--danger);
  background: #140b0d;
}

.radar {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  border: 2px solid rgba(249, 115, 22, 0.65);
  background:
    linear-gradient(90deg, transparent 49%, rgba(249, 115, 22, 0.3) 50%, transparent 51%),
    linear-gradient(transparent 49%, rgba(249, 115, 22, 0.3) 50%, transparent 51%),
    radial-gradient(circle, rgba(249, 115, 22, 0.24), transparent 58%);
}

.radar.active {
  animation: pulse 1.2s infinite ease-in-out;
}

.log {
  margin: 0;
  padding: 1rem;
  max-height: 12rem;
  overflow: auto;
  border-top: 1px solid var(--line);
  color: #b8afa6;
  background: #08090c;
  font-size: 0.78rem;
}

@keyframes pulse {
  50% {
    transform: scale(1.04);
    opacity: 0.72;
  }
}

@media (max-width: 900px) {
  .controls {
    position: static;
    max-height: none;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .result-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .download {
    width: 100%;
    text-align: center;
  }

  .result-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
}
