:root {
  color-scheme: light;
  --ink: #181816;
  --muted: #66685f;
  --paper: #f4f1e9;
  --panel: #ffffff;
  --panel-soft: #faf8f2;
  --line: #d8d1c3;
  --string: #7c7a73;
  --fret: #bdb5a7;
  --root: #d94d32;
  --tone: #167a6b;
  --accent: #225d7f;
  --accent-deep: #153f59;
  --gold: #bd8d24;
  --shadow: 0 22px 70px rgba(31, 28, 20, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(34, 93, 127, 0.16), transparent 32%),
    linear-gradient(160deg, rgba(22, 122, 107, 0.1), transparent 38%),
    var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 248, 242, 0.86)),
    var(--panel-soft);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(24, 24, 22, 0.14);
  border-radius: 8px;
  background: #fffdf7;
  box-shadow: 0 10px 26px rgba(31, 28, 20, 0.13);
}

.brand-logo {
  display: block;
  width: 46px;
  height: 46px;
}

.logo-field {
  fill: #f8f2df;
  stroke: var(--ink);
  stroke-width: 2;
}

.logo-string,
.logo-fret {
  fill: none;
  stroke: rgba(24, 24, 22, 0.62);
  stroke-linecap: round;
  stroke-width: 2;
}

.logo-route {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-width: 4;
}

.logo-root {
  fill: var(--root);
}

.logo-tone {
  fill: var(--tone);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.42rem;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
}

h3 {
  font-size: 1rem;
}

.brand-block p,
.section-title p,
.control-panel label,
.summary-chip,
.eyebrow {
  color: var(--muted);
}

.brand-block p {
  margin-top: 4px;
  line-height: 1.3;
}

.control-group {
  display: grid;
  gap: 10px;
}

.control-panel label {
  display: grid;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
}

.save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  outline: none;
}

input {
  height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 118px;
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 95, 146, 0.14);
}

.input-row button,
.save-row button,
.secondary-button,
.wide-button {
  min-height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(34, 93, 127, 0.18);
}

.input-row button:hover,
.save-row button:hover,
.secondary-button:hover,
.wide-button:hover {
  background: var(--accent-deep);
}

.input-row button {
  font-size: 1.4rem;
}

.save-row button {
  font-size: 1.2rem;
  font-weight: 950;
}

.wide-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.secondary-button {
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.saved-progressions {
  gap: 10px;
}

.pro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.pro-panel p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.25;
}

.pro-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(189, 141, 36, 0.16);
  color: #795812;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.pro-status.active {
  background: rgba(22, 122, 107, 0.14);
  color: var(--tone);
}

.pro-status.offline {
  background: rgba(102, 104, 95, 0.12);
  color: var(--muted);
}

.saved-list {
  display: grid;
  gap: 8px;
  max-height: 248px;
  overflow: auto;
}

.saved-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: stretch;
}

.saved-load,
.saved-delete {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: inherit;
}

.saved-load {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  text-align: left;
}

.saved-load:hover,
.saved-load.active,
.saved-delete:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.96);
}

.saved-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-chords {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.saved-source {
  color: var(--accent);
}

.saved-delete {
  display: grid;
  width: 34px;
  min-width: 0;
  place-items: center;
  color: var(--root);
  font-size: 1rem;
  font-weight: 950;
}

.root-dot {
  background: var(--root);
}

.tone-dot {
  background: var(--tone);
}

.muted-dot {
  background: #343331;
}

.main-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(180px, 1fr);
  gap: 22px;
  min-width: 0;
  padding: 26px;
  overflow: auto;
}

.panel-header,
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-chip {
  flex: 0 0 auto;
  max-width: 360px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
}

.fretboard-section {
  overflow-x: auto;
}

.diagram {
  min-width: 680px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 12px 34px rgba(31, 28, 20, 0.07);
}

.fretboard {
  display: grid;
  grid-template-columns: 46px repeat(var(--frets), minmax(52px, 1fr));
  grid-template-rows: repeat(6, 34px) 28px;
  align-items: center;
  min-height: 232px;
}

