.semantic-page {
  --deep-blue: #335e9b;
  background: linear-gradient(135deg, #f1f6ff 0%, #edf8f8 52%, #f5f6ff 100%);
}

.semantic-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.semantic-sidebar {
  display: grid;
  gap: 18px;
}

.semantic-main {
  min-width: 0;
  min-height: 640px;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .84);
  box-shadow: var(--shadow);
}

.semantic-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.semantic-title h1 {
  margin: 4px 0 0;
  font-size: 34px;
  letter-spacing: 0;
}

.semantic-prompt {
  margin: 0 0 20px;
  padding: 20px;
  border: 1px solid #cad9f1;
  border-left: 7px solid var(--sky);
  border-radius: var(--radius);
  background: #f5f8ff;
}

.semantic-prompt span {
  color: var(--deep-blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.semantic-prompt p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.35;
  font-weight: 900;
}

.semantic-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.semantic-section-heading h2,
.semantic-section-heading h3 {
  margin: 0;
}

.semantic-section-heading h3 {
  font-size: 18px;
}

.exemplar-library {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.exemplar-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.exemplar-card.selected {
  border-color: rgba(139, 184, 255, .8);
  background: #f7f9ff;
  box-shadow: inset 4px 0 0 var(--sky);
}

.exemplar-select {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  accent-color: var(--deep-blue);
}

.exemplar-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.exemplar-name {
  font-weight: 900;
}

.exemplar-poles {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.exemplar-poles span:first-child,
.exemplar-poles span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-exemplar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #ffd2ca;
  border-radius: 50%;
  background: #fff7f5;
  color: #9b3f35;
  font-weight: 900;
}

.exemplar-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.exemplar-form .topic-input {
  min-height: 86px;
}

.exemplar-empty {
  padding: 16px;
  border: 1px dashed #bfd2ee;
  border-radius: var(--radius);
  background: #f8faff;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.axis-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.axis-pole {
  padding: 10px;
  border-radius: var(--radius);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.axis-pole.away {
  background: #fff3f1;
  color: #98463a;
}

.axis-pole.toward {
  background: #eafff8;
  color: #267662;
}

.axis-arrow {
  color: var(--muted);
  font-weight: 900;
}

.semantic-progress {
  margin-bottom: 22px;
}

.semantic-waiting {
  min-height: 310px;
  display: grid;
  place-items: center;
  gap: 14px;
  border: 1px dashed #bfd7cf;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .5);
  color: var(--muted);
  padding: 30px;
  text-align: center;
}

.semantic-waiting img {
  width: 120px;
  animation: float 5s ease-in-out infinite;
}

.analysis-loading {
  min-height: 430px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  border: 1px dashed #bfd2ee;
  border-radius: var(--radius);
  background: #f8faff;
  color: var(--muted);
  text-align: center;
  padding: 30px;
}

.analysis-mochi {
  width: 92px;
  filter: drop-shadow(0 12px 16px rgba(57, 79, 74, .12));
  animation: float 5s ease-in-out infinite;
}

.analysis-loading strong {
  color: var(--ink);
  font-size: 18px;
}

.plot-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.plot-toolbar h2 {
  margin: 0;
  font-size: 24px;
}

.plot-tabs {
  flex: 0 0 auto;
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f5f7f6;
}

.plot-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.plot-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(48, 69, 65, .1);
}

.semantic-chart-shell {
  position: relative;
  padding: 18px 16px 42px 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.semantic-chart-surface {
  position: relative;
  min-height: 500px;
  border-left: 2px solid #9caaa5;
  border-bottom: 2px solid #9caaa5;
  background-color: #fcfdfd;
  background-image:
    linear-gradient(rgba(219, 231, 225, .55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(219, 231, 225, .55) 1px, transparent 1px);
  background-size: 25% 25%;
  overflow: visible;
}

.chart-axis-title {
  position: absolute;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  pointer-events: none;
}

.chart-axis-title.x {
  left: 58px;
  right: 16px;
  bottom: 12px;
  text-align: center;
}

.chart-axis-title.y {
  left: 10px;
  top: 50%;
  transform: translate(-35%, -50%) rotate(-90deg);
  white-space: nowrap;
}

.chart-pole-label {
  position: absolute;
  bottom: -29px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.chart-pole-label.left {
  left: 0;
}

.chart-pole-label.right {
  right: 0;
}

.plot-point {
  --point-color: var(--mint);
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--point-color);
  color: var(--ink);
  font-size: 19px;
  line-height: 1;
  box-shadow: 0 5px 12px rgba(48, 69, 65, .16), inset 0 -4px 0 rgba(255, 255, 255, .28);
  transition: transform .14s ease, box-shadow .14s ease;
  z-index: 2;
}

.plot-point:hover,
.plot-point:focus-visible {
  transform: translate(-50%, -50%) scale(1.22);
  outline: none;
  box-shadow: 0 9px 20px rgba(48, 69, 65, .24), 0 0 0 5px rgba(139, 184, 255, .25);
  z-index: 8;
}

.plot-point.winner {
  box-shadow: 0 5px 12px rgba(48, 69, 65, .16), 0 0 0 5px rgba(255, 209, 102, .55);
}

.plot-point.winner::after {
  content: "★";
  position: absolute;
  top: -13px;
  right: -10px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid #b98500;
  border-radius: 50%;
  background: var(--lemon);
  color: #6a4d00;
  font-size: 12px;
  line-height: 1;
}

.plot-point.anchor {
  width: 30px;
  height: 30px;
  border-style: dashed;
  background: #fff;
  font-size: 11px;
  font-weight: 1000;
  z-index: 1;
}

.plot-point.source {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  z-index: 3;
}

.plot-tooltip {
  position: absolute;
  width: min(310px, calc(100% - 20px));
  display: none;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: 0 16px 30px rgba(38, 50, 56, .28);
  pointer-events: none;
  z-index: 20;
}

.plot-tooltip.show {
  display: block;
}

.plot-tooltip strong,
.plot-tooltip span {
  display: block;
}

.plot-tooltip span {
  margin-top: 5px;
  color: rgba(255, 255, 255, .82);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.plot-tooltip small {
  display: block;
  margin-top: 8px;
  color: #bfe5da;
  font-size: 11px;
  line-height: 1.35;
}

.plot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.plot-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-mark {
  width: 13px;
  height: 13px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mint);
}

.legend-mark.source {
  border-radius: 3px;
  background: var(--ink);
}

.legend-mark.anchor {
  border-style: dashed;
  background: #fff;
}

.legend-mark.winner {
  display: inline-grid;
  place-items: center;
  border-color: #b98500;
  background: var(--lemon);
  color: #6a4d00;
  font-size: 9px;
  font-style: normal;
}

.semantic-response-input {
  min-height: 190px;
}

.character-count {
  margin-left: auto;
}

.semantic-done-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid #ccebe2;
  border-radius: var(--radius);
  background: #f0fff9;
}

.semantic-done-card strong {
  color: #267662;
}

.semantic-done-card p {
  margin: 0;
}

@media (max-width: 960px) {
  .semantic-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .semantic-title,
  .plot-toolbar {
    flex-direction: column;
  }

  .plot-tabs {
    width: 100%;
  }

  .plot-tab {
    flex: 1;
  }

  .semantic-chart-shell {
    padding-left: 44px;
  }

  .semantic-chart-surface {
    min-height: 410px;
  }

  .chart-axis-title.x {
    left: 44px;
  }

  .plot-point {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }
}

@media (max-width: 520px) {
  .exemplar-poles {
    grid-template-columns: 1fr;
  }

  .exemplar-poles span:nth-child(2) {
    display: none;
  }

  .semantic-chart-shell {
    padding: 12px 10px 42px 36px;
  }

  .chart-axis-title.x {
    left: 36px;
    right: 10px;
  }

  .chart-axis-title.y {
    left: 4px;
  }
}
