/* ChordLyric. Charcoal + amber, from the approved handoff pictures (dark first; no purple). */
:root {
  --bg: #0e0d0c;
  --panel: #191715;
  --panel2: #221f1c;
  --line: #34302b;
  --fg: #f4eee6;
  --muted: #9d958a;
  --amber: #f2a33a;
  --amber-soft: rgba(242, 163, 58, .14);
  --amber-dim: #7a5426;
  /* vocal colors (handoff): white me, amber backup, blue someone else, green everyone */
  --v-me: #f4eee6;
  --v-backup: #f2a33a;
  --v-other: #6fb6ff;
  --v-both: #7fd68e;
  --lyric: 26px;
  --chord: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --edge: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow-x: hidden; background: var(--bg); color: var(--fg); font: 17px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--amber); text-decoration: none; }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; font-size: 17px; color: var(--fg); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
#app { min-height: 100%; }

.page { max-width: 1600px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top, 0px)) var(--edge) 110px; display: grid; gap: 20px; }

/* top bar */
.top { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand img { width: 40px; height: 40px; }
.brand b { display: block; color: var(--amber); font-size: 24px; line-height: 1.1; font-weight: 700; }
.brand small { color: var(--muted); font-size: 13px; }
.btn { min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.btn.amber { background: var(--amber); color: #1a1209; border-color: var(--amber); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 15px; }
.icon { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.icon svg { width: 22px; height: 22px; }
.back { color: var(--amber); }

h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.05; margin: 6px 0 0; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 22px; margin: 0; }
.sub { color: var(--muted); margin: 0; }

.search { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; min-height: 56px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 14px 0; }
.search svg { width: 22px; height: 22px; color: var(--muted); flex: none; }

/* 4 action cards: 4 across on desktop, 2x2 on phones */
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .actions { grid-template-columns: repeat(2, 1fr); } }
.action { color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 6px; align-content: start; text-align: left; cursor: pointer; min-height: 132px; }
.action svg { width: 30px; height: 30px; color: var(--amber); }
.action b { font-size: 18px; }
.action span { color: var(--muted); font-size: 14px; line-height: 1.3; }

.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.list { display: grid; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.item .num { width: 52px; height: 52px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 700; color: var(--amber); background: radial-gradient(circle at 30% 30%, #3a2a14, #141210 70%); border: 1px solid var(--line); }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .tx span { color: var(--muted); font-size: 15px; }
.item .tag { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.item .tag.go { color: var(--amber); border-color: var(--amber-dim); }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tabs button { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; font-size: 15px; padding: 4px; }
.tabs button[aria-selected="true"] { background: var(--amber); color: #1a1209; border-color: var(--amber); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 12px; }
.note { color: var(--muted); font-size: 15px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 50px; width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 0; }

/* bottom nav (phones and desktop): 4 equal items */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(14, 13, 12, .96); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px var(--edge) max(8px, env(safe-area-inset-bottom, 0px)); }
.nav a { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 13px; padding: 6px 0; }
.nav a svg { width: 26px; height: 26px; }
.nav a.on { color: var(--amber); }

/* ---------- song screen ---------- */
.song { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.song-top { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top, 0px)) var(--edge) 8px; }
.song-title { flex: 1; min-width: 0; text-align: center; }
.song-title b { display: block; color: var(--amber); font-size: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-title b::after { content: ""; display: block; width: 44px; height: 2px; background: var(--amber); margin: 6px auto 0; border-radius: 2px; }
.song-title small { color: var(--muted); font-size: 13px; display: block; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-title button { background: none; border: 0; cursor: pointer; padding: 0; color: var(--muted); font-size: 13px; }
.song-title button.unset { color: var(--amber); }
.strip { display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 4px var(--edge) 8px; border-bottom: 1px solid var(--line); }
.chart { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 var(--edge); -webkit-overflow-scrolling: touch; }
.chart-in { max-width: 1100px; margin: 0 auto; padding: 14px 0 45vh; }
.sec { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 22px 0 6px; }
.ln { border: 1px solid transparent; border-radius: 12px; padding: 4px 10px; margin: 2px -11px; transition: background .25s, border-color .25s, opacity .25s; }
.ln.cur { background: var(--amber-soft); border-color: rgba(242, 163, 58, .35); }
.ln.cur .w { color: #ffd9a3; }
.ln.chorus { border-left: 3px solid var(--line); border-radius: 0 12px 12px 0; }
.ln.past { opacity: .5; }
.ln[data-who="backup"] .w { color: var(--v-backup); }
.ln[data-who="other"] .w { color: var(--v-other); }
.ln[data-who="both"] .w { color: var(--v-both); }
.seg { display: inline-flex; flex-direction: column; vertical-align: bottom; white-space: pre-wrap; max-width: 100%; }
.c { font: 700 var(--chord) / 1.25 var(--mono); color: var(--amber); min-height: 1.25em; white-space: pre; }
.w { font-size: var(--lyric); line-height: 1.3; color: var(--v-me); overflow-wrap: anywhere; }
.c[data-ch] { cursor: pointer; }
/* a short instruction line ("Barre 3rd"): one small centered line, no box */
.cue { text-align: center; font-size: 15px; font-weight: 600; color: var(--muted); margin: 6px 0; }
/* chord shape card for a tapped chord: top right, over lines already played */
.cpop { position: fixed; right: var(--edge); z-index: 25; display: grid; justify-items: center; gap: 2px; padding: 6px 8px; border-radius: 12px; border: 1px solid var(--amber-dim); background: rgba(20, 18, 16, .92); color: var(--amber); font: 700 15px var(--mono); cursor: pointer; }
.cpop svg { width: 70px; height: 85px; }
.patches { display: grid; gap: 8px; }
.prow { display: grid; grid-template-columns: 1fr 110px; gap: 10px; align-items: center; }
.prow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow input { min-width: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 46px; width: 100%; }
.chordonly .c { margin-right: .9em; }
pre.tabx { margin: 0; font: 700 15px/1.35 var(--mono); color: var(--fg); overflow: hidden; }
.ln.cur pre.tabx { color: var(--amber); }
.strum { font: 700 24px var(--mono); letter-spacing: .25em; }
.blank { height: 14px; }
.tips { margin: 18px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; color: var(--muted); display: grid; gap: 8px; }

/* transport: one row sound wave, glowing played segment, semi-transparent buttons on top */
.trans { position: relative; height: 92px; padding: 0 var(--edge) max(8px, env(safe-area-inset-bottom, 0px)); }
.wave { position: absolute; inset: 14px var(--edge); display: flex; align-items: center; gap: 3px; }
.wave i { flex: 1; border-radius: 2px; background: #4a3d2c; display: block; min-width: 1px; }
.wave i.done { background: #9a6a2c; }
.wave i.now { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.tbtns { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; gap: 22px; }
.tb { width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(242, 163, 58, .45); background: rgba(20, 18, 16, .55); color: var(--amber); font-weight: 700; font-size: 16px; cursor: pointer; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; }
.tb.play { width: 76px; height: 76px; border-width: 2px; border-color: var(--amber); }
.tb.play svg { width: 30px; height: 30px; }
.learnbar { display: grid; grid-template-columns: 52px 1fr 52px 52px; gap: 10px; align-items: center; padding: 0 var(--edge) max(10px, env(safe-area-inset-bottom, 0px)); }
.learnbar .icon { width: 52px; height: 46px; }
.learnbar .icon.on { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }
.learnbtn { min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--amber-dim); background: var(--amber-soft); color: var(--amber); font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.learnbtn .yt { width: 26px; height: 19px; border-radius: 6px; background: var(--amber); display: grid; place-items: center; }
.learnbtn .yt::after { content: ""; border-left: 9px solid #1a1209; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 2px; }
.song.full .song-top, .song.full .editbar, .song.full .strip, .song.full .trans, .song.full .learnbar, .song.full .jam { display: none; }

.exitfull { position: absolute; top: max(6px, env(safe-area-inset-top, 0px)); right: var(--edge); z-index: 3; width: 44px; height: 44px; opacity: .6; }

/* chord shapes */
.shape { display: grid; justify-items: center; font: 700 15px var(--mono); color: var(--amber); background: none; border: 0; cursor: pointer; padding: 2px; }
.shape svg { width: 58px; height: 70px; }
.shape.big svg { width: 120px; height: 146px; }
.shape .none { width: 58px; height: 70px; display: grid; place-items: center; font: 12px var(--font); color: var(--muted); }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88vh; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--amber-dim); border-radius: 20px 20px 0 0; padding: 16px var(--edge) max(18px, env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; }
@media (min-width: 900px) { .sheet { left: auto; top: 0; width: 460px; max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--amber-dim); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 12px; overflow: hidden; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vid { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; background: var(--panel2); cursor: pointer; }
.vid img { width: 112px; height: 63px; object-fit: cover; border-radius: 8px; flex: none; background: #000; }
.vid .tx { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.vid .tx b { display: block; color: var(--fg); font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; color: #1a1209; background: var(--amber); border-radius: 6px; padding: 1px 6px; margin-right: 6px; }
.star { width: 46px; height: 46px; border: 0; background: none; font-size: 26px; color: var(--muted); cursor: pointer; flex: none; }
.star.on { color: var(--amber); }
.legend { position: fixed; left: var(--edge); right: var(--edge); z-index: 25; background: rgba(25, 23, 21, .82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 4px; font-size: 16px; max-width: 520px; margin: 0 auto; pointer-events: none; }
.legend b:nth-child(1) { color: var(--v-me); } .legend b:nth-child(2) { color: var(--v-backup); } .legend b:nth-child(3) { color: var(--v-other); } .legend b:nth-child(4) { color: var(--v-both); }

/* edit mode */
.editbar { background: #3a2a14; color: var(--amber); padding: 8px var(--edge); font-size: 15px; font-weight: 600; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.editing .ln { border-style: dashed; border-color: var(--line); cursor: text; }
.lineedit { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--amber-dim); border-radius: 12px; background: var(--panel); margin: 4px -11px; }
.lineedit input { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 600 17px var(--mono); }
.lineedit .row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dot { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-size: 14px; font-weight: 600; }
.dot.on { border-color: var(--amber); }

/* chord drawing grid */
.draw { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-width: 360px; }
.draw button { min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 700; }
.draw button.on { background: var(--amber); color: #1a1209; border-color: var(--amber); }
.draw .lab { text-align: center; color: var(--muted); font-size: 13px; }
.shapes-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--amber-dim); color: var(--fg); padding: 10px 16px; border-radius: 12px; z-index: 50; font-size: 15px; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: reduce) { .chart { scroll-behavior: auto; } }
