:root{
  /* Shared */
  --warn:#C9A24D;
  --danger:#D86262;
  --radius-lg:18px;
  --radius-md:14px;
  --shadow-soft: 0 10px 30px rgba(0,0,0,0.25);
}

/* Active theme tokens (set via body[data-theme]) */
body[data-theme="slate"]{
  --bg-1:#1E2228;
  --bg-2:#252A31;
  --grid:#1A1F24;
  --border:#2F3640;
  --text:#E6E8EB;
  --text-2:#A9B0BA;
  --muted:#6E7681;
  --accent:#4C6EF5;
  --accent-2:rgba(76,110,245,0.20);
  --focus:rgba(76,110,245,0.45);
  --surface:rgba(255,255,255,0.015);
}

body[data-theme="paper"]{
  --bg-1:#F2F0EA;          /* warm paper */
  --bg-2:#FAF8F3;          /* slightly lighter */
  --grid:#E6E1D6;
  --border:#D2CCC1;
  --text:#1D242C;
  --text-2:#3B4652;
  --muted:#66707C;
  --accent:#3F63E6;
  --accent-2:rgba(63,99,230,0.12);
  --focus:rgba(63,99,230,0.28);
  --surface:rgba(0,0,0,0.03);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(76,110,245,0.10), transparent 45%),
              linear-gradient(180deg, var(--bg-1), var(--bg-2));
  color:var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

body[data-theme="paper"]{
  background: radial-gradient(1200px 600px at 20% 0%, rgba(63,99,230,0.08), transparent 55%),
              linear-gradient(180deg, var(--bg-1), var(--bg-2));
}

a{color:inherit}

/* Top bar */
.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  padding:16px 18px 12px;
}

.brand{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:340px;
}

.brandTop{
  display:flex;
  align-items:center;
  gap:10px;
}

.logo{
  width:34px;
  height:34px;
  display:block;
  border-radius:10px; /* keeps it soft even if we swap logo later */
}

.wordmark{
  font-family: "DM Sans", Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight:600;
  font-size:20px;
  letter-spacing:0.2px;
}

.pill{
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--text-2);
  background:var(--surface);
}

.subtitle{
  font-size:12px;
  color:var(--muted);
  margin-left:6px;
}

.docContext{
  display:flex;
  gap:12px;
  align-items:flex-end;
}

.controls{
  display:flex;
  align-items:flex-end;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
  max-width: 980px;
}

.group{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.lbl{
  font-size:11px;
  color:var(--muted);
}

.select,.input{
  height:36px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text);
  outline:none;
}

body[data-theme="paper"] .select,
body[data-theme="paper"] .input{
  background:rgba(255,255,255,0.55);
}

.input{width:64px}

.seg{
  display:flex;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  background:var(--surface);
}

.seg button{
  height:36px;
  padding:0 12px;
  border:0;
  background:transparent;
  color:var(--text-2);
  font-weight:500;
  cursor:pointer;
  font-family: inherit;
}

.seg button.active{
  background:rgba(76,110,245,0.14);
  color:var(--text);
}

body[data-theme="paper"] .seg button.active{
  background:rgba(63,99,230,0.10);
}

.seg button:hover{
  background:rgba(255,255,255,0.05);
}

body[data-theme="paper"] .seg button:hover{
  background:rgba(0,0,0,0.04);
}

/* Chords "inferred" gentle outline */
.chordHintWrap .chordSeg{
  border-color: rgba(201,162,77,0.30);
  box-shadow: 0 0 0 1px rgba(201,162,77,0.10) inset;
}
.chordHintWrap .chordSeg:hover{
  border-color: rgba(201,162,77,0.50);
  box-shadow: 0 0 0 1px rgba(201,162,77,0.18) inset;
}

/* Actions */
.actions{
  flex-direction:row;
  align-items:flex-end;
  gap:10px;
  margin-left:8px;
}

.btn{
  height:36px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text);
  font-weight:500;
  cursor:pointer;
  font-family: inherit;
}

.btn:hover{border-color:rgba(255,255,255,0.18)}
body[data-theme="paper"] .btn:hover{border-color:rgba(0,0,0,0.12)}

.btn.primary{
  border-color: rgba(76,110,245,0.55);
  box-shadow: 0 0 0 1px rgba(76,110,245,0.20) inset;
}
body[data-theme="paper"] .btn.primary{
  border-color: rgba(63,99,230,0.50);
  box-shadow: 0 0 0 1px rgba(63,99,230,0.16) inset;
}

/* Main */
.main{
  padding:0 18px 10px;
}

