.coordinate-plane-layout,
.coordinate-plane-builder,
.coordinate-plane-builder > * {
  min-width: 0;
  max-width: 100%;
}

.coordinate-plane-layout {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.coordinate-plane-builder {
  display: grid;
  gap: 14px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid #b9d7d4;
  border-radius: 12px;
  background: #f3fbf9;
}

.coordinate-plane-instructions {
  padding: 12px 14px;
  border-left: 4px solid var(--teal);
  background: #fffdfa;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.coordinate-plane-instructions b { color: var(--ink); }
.coordinate-plane-instructions ol { margin: 6px 0 0; padding-left: 20px; }

.plane-available,
.plane-built {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdfa;
}

.plane-available > div,
.plane-history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.plane-tool,
.plane-history button,
.plane-built-item button {
  width: auto;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.plane-tool[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}

.coordinate-plane-canvas {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid #d7e5e3;
  border-radius: 10px;
  background: #fffdfa;
}

.coordinate-plane-canvas svg {
  display: block;
  width: max(100%, 620px);
  height: auto;
}

.plane-scroll-hint { display: none; color: var(--muted); }

.plane-grid-line { stroke: #dce9e7; stroke-width: 1; }
.plane-axis { stroke: #879f9d; stroke-width: 2; }
.plane-grid-label { fill: #6b7e8e; text-anchor: middle; font: 11px Inter, ui-sans-serif, sans-serif; }
.plane-built-object { stroke: var(--orange); stroke-width: 5; stroke-linecap: round; }
.plane-built-object.is-line { stroke-dasharray: 12 5; }
.plane-source-point { cursor: pointer; }
.plane-source-point circle { fill: var(--ink); stroke: #fffdfa; stroke-width: 3; }
.plane-source-point text { fill: var(--ink); font: 800 17px Inter, ui-sans-serif, sans-serif; }
.plane-source-point:focus { outline: none; }
.plane-source-point:focus circle,
.plane-source-point.is-selected circle { fill: var(--orange); stroke: var(--ink); stroke-width: 4; }

.plane-selection,
.coordinate-plane-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.plane-built > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.plane-built > div:first-child span {
  color: #a15a18;
  font-weight: 800;
}

.plane-built ul {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.plane-built li.is-empty { color: var(--muted); font-size: 13px; }

.plane-built-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-left: 4px solid var(--orange);
  background: #fff3df;
  font-weight: 700;
}

.plane-built-item button {
  min-height: 32px;
  border-color: #d59a58;
  padding: 5px 9px;
}

.plane-history button:disabled {
  cursor: default;
  opacity: .45;
}

.coordinate-plane-answer-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 650px) {
  .coordinate-plane-builder { padding: 12px 8px; }
  .coordinate-plane-canvas { margin-inline: 0; }
  .coordinate-plane-answer-fields { grid-template-columns: minmax(0, 1fr); }
  .plane-scroll-hint { display: block; }
  .plane-built-item { align-items: flex-start; }
}
