/* HOP tools. Loaded after hop.css and built from the same ledger:
   bone on char, straw for what you chose, clot for what is in the way. */

.bench {
  max-width: var(--spread);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.bench .mast h1 {
  font-size: clamp(2rem, 4.6vw, 3rem);
  line-height: 1.02;
}

.bench .lede {
  max-width: 40rem;
}

.bench .banner {
  font-size: 1.35rem;
}

.bench a {
  color: var(--straw);
}

.bench :focus-visible {
  outline: 2px solid var(--straw);
  outline-offset: 2px;
}

/* ---- form controls */

.field {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.field > label,
.field > .label {
  color: var(--straw);
  font-size: 0.82rem;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  padding: 0.4rem 0.1rem;
  border: 0;
  border-bottom: 1px solid var(--straw-deep);
  border-radius: 0;
  background: transparent;
  color: var(--bone);
  font: inherit;
  font-size: 1rem;
}

.field select {
  cursor: pointer;
}

.field option {
  background: var(--soot);
  color: var(--bone);
}

.field input::placeholder {
  color: var(--bone-dim);
  opacity: 0.7;
}

.field input:disabled,
.field select:disabled {
  color: var(--bone-dim);
  border-bottom-style: dashed;
  cursor: not-allowed;
}

.field .hint {
  color: var(--bone-dim);
  font-size: 0.82rem;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.9rem 1.5rem;
  align-items: end;
}

.btn {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border: 0;
  background: var(--straw);
  color: var(--char);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.bench a.btn {
  color: var(--char);
}

.btn:hover {
  background: var(--bone);
}

.btn:disabled {
  background: var(--ash);
  color: var(--bone-dim);
  cursor: not-allowed;
}

.btn-quiet {
  padding: 0.2rem 0;
  border: 0;
  border-bottom: 1px solid var(--straw-deep);
  background: none;
  color: var(--straw);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.btn-quiet:hover {
  color: var(--bone);
  border-bottom-color: var(--bone);
}

.btn-quiet:disabled {
  color: var(--bone-dim);
  border-bottom-style: dashed;
  cursor: not-allowed;
}

.modes {
  display: flex;
  gap: 1.5rem;
  margin: 1.4rem 0 0;
  border-bottom: 1px solid var(--line);
}

.modes button {
  margin-bottom: -1px;
  padding: 0.45rem 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--bone-dim);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 560;
  cursor: pointer;
}

.modes button:hover {
  color: var(--bone);
}

.modes button[aria-selected="true"] {
  color: var(--bone);
  border-bottom-color: var(--straw);
}

.tag {
  display: inline-block;
  color: var(--bone-dim);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tag.is-back {
  color: var(--clot-bright);
}

.tag.is-front {
  color: var(--straw);
}

.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}

.verdict {
  margin: 0.9rem 0 0;
  padding: 0.1rem 0 0.1rem 0.9rem;
  border-left: 3px solid var(--straw-deep);
}

.verdict.is-bad {
  border-left-color: var(--clot);
}

.verdict p:last-child {
  margin-bottom: 0;
}

.empty {
  color: var(--bone-dim);
  font-style: italic;
}

.sources {
  margin: 2.5rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--bone-dim);
  font-size: 0.85rem;
  max-width: 46rem;
}

.sources p {
  margin: 0 0 0.35rem;
}

.bench table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bench tbody th {
  width: auto;
}

/* ---- tool index */

.tool-index td:last-child {
  color: var(--bone-dim);
}

.tool-index th a {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 560;
  text-decoration: none;
}

.tool-index th a:hover {
  text-decoration: underline;
}

.index-body {
  max-width: 46rem;
}

/* ---- cluster jewels */

.cluster {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem 2.5rem;
  margin-top: 1.4rem;
}

.cluster section {
  margin: 0;
  min-width: 0;
}

.picker .fields {
  grid-template-columns: 1fr;
  margin-bottom: 0.9rem;
}

.pick-list {
  max-height: 24rem;
  overflow-y: auto;
  border-top: 1px solid var(--straw-deep);
  border-bottom: 1px solid var(--line);
}

.pick-list li {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.pick-list li:last-child {
  border-bottom: 0;
}

.pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.1rem 0.75rem;
  align-items: baseline;
  width: 100%;
  padding: 0.42rem 0.5rem 0.42rem 0.6rem;
  border: 0;
  border-left: 3px solid transparent;
  background: none;
  color: var(--bone);
  font: inherit;
  font-size: 0.96rem;
  text-align: left;
  cursor: pointer;
}

.pick:hover {
  background: var(--soot);
}

.pick[aria-pressed="true"] {
  border-left-color: var(--straw);
  background: var(--soot);
  color: var(--straw);
}

.pick.is-candidate {
  border-left-color: var(--clot);
}

.pick.is-dim {
  color: var(--bone-dim);
}

.pick:disabled {
  color: var(--bone-dim);
  opacity: 0.45;
  cursor: not-allowed;
}

.pick:disabled:hover {
  background: none;
}

.pick .tags {
  display: flex;
  gap: 0.6rem;
}

.plate {
  border-bottom: 1px solid var(--line);
}

.ring {
  display: block;
  width: 100%;
  max-width: 27rem;
  height: auto;
  margin: 0 auto;
}

.ring .track,
.ring .stem {
  fill: none;
  stroke: var(--straw-deep);
  stroke-width: 1.6;
}

.ring .small {
  fill: var(--char);
  stroke: var(--bone-dim);
  stroke-width: 1.4;
}

.ring .socket {
  fill: var(--char);
  stroke: var(--bone);
  stroke-width: 1.6;
}

.ring .notable {
  fill: var(--char);
  stroke: var(--bone-dim);
  stroke-width: 2;
  stroke-dasharray: 3 3;
}

.ring .notable.is-set {
  stroke: var(--bone);
  stroke-dasharray: none;
}

.ring .notable.is-wanted {
  fill: var(--straw);
  stroke: var(--straw);
}

.ring .notable.is-misplaced {
  fill: var(--clot);
  stroke: var(--clot-bright);
}

.ring text {
  fill: var(--bone);
  font-family: var(--text);
  font-size: 13px;
}

.ring .caption {
  fill: var(--bone-dim);
  font-size: 11px;
}

.ring .name.is-empty {
  fill: var(--bone-dim);
  font-style: italic;
}

.chosen {
  margin: 0.9rem 0 0;
}

.chosen li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.chosen .who {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 560;
}

.chosen .what {
  grid-column: 1 / -1;
  color: var(--bone-dim);
  font-size: 0.9rem;
}

.trade-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.2rem 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.trade-league {
  margin-top: 0.9rem;
}

/* A class that sets display would otherwise undo the hidden attribute. */
.bench [hidden] {
  display: none;
}

/* ---- timeless jewels
   The tree is the page. On wide screens it fills the window beside a narrow
   column of controls and results. On narrow screens that column dissolves
   (display: contents) so the tree can sit between the tabs and the results. */

.wide .bench,
.wide .running-inner,
.wide .footer-inner {
  max-width: none;
}

.timeless {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.timeless .side {
  display: contents;
}

.timeless .mast {
  grid-area: auto; /* hop.css names an area that this grid does not have */
  order: 1;
}

.timeless-controls {
  order: 2;
  margin: 1.4rem 0 0;
}

.timeless .modes {
  order: 3;
}

.timeless .chart-col {
  order: 4;
  min-width: 0;
  margin-top: 1.25rem;
}

.timeless .panel {
  order: 5;
  margin: 1.5rem 0 0;
}

.timeless .sources {
  order: 6;
}

.timeless-controls .fields {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.timeless-controls .is-wide {
  grid-column: 1 / -1;
}

.timeless-controls .paste-note {
  margin: 0;
  align-self: center;
}

.chart {
  position: relative;
  height: 70vh; /* most of a phone screen, with room left to scroll past it */
  min-height: 22rem;
  border-top: 1px solid var(--straw-deep);
  border-bottom: 1px solid var(--line);
  background: rgba(34, 28, 24, 0.45);
  overflow: hidden;
  touch-action: none;
}

.chart canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.chart canvas.is-dragging {
  cursor: grabbing;
}

.chart canvas.is-pointing {
  cursor: pointer;
}

.chart-tools {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.35rem;
}

.chart-tools button {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid var(--straw-deep);
  background: rgba(20, 17, 14, 0.9);
  color: var(--straw);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.chart-tools button:hover {
  color: var(--bone);
  border-color: var(--bone);
}

.chart-note {
  position: absolute;
  left: 0.6rem;
  bottom: 0.45rem;
  margin: 0;
  color: var(--bone-dim);
  font-size: 0.82rem;
  pointer-events: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  margin: 0.5rem 0 0;
  color: var(--bone-dim);
  font-size: 0.82rem;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 0.62rem;
  height: 0.62rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--key, var(--bone-dim));
  vertical-align: -0.02rem;
}

.legend .is-hollow::before {
  box-shadow: inset 0 0 0 1px var(--bone-dim);
}

.tip {
  position: absolute;
  z-index: 5;
  max-width: min(19rem, 80%);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--straw-deep);
  background: rgba(20, 17, 14, 0.97);
  font-size: 0.86rem;
  line-height: 1.4;
  pointer-events: none;
}

.tip[hidden] {
  display: none;
}

.tip .tip-name {
  margin: 0 0 0.2rem;
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 560;
  color: var(--bone);
}

.tip p {
  margin: 0;
}

.tip .was {
  color: var(--bone-dim);
}

.tip .now {
  color: var(--straw);
}

.tip .tip-rule {
  margin: 0.35rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.panel {
  min-width: 0;
}

.panel h3 {
  margin-top: 1.1rem;
}

.panel h3:first-child {
  margin-top: 0;
}

.panel .table-wrap {
  margin-top: 0.4rem;
}

.panel td .gain {
  color: var(--straw);
}

.panel td .swap {
  font-weight: 650;
}

.panel .count {
  color: var(--bone-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tally li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
  font-size: 0.94rem;
}

.wanted-stats li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.6rem 3.6rem auto;
  gap: 0.6rem;
  align-items: end;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
  font-size: 0.94rem;
}

.wanted-stats .field input {
  padding: 0.2rem 0.1rem;
  font-variant-numeric: tabular-nums;
}

.search-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.1rem;
  margin: 0.9rem 0 0;
}

.progress {
  width: 100%;
  height: 3px;
  margin-top: 0.7rem;
  background: var(--ash);
}

.progress > i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--straw);
}

.seed-results {
  max-height: 26rem;
  overflow-y: auto;
}

.seed-results button.seed {
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--straw-deep);
  background: none;
  color: var(--straw);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.seed-results tr.is-current td {
  background: var(--soot);
}

.paste-note {
  margin: 0.6rem 0 0;
  color: var(--bone-dim);
  font-size: 0.85rem;
}

@media (min-width: 960px) {
  .cluster {
    grid-template-columns: 21rem minmax(0, 1fr);
    align-items: start;
  }

  .pick-list {
    max-height: calc(100vh - 19rem);
    min-height: 18rem;
  }

  .picker {
    position: sticky;
    top: 4rem;
  }

  .timeless {
    grid-template-columns: minmax(0, 1fr) clamp(23rem, 27vw, 28rem);
    column-gap: 2rem;
    align-items: start;
    padding-top: 0.65rem;
  }

  .timeless .side {
    display: block;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  /* The tree stays put, filling the window under the header, while the column scrolls. */
  .timeless .chart-col {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 3.9rem;
    margin-top: 0;
  }

  .timeless .chart {
    height: calc(100vh - 7rem);
    min-height: 26rem;
  }

  .timeless .mast {
    padding-top: 0.5rem;
  }

  .timeless .mast h1 {
    font-size: 2rem;
  }

  .timeless .lede {
    margin-top: 0.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 560px) {
  .bench {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .wanted-stats li {
    grid-template-columns: minmax(0, 1fr) 3.2rem 3.2rem;
  }

  .wanted-stats li .btn-quiet {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 420px) {
  .timeless-controls .fields {
    grid-template-columns: 1fr;
  }
}

@media print {
  .chart-tools,
  .picker,
  .modes {
    display: none;
  }
}
