/* Analysis workspace: wide on a computer, stacked on a phone. */

/* The app's own palette (Theme.swift, dark theme), so a colour means the same
   thing on the phone and here. */
.analysis {
  --app-surface: #16273a;
  --app-elevated: #1f3548;
  --app-card: #121f2e;
  --app-primary: #3dba6f;
  --app-primary-light: #52d687;
  --app-accent: #ffb84d;
  --app-text-secondary: #b9cedc;
  --app-text-muted: #7c93a3;
  --app-error: #ff5c6c;
  --app-border: #2a4a61;
  --app-break-left: #6fa8ff;
  --app-break-right: #ff8552;
  --app-uphill: #5be7c4;
  --app-downhill: #ff9e7d;
  --cat-eagle: #f5d26b;
  --cat-birdie: #ff5c6c;
  --cat-par: #3dba6f;
  --cat-bogey: #5aa2ff;
  --cat-double: #f2f4f6;

  --surface: var(--app-card);
  --line: var(--app-border);
  --bad: var(--app-error);
  --muted: var(--app-text-secondary);
}

/* KNDR lab on the left, the PUTTOR wordmark in the very middle (back to the
   app's page), the file and the quick links on the right. */
.page-header--analysis {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.page-header__puttor {
  display: block;
  line-height: 0;
  transition: opacity 0.2s ease;
}

.page-header__puttor img {
  width: auto;
  height: 34px;
}

@media (hover: hover) and (pointer: fine) {
  .page-header__puttor:hover {
    opacity: 0.8;
  }
}

.page-header__meta {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 640px) {
  .page-header__puttor img {
    height: 24px;
  }

  .file-name {
    display: none;
  }

  .ghost-button__long {
    display: none;
  }

  .ghost-button {
    padding: 0.4em 0.8em;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .filters {
    gap: 0.6rem 1rem;
    padding: 0.75rem 16px;
  }

  .filter select {
    font-size: 0.9rem;
  }

  .workspace {
    padding: 1rem 16px 3rem;
  }

  .panel {
    padding: 1rem 0.75rem 1.25rem;
  }

  .plot__title {
    font-size: 1.1rem;
  }
}

.file-name {
  color: var(--muted);
  font-size: 0.9rem;
}

.ghost-button {
  padding: 0.5em 1.1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .ghost-button:hover {
    border-color: var(--green);
    color: var(--green);
  }
}

/* Drop zone */

.intro {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 5rem) 1.5rem 4rem;
  text-align: center;
}

.intro__title {
  margin: 0 0 1rem;
  color: var(--white);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
}

.intro__lead {
  margin: 0 0 2.5rem;
  color: var(--muted);
}

.drop {
  padding: clamp(2rem, 6vw, 3.5rem) 1.5rem;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  background: var(--surface);
}

.drop--over {
  border-color: var(--green);
  background: rgba(61, 186, 111, 0.08);
}

.drop__text {
  margin: 0 0 0.75rem;
  color: var(--white);
}

.drop__or {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.drop__error {
  margin: 1.25rem 0 0;
  color: var(--bad);
}

.intro__back {
  margin-top: 2.5rem;
}

/* Filter row */

.filters {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  width: min(calc(100% - 4vw), 2200px);
  margin: 0 auto;
  padding: 1rem clamp(0.75rem, 2vw, 1.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--navy);
}

.filter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.filter__label {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter select {
  padding: 0.45em 0.7em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--white);
  font: inherit;
  font-size: 0.95rem;
}

.filters[hidden] {
  display: none;
}

/* A shared report: whose, how many rounds, over which days */

.report-info {
  width: min(calc(100% - 4vw), 2200px);
  margin: 0 auto;
  padding: 1rem clamp(0.75rem, 2vw, 1.5rem) 0;
  color: var(--app-text-secondary);
  font-size: 0.95rem;
}

.report-info strong {
  color: var(--white);
  font-weight: 400;
}

.report-info[hidden] {
  display: none;
}

/* Three columns: list · graph · text */

.workspace {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(500px, 1fr) minmax(280px, 360px);
  gap: clamp(1rem, 2vw, 2rem);
  align-items: start;
  width: min(calc(100% - 4vw), 2200px);
  margin: 0 auto;
  padding: 1.5rem clamp(0.75rem, 2vw, 1.5rem) 4rem;
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  top: 5rem;
}

.section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.section--active {
  border-color: rgba(61, 186, 111, 0.55);
}

.section__head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 0;
  background: transparent;
  color: var(--white);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .section__head:hover {
    background: rgba(255, 255, 255, 0.03);
  }
}

.section--active .section__title {
  color: var(--green);
}

.section__value {
  color: var(--muted);
  font-size: 0.85rem;
}

.section__body {
  margin: 0;
  padding: 0.25rem 1rem 1rem;
  border-top: 1px solid var(--line);
}

.section__body .row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.section__body dt {
  color: var(--muted);
}

.section__body dd {
  margin: 0;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

/* Graph */

.plot {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1rem, 2vw, 1.5rem);
  min-width: 500px;
}

.panel {
  padding: 1.25rem clamp(1rem, 1.5vw, 1.5rem) 1.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.plot__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.plot__title {
  margin: 0;
  color: var(--white);
  font-size: 1.3rem;
  font-weight: 400;
}

.plot__canvas svg {
  display: block;
  width: 100%;
  height: auto;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.4em 0.9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .chip:hover {
    color: var(--white);
  }
}

.chip--on {
  border-color: var(--green);
  color: var(--green);
}

/* Chart ink */

.grid { stroke: rgba(42, 74, 97, 0.45); stroke-width: 1; }
.axis { stroke: var(--app-border); stroke-width: 1; }
.zero { stroke: var(--app-text-muted); stroke-width: 1.5; }
.average { stroke: var(--app-primary); stroke-width: 1; stroke-dasharray: 6 5; opacity: 0.85; }
.tick { fill: var(--app-text-secondary); font-size: 15px; }
.tick--dim { fill: var(--app-text-muted); font-size: 13px; }
.value { fill: #fff; font-size: 15px; font-variant-numeric: tabular-nums; }
.value--small { fill: var(--app-text-secondary); font-size: 12px; }
.lg-track { fill: rgba(124, 147, 163, 0.14); }
.lg-mark { stroke: #fff; stroke-width: 3; }
.lg-centre { stroke: var(--app-text-muted); stroke-width: 1.5; }
.lg-left, .lg-left-bar { fill: var(--app-break-left); }
.lg-right, .lg-right-bar { fill: var(--app-break-right); }
.tick--good { fill: var(--app-primary); }
.tick--bad { fill: var(--app-error); }
.legend { fill: var(--app-text-muted); font-size: 14px; }
.empty { fill: var(--app-text-muted); font-size: 18px; }
.bar { fill: var(--app-primary); }
.bar--good { fill: var(--app-primary); }
.bar--bad { fill: var(--app-error); }
.bar--you { fill: var(--app-primary); }
.bar--muted { fill: rgba(124, 147, 163, 0.35); }
.cat--eagle { fill: var(--cat-eagle); }
.cat--birdie { fill: var(--cat-birdie); }
.cat--par { fill: var(--cat-par); }
.cat--bogey { fill: var(--cat-bogey); }
.cat--double { fill: var(--cat-double); }
.tour-line { fill: none; stroke: var(--app-text-secondary); stroke-width: 2; }
.tour-dot { fill: var(--app-text-secondary); }
.ring { fill: none; stroke: rgba(124, 147, 163, 0.35); }
.hole { fill: #fff; }

/* Table */

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child,
.data-table th:nth-child(2),
.data-table td:nth-child(2) {
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag {
  padding: 0 0.35em;
  border-radius: 4px;
  background: rgba(61, 186, 111, 0.2);
  color: var(--green);
  font-size: 0.75rem;
}

/* Text column */

.readout {
  position: sticky;
  top: 5rem;
  max-height: calc(100svh - 7rem);
  overflow-y: auto;
  padding: 1.25rem 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-size: 0.95rem;
}

.readout__title {
  margin: 0 0 1rem;
  color: var(--green);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.readout p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.readout h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 400;
}

.readout__count {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
}

.readout__list {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.readout__list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.readout__list--plain li {
  display: block;
}

.readout .good { color: var(--green); }
.readout .bad { color: var(--bad); }
.data-table .good { color: var(--green); }
.data-table .bad { color: var(--bad); }

.empty-text {
  color: var(--muted);
}

/* Narrow screens: one column, the phone layout */

.section-picker {
  display: none;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
    width: 100%;
  }

  /* A list to pick the statistic, then its graph, its figures and the text. */
  .section-picker {
    display: block;
    position: sticky;
    top: 0;
    z-index: 2;
    order: -1;
    margin: -0.5rem 0;
    padding: 0.5rem 0;
    background: var(--navy);
  }

  .section-picker select {
    width: 100%;
    padding: 0.75em 1em;
    border: 1px solid rgba(61, 186, 111, 0.55);
    border-radius: 12px;
    background: var(--app-surface);
    color: var(--white);
    font: inherit;
    font-size: 1rem;
  }

  .sections {
    order: 1;
  }

  .readout {
    order: 2;
  }

  .section:not(.section--active),
  .section--active .section__head,
  .section:not(:has(> .section__body:not(:empty))) {
    display: none;
  }

  .section__body {
    border-top: 0;
    padding-top: 0.75rem;
  }

  .filters {
    position: static;
  }

  .sections,
  .readout {
    position: static;
    max-height: none;
  }

  .plot {
    min-width: 0;
    overflow-x: auto;
  }

  .plot__canvas {
    min-width: 500px;
  }

  .filters {
    width: 100%;
  }
}

.row--button {
  cursor: pointer;
  border-radius: 6px;
  padding-inline: 0.4rem;
  margin-inline: -0.4rem;
}

@media (hover: hover) and (pointer: fine) {
  .row--button:hover {
    background: rgba(255, 255, 255, 0.05);
  }
}

.row--on {
  background: rgba(61, 186, 111, 0.12);
}

.row--on dt {
  color: var(--green);
}

.data-table .row--warn td {
  background: rgba(226, 87, 76, 0.08);
}

/* Compare: two selections side by side, the text under each graph */

.filters__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-left: auto;
}

.filters__hint {
  margin: 0;
  align-self: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.filter-set {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.toggle input {
  accent-color: var(--green);
  width: 1rem;
  height: 1rem;
}

.is-compare .workspace {
  grid-template-columns: minmax(200px, 250px) 1fr;
}

.is-compare .plot {
  grid-template-columns: 1fr 1fr;
}

.panel--compare {
  max-height: calc(100svh - 9rem);
  overflow-y: auto;
}

.panel__readout {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.panel__readout p { margin: 0 0 1rem; color: var(--muted); }
.panel__readout h3 { margin: 1.25rem 0 0.5rem; color: var(--white); font-size: 0.95rem; font-weight: 400; }
.panel__readout .readout__title { margin-top: 0; color: var(--green); font-size: 0.95rem; }
.panel__readout .readout__list { margin: 0 0 1rem; padding: 0; list-style: none; }
.panel__readout .readout__list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.panel__readout .readout__list--plain li { display: block; }
.panel__readout .good { color: var(--green); }
.panel__readout .bad { color: var(--bad); }

.side-badge {
  display: inline-block;
  width: 1.6em;
  margin-right: 0.35rem;
  border-radius: 6px;
  background: rgba(61, 186, 111, 0.18);
  color: var(--green);
  font-size: 0.8em;
  text-align: center;
}

.side-badge--B {
  background: rgba(74, 144, 217, 0.18);
  color: #7fb6ea;
}

.section__side {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.75rem;
}

/* Score vs putting */

.band-played { fill: rgba(124, 147, 163, 0.12); }
.band-played-line { stroke: var(--app-text-muted); stroke-width: 1.5; }
.band-pro { fill: rgba(255, 184, 77, 0.1); }
.band-pro-line { stroke: var(--app-accent); stroke-width: 1.5; stroke-dasharray: 6 5; }
.gap { stroke-width: 3; }
.gap--good { stroke: rgba(61, 186, 111, 0.85); }
.gap--bad { stroke: rgba(255, 92, 108, 0.85); }
.line-played { fill: none; stroke: rgba(242, 244, 246, 0.45); stroke-width: 0.8; }
.line-pro { fill: none; stroke: rgba(124, 147, 163, 0.65); stroke-width: 1.2; stroke-dasharray: 4 4; }
/* As in the app: score played a grey dot, standardized putting a yellow star. */
.dot-played { fill: #7C93A3; }
.dot-pro { fill: #FFD43B; stroke: #000; stroke-width: 2.7; stroke-linejoin: round; paint-order: stroke; }

@media (max-width: 1100px) {
  .is-compare .workspace,
  .is-compare .plot {
    grid-template-columns: 1fr;
  }

  .panel--compare {
    max-height: none;
    overflow: visible;
  }
}

/* Plot controls: direction, colour, a distance band and the zoom */

.plot-controls {
  margin-bottom: 1rem;
}

.filter-set--plot {
  margin: 0.85rem 0 0;
  align-items: center;
}

.num {
  width: 5.5rem;
  padding: 0.45em 0.6em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--app-surface);
  color: var(--white);
  font: inherit;
  font-size: 0.95rem;
}

.zoom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zoom .chip {
  min-width: 2.2rem;
  text-align: center;
}

.filter select {
  background: var(--app-surface);
}

.section,
.panel,
.readout {
  background: var(--app-card);
}

.plot__canvas {
  touch-action: pan-y;
}

/* Playing statistics: one card per figure, arrows and dots underneath */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.pager__arrow {
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .pager__arrow:hover {
    border-color: var(--app-primary);
    color: var(--app-primary);
  }
}

.pager__dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.pager__dot {
  width: 0.7rem;
  height: 0.7rem;
  padding: 0;
  border: 1px solid var(--app-text-muted);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .pager__dot:hover {
    border-color: var(--app-primary);
  }
}

.pager__dot--on {
  border-color: var(--app-primary);
  background: var(--app-primary);
}

/* Two typed bounds, from – to, as the app lays out the putt length. */
.filter--range .range {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.filter--range .num {
  width: 4.2rem;
  text-align: center;
}

.range__dash,
.range__unit {
  color: var(--muted);
}

.filter--off {
  opacity: 0.4;
}

.filter--off .num {
  cursor: not-allowed;
}

/* Intention, laid out as in the app: played as meant × dropped, then a card
   per option. */
.intention {
  display: grid;
  gap: 1rem;
  padding: 0.5rem 0;
}

.matrix {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 1rem;
  border-radius: 14px;
  background: var(--app-elevated);
}

.matrix__head {
  color: var(--app-text-secondary);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.matrix__row {
  padding-right: 0.75rem;
  color: var(--white);
  font-size: 0.9rem;
  white-space: nowrap;
}

.matrix__row--yes::first-letter { color: var(--app-primary); }
.matrix__row--no::first-letter { color: var(--app-error); }

.matrix__cell {
  display: grid;
  justify-items: center;
  padding: 0.6rem 0.25rem;
  border-radius: 10px;
}

.matrix__cell strong {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.matrix__cell span {
  color: var(--app-text-muted);
  font-size: 0.8rem;
}

.matrix__cell--good { background: rgba(61, 186, 111, 0.12); }
.matrix__cell--good strong { color: var(--app-primary); }
.matrix__cell--muted { background: rgba(185, 206, 220, 0.1); }
.matrix__cell--muted strong { color: var(--app-text-secondary); }
.matrix__cell--accent { background: rgba(255, 184, 77, 0.12); }
.matrix__cell--accent strong { color: var(--app-accent); }
.matrix__cell--bad { background: rgba(255, 92, 108, 0.12); }
.matrix__cell--bad strong { color: var(--app-error); }

.matrix__note {
  margin: -0.25rem 0 0;
  color: var(--app-text-secondary);
  font-size: 0.9rem;
}

.segmented {
  display: flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--app-surface);
}

.segmented__item {
  flex: 1;
  padding: 0.45em 0.8em;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--app-text-secondary);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.segmented__item--on {
  background: var(--app-elevated);
  color: var(--white);
}

.intention__cards {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}

.icard {
  padding: 1rem;
  border-radius: 14px;
  background: var(--app-elevated);
}

.icard__head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.icard__part {
  color: var(--app-accent);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icard__head h3 {
  flex: 1;
  margin: 0;
  color: var(--white);
  font-size: 1rem;
  font-weight: 500;
}

.icard__count {
  color: var(--app-text-muted);
  font-size: 0.8rem;
}

.icard__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.istat {
  display: grid;
  justify-items: center;
  padding: 0.55rem 0.25rem;
  border-radius: 10px;
  background: var(--app-surface);
  text-align: center;
}

.istat strong {
  color: var(--white);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.istat span {
  color: var(--app-text-secondary);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.istat small {
  color: var(--app-text-muted);
  font-size: 0.75rem;
}

.icard__line {
  margin: 0.2rem 0 0;
  color: var(--app-text-secondary);
  font-size: 0.85rem;
}

/* The round conditions, folded behind one button as in the app: green speed,
   weather, grain, putter, format, reading. */
.conditions {
  position: relative;
}

.conditions__button {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.45em 0.9em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--white);
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
}

.conditions__button::-webkit-details-marker {
  display: none;
}

.conditions__button::after {
  content: '▾';
  color: var(--muted);
  font-size: 0.8em;
}

.conditions[open] .conditions__button {
  border-color: var(--green);
}

@media (hover: hover) and (pointer: fine) {
  .conditions__button:hover {
    border-color: var(--green);
  }
}

.conditions__count {
  display: inline-grid;
  place-items: center;
  min-width: 1.4em;
  height: 1.4em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--green);
  color: var(--navy, #081420);
  font-size: 0.8em;
  font-weight: 600;
}

.conditions__fields {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 5;
  display: grid;
  gap: 0.75rem;
  min-width: 17rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.conditions__fields .filter {
  justify-content: space-between;
}

.conditions__clear {
  justify-self: start;
  padding: 0.35em 0.8em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .conditions__clear:hover {
    border-color: var(--green);
    color: var(--green);
  }
}

/* Figures as rows: name, bar, value; on a phone the bar under the name */

.figures {
  display: grid;
  gap: 0.9rem;
  padding: 0.5rem 0;
}

.figures__row {
  display: grid;
  grid-template-columns: minmax(8rem, 14rem) 1fr minmax(5rem, auto);
  align-items: center;
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

.figures__label {
  color: var(--app-text-secondary);
}

.figures__track {
  position: relative;
  height: 0.9rem;
  border-radius: 4px;
  background: rgba(124, 147, 163, 0.14);
  overflow: hidden;
}

.figures__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 4px;
}

.figures__fill--good { background: var(--app-primary); }
.figures__fill--bad { background: var(--app-error); }

.figures__fill[style*="right"] {
  left: auto;
}

.figures__centre {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.5px;
  background: var(--app-text-muted);
}

.figures__value {
  color: var(--white);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.figures__value--none {
  color: var(--app-text-muted);
}

.figures__dim {
  color: var(--app-text-muted);
}

.figures__note {
  margin: 0;
  color: var(--app-text-muted);
  font-size: 0.85rem;
}

.figures__note--gap {
  margin-top: 1rem;
}

.figures__track:has(.figures__mark) {
  overflow: visible;
}

.figures__mark {
  position: absolute;
  top: -0.25rem;
  bottom: -0.25rem;
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
}

.figures__fill--left,
.figures__side--left { background: var(--app-break-left); }
.figures__fill--right,
.figures__side--right { background: var(--app-break-right); }

.figures__side {
  padding: 0 0.35em;
  border-radius: 4px;
  color: var(--navy);
}

@media (max-width: 640px) {
  .figures__row {
    grid-template-columns: 1fr auto;
  }

  .figures__track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .figures__track:empty {
    display: none;
  }
}

/* Phones: the graph keeps a readable size and swipes sideways in its card */

@media (max-width: 640px) {
  .plot {
    overflow-x: visible;
  }

  .plot__canvas {
    min-width: 0;
    overflow-x: auto;
    touch-action: pan-x pan-y;
  }

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

  .panel {
    min-width: 0;
  }

  .plot__canvas svg {
    min-width: 640px;
  }

  /* The dispersion is round: it fits the screen instead. */
  .panel[data-section="dispersion"] .plot__canvas svg {
    min-width: 0;
  }

  .plot__canvas .tick,
  .plot__canvas .value {
    font-size: 18px;
  }

  .plot__canvas .legend {
    font-size: 16px;
  }

  .plot__canvas .value--small {
    font-size: 15px;
  }
}
