:root {
  --sage-50: #f4f7f2;
  --sage-100: #e6ede2;
  --sage-200: #cfdcc9;
  --sage-300: #b0c5a8;
  --sage-400: #8fa987;
  --sage-500: #739070;
  --sage-600: #5a7655;
  --sage-700: #46604a;
  --sage-800: #34483a;
  --sand-50: #fbf8f2;
  --sand-100: #f5efe3;
  --sand-200: #e9dfcb;
  --clay: #c98f73;
  --clay-bg: #f6e6dd;
  --sky: #7ea3b5;
  --sky-bg: #e3edf2;
  --rose: #c58a96;
  --rose-bg: #f5e4e8;
  --warn-bg: #fbeee0;
  --warn-ink: #8a4b17;
  --ink: #26332a;
  --muted: #627268;
  --line: #e0e6dc;
  --white: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(38, 51, 42, 0.05), 0 6px 20px rgba(38, 51, 42, 0.06);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--sand-50);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.2; margin: 0 0 0.5em; color: var(--sage-800); letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--sage-700); text-decoration-color: var(--sage-300); text-underline-offset: 3px; }
a:hover { color: var(--sage-800); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sage-400); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--sage-700); color: #fff; padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(251, 248, 242, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.brand { font-family: var(--font-display); font-size: 1.35rem; color: var(--sage-800); text-decoration: none; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand .dot { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--sage-300), var(--sage-600)); display: inline-block; }
.search-wrap { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search-wrap input { width: 100%; padding: 10px 14px 10px 42px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.search-wrap .ico { font-size: 14px; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; max-height: 70vh; overflow-y: auto; }
.results a { display: block; padding: 10px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--sage-50); }
.results a:hover, .results a:focus { background: var(--sage-50); }
.results small { color: var(--muted); display: block; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.nav { max-width: 1180px; margin: 0 auto; padding: 0 20px 10px; display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--sage-800); font-size: 0.95rem; }
.nav a:hover { background: var(--sage-100); }
.nav a.active { background: var(--sage-600); color: #fff; }
.nav .sep { width: 1px; background: var(--line); margin: 6px 6px; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; min-height: 70vh; }
.site-footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 30px 20px 50px; border-top: 1px solid var(--line); }

/* generic */
.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 65ch; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--sage-600); background: var(--sage-600); color: #fff; text-decoration: none; cursor: pointer; font-weight: 500; }
.btn:hover { background: var(--sage-700); color: #fff; }
.btn.ghost { background: transparent; color: var(--sage-700); border-color: var(--sage-300); }
.btn.ghost:hover { background: var(--sage-100); color: var(--sage-800); }
.btn.small { padding: 6px 14px; font-size: 0.9rem; }
.btn.on { background: var(--sage-100); color: var(--sage-800); border-color: var(--sage-400); }
.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--sage-100); color: var(--sage-800); font-size: 0.82rem; border: 1px solid transparent; }
.chip.sand { background: var(--sand-100); color: #6d5a33; }
.chip.clay { background: var(--clay-bg); color: #8a5338; }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
button.chip { cursor: pointer; border-color: var(--sage-200); background: #fff; }
button.chip.on { background: var(--sage-600); color: #fff; border-color: var(--sage-600); }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
input[type=text], input[type=search], select, textarea { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label.lbl { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; background: #fff; border: 1px dashed var(--sage-200); border-radius: var(--radius); }

/* home */
.hero { background: linear-gradient(135deg, var(--sage-100), var(--sand-100)); border-radius: 24px; padding: clamp(28px, 5vw, 56px); margin-bottom: 32px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(143, 169, 135, 0.35), transparent 70%); }
.hero p { max-width: 56ch; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 24px; }
.stat { background: rgba(255, 255, 255, 0.7); border-radius: 12px; padding: 12px 18px; min-width: 120px; }
.stat b { font-family: var(--font-display); font-size: 1.6rem; color: var(--sage-800); display: block; line-height: 1.1; }
.app-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; position: relative; overflow: hidden; }
.app-card:hover { transform: translateY(-2px); color: inherit; box-shadow: 0 2px 4px rgba(38, 51, 42, 0.06), 0 12px 28px rgba(38, 51, 42, 0.1); }
.app-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--sage-400); }
.app-card.clay::before { background: var(--clay); }
.app-card.sky::before { background: var(--sky); }
.app-card.sand::before { background: #cdb88a; }
.app-card.rose::before { background: var(--rose); }
.app-card h3 { margin: 0; }
.bar-prog { height: 6px; background: var(--sage-100); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar-prog i { display: block; height: 100%; background: var(--sage-500); border-radius: 99px; }

/* exercise list */
.filters { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 18px 0; display: grid; gap: 12px; }
.filters .row { gap: 6px; }
.ex-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; transition: border-color 0.15s, transform 0.15s; }
.ex-card:hover { border-color: var(--sage-400); transform: translateY(-1px); color: inherit; }
.ex-card h3 { margin: 0; font-size: 1.05rem; }
.ex-card .tick { color: var(--sage-600); font-size: 0.85rem; }
.group-title { margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }

/* exercise detail */
.ex-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.ex-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; margin-top: 18px; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--sage-100); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video.empty { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; text-align: center; padding: 20px; color: var(--sage-800); }
.section { margin-bottom: 20px; }
.section h3 { display: flex; align-items: center; gap: 8px; }
.section h3 .badge { font-size: 0.7rem; font-family: var(--font-body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 500; }
ul.list, ol.list { margin: 0; padding-left: 1.2em; }
ul.list li, ol.list li { margin-bottom: 0.4em; }
ul.list ul { margin-top: 0.3em; padding-left: 1.1em; color: #3e4c42; }
ol.list li::marker { color: var(--sage-600); font-weight: 600; }
.callout { border-radius: 12px; padding: 14px 18px; }
.callout.warn { background: var(--warn-bg); color: #5c3410; border: 1px solid #f0d6b5; }
.callout.warn h3 { color: var(--warn-ink); }
.callout.info { background: var(--sage-50); border: 1px solid var(--sage-200); }
.mods { display: grid; gap: 8px; }
.mod { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.mod .k { flex: none; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 99px; margin-top: 3px; }
.mod .k.easier { background: #e1f0dc; color: #2f5d2b; }
.mod .k.harder { background: var(--clay-bg); color: #8a4a2c; }
.mod .k.option { background: var(--sand-100); color: #6d5a33; }
.side-stack { display: grid; gap: 16px; align-content: start; }
.note-box textarea { background: var(--sand-50); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.src { font-size: 0.85rem; color: var(--muted); }

/* learn */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.tabs a { padding: 8px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--sage-800); }
.tabs a.active { background: var(--sage-600); border-color: var(--sage-600); color: #fff; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--sage-50); font-weight: 600; color: var(--sage-800); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
.term { padding: 14px 0; border-bottom: 1px solid var(--line); }
.term b { color: var(--sage-800); }
.principle { border-left: 4px solid var(--sage-400); padding: 4px 0 4px 16px; margin-bottom: 14px; }
.principle b { font-family: var(--font-display); font-size: 1.1rem; color: var(--sage-800); }
details.acc { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px; margin-bottom: 8px; }
details.acc summary { cursor: pointer; padding: 12px 0; font-weight: 500; color: var(--sage-800); }
details.acc[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }

/* quiz */
.quiz-box { max-width: 760px; margin: 0 auto; }
.q-count { font-size: 0.9rem; color: var(--muted); }
.q-text { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.35; margin: 10px 0 18px; color: var(--sage-800); }
.q-quote { background: var(--sage-50); border-left: 4px solid var(--sage-300); padding: 10px 16px; border-radius: 0 10px 10px 0; margin-bottom: 14px; font-size: 0.97rem; }
.opt { display: block; width: 100%; text-align: left; padding: 14px 18px; margin-bottom: 10px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--sage-400); background: var(--sage-50); }
.opt.right { border-color: #5aa04f; background: #e9f4e5; }
.opt.wrong { border-color: #c9694f; background: #fbe9e3; }
.opt:disabled { cursor: default; }
.why { margin-top: 14px; padding: 14px 18px; border-radius: 12px; background: var(--sage-50); border: 1px solid var(--sage-200); }
.progress-track { height: 8px; background: var(--sage-100); border-radius: 99px; margin-bottom: 18px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--sage-500); transition: width 0.3s; }
.score-ring { font-family: var(--font-display); font-size: 3.2rem; color: var(--sage-700); }

/* flashcards */
.flash { perspective: 1000px; max-width: 640px; margin: 20px auto; }
.flash-inner { position: relative; min-height: 300px; transition: transform 0.5s; transform-style: preserve-3d; cursor: pointer; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; overflow: auto; }
.face.back { transform: rotateY(180deg); background: var(--sage-50); align-items: flex-start; text-align: left; justify-content: flex-start; }
.face .big { font-family: var(--font-display); font-size: 1.8rem; color: var(--sage-800); }
@media (prefers-reduced-motion: reduce) { .flash-inner { transition: none; } }

/* planner */
.plan-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; }
.plan-item { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.plan-item .n { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--sage-100); color: var(--sage-800); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.plan-item .grow { flex: 1; min-width: 0; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; cursor: pointer; }
.icon-btn:hover { background: var(--sage-100); }
.cover span { display: inline-flex; align-items: center; gap: 4px; margin: 3px 4px 3px 0; }
.cover .yes { background: #e1f0dc; color: #2f5d2b; }
.cover .no { background: var(--sand-100); color: #8b7a55; }
.pick-list { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pick-list > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--sage-50); }

/* print */
.print-only { display: none; }
@media print {
  .site-header, .site-footer, .no-print, .filters { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  main { padding: 0; max-width: none; }
  .card, .ex-card { box-shadow: none; }
  .print-ex { break-inside: avoid; page-break-inside: avoid; border: 1px solid #ccc; padding: 10px 14px; margin-bottom: 10px; border-radius: 6px; }
  .print-only { display: block; }
  a { color: inherit; text-decoration: none; }
}
.print-ex h3 { margin-bottom: 4px; }
.print-ex .cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 20px; font-size: 0.92rem; }

/* responsive */
@media (max-width: 860px) {
  .ex-layout, .plan-layout { grid-template-columns: 1fr; }
  .menu-btn { display: inline-block; }
  .nav { display: none; flex-direction: column; padding-bottom: 14px; }
  .nav.open { display: flex; }
  .nav .sep { display: none; }
  .search-wrap { max-width: none; }
  .bar { flex-wrap: wrap; }
  .search-wrap { order: 3; flex-basis: 100%; margin-left: 0; }
  .menu-btn { margin-left: auto; }
}

.site-footer .quote { font-family: var(--font-display); font-size: clamp(1.1rem, 2.4vw, 1.45rem); color: var(--sage-700); max-width: 52ch; margin: 0 auto 10px; line-height: 1.4; transition: opacity 0.5s; }
.site-footer .quote.fade { opacity: 0; }
.quote-next { background: none; border: 1px solid var(--sage-200); color: var(--sage-700); border-radius: 999px; padding: 4px 14px; cursor: pointer; font-size: 0.85rem; }
.quote-next:hover { background: var(--sage-100); }
@media (prefers-reduced-motion: reduce) { .site-footer .quote { transition: none; } }

/* photos, cues, modal */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photos button { padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; cursor: zoom-in; aspect-ratio: 4 / 3; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.photos button:hover img { transform: scale(1.04); }
.cue-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cue { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: #fff; }
.cue h4 { font-family: var(--font-body); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--sage-600); margin: 0 0 6px; }
.cue ul { margin: 0; padding-left: 1.1em; }
.cue li { margin-bottom: 0.35em; }
.cue.say { background: var(--sage-50); }
.cue.watch { background: var(--warn-bg); border-color: #f0d6b5; }
.cue.watch h4 { color: var(--warn-ink); }
.overlay { position: fixed; inset: 0; background: rgba(38, 51, 42, 0.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.overlay[hidden] { display: none; }
.sheet { background: #fff; border-radius: 18px; max-width: 760px; width: 100%; max-height: 92vh; overflow-y: auto; padding: 22px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.sheet .x { position: absolute; right: 12px; top: 12px; background: var(--sage-100); border: 0; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; }
.sheet img.big { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 10px; }
.muscle-sheet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; }
.muscle-sheet .pic { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; }
.muscle-sheet .pic img { max-width: 100%; max-height: 340px; }
.muscle-sheet h2 { margin-top: 0; }
.muscle-sheet dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--sage-600); margin-top: 12px; }
.muscle-sheet dd { margin: 2px 0 0; }
.credit { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
button.chip.mchip { cursor: pointer; }
button.chip.mchip:hover { background: var(--sage-200); }
button.chip.mchip.sand:hover { background: var(--sand-200); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.charts img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
@media (max-width: 640px) { .muscle-sheet { grid-template-columns: 1fr; } }
@media print { .overlay { display: none !important; } }

.site-footer .quote .by { display: block; font-family: var(--font-body); font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.today { margin: 20px 0 0; padding: 14px 18px; background: rgba(255,255,255,0.7); border-radius: 12px; max-width: 60ch; font-family: var(--font-display); color: var(--sage-800); font-size: 1.05rem; line-height: 1.4; }
.today b { font-family: var(--font-body); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sage-600); font-weight: 600; }

button.chip.cchip { cursor: pointer; background: #fff; color: var(--warn-ink); border-color: #e8c9a0; font-size: 0.78rem; padding: 2px 10px; }
button.chip.cchip:hover { background: #fdf3e4; }
.cchips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.cdl dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--sage-600); margin-top: 14px; }
.cdl dd { margin: 3px 0 0; }
