:root {
  --bg: #151515;
  --ink: #f7f4eb;
  --muted: rgba(255, 255, 255, 0.78);
  --card: #f2f3ff;
  --card-deeper: #e7e9fa;
  --header: #c6c9ee;
  --line: rgba(27, 29, 47, 0.12);
  --text: #11121a;
  --navy: #18243c;
  --white-score: #ffffff;
  --score-1: #b82d32;
  --score-2: #ffa45c;
  --score-3: #e7cb62;
  --score-4: #6874f4;
  --score-5: #43dc68;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

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:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.08) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.05) 0 1px, transparent 2px),
    linear-gradient(135deg, rgba(255,255,255,0.05), transparent 20%, rgba(255,255,255,0.04) 50%, transparent 80%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 6px),
    #171717;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background:
    repeating-linear-gradient(95deg, transparent 0 15px, rgba(255,255,255,0.05) 16px 17px),
    repeating-linear-gradient(5deg, transparent 0 20px, rgba(255,255,255,0.035) 21px 22px);
  mix-blend-mode: screen;
}

button,
a {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.hero {
  text-align: center;
  margin-bottom: 42px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.64);
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 6.6rem);
  letter-spacing: -0.025em;
  line-height: 0.94;
  font-weight: 950;
}

.subtitle {
  margin: 26px auto 0;
  max-width: 980px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.28rem);
  line-height: 1.45;
}

.top-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.link-button,
.utility-button {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.link-button:hover,
.utility-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.link-button:focus-visible,
.utility-button:focus-visible,
.score-cell:focus-visible,
.grid-scroll:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}

.link-button--primary {
  background: #ff1f2d;
  color: #ffffff;
  box-shadow: 0 12px 32px rgba(255, 31, 45, 0.24);
}

.link-button--secondary {
  background: #fff;
  color: #151515;
  box-shadow: 0 12px 32px rgba(255, 255, 255, 0.12);
}

.tracker-card {
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-lg);
  padding: 20px 20px 24px;
  box-shadow: var(--shadow);
}

.tracker-card__topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  padding: 6px 6px 18px;
}

.tracker-card h2,
.legend-card h2,
.progress-card h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.tracker-card p,
.storage-note,
.info-copy p {
  margin: 6px 0 0;
  color: rgba(17, 18, 26, 0.75);
  line-height: 1.35;
}

.save-status {
  flex: 0 0 auto;
  min-width: 152px;
  text-align: center;
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(24, 36, 60, 0.08);
  color: rgba(24, 36, 60, 0.74);
  font-size: 0.9rem;
  font-weight: 800;
}

.mobile-note {
  display: none;
  margin: 0 6px 12px !important;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff3cf;
  color: #423100 !important;
  font-size: 0.92rem;
  font-weight: 700;
}

.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.tracker-table {
  width: 100%;
  min-width: 930px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.tracker-table th,
.tracker-table td {
  text-align: center;
  vertical-align: middle;
}

.tracker-table th {
  background: var(--header);
  color: #05050a;
  padding: 12px 10px;
  font-weight: 950;
  line-height: 1.05;
  border-right: 1px solid rgba(255,255,255,0.36);
}

.tracker-table th:first-child {
  border-top-left-radius: 12px;
}

.tracker-table th:last-child {
  border-top-right-radius: 12px;
}

.tracker-table .position-header {
  width: 126px;
  text-align: left;
  padding-left: 14px;
}

.tracker-table .progress-header {
  width: 116px;
}

.chord-quality {
  display: block;
  font-size: 1.22rem;
}

.chord-function {
  display: block;
  font-size: 0.9rem;
  margin-top: 2px;
}

.position-cell {
  background: #eef0f8;
  color: #11121a;
  text-align: left !important;
  font-weight: 950;
  line-height: 1.05;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.score-td {
  padding: 0;
  height: 58px;
  background: #fff;
}

.score-cell {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 950;
  color: #fff;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.24);
}

.score-cell[data-score="0"] {
  background: var(--white-score);
  color: transparent;
}

.score-cell[data-score="1"] { background: var(--score-1); }
.score-cell[data-score="2"] { background: var(--score-2); }
.score-cell[data-score="3"] { background: var(--score-3); }
.score-cell[data-score="4"] { background: var(--score-4); }
.score-cell[data-score="5"] { background: var(--score-5); }

.row-progress,
.chord-progress-value {
  background: #eef0f8;
  font-weight: 950;
  color: #11121a;
  font-size: 1.08rem;
}

tfoot th,
tfoot td {
  background: var(--card-deeper);
  padding: 14px 10px;
  font-weight: 950;
}

tfoot th {
  text-align: left !important;
  padding-left: 14px;
  border-bottom-left-radius: 12px;
}

tfoot td:last-child {
  border-bottom-right-radius: 12px;
}

.below-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  margin-top: 28px;
  align-items: start;
}

.legend-card,
.progress-card {
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 20px;
  backdrop-filter: blur(2px);
}

.legend-card h2,
.progress-card h2 {
  color: #fff;
  margin-bottom: 14px;
}

.legend-list {
  display: grid;
  gap: 8px;
}

.legend-item {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 12px;
}

.legend-pill {
  min-height: 38px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  font-weight: 950;
  color: #fff;
}

.legend-pill[data-score="0"] {
  background: #fff;
  color: #11121a;
}

.legend-pill[data-score="1"] { background: var(--score-1); }
.legend-pill[data-score="2"] { background: var(--score-2); }
.legend-pill[data-score="3"] { background: var(--score-3); }
.legend-pill[data-score="4"] { background: var(--score-4); }
.legend-pill[data-score="5"] { background: var(--score-5); }

.legend-copy {
  color: #fff;
  font-weight: 750;
  line-height: 1.25;
}

.overall-box {
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  font-weight: 950;
  box-shadow: 0 18px 55px rgba(0,0,0,0.2);
}

.overall-box span {
  font-size: clamp(1.25rem, 2vw, 1.55rem);
}

.overall-box strong {
  font-size: clamp(2.4rem, 6vw, 4rem);
  letter-spacing: -0.06em;
}

.storage-note {
  margin-top: 16px;
  color: rgba(255,255,255,0.78);
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.utility-button {
  background: #fff;
  color: #151515;
}

.info-copy {
  margin-top: 24px;
  color: rgba(255,255,255,0.86);
}

.info-copy p {
  color: rgba(255,255,255,0.82);
  font-size: 1rem;
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 34px;
  }

  .tracker-card__topline,
  .below-grid,
  .overall-box {
    display: block;
  }

  .save-status {
    margin-top: 14px;
    display: inline-block;
  }

  .below-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mobile-note {
    display: block;
  }

  .overall-box strong {
    display: block;
    margin-top: 8px;
  }
}

@media (max-width: 560px) {
  .hero {
    text-align: left;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .link-button,
  .utility-button {
    width: 100%;
    text-align: center;
  }

  .tracker-card,
  .legend-card,
  .progress-card {
    padding: 14px;
  }

  .legend-item {
    grid-template-columns: 58px 1fr;
    gap: 9px;
  }

  .legend-copy {
    font-size: 0.92rem;
  }
}
