:root {
  color-scheme: dark;

  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  font-size: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 0;
}

body {
  overflow-x: hidden;

  background: #111;
  color: #eee;
}

button,
input,
select {
  font: inherit;
}

button,
input[type="number"],
select {
  height: 32px;
}

button {
  border: 1px solid #444;
  border-radius: 4px;

  background: #272727;
  color: #eee;

  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #333;
}

button:disabled {
  opacity: 0.42;
  cursor: default;
}

input,
select {
  min-width: 0;

  border: 1px solid #444;
  border-radius: 4px;

  background: #1b1b1b;
  color: #eee;
}

input[type="number"] {
  padding: 2px 8px;
}

select {
  padding: 2px 28px 2px 8px;
}

.page-width {
  width: min(1020px, calc(100% - 28px));

  margin-inline: auto;
}

/* Header */

.topbar {
  border-bottom: 1px solid #303030;
}

.brand-block {
  min-height: 82px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;

  padding-block: 11px;
}

.brand-name {
  font-size: 16px;
}

.global-reference {
  margin-top: 12px;

  display: flex;
  align-items: center;

  gap: 6px;

  color: #bbb;
}

.global-reference label {
  color: #ddd;
}

.global-reference input {
  width: 84px;
}

.global-reference button {
  height: 28px;

  padding: 0 8px;
}

/* Tabs */

.tabs {
  border-bottom: 1px solid #303030;
}

.tabs-inner {
  height: 38px;

  display: flex;
  align-items: end;

  gap: 22px;
}

.tab {
  height: 38px;

  padding: 0 2px;

  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;

  background: transparent;
  color: #999;
}

.tab:hover:not(:disabled) {
  background: transparent;
  color: #eee;
}

.tab.active {
  border-bottom-color: #ddd;

  color: #fff;
}

/* Main */

main {
  padding-block: 18px 28px;
}

.tab-panel[hidden] {
  display: none;
}

.experiment {
  min-width: 0;
}

.reference-experiment {
  max-width: 520px;
}

.tuning-experiment,
.pick-experiment {
  max-width: 850px;
}

h1 {
  margin: 0;

  font-size: 16px;
  font-weight: 650;
}

/* Forms */

.form-grid {
  margin-top: 16px;

  display: grid;

  gap: 14px 24px;

  justify-content: start;
}

.reference-form {
  grid-template-columns: repeat(2, 220px);
}

.tuning-form,
.pick-form {
  grid-template-columns: repeat(3, 220px);
}

.field {
  min-width: 0;
}

.field > label {
  display: block;

  margin-bottom: 5px;

  color: #bbb;

  font-size: 12px;
  line-height: 1.2;
}

.control-row {
  min-width: 0;

  display: flex;
  align-items: center;

  gap: 7px;
}

.note-select {
  width: 132px;
}

.wave-select {
  width: 116px;
}

.interval-select {
  width: 150px;
}

.count-select {
  width: 72px;
}

.number-input {
  width: 104px;
}

.suffix {
  white-space: nowrap;

  color: #ddd;
}

.hz-readout {
  font-variant-numeric: tabular-nums;
}

/* Actions and stats */

.actions {
  margin-top: 15px;

  display: flex;
  flex-wrap: wrap;
  align-items: center;

  gap: 7px;
}

.test-actions {
  min-height: 34px;
}

.action-stats {
  margin-left: 7px;

  color: #bbb;

  font-size: 14px;
  font-weight: 500;

  font-variant-numeric: tabular-nums;
}

.icon-button {
  width: 32px;
  min-width: 32px;

  padding: 0;

  display: inline-grid;
  place-items: center;
}

.icon-button svg {
  width: 15px;
  height: 15px;

  fill: currentColor;
}

.link-button {
  height: auto;

  margin-left: 2px;

  padding: 0;

  border: 0;

  background: transparent;
  color: #aaa;

  font-size: 12px;

  text-decoration: underline;
}

.link-button:hover:not(:disabled) {
  background: transparent;

  color: #fff;
}

/* Flat and Sharp */

.judgment {
  width: max-content;

  margin-top: 10px;

  display: inline-flex;

  border: 1px solid #444;
  border-radius: 5px;

  overflow: hidden;
}

.judgment button {
  min-width: 78px;

  margin: 0;

  padding: 0 12px;

  border: 0;
  border-radius: 0;

  background: #222;
}

.judgment button + button {
  border-left: 1px solid #444;
}

.judgment button:hover:not(:disabled) {
  background: #333;
}

.judgment button:disabled {
  background: #1a1a1a;
}

/* Tuning result */

.result {
  min-height: 42px;

  margin-top: 10px;

  line-height: 1.5;

  font-variant-numeric: tabular-nums;
}

.result.correct {
  color: #68d47d;
}

.result.incorrect {
  color: #ee7474;
}

/* Candidate test */

.candidate-list {
  max-width: 720px;

  margin-top: 12px;

  display: grid;

  gap: 4px;
}

.candidate-row {
  min-width: 0;
  min-height: 32px;

  display: grid;

  grid-template-columns:
    30px
    32px
    76px
    minmax(0, 1fr);

  align-items: center;

  gap: 7px;
}

.candidate-number {
  font-weight: 650;
}

.candidate-play {
  width: 30px;
  min-width: 30px;
  height: 30px;
}

.choose-button {
  width: 76px;

  padding: 0 8px;
}

.candidate-details {
  min-width: 0;

  overflow: hidden;

  text-overflow: ellipsis;
  white-space: nowrap;

  color: #aaa;

  font-variant-numeric: tabular-nums;
}

.candidate-result-icon {
  display: inline-block;

  width: 1.4em;

  font-weight: 700;
  text-align: center;
}

.candidate-row.pick-wrong,
.candidate-row.pick-wrong .candidate-details {
  color: #ee7474;
}

.candidate-row.pick-target,
.candidate-row.pick-target .candidate-details {
  color: #6ea8ff;
}

.candidate-row.pick-correct,
.candidate-row.pick-correct .candidate-details {
  color: #68d47d;
}

/* Responsive */

@media (max-width: 760px) {
  .tuning-form,
  .pick-form {
    grid-template-columns: repeat(2, 220px);
  }
}

@media (max-width: 560px) {
  .reference-form,
  .tuning-form,
  .pick-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .field {
    max-width: 260px;
  }

  .action-stats {
    width: 100%;

    margin-top: 3px;
    margin-left: 0;
  }

  .candidate-row {
    min-height: 54px;

    grid-template-columns:
      30px
      32px
      76px;

    grid-template-rows:
      32px
      auto;
  }

  .candidate-details {
    grid-column: 1 / -1;
    grid-row: 2;

    padding-left: 37px;

    overflow: visible;

    text-overflow: clip;
    white-space: normal;

    font-size: 12px;
  }
}

@media (max-width: 390px) {
  .page-width {
    width: calc(100% - 20px);
  }

  .tabs-inner {
    gap: 16px;
  }

  .global-reference {
    flex-wrap: wrap;
  }
}
