* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

#sidebar {
  width: 250px;
  flex-shrink: 0;
  padding: 1.5rem 1rem;
  background: #12122a;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-right: 1px solid #2a2a4a;
  overflow-y: auto;
}

h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e8441a;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

/* ── Region banner ────────────────────────────────────────────────────────── */

#region-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 10px;
  border-bottom: 1px solid #2a2a4a;
  margin-bottom: -0.3rem;
}

#region-name {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #7888b8;
}

#region-change {
  font-size: 0.72rem;
  color: #4858a8;
  text-decoration: none;
  transition: color 0.15s;
}

#region-change:hover {
  color: #7090ff;
}

#controls {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="number"],
input[type="text"],
select {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  color: #e0e0e0;
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
  width: 100%;
  transition: border-color 0.15s;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #e8441a;
}

select {
  cursor: pointer;
  padding-right: 1.8rem;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 8px;
}

button {
  background: #e8441a;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  width: 100%;
  transition: background 0.15s, opacity 0.15s;
}

button:hover:not(:disabled) { background: #c73414; }
button:disabled { opacity: 0.4; cursor: default; }

#status {
  font-size: 0.75rem;
  color: #666;
  min-height: 1em;
  line-height: 1.4;
}

/* ── Customization section ────────────────────────────────────────────────── */

#customization {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 0.2rem;
  border-top: 1px solid #2a2a4a;
}

.section-label {
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: -0.1rem;
}

/* ── Palette buttons ──────────────────────────────────────────────────────── */

#palette-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.palette-btn {
  height: 46px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.palette-scale {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 7px;
}

.palette-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.55);
}

.palette-btn.active {
  border-color: transparent;
  box-shadow: 0 0 0 2px #e8441a, 0 0 0 4px rgba(232, 68, 26, 0.25);
}

/* ── Downloads ────────────────────────────────────────────────────────────── */

#downloads {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #2a2a4a;
}

#btn-png,
#btn-pdf {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  font-size: 0.8rem;
  font-weight: 400;
  padding: 0.4rem;
}

#btn-png:hover:not(:disabled),
#btn-pdf:hover:not(:disabled) {
  background: #2a2a4a;
}

/* ── Map area ─────────────────────────────────────────────────────────────── */

#map-area {
  flex: 1;
  background: #242436;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#map-wrapper {
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  box-shadow:
    0 14px 50px rgba(0, 0, 0, 0.65),
    0  4px 14px rgba(0, 0, 0, 0.40),
    0  1px  3px rgba(0, 0, 0, 0.30);
}

#map {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}
