:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.25rem;
  --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;
  --font-display: 'Zodiak', 'Georgia', serif;
  --font-body: 'Satoshi', 'Helvetica Neue', sans-serif;
  --radius: 14px; --radius-sm: 9px;

  --bg: #F4EEE3;
  --surface: #FBF8F2;
  --surface-2: #EFE7D9;
  --text: #2A2018;
  --muted: #716454;
  --faint: #A09381;
  --border: #E0D5C3;
  --accent: #A85A17;
  --accent-hover: #8E4A10;
  --accent-soft: #F2DFC9;
  --on-accent: #FFF9F1;
  --good: #52703A;
  --good-soft: #E1E8D3;
  --warn: #A5462F;
  --wood: #6B4527;
  --fret: #C9B79C;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
}
:root[data-theme="dark"] {
  --bg: #16110C;
  --surface: #1F1812;
  --surface-2: #2A2119;
  --text: #EFE6D8;
  --muted: #B3A590;
  --faint: #7D705F;
  --border: #3A2F24;
  --accent: #E39A55;
  --accent-hover: #F0AE6D;
  --accent-soft: #3D2A18;
  --on-accent: #1C120A;
  --good: #9BBF78;
  --good-soft: #27311D;
  --warn: #E08469;
  --wood: #4A3120;
  --fret: #6B5A45;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-family: var(--font-display); font-weight: 500; font-size: var(--text-xl); letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: var(--text-base); font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.xs { font-size: var(--text-xs); }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: var(--space-8);
  padding: var(--space-6) var(--space-4);
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--accent); padding: 0 var(--space-2); }
.brand span { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.logo { width: 32px; height: 32px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--muted); font-size: var(--text-sm); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 0 var(--space-2); }
.sync { font-size: var(--text-xs); color: var(--faint); }

main { padding: var(--space-8) clamp(var(--space-4), 4vw, var(--space-12)) var(--space-12); max-width: 1180px; width: 100%; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.page-head p { margin-top: var(--space-1); }
.eyebrow { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }

/* Cards & grid */
.grid { display: grid; gap: var(--space-4); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

.stat .label { font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.stat .value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: var(--space-1); }
.stat .sub { font-size: var(--text-xs); color: var(--muted); margin-top: var(--space-1); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: .6rem 1rem; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent); font-size: var(--text-sm); font-weight: 700;
  cursor: pointer; text-decoration: none; transition: background .15s, transform .1s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.lg { padding: .85rem 1.4rem; font-size: var(--text-base); }
.btn.icon { padding: .5rem; width: 40px; height: 40px; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ghost { background: none; border: none; color: var(--muted); cursor: pointer; padding: .35rem .5rem; border-radius: 8px; font-size: var(--text-sm); }
.ghost:hover { background: var(--surface-2); color: var(--text); }
.ghost.danger:hover { color: var(--warn); }

.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: var(--text-xs); background: var(--surface-2); color: var(--muted); font-weight: 500; white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: none; padding: .35rem .8rem; border-radius: 999px; cursor: pointer; font-size: var(--text-sm); color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

/* Forms */
label.field { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-sm); font-weight: 500; }
label.field span { color: var(--muted); font-size: var(--text-xs); font-weight: 500; }
input[type=text], input[type=email], input:not([type]), input[type=number], input[type=url], select, textarea {
  width: 100%; padding: .55rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); font-size: var(--text-sm);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* Today */
.hero-card { display: grid; grid-template-columns: auto 1fr; gap: var(--space-6); align-items: center; }
.ring { width: 132px; height: 132px; position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .ring-label b { font-family: var(--font-display); font-size: 1.9rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .ring-label span { font-size: var(--text-xs); color: var(--muted); }
.week-dots { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.week-dots div { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--muted); }
.week-dots i { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border); display: block; }
.week-dots i.part { background: var(--accent-soft); border-color: var(--accent); }
.week-dots i.full { background: var(--accent); border-color: var(--accent); }
.week-dots .today-dot { color: var(--text); font-weight: 700; }

.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plan-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.plan-list li:first-child { border-top: none; }
.plan-num { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: var(--text-xs); font-weight: 700; color: var(--muted); }
.plan-list .t { font-weight: 700; font-size: var(--text-sm); }
.plan-list .m { font-size: var(--text-xs); color: var(--muted); display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-top: 2px; }
.plan-list li.done .plan-num { background: var(--good-soft); color: var(--good); }
.plan-list li.done .t { color: var(--muted); text-decoration: line-through; }
.plan-list li.current { background: var(--accent-soft); margin: 0 calc(-1 * var(--space-3)); padding-left: var(--space-3); padding-right: var(--space-3); border-radius: var(--radius-sm); border-top-color: transparent; }
.plan-list li.current + li { border-top-color: transparent; }
.plan-list li.current .plan-num { background: var(--accent); color: var(--on-accent); }

.tip { border-left: 3px solid var(--accent); padding: var(--space-1) 0 var(--space-1) var(--space-4); }
.tip p + p { margin-top: var(--space-2); }

/* Practice */
.timer { font-family: var(--font-display); font-size: clamp(2.2rem, 1.6rem + 2vw, 3.2rem); font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1; }
.now-card { border-color: var(--accent); }
.now-title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; }
.tempo-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; position: relative; }
.tempo-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }
.quality { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-2); }
.quality button { border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm); padding: .5rem .25rem; cursor: pointer; font-size: var(--text-xs); color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.quality button b { font-size: var(--text-base); color: var(--text); }
.quality button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.quality button.on b { color: var(--accent); }