.canvasWrap{
  border:1px solid var(--border);
  border-radius: var(--radius-lg);
  background:var(--surface);
  padding:12px;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  scrollbar-color: rgba(160,170,185,0.35) transparent;
}

.canvasWrap::-webkit-scrollbar{ height:10px; }
.canvasWrap::-webkit-scrollbar-track{ background: transparent; }
.canvasWrap::-webkit-scrollbar-thumb{
  background: rgba(160,170,185,0.22);
  border-radius: 999px;
}
.canvasWrap::-webkit-scrollbar-thumb:hover{ background: rgba(160,170,185,0.32); }

body[data-theme="paper"] .canvasWrap{
  background:rgba(255,255,255,0.45);
}

#editor{
  width:auto;
  max-width:none;
  height:auto;
  display:block;
}

.tooltip{
  position:fixed;
  z-index:50;
  max-width: 420px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,0.70);
  color:#fff;
  font-size:12px;
  line-height:1.35;
  box-shadow: var(--shadow-soft);
  pointer-events:none;
}

body[data-theme="paper"] .tooltip{
  background: rgba(20,24,28,0.88);
}

.status{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.hint{
  color:var(--text-2);
  font-size:12px;
  margin-left:10px;
}

/* Subtle UI tooltip for control hovers */
.uiTip{
  position:fixed;
  z-index:180;
  max-width:360px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size:12px;
  line-height:1.35;
  box-shadow: var(--shadow-soft);
  pointer-events:none;
}

.badge{
  font-size:11px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--text-2);
  background: transparent;
}

.mono{
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.small{font-size:12px}

.statusRight{
  display:flex;
  align-items:center;
  gap:10px;
}

.footerBar{
  padding:10px 18px 16px;
}

.footerLeft{
  display:flex;
  flex-direction:column;
  gap:6px;
  align-items:flex-start;
}

.footerControls{
  display:flex;
  align-items:center;
  gap:14px;
}

.themeBtn{
  padding:0;
  border:0;
  background:transparent;
  color:var(--muted);
  font-size:12px;
  cursor:pointer;
  font-family: inherit;
}

.themeBtn:hover{ color: var(--text-2); }

.themeMenu{
  position:fixed;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  background:var(--bg-2);
  box-shadow: var(--shadow-soft);
  z-index:60;
}

.themeItem{
  display:block;
  width:100%;
  padding:10px 12px;
  border:0;
  background:transparent;
  color:var(--text);
  cursor:pointer;
  text-align:left;
  font-size:12px;
}

.themeItem:hover{
  background: var(--surface);
}

.footerMeta{
  color:var(--muted);
}

/* ------------------------------
   About modal
------------------------------ */

.modal{
  position:fixed;
  inset:0;
  z-index:200;
  display:grid;
  place-items:center;
}

/* Ensure the native [hidden] attribute always wins (prevents accidental auto-show). */
.modal[hidden]{
  display:none !important;
}

.modalBackdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.42);
}

.modalPanel{
  position:relative;
  width:min(760px, calc(100vw - 40px));
  max-height:calc(100vh - 60px);
  overflow:auto;
  border:1px solid var(--border);
  border-radius:18px;
  background:var(--bg-2);
  box-shadow: var(--shadow-soft);
}

.modalHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  padding:18px 18px 8px;
}

.modalHeader h2{
  margin:0;
  font-size:16px;
  font-weight:600;
  color:var(--text);
}

.iconBtn{
  border:1px solid var(--border);
  background:transparent;
  color:var(--muted);
  border-radius:12px;
  padding:6px 10px;
  cursor:pointer;
}

.iconBtn:hover{ color: var(--text-2); background: var(--surface); }

.modalBody{
  padding:8px 18px 18px;
  color:var(--text);
  font-size:14px;
  font-weight:400;
}

.modalBody h3{
  margin:14px 0 6px;
  font-size:13px;
  letter-spacing:0.02em;
  text-transform:uppercase;
  color:var(--muted);
}

.modalBody p{ margin:0 0 10px; line-height:1.5; color:var(--text); }

.modalBody ul{
  margin:8px 0 10px 18px;
  padding:0;
  color:var(--text);
}

.modalBody strong{ font-weight:500; }

.modalBody li{ margin:6px 0; }

.modalBody a{ color: var(--text-2); text-decoration:none; border-bottom:1px solid transparent; }
.modalBody a:hover{ border-bottom-color: var(--border); }

.divider{ height:1px; background:var(--border); margin:14px 0; }

.muted{ color:var(--muted); }

.sig{ margin-top:6px; color:var(--text-2); }
