:root {
  --bg: #f3efe6;
  --ink: #1a1814;
  --muted: #5e584e;
  --paper: #fffdf8;
  --paper-2: #f3ece1;
  --line: #ddd6c8;
  --wood: #7a3e24;
  --wood-deep: #171512;
  --copper: #b85a2a;
  --good: #1d6b45;
  --shadow: 0 10px 28px rgba(26, 24, 20, 0.06);
  --bar-space: 5.2rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Be Vietnam Pro", "Noto Sans", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--wood); }
h1, h2, h3 { line-height: 1.2; font-weight: 650; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); margin: 0 0 0.4rem; letter-spacing: -0.035em; }
h2 { font-size: 1.7rem; margin: 0 0 0.6rem; }
h3 { font-size: 1.15rem; margin: 0 0 0.4rem; }
p { margin: 0.4rem 0 0.8rem; }

.skip {
  position: absolute;
  left: 0.8rem;
  top: -3rem;
  background: white;
  padding: 0.4rem 0.7rem;
  z-index: 5;
}
.skip:focus { top: 0.6rem; }

.shell { min-height: 100vh; min-height: 100dvh; }
.lesson-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 6;
  width: 100%;
  height: 3px;
  pointer-events: none;
}
.lesson-progress-bar {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--copper);
  transition: transform 420ms ease;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(243, 239, 230, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.site-header-row {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  gap: 0.15rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  padding: 0.4rem 0.72rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 200ms ease, color 200ms ease;
}
.site-nav a.active,
.site-nav a:hover { background: rgba(122, 62, 36, 0.1); }
.site-nav a.active { color: var(--wood); }
.names-toggle {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

main {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 1.6rem clamp(1rem, 3vw, 1.25rem) calc(var(--bar-space) + env(safe-area-inset-bottom));
  min-width: 0;
}
section { margin: 0 0 3.4rem; scroll-margin-top: 5rem; scroll-margin-bottom: var(--bar-space); }
.hero-grid, .split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.2rem;
  align-items: start;
}
.card, .shot, .callout, .warn, .detail, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.shot { margin: 0; overflow: hidden; }
.shot img { display: block; width: 100%; }
.shot figcaption, .hint, .group-label { color: var(--muted); }
.shot figcaption { padding: 0.7rem 0.9rem 0.9rem; font-size: 0.92rem; }
.card, .callout, .warn, .panel { padding: 1rem 1.1rem; }
.callout { border-left: 4px solid var(--copper); }
.warn { border-left: 4px solid #9a3412; background: #fff8f3; }
.kicker {
  color: var(--copper);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin: 0 0 0.35rem;
}

.row, .chips { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.chips { margin: 0.3rem 0 0.8rem; }
button, select, input[type="text"], input[type="number"] {
  font: inherit;
  color: var(--ink);
  background: white;
  border: 1px solid #d9cbbd;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  max-width: 100%;
}
button, select, .site-nav a, .continue-bar a, .continue-bar button {
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease, transform 200ms ease;
}
button { cursor: pointer; }
button:hover { border-color: var(--wood); }
button:active, .continue-bar a:active { transform: scale(0.98); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--wood);
  outline-offset: 2px;
}
button[aria-pressed="true"] {
  background: var(--wood);
  color: white;
  border-color: var(--wood);
}
input[type="text"], input[type="number"], select { border-radius: 10px; }
.row input[type="text"], .row input[type="number"] { flex: 1 1 12rem; min-width: min(100%, 10rem); }
code { overflow-wrap: anywhere; }
label { font-size: 0.95rem; }
.group-label { font-size: 0.82rem; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; margin: 0.8rem 0 0.2rem; }

.detail {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 0.5rem 1.2rem;
  padding: 1rem;
  margin-top: 0.4rem;
}
.diagram { width: 100%; height: auto; background: #fffdf9; border-radius: 12px; }
.diagram .fing { fill: white; font-size: 12px; font-weight: 700; }
.diagram .nm { fill: #6a3b22; font-size: 10px; font-weight: 650; }
.diagram .fret-no, .diagram .str-no { fill: #6d5e52; font-size: 11px; }
.diagram .nut-mark { fill: #1c1612; font-size: 15px; font-weight: 700; }
.note-list { margin: 0.2rem 0 0.8rem; padding-left: 1.1rem; }
.note-list li { margin: 0.15rem 0; }

#fretboard, #minute-log { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.fretboard { width: 100%; min-width: 36rem; border-collapse: collapse; background: var(--paper); border-radius: 12px; }
.fretboard th, .fretboard td { border-bottom: 1px solid var(--line); text-align: center; padding: 0.15rem; }
.fretboard th { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.fretboard button {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  padding: 0.35rem 0.1rem;
}
.fretboard button small { color: var(--muted); font-size: 0.72rem; }
.fretboard button.acc { color: #8a7568; }
.fretboard button:hover { background: #f3e6d8; }

.pattern { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.4rem; margin: 0.6rem 0; }
.cell {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
  padding: 0.45rem 0;
}
.cell span { display: block; color: var(--muted); font-size: 0.78rem; }
.cell strong { font-size: 1.15rem; }
.cell.miss { color: #a89888; }
.cell.hit { background: #f8efe6; }
.cell.active { outline: 2px solid var(--wood); }

.timer-num {
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  margin: 0.2rem 0;
}
.blocks { padding-left: 1.2rem; }
.blocks .now { font-weight: 700; color: var(--wood); }
.weeks { padding-left: 1.2rem; }
.weeks > li { margin: 0.7rem 0; }

table.data { width: 100%; border-collapse: collapse; background: var(--paper); font-size: 0.95rem; }
table.data th, table.data td { border-bottom: 1px solid var(--line); text-align: left; padding: 0.55rem 0.45rem; vertical-align: top; }
table.data th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
#minute-app, #practice-app, #strum-app { margin-top: 0.8rem; }

.schematic { width: min(100%, 420px); height: auto; background: white; border-radius: 12px; border: 1px solid var(--line); }
.level-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
.guide-grid, .song-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0.4rem 0 1rem; }
.song-grid h3, .guide-card h3 { margin-top: 0; }
.bars { font-weight: 650; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; }
details.week { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 0.75rem 0.95rem; margin: 0.55rem 0; }
details.week summary { cursor: pointer; font-weight: 650; }
details.week ol, details.week ul { margin: 0.45rem 0 0; }
.year-list { margin: 0.2rem 0 0; padding-left: 1.2rem; }
.year-list li { margin: 0.55rem 0; }
.guide-card ul { margin: 0.35rem 0 0; padding-left: 1.15rem; }
.guide-card li { margin: 0.38rem 0; }
.guide-card .shot { margin-bottom: 0.7rem; }
.level-grid h3 { margin-top: 0; }
footer { color: var(--muted); font-size: 0.92rem; }
footer ul { padding-left: 1.1rem; }

@media (max-width: 860px) {
  .site-header-row {
    grid-template-columns: 1fr auto;
    padding: 0.55rem 0.75rem 0.4rem;
  }
  .brand { grid-column: 1; grid-row: 1; }
  .names-toggle { grid-column: 2; grid-row: 1; }
  .site-nav { grid-column: 1 / -1; grid-row: 2; }
  .hero-grid, .split, .detail, .level-grid, .guide-grid, .song-grid { grid-template-columns: 1fr; }
  main { padding: 1rem 0.9rem calc(var(--bar-space) + env(safe-area-inset-bottom)); }
  section { scroll-margin-top: 7.5rem; }
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.45rem; }
  #error-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  #error-table, #error-table tbody, #error-table tr, #error-table td { display: block; width: auto; }
  #error-table { background: transparent; border: 0; }
  #error-table tr {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    margin: 0 0 0.7rem;
  }
  #error-table td { border: 0; padding: 0.12rem 0; }
  #error-table td:first-child { font-weight: 650; }
  #error-table td:nth-child(2) { color: var(--muted); }
}
.lesson-dots { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.2rem 0 0.85rem; }
.lesson-dots button {
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border-radius: 999px;
}
.lesson-dots button.is-done { background: #e7f3ec; border-color: #1d6b45; }
.lesson-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 1rem; align-items: start; }
.study h3, .hand-card h3 { margin-top: 0; }
.study p:last-child, .hand-card p:last-child { margin-bottom: 0; }
.hand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin: 0.8rem 0 1rem; }
.hand-card ol { margin: 0.2rem 0 0; padding-left: 1.2rem; }
.hand-card li { margin: 0.28rem 0; }
.clip { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: #1c1612; }
.clip img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.clip span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--copper); color: white; border-radius: 999px; padding: 0.45rem 0.9rem; }
.clip-frame { display: block; width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; background: #111; }
.mini-diagrams { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mini-diagrams figure { margin: 0; width: 148px; }
.mini-diagrams figcaption { text-align: center; font-size: 0.85rem; color: var(--muted); }
.study, .hand-card, .lesson-steps, .lesson-grid { scroll-margin-bottom: calc(var(--bar-space) + 0.4rem); }
.lesson-steps { margin: 0.6rem 0; padding-left: 0; list-style: none; }
.lesson-steps li { margin: 0.35rem 0; padding: 0.35rem 0.5rem; }
.lesson-steps li.now { background: #f8efe6; border-radius: 8px; }
.lesson-steps label { display: flex; gap: 0.5rem; align-items: flex-start; }
.lesson-steps input { width: 1.15rem; height: 1.15rem; margin-top: 0.25rem; flex: 0 0 auto; }
.lesson-panel.is-entering { animation: lesson-in 320ms ease; }
@keyframes lesson-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.continue-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem max(1.2rem, calc((100% - 980px) / 2)) calc(0.75rem + env(safe-area-inset-bottom));
  background: var(--wood-deep);
  color: #f6efe6;
}
.continue-bar p { margin: 0; flex: 1 1 auto; min-width: 0; }
.continue-bar a, .continue-bar button {
  background: var(--copper);
  color: white;
  text-decoration: none;
  border: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .lesson-grid, .hand-grid { grid-template-columns: 1fr; }
  .mini-diagrams figure { width: min(148px, 46%); }
  .pattern { gap: 0.25rem; }
  .cell { padding: 0.35rem 0; }
  .cell strong { font-size: 1rem; }
  .continue-bar {
    gap: 0.55rem;
    padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom));
  }
  .continue-bar p { font-size: 0.92rem; line-height: 1.3; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lesson-panel.is-entering { animation: none; }
  .lesson-progress-bar, button, select, .site-nav a, .continue-bar a, .continue-bar button { transition: none; }
}
@media print {
  .site-header, .lesson-progress, .site-nav, .row, button, .skip, .continue-bar { display: none !important; }
  .shell { display: block; }
  body { background: white; }
  .card, .shot, .detail, .callout { box-shadow: none; }
}