/* Metronome */
.metro-bpm { display: flex; align-items: center; justify-content: center; gap: var(--space-4); }
.metro-bpm .bpm { font-family: var(--font-display); font-size: clamp(3rem, 2.4rem + 2vw, 4.2rem); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: center; }
.metro-bpm .bpm small { display: block; font-family: var(--font-body); font-size: var(--text-xs); color: var(--muted); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.beats { display: flex; justify-content: center; gap: var(--space-2); margin: var(--space-4) 0; min-height: 18px; }
.beats i { width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--border); transition: background .05s, transform .05s; }
.beats i.first { border-color: var(--accent); }
.beats i.hit { background: var(--accent); border-color: var(--accent); transform: scale(1.2); }
.tempo-name { text-align: center; font-size: var(--text-xs); color: var(--muted); }
.metro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-4); }
.trainer { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px dashed var(--border); }
.switch { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--text-sm); font-weight: 500; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--border); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

/* Library */
.toolbar { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar input[type=text] { max-width: 260px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.item-card { display: flex; flex-direction: column; gap: var(--space-3); cursor: pointer; transition: border-color .15s, transform .15s; text-align: left; }
.item-card:hover { border-color: var(--accent); }
.item-card .title { font-weight: 700; }
.jam-checks { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.spark { width: 100%; height: 38px; display: block; }

/* Progress */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; position: relative; padding-top: var(--space-2); }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .bar { width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--accent); min-height: 3px; transition: height .4s; }
.bars .bar.zero { background: var(--surface-2); }
.bars .col span { font-size: 11px; color: var(--faint); }
.bars .goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--good); pointer-events: none; }
.bars .goal b { position: absolute; right: 0; top: -18px; font-size: 11px; color: var(--good); font-weight: 500; }
.hbar { display: grid; grid-template-columns: 120px 1fr 56px; gap: var(--space-3); align-items: center; font-size: var(--text-sm); padding: 6px 0; }
.hbar .track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hbar .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
.tempo-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.tempo-row:first-child { border-top: none; }
.session-row { padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.session-row:first-child { border-top: none; }
.session-row .refl { font-size: var(--text-sm); color: var(--muted); margin-top: 4px; }

/* Tools */
.fretboard-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--space-2)); padding: 0 var(--space-2); }
.fretboard { min-width: 760px; width: 100%; display: block; }
.fb-note { cursor: default; }
.legend { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-xs); color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -2px; margin-right: 6px; }
.chop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.chop { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); cursor: pointer; text-align: left; }
.chop.on { border-color: var(--accent); background: var(--accent-soft); }
.chop .frets { white-space: nowrap; font-family: var(--font-display); font-size: var(--text-base); font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.strings { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.string-btn { border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius); padding: var(--space-4) var(--space-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.string-btn b { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; line-height: 1; }
.string-btn span { font-size: var(--text-xs); color: var(--muted); }
.string-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.needle-wrap { position: relative; height: 90px; margin: var(--space-4) 0 var(--space-2); }
.needle-scale { position: absolute; left: 0; right: 0; bottom: 18px; height: 40px; }
.needle-scale i { position: absolute; bottom: 0; width: 1.5px; background: var(--border); height: 14px; }
.needle-scale i.c { height: 34px; background: var(--good); width: 2px; }
.needle { position: absolute; bottom: 18px; left: 50%; width: 3px; height: 60px; background: var(--accent); border-radius: 2px; transform-origin: bottom center; transition: left .12s ease-out; }
.needle.in { background: var(--good); }
.needle-labels { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--faint); }
.tuner-read { text-align: center; }
.tuner-read b { font-family: var(--font-display); font-size: 3rem; font-weight: 500; line-height: 1; }

/* Empty & misc */
.empty { text-align: center; padding: var(--space-8) var(--space-4); color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: var(--space-2); }
.empty .btn { margin-top: var(--space-4); }
.divider { height: 1px; background: var(--border); margin: var(--space-4) 0; }

dialog {
  border: 1px solid var(--border); border-radius: 18px; padding: 0; background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(20, 12, 5, .45); }
.modal-body { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.modal-foot { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 18px 18px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; flex-direction: column; gap: var(--space-2); }
.checks label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); cursor: pointer; }
.checks input { accent-color: var(--accent); width: 16px; height: 16px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: .6rem 1.1rem; border-radius: 999px; font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.session-pill { position: fixed; right: 20px; bottom: 20px; z-index: 40; }
.session-pill a { display: inline-flex; gap: var(--space-2); align-items: center; background: var(--accent); color: var(--on-accent); text-decoration: none; padding: .6rem 1rem; border-radius: 999px; font-weight: 700; font-size: var(--text-sm); box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.session-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* Responsive */
@media (max-width: 1024px) {
  .g-main { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30;
    flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: none; border-top: 1px solid var(--border); gap: 0;
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; flex: 1; text-align: center; }
  .nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  main { padding: var(--space-5) var(--space-4) 110px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .hero-card { grid-template-columns: 1fr; justify-items: start; }
  .form-grid { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 90px 1fr 48px; }
  .tempo-row { grid-template-columns: 1fr auto; }
  .tempo-row .tempo-mid { grid-column: 1 / -1; order: 3; }
  .session-pill { bottom: 84px; right: 12px; }
  .mobile-only { display: inline-flex !important; }
}
.mobile-only { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

div.field { display: flex; flex-direction: column; gap: var(--space-1); }
.lbl-m { display: none; }
@media (max-width: 760px) { .lbl-d { display: none; } .lbl-m { display: inline; } }
@media (max-width: 760px) { .g-3.keep { grid-template-columns: repeat(3, minmax(0,1fr)); } }

/* Lessons / PDFs */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); text-align: center; padding: var(--space-8) var(--space-4); border: 1.5px dashed var(--fret); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; font-size: var(--text-sm); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg, .thumb-fallback svg, .file-chip svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dropzone > svg { width: 34px; height: 34px; color: var(--accent); }
.pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.pdf-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.thumb { position: relative; display: block; width: 100%; aspect-ratio: 8.5 / 8; overflow: hidden; border: none; border-bottom: 1px solid var(--border); background: var(--surface-2); cursor: pointer; padding: 0; }
.thumb canvas { position: absolute; top: 0; left: 0; width: 100%; opacity: 0; transition: opacity .25s; background: #fff; }
.thumb canvas.ready { opacity: 1; }
.thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.thumb-fallback svg { width: 40px; height: 40px; }
.thumb:hover canvas.ready { opacity: .92; }
.pdf-meta { padding: var(--space-4) var(--space-4) 0; flex: 1; min-width: 0; }
.pdf-meta .title { font-weight: 700; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-note { margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pdf-actions { display: flex; justify-content: flex-end; gap: 2px; padding: var(--space-2) var(--space-3); }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 10px 5px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); font-size: var(--text-xs); font-weight: 500; cursor: pointer; }
.file-chip:hover { border-color: var(--accent); color: var(--accent); }
.file-chip svg { width: 15px; height: 15px; flex: none; color: var(--accent); }
.file-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.wide { width: min(980px, calc(100vw - 16px)); height: calc(100dvh - 32px); max-height: none; }
.viewer { display: flex; flex-direction: column; height: 100%; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.viewer-title { display: flex; flex-direction: column; min-width: 0; }
.viewer-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-note { padding: var(--space-3) var(--space-4); background: var(--accent-soft); border-bottom: 1px solid var(--border); }
.viewer-pages { flex: 1; overflow: auto; background: var(--surface-2); padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.viewer-pages canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); border-radius: 2px; max-width: none; }
.thumb.loaded .thumb-fallback { display: none; }
@media (max-width: 760px) { .pdf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); } .pdf-meta { padding: var(--space-3) var(--space-3) 0; } }

/* Memorize */
.memo-list { display: flex; flex-direction: column; }
.memo-row { display: grid; grid-template-columns: 52px minmax(0,1fr) auto; gap: var(--space-4); align-items: center; padding: var(--space-3) var(--space-2); border-top: 1px solid var(--border); text-decoration: none; border-radius: var(--radius-sm); }
.memo-row:first-child { border-top: none; }
.memo-row:hover { background: var(--surface-2); }
.memo-row .t { font-weight: 700; font-size: var(--text-sm); }
.memo-ring { --p: 0; width: 48px; height: 48px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); display: grid; place-items: center; }
.memo-ring span { width: 38px; height: 38px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.memo-section { padding: var(--space-4) 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--space-2); }
.memo-section:first-of-type { border-top: none; padding-top: 0; }
.memo-section > .ghost { align-self: flex-start; }
.sec-name { font-weight: 700; max-width: 240px; background: transparent !important; border-color: transparent !important; padding-left: 0 !important; font-size: var(--text-base) !important; }
.sec-name:hover { border-color: var(--border) !important; padding-left: .7rem !important; }
.phrase-row { display: grid; grid-template-columns: 120px minmax(0,1fr) auto auto auto; gap: var(--space-2); align-items: center; }
.phrase-row select { width: auto; }
.lvl { display: inline-flex; gap: 3px; }
.lvl i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); }
.lvl i.on { background: var(--good); border-color: var(--good); }
.method { text-align: left; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s; }
.method:hover:not(:disabled) { border-color: var(--accent); }
.method:disabled { opacity: .55; cursor: not-allowed; }
.method b { font-size: var(--text-sm); }
.memo-run { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.rate3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.rate3 button { position: relative; border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm); padding: var(--space-3); cursor: pointer; display: flex; flex-direction: column; gap: 2px; text-align: left; transition: border-color .15s, background .15s; }
.rate3 button b { font-size: var(--text-sm); }
.rate3 button span { font-size: var(--text-xs); color: var(--muted); }
.rate3 button:nth-child(1):hover { border-color: var(--good); background: var(--good-soft); }
.rate3 button:nth-child(2):hover { border-color: var(--accent); background: var(--accent-soft); }
.rate3 button:nth-child(3):hover { border-color: var(--warn); }
kbd { font-family: var(--font-body); font-size: 11px; color: var(--faint); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }
.rate3 kbd { position: absolute; top: 8px; right: 8px; }
.sheet { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: #fff; min-height: 240px; }
.sheet canvas { display: block; width: 100%; transition: filter .2s; }
.sheet.covered canvas { filter: blur(16px) grayscale(.4); opacity: .35; }
.sheet.covered.peek canvas { filter: none; opacity: 1; }
.sheet-cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); text-align: center; background: color-mix(in srgb, var(--surface) 55%, transparent); color: var(--text); }
.sheet.peek .sheet-cover { display: none; }
.answer { background: var(--good-soft); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); }
.phrase-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-2); }
.phrase-sum div { display: flex; align-items: center; gap: var(--space-2); }
@media (max-width: 900px) { .memo-run { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .phrase-row { grid-template-columns: 1fr auto auto; }
  .phrase-row input[data-f=cue] { grid-column: 1 / -1; order: 5; }
  .rate3 { grid-template-columns: 1fr; }
  .nav a { font-size: 10px; padding: 6px 2px; }
}
.phrase-sum span { white-space: nowrap; }
@media (max-width: 760px) {
  .phrase-row { display: flex; flex-wrap: wrap; gap: var(--space-2); padding-bottom: var(--space-2); border-bottom: 1px dashed var(--border); }
  .phrase-row input[data-f=label] { flex: 1; min-width: 0; }
  .phrase-row input[data-f=cue] { flex-basis: 100%; order: 5; }
}

/* Auth */
.auth-mode .sidebar { display: none; }
.auth-mode .shell { grid-template-columns: 1fr; }
.auth-wrap { min-height: calc(100dvh - 80px); display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-8); }
.auth-msg { color: var(--accent); background: var(--accent-soft); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.linkish { background: none; border: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; font-size: inherit; }
.sidebar-foot { flex-wrap: wrap; }
input[type=password] { width: 100%; padding: .55rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); font-size: var(--text-sm); }
.auth-mode main { max-width: none; }