.string-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.fret-cell {
  position: relative;
  display: grid;
  height: 34px;
  place-items: center;
  border-left: 2px solid var(--fret);
}

.fret-cell::before {
  position: absolute;
  right: 0;
  left: 0;
  top: 50%;
  height: 2px;
  background: var(--string);
  content: "";
}

.nut-cell {
  border-left-color: #312f2a;
  border-left-width: 5px;
}

.note-dot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--tone);
  color: white;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.note-dot.root {
  background: var(--root);
}

.mute-mark {
  position: relative;
  z-index: 1;
  color: #333;
  font-weight: 900;
}

.fret-number {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
}

.voicing-list,
.route-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
}

.progression-section {
  display: grid;
  gap: 14px;
}

.route-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.route-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.route-option {
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: inherit;
  text-align: left;
}

.route-option:hover,
.route-option.active {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(34, 93, 127, 0.14);
}

.option-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.option-name {
  font-weight: 950;
}

.option-meta,
.option-shapes {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
}

.option-shapes {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-diagram-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: inherit;
  text-align: left;
  box-shadow: 0 10px 30px rgba(31, 28, 20, 0.06);
}

.route-diagram-card:hover {
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgba(34, 93, 127, 0.14);
}

.route-step,
.route-diagram-meta,
.box-position {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.route-diagram-title {
  font-size: 1.25rem;
  font-weight: 950;
  line-height: 1;
}

.chord-box {
  display: grid;
  gap: 6px;
  width: 100%;
}

.box-markers,
.box-strings {
  display: grid;
  grid-template-columns: 18px repeat(6, minmax(0, 1fr));
  gap: 0;
  text-align: center;
}

.box-markers::before,
.box-strings::before {
  content: "";
}

.box-marker,
.box-strings span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.box-marker.open {
  color: #111;
  font-weight: 950;
}

.box-marker.muted {
  color: var(--root);
  font-weight: 950;
}

.box-neck {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: stretch;
}

.box-fret-labels {
  display: grid;
  grid-template-rows: repeat(var(--box-rows), 30px);
  align-items: center;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-align: left;
}

.box-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(22px, 1fr));
  grid-template-rows: repeat(var(--box-rows), 30px);
  border-top: 2px solid #312f2a;
}

.box-cell {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  border-bottom: 1px solid var(--fret);
}

.box-cell::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--string);
  content: "";
  transform: translateX(-50%);
}

.box-cell.string-open::before {
  width: 2px;
  background: #111;
}

.box-cell.string-muted::before {
  width: 2px;
  background: var(--root);
}

.box-dot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--tone);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 950;
}

.box-dot.root {
  background: var(--root);
}

.voicing-card {
  display: grid;
  gap: 10px;
  min-height: 140px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  text-align: left;
  box-shadow: 0 8px 22px rgba(31, 28, 20, 0.05);
}

button.voicing-card {
  color: inherit;
}

.voicing-card:hover,
.voicing-card.active {
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(34, 93, 127, 0.14);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-name {
  font-weight: 900;
}

.score-pill {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(33, 123, 111, 0.12);
  color: var(--tone);
  font-size: 0.74rem;
  font-weight: 900;
}

.tab-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.tab-cell {
  display: grid;
  min-width: 0;
  min-height: 32px;
  place-items: center;
  border-radius: 6px;
  background: #f0ece2;
  font-size: 0.82rem;
  font-weight: 900;
}

.card-meta {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.route-card {
  position: relative;
}

.route-card .score-pill {
  margin-right: 12px;
}

.route-card::before {
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  content: attr(data-step);
}

.empty-state,
.error-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.error-state {
  border-color: rgba(216, 79, 42, 0.45);
  color: #9d341d;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-panel {
    padding: 18px;
  }

  .panel-header,
  .section-title {
    align-items: start;
    flex-direction: column;
  }

  .summary-chip {
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .settings-grid,
  .voicing-list,
  .route-list {
    grid-template-columns: 1fr;
  }

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