:root {
  --bg: #f5f3ec;
  --panel: #fffdf8;
  --text: #222020;
  --muted: #6c6460;
  --accent: #a63d40;
  --border: #d9d1c7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #fff8ed, var(--bg));
}

.app {
  height: 100%;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 16px;
  overflow: auto;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
}

.subtitle {
  margin: 4px 0 16px;
  color: var(--muted);
}

label {
  display: block;
  font-size: 0.9rem;
  margin: 14px 0 6px;
}

.item-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.item-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.item-btn:hover {
  border-color: var(--accent);
}

.item-btn.is-selected {
  border-color: #3f7ecc;
  box-shadow: inset 0 0 0 1px #3f7ecc;
  background: #f3f8ff;
}

.item-btn-name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
}

.item-btn-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

select,
button {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.goto-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.status,
.hint {
  margin-top: 14px;
  font-size: 0.9rem;
}

.status {
  color: var(--accent);
  min-height: 22px;
}

.hint {
  color: var(--muted);
}

#legend {
  margin: 10px 0 0;
  padding-left: 18px;
}

#legend li {
  margin: 6px 0;
}

.canvas-wrap {
  min-width: 0;
  min-height: 0;
  position: relative;
}

#map-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #ffffff;
  cursor: crosshair;
}

.replacement-menu {
  position: absolute;
  z-index: 5;
  min-width: 200px;
  max-width: 280px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
  padding: 8px;
}

.hover-popover {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  background: rgba(34, 32, 32, 0.92);
  color: #fff;
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  max-width: 220px;
  white-space: nowrap;
}

.replacement-menu-title {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.replacement-menu-list {
  display: grid;
  gap: 6px;
}

.replacement-menu-list button {
  text-align: left;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
  }
}