/* ---------- v2: recordings, reports, sharing ---------- */
body:not(.sb) .sb-only { display: none !important; }
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2), var(--bg), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.btn.small, .ghost.small { padding: .4rem .75rem; font-size: var(--text-xs); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #C8402B; display: inline-block; flex: none; }
.rec-btn .rec-dot { box-shadow: 0 0 0 3px rgba(200, 64, 43, .18); }
.rec-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 60; display: flex; align-items: center; gap: var(--space-3); background: var(--text); color: var(--bg); padding: .55rem .6rem .55rem 1rem; border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100vw - 24px); }
.rec-bar .rec-dot { animation: pulse 1.2s infinite; }
.rec-bar .rec-label { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.rec-bar .rec-what { opacity: .75; max-width: 22ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-bar .btn { background: #C8402B; color: #fff; }
.rec-meter { width: 72px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; }
:root[data-theme="dark"] .rec-meter { background: rgba(0,0,0,.2); }
.rec-meter i { display: block; height: 100%; background: #7FB069; transform-origin: left; transform: scaleX(.03); transition: transform .06s linear; }
.rec-meter i.hot { background: #E0533A; }
.rec-list { display: flex; flex-direction: column; }
.rec-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3); align-items: start; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.rec-list > .rec-row:first-child { border-top: none; }
.rec-row.static { grid-template-columns: 1fr auto; }
.rec-play { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--accent); display: grid; place-items: center; cursor: pointer; }
.rec-play svg { width: 16px; height: 16px; margin-left: 2px; }
.rec-play:hover { border-color: var(--accent); }
.rec-info { min-width: 0; }
.rec-info .t { font-weight: 700; font-size: var(--text-sm); }
.rec-note { color: var(--muted); margin-top: 2px; }
.rec-audio audio, .rec-info audio { width: 100%; margin-top: var(--space-2); height: 40px; }
.rec-actions { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.link-box { display: flex; gap: var(--space-2); }
.link-box input { flex: 1; min-width: 0; font-size: var(--text-xs); }
a.btn.lg { text-align: center; justify-content: center; text-decoration: none; }
.share-msg { background: var(--accent-soft); color: var(--text); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); margin-top: var(--space-2); }
.share-card h3 { font-family: var(--font-display); font-size: var(--text-lg); }
.seg button[data-act="pv-days"] { white-space: nowrap; }
/* Report */
.report { display: flex; flex-direction: column; gap: var(--space-4); }
.report-head { padding: var(--space-2) 0 var(--space-2); }
.report-head h1 { margin-top: 4px; }
.report-brand { display: flex; align-items: center; gap: 8px; color: var(--accent); font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); margin-bottom: var(--space-4); }
.report-brand .logo { width: 30px; height: 30px; }
.report-msg { margin: 0; padding: var(--space-4) var(--space-5); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: var(--text-base); }
.rpt-bars { display: flex; align-items: flex-end; gap: 3px; height: 170px; padding-top: 18px; }
.rpt-bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.rpt-bars .bar { width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; }
.rpt-bars .bar.zero { background: var(--border); }
.rpt-bars .v { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 14px; }
.rpt-bars .d { font-size: 10px; color: var(--faint); margin-top: 4px; font-variant-numeric: tabular-nums; }
.rpt-table { display: flex; flex-direction: column; }
.rpt-tr { display: grid; grid-template-columns: minmax(0, 1fr) 70px 130px 56px; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--border); align-items: start; font-size: var(--text-sm); }
.rpt-th { font-size: var(--text-xs); color: var(--muted); border-top: none; padding-top: 0; }
.rpt-notes { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; color: var(--muted); }
.up { color: var(--good); font-weight: 700; font-size: var(--text-xs); }
.report-foot { text-align: center; padding: var(--space-4) 0 var(--space-8); }
.report-wrap { max-width: 920px; margin: 0 auto; padding: var(--space-6) 0; }
.report-tools { display: flex; justify-content: flex-end; margin-bottom: var(--space-2); }
.report-mode main { max-width: none; }
@media (max-width: 760px) {
  .nav { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; min-width: 66px; }
  .rec-bar { bottom: 84px; }
  .rec-bar .rec-what, .rec-bar .rec-label { display: none; }
  .rec-row { grid-template-columns: auto 1fr; }
  .rec-actions { grid-column: 2; justify-content: flex-start; margin-left: -8px; }
  .rpt-tr { grid-template-columns: minmax(0, 1fr) 64px; }
  .rpt-tr > :nth-child(3), .rpt-tr > :nth-child(4) { grid-column: auto; }
  .rpt-th > :nth-child(3), .rpt-th > :nth-child(4) { display: none; }
  .rpt-tr:not(.rpt-th) > :nth-child(3)::before { content: 'Tempo '; color: var(--muted); font-size: var(--text-xs); }
  .rpt-tr:not(.rpt-th) > :nth-child(4)::before { content: 'Feel '; color: var(--muted); font-size: var(--text-xs); }
  .report-wrap { padding: var(--space-2) 0; }
  .link-box { flex-direction: column; }
}
@media print {
  .no-print, .sidebar, .session-pill, .rec-bar, .toast { display: none !important; }
  body, main { background: #fff !important; }
  .card { box-shadow: none; break-inside: avoid; border: 1px solid #ddd; }
  .report-wrap { padding: 0; }
  audio { display: none; }
}
.rec-row > .rec-audio { grid-column: 2 / -1; }
.rec-row > .rec-audio:empty { display: none; }
.rec-row.static .rec-audio { grid-column: auto; }
.rec-row .rec-audio audio { margin-top: 0; }
.card-head.wrap { flex-wrap: wrap; gap: var(--space-2); }
.card-head.wrap select { max-width: 260px; }
.btn.rec-btn:not(.secondary) .rec-dot { background: var(--on-accent); box-shadow: none; }
@media (max-width: 760px) { .rec-row > .rec-audio { grid-column: 1 / -1; } }
