:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #5b6770;
  --line: #d7dde0;
  --panel: #ffffff;
  --band: #f7f4ed;
  --accent: #1f7a6d;
  --accent-dark: #14584f;
  --warm: #d98634;
  --danger: #a63333;
  --shadow: 0 18px 45px rgba(20, 34, 38, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(120deg, rgba(31, 122, 109, 0.11), rgba(217, 134, 52, 0.10)),
    #fbfaf7;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(23, 33, 38, 0.10);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(247, 244, 237, 0.82)),
    repeating-linear-gradient(0deg, transparent, transparent 9px, rgba(31, 122, 109, 0.15) 10px);
  box-shadow: 6px 6px 0 rgba(217, 134, 52, 0.32);
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 26px auto 56px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(20, 34, 38, 0.06);
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.tab.is-active {
  color: #ffffff;
  background: var(--accent);
}

.tab-panel {
  display: none;
  margin-top: 18px;
}

.tab-panel.is-active {
  display: grid;
  gap: 18px;
}

.section-band {
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(23, 33, 38, 0.10);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

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

h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: 0;
}

.input-grid {
  display: grid;
  gap: 14px;
}

.input-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label span,
.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--ink);
  background: #ffffff;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(31, 122, 109, 0.26);
  outline-offset: 2px;
}

.number-field {
  width: 100%;
}

.number-stepper {
  display: none;
}

.prompt-line {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 700;
}

.priority-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(217, 134, 52, 0.38);
  border-left: 5px solid var(--warm);
  border-radius: 6px;
  color: #69410f;
  background: #fff8ea;
  font-weight: 800;
}

.sentence-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.sentence-input.wrap {
  flex-wrap: wrap;
}

.sentence-input input {
  width: 120px;
  flex: 0 0 120px;
}

.sentence-input .number-field {
  width: 120px;
  flex: 0 0 120px;
}

.course-list {
  display: grid;
  gap: 10px;
}

.course-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) minmax(88px, 0.55fr) minmax(110px, 0.65fr) 42px;
  gap: 10px;
  align-items: end;
}

.course-row.credits-only {
  grid-template-columns: minmax(120px, 1fr) minmax(92px, 160px) 42px;
}

.remove-row,
.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.icon-button {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.add-courses-button {
  width: auto;
  min-width: 0;
  max-width: 96px;
  padding: 0 10px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.remove-row {
  color: var(--danger);
}

.trash-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
}

.result-box {
  margin-top: 16px;
  padding: 16px;
  border-left: 5px solid var(--accent);
  border-radius: 6px;
  background: var(--band);
}

.result-box strong {
  color: var(--accent-dark);
}

.result-box .warning {
  color: var(--danger);
  font-weight: 800;
}

.combo-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.combo-list li {
  padding: 10px 12px;
  border: 1px solid rgba(23, 33, 38, 0.10);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.combo-list li.is-hidden {
  display: none;
}

.show-more-combos {
  margin-top: 12px;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--accent-dark);
  background: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.scale-modal {
  width: min(720px, calc(100% - 30px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(10, 20, 24, 0.32);
}

.scale-modal::backdrop {
  background: rgba(10, 20, 24, 0.42);
}

.scale-modal form {
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--band);
}

.option-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.option-row input {
  width: auto;
  min-height: auto;
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 760px) {
  .topbar,
  .brand,
  .sentence-input {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    align-items: flex-start;
  }

  .topbar .secondary-button {
    width: 100%;
  }

  .input-grid.two,
  .course-row,
  .course-row.credits-only,
  .scale-grid {
    grid-template-columns: 1fr;
  }

  .remove-row,
  .icon-button {
    width: 100%;
  }

  .sentence-input input {
    width: 100%;
    flex-basis: auto;
  }

  .sentence-input .number-field {
    width: 100%;
    flex-basis: auto;
  }

  .number-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .number-field input {
    border-radius: 6px 0 0 6px;
  }

  .number-stepper {
    display: grid;
    grid-template-rows: 1fr 1fr;
    min-height: 42px;
  }

  .number-step {
    display: grid;
    place-items: center;
    min-height: 21px;
    border: 1px solid var(--line);
    border-left: 0;
    background: #ffffff;
    cursor: pointer;
  }

  .number-step:first-child {
    border-radius: 0 6px 0 0;
    border-bottom: 0;
  }

  .number-step:last-child {
    border-radius: 0 0 6px 0;
  }

  .number-step span {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
  }

  .number-step[data-step="up"] span {
    border-bottom: 6px solid var(--ink);
  }

  .number-step[data-step="down"] span {
    border-top: 6px solid var(--ink);
  }

  .modal-actions {
    flex-direction: column;
  }
}
