:root {
  --bg: #f5f6fb; --surface: #ffffff; --surface-2: #eef0f8; --text: #171a2b; --muted: #6b7088;
  --border: #e3e6f1; --accent: #6d5efc; --accent-2: #ec4899; --chord: #e11d74; --danger: #e5484d;
  --shadow: 0 8px 30px rgba(30, 30, 80, .08); --radius: 16px;
  --grad: linear-gradient(135deg, #6d5efc, #ec4899);
}
:root[data-theme="dark"] {
  --bg: #0d0f1a; --surface: #161929; --surface-2: #1e2236; --text: #eceefb; --muted: #9aa0bd;
  --border: #272c45; --accent: #8b7dff; --chord: #ff6fb1; --shadow: 0 8px 30px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--text); background: var(--bg);
  font-family: ui-sans-serif, -apple-system, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  background-image: radial-gradient(900px 400px at 85% -10%, rgba(109, 94, 252, .18), transparent),
                    radial-gradient(700px 400px at -10% 110%, rgba(236, 72, 153, .12), transparent);
  background-attachment: fixed;
}
header {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: color-mix(in srgb, var(--surface) 75%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
header h1 { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; }
.logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--grad); font-size: 1.2rem; box-shadow: 0 4px 14px rgba(109, 94, 252, .4); }
.logo.big { width: 72px; height: 72px; font-size: 2.2rem; border-radius: 22px; margin: 0 auto 14px; }
.header-right { display: flex; gap: 10px; align-items: center; }
#auth { display: flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); }
.layout { display: flex; min-height: calc(100vh - 61px); }
#sidebar { width: 310px; flex-shrink: 0; padding: 20px 16px; overflow-y: auto; max-height: calc(100vh - 61px); position: sticky; top: 61px; border-right: 1px solid var(--border); }
#sidebar section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-top: 14px; box-shadow: var(--shadow); }
#sidebar h2 { font-size: .72rem; margin: 2px 6px 8px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
#sidebar h2 small { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .75; margin-left: 4px; }
#sidebar ul { list-style: none; margin: 4px 0 0; padding: 0; max-height: 240px; overflow-y: auto; }
#sidebar li button { width: 100%; text-align: left; border: 0; background: none; color: inherit; padding: 9px 10px; border-radius: 10px; cursor: pointer; font: inherit; font-size: .93rem; transition: background .15s, transform .15s; display: flex; flex-direction: column; }
#sidebar li button:hover { background: var(--surface-2); }
#sidebar li button.active { background: var(--grad); color: #fff; }
#sidebar li button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#sidebar small { color: var(--muted); font-size: .78rem; }
#sidebar li button.active small { color: rgba(255, 255, 255, .85); }
input, select, textarea { font: inherit; color: var(--text); padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
#search { width: 100%; border-radius: 999px; padding: 10px 16px; box-shadow: var(--shadow); }
main { flex: 1; padding: 32px clamp(16px, 4vw, 48px); max-width: 980px; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main h2 { font-size: 1.9rem; letter-spacing: -.03em; margin: 0 0 4px; }
.empty { text-align: center; margin-top: 18vh; color: var(--muted); }
.btn { font: inherit; font-size: .9rem; font-weight: 600; padding: 9px 16px; border: 0; background: var(--grad); color: #fff; border-radius: 999px; cursor: pointer; transition: transform .15s, box-shadow .15s; box-shadow: 0 4px 14px rgba(109, 94, 252, .3); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(109, 94, 252, .4); }
.btn.alt { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.danger { background: var(--danger); box-shadow: none; }
#sidebar .btn { width: 100%; margin: 2px 0 4px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 1.1rem; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 16px 0; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: fit-content; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1rem; line-height: 1.55; white-space: pre; overflow-x: auto; }
.sheet .chord { color: var(--chord); font-weight: 700; }
.sheet .section { color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: .85em; letter-spacing: .06em; }
.sheet.lyrics { font-family: ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif; font-size: 1.3rem; line-height: 1.7; white-space: pre-wrap; }
label { display: block; margin-top: 14px; font-weight: 600; font-size: .9rem; }
.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 22px 22px; box-shadow: var(--shadow); }
.form input, .form select { width: 100%; margin-top: 6px; }
.form textarea { width: 100%; height: 320px; margin-top: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre; }
.form .sheet { box-shadow: none; background: var(--surface-2); }
.form .btn { margin-top: 12px; }
.error { color: var(--danger); min-height: 1.2em; }
.sched-item { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border); padding: 10px 14px; margin: 10px 0; border-radius: 14px; }
.sched-item .grow { flex: 1; }
.sched-item select { width: auto !important; margin: 0 !important; }
@media (max-width: 760px) {
  .layout { flex-direction: column; } #sidebar { width: 100%; max-height: none; position: static; border-right: 0; }
  header h1 { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
