.tool-shell {
  width: min(1120px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.tool-header,
.tool-actions,
.editor-panel {
  background: var(--panel);
  border: 1px solid #2d2a24;
  border-radius: 8px;
  padding: 14px 16px;
}

.tool-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.tool-header .links {
  width: auto;
  margin: 0;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.map-grid {
  display: grid;
  gap: 8px;
  background: #0c0c10;
  border: 1px solid #2d2a24;
  border-radius: 8px;
  padding: 12px;
}

.cell-button {
  position: relative;
  min-height: 96px;
  border: 1px solid #51462b;
  background: #181820;
  color: var(--ink);
  padding: 0;
}

.cell-button.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(240, 180, 60, 0.45);
}

.cell-label {
  position: absolute;
  left: 8px;
  top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.marker {
  position: absolute;
  right: 8px;
  top: 6px;
  color: #ffdf70;
  font-size: 12px;
}

.road {
  position: absolute;
  background: #2d775f;
}

.road.n {
  left: 44%;
  top: 0;
  width: 12%;
  height: 50%;
}

.road.e {
  right: 0;
  top: 44%;
  width: 50%;
  height: 12%;
}

.road.s {
  left: 44%;
  bottom: 0;
  width: 12%;
  height: 50%;
}

.road.w {
  left: 0;
  top: 44%;
  width: 50%;
  height: 12%;
}

.road.center {
  left: 36%;
  top: 36%;
  width: 28%;
  height: 28%;
  border-radius: 999px;
}

.editor-panel h2 {
  margin: 0 0 8px;
}

.editor-panel p {
  color: var(--muted);
  margin-bottom: 12px;
}

.field-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field-grid label {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid #393526;
  border-radius: 6px;
  background: var(--panel-2);
  padding: 8px;
}

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid #51462b;
  border-radius: 6px;
  background: #07070a;
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  padding: 10px;
}

@media (max-width: 820px) {
  .tool-header,
  .editor-layout {
    grid-template-columns: 1fr;
  }
}
