@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

body[data-view="setup"] {
  min-height: 100vh;
  background-color: #f7fbf8;
  background-image: radial-gradient(#008b9015 1px, transparent 1px);
  background-size: 20px 20px;
}

.phonics-setup {
  --setup-text: #17383b;
  --setup-muted: #587477;
  --setup-teal: #007f89;
  --setup-dark-teal: #004e55;
  --setup-panel: #e8f3ed;
  --setup-yellow: #ffe343;
  color: var(--setup-text);
  font-family: "DM Sans", "URW Gothic", sans-serif;
}

.phonics-setup :focus-visible {
  outline: 3px solid var(--setup-teal);
  outline-offset: 4px;
}

.setup-intro {
  padding: 30px 0 25px;
}

.setup-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  color: var(--setup-teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.8px;
}

.setup-eyebrow::before {
  content: "";
  flex: 0 0 6px;
  height: 6px;
  background: var(--setup-teal);
  border-radius: 50%;
}

.setup-intro h2 {
  margin: 0;
  font-weight: 700;
  font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -1.6px;
  line-height: 1.1;
}

.setup-description {
  margin: 8px 0 0;
  color: var(--setup-muted);
  font-size: 16px;
}

.setup-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(14px, 2vw, 23px);
}

.setup-panel {
  background: var(--setup-panel);
  border: 1px solid #c4dcd3;
  border-radius: 22px;
  padding: clamp(17px, 2vw, 25px);
}

.setup-panel h2 {
  margin: 0;
  color: #15545a;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.setup-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#bank-count {
  color: var(--setup-muted);
  font-size: 12px;
  text-align: right;
}

.list-mode {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  padding: 4px;
  background: #d9ebe1;
  border-radius: 11px;
}

.list-mode button {
  flex: 1;
  padding: 9px 5px;
  min-height: 37px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #436a5c;
  font-size: 13px;
  font-weight: 700;
}

.list-mode button[aria-pressed="true"] {
  background: #fff;
  color: #005b64;
  border-color: #9fc3b4;
  box-shadow: 0 2px 0 #9fc3b4;
}

.phase-options,
.setup-tempo-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.phase-option,
.setup-tempo-option {
  min-width: 0;
  background: #fff;
  border: 1px solid #b9d6ce;
  border-radius: 12px;
  padding: 11px 9px;
}

.phase-option {
  min-height: 68px;
  position: relative;
  text-align: left;
}

.phase-option strong,
.setup-tempo-option strong {
  display: block;
  font-size: 14px;
}

.phase-option strong {
  padding-right: 13px;
}

.phase-option small,
.setup-tempo-option small {
  display: block;
  margin-top: 4px;
  color: var(--setup-muted);
  font-size: 11px;
  line-height: 1.3;
}

.option-check {
  position: absolute;
  top: 11px;
  right: 9px;
  width: 12px;
  height: 12px;
  border: 1px solid #7da79d;
  border-radius: 50%;
}

.phase-option[aria-pressed="true"] {
  background: var(--setup-teal);
  border-color: var(--setup-dark-teal);
  color: #fff;
  box-shadow: 0 3px 0 var(--setup-dark-teal);
}

.phase-option[aria-pressed="true"] small {
  color: #ddf6ec;
}

.phase-option[aria-pressed="true"] .option-check {
  border: 4px solid var(--setup-yellow);
}

.setup-tempo-option {
  min-height: 59px;
  text-align: center;
}

.setup-tempo-option[aria-pressed="true"] {
  background: var(--setup-yellow);
  border-color: var(--setup-text);
  box-shadow: 0 2px 0 var(--setup-text);
}

.setup-tempo-option[aria-pressed="true"] small {
  color: #365b53;
}

.sound-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.sound-filters input,
.sound-filters select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #9fc3b4;
  border-radius: 8px;
  background: #fff;
  color: var(--setup-text);
  font: inherit;
  font-size: 13px;
}

.sound-filters input::placeholder {
  color: #5e7a6e;
}

.sound-tools,
.sound-tools > div {
  display: flex;
  align-items: center;
}

.sound-tools {
  justify-content: space-between;
  margin: 8px 0;
  color: var(--setup-muted);
  font-size: 12px;
}

.sound-tools > div {
  gap: 15px;
}

.sound-tools button {
  padding: 5px 0;
  background: transparent;
  border: 0;
  color: #006872;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sound-tools button:disabled,
.setup-buttons button:disabled {
  opacity: .5;
}

.sound-choices {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  max-height: 232px;
  overflow: auto;
  padding: 5px;
  margin: -3px -5px 0;
  scrollbar-color: #8bb9a7 var(--setup-panel);
  scrollbar-width: thin;
}

.sound-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 55px;
  padding: 6px 3px;
  background: #fff;
  color: var(--setup-text);
  border: 1px solid #aacbbd;
  border-radius: 9px;
  text-align: center;
}

.sound-choice strong {
  font-size: 12px;
  line-height: 1.1;
}

.sound-choice .grapheme {
  font-family: "Comic Sans MS", "Comic Sans", "Comic Neue", cursive;
  font-size: 19px;
}

.sound-choice small {
  font-size: 12px;
}

.sound-choice[aria-pressed="true"] {
  background: var(--setup-teal);
  border-color: var(--setup-dark-teal);
  color: #fff;
  box-shadow: 0 2px 0 var(--setup-dark-teal);
}

.sound-choice[aria-pressed="true"] strong {
  color: var(--setup-yellow);
}

.phase-note,
.selected-sounds,
.no-sounds {
  margin: 12px 0 0;
  color: var(--setup-muted);
  font-size: 12px;
  line-height: 1.5;
}

.selected-sounds {
  color: #335c4d;
}

.setup-volume {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 36px 3fr;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.setup-volume label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

.setup-volume svg {
  width: 17px;
  height: 17px;
  color: var(--setup-teal);
}

.setup-volume output {
  color: var(--setup-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.setup-volume input {
  width: 100%;
  min-width: 0;
  accent-color: var(--setup-teal);
}

.setup-actions,
.setup-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.setup-actions {
  justify-content: space-between;
  margin-top: 23px;
}

.setup-actions p {
  margin: 0;
  color: var(--setup-muted);
  font-size: 13px;
}

.setup-buttons .soundbank-button {
  max-width: none;
  font-size: 12px;
  color: #006872;
}

.setup-start {
  min-width: 188px;
  background: var(--setup-yellow);
}

.setup-start:hover {
  background: #ffeb71;
}

.setup-start:disabled {
  box-shadow: 0 3px 0 var(--setup-text);
  transform: none;
}

.setup-start svg {
  fill: currentColor;
  stroke-width: 0;
}

@media (max-width: 760px) {
  .setup-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .setup-intro {
    padding: 24px 0 19px;
  }

  .setup-description {
    font-size: 14px;
  }

  .sound-choices {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 207px;
  }
}

@media (max-width: 440px) {
  .sound-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .sound-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .setup-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 11px;
    text-align: center;
  }

  .setup-buttons {
    flex-direction: column-reverse;
    gap: 9px;
  }

  .setup-start {
    width: 100%;
  }
}
