:root{
  --bg:#0b0f14;
  --panel:#0f1621;
  --panel2:#0c121b;
  --border:#1b2a3d;
  --text:#d7e3f4;
  --muted:#8aa0bd;
  --muted2:#6f85a3;
  --good:#23c483;
  --bad:#ff5b6e;
  --warn:#f9c846;
  --btn:#162233;
  --btn2:#121b28;
  --btnBorder:#22344c;
  --shadow: rgba(0,0,0,0.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 20% -10%, #162238 0%, rgba(11,15,20,0) 55%),
              radial-gradient(900px 700px at 85% 0%, #1a1f31 0%, rgba(11,15,20,0) 60%),
              var(--bg);
  color:var(--text);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, rgba(15,22,33,0.95), rgba(15,22,33,0.55));
  position:sticky;
  top:0;
  z-index:10;
  backdrop-filter: blur(10px);
}

.brandTitle{font-weight:700; letter-spacing:0.3px}
.brandSub{color:var(--muted); font-size:12px; margin-top:2px}
.status{
  font-size:12px;
  color:var(--muted);
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background: rgba(12,18,27,0.7);
}

.layout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:14px;
  padding:14px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 980px){
  .layout{grid-template-columns:1fr}
}

.panel{
  background: linear-gradient(180deg, rgba(15,22,33,0.96), rgba(12,18,27,0.92));
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow: 0 16px 40px var(--shadow);
}

.controls{
  padding:14px;
}

.controls h2{
  margin:14px 0 10px;
  font-size:13px;
  color:var(--muted);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.7px;
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
  margin:10px 0;
}

.row.two > *{flex:1}
.row.three > *{flex:1}

label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

.val{
  color:var(--text);
  font-weight:700;
  margin-left:6px;
}

select, input[type="range"], input[type="text"]{
  width:100%;
}

select, input[type="text"]{
  background: rgba(10,14,20,0.8);
  color: var(--text);
  border:1px solid var(--btnBorder);
  padding:10px 10px;
  border-radius:12px;
  outline:none;
}

input[type="text"]::placeholder{
  color: var(--muted2);
}

input[type="range"]{
  accent-color: #93b8ff;
}

.check{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  color:var(--muted);
  user-select:none;
}

.check input{transform: translateY(0.5px)}

.btn{
  width:100%;
  border-radius:12px;
  border:1px solid var(--btnBorder);
  background: linear-gradient(180deg, rgba(22,34,51,0.95), rgba(14,22,33,0.95));
  color:var(--text);
  padding:10px 12px;
  cursor:pointer;
  transition: transform .06s ease, filter .12s ease;
}

.btn:hover{filter:brightness(1.08)}
.btn:active{transform: translateY(1px)}

.primary{
  border-color: rgba(147,184,255,0.55);
  box-shadow: 0 10px 30px rgba(147,184,255,0.12);
}

.secondary{
  background: linear-gradient(180deg, rgba(18,27,40,0.95), rgba(12,18,27,0.95));
}

.toggleBtn.active{
  border-color: rgba(35,196,131,0.55);
  background: linear-gradient(180deg, rgba(18,56,41,0.96), rgba(10,24,18,0.96));
  box-shadow: 0 10px 26px rgba(35,196,131,0.16);
}

.danger{
  border-color: rgba(255,91,110,0.55);
  background: linear-gradient(180deg, rgba(45,18,24,0.9), rgba(22,12,16,0.9));
}

.checksCol{
  display:flex;
  flex-direction:column;
  gap:8px;
  justify-content:center;
  padding-top:18px;
}

.hint{
  border:1px dashed rgba(138,160,189,0.35);
  border-radius:12px;
  padding:10px;
  background: rgba(12,18,27,0.6);
  margin-top:18px;
}
.hintTitle{font-size:11px; color:var(--muted); font-weight:700; margin-bottom:4px}
.hintBody{font-size:12px; color:var(--muted2)}

.midiDebug{
  margin-top:6px;
  color:var(--muted2);
  font-size:11px;
  line-height:1.35;
}

.voiceRoutingPanel{
  margin:10px 0 2px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: rgba(10,14,20,0.58);
}

.voiceRoutingHead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.voiceGrooveRow{
  margin-top:0;
}

.voiceGrooveControls{
  align-items:flex-start;
  margin-top:8px;
  margin-bottom:12px;
}

.voiceGrooveInfo{
  min-height:100%;
  padding:10px 12px;
  border:1px dashed rgba(138,160,189,0.28);
  border-radius:12px;
  background: rgba(12,18,27,0.52);
  color:var(--muted2);
  font-size:12px;
  line-height:1.45;
}

.voiceRoutingGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}

.voiceRoute{
  padding:10px;
  border:1px solid rgba(27,42,61,0.88);
  border-radius:12px;
  background: rgba(12,18,27,0.72);
}

.voiceRouteTop{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}

.voiceRouteTitle{
  font-size:13px;
  font-weight:700;
  color:var(--text);
}

.voiceRoute label{
  margin-bottom:6px;
}

.voiceRouteMeta{
  color:var(--muted2);
  margin-left:6px;
}

.voiceRouteGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:8px;
}

.voiceField{
  min-width:0;
}

.voiceFieldLabel{
  display:block;
  margin-bottom:5px;
  font-size:11px;
  color:var(--muted2);
  text-transform:uppercase;
  letter-spacing:0.45px;
}

.voiceRoutingSummary{
  margin-top:10px;
  font-size:12px;
  color:var(--muted2);
}

.theoryPanel{
  position:relative;
  overflow:hidden;
  padding:14px;
  border:1px solid rgba(133,84,73,0.42);
  border-radius:18px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(145,56,56,0.18), rgba(145,56,56,0) 48%),
    radial-gradient(90% 130% at 100% 0%, rgba(188,139,86,0.12), rgba(188,139,86,0) 44%),
    linear-gradient(180deg, rgba(19,17,24,0.96), rgba(10,14,20,0.9));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 18px 40px rgba(0,0,0,0.24);
}

.theoryHero{
  display:grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  gap:12px;
  margin-bottom:12px;
}

.theoryHeroCopy{
  min-width:0;
}

.theoryEyebrow{
  margin-bottom:8px;
  color:#d6ad86;
  font-size:11px;
  font-weight:700;
  letter-spacing:0.18em;
  text-transform:uppercase;
}

.theoryLead{
  max-width:18ch;
  color:#f1e7dc;
  font-family: "Iowan Old Style","Palatino Linotype","Book Antiqua",Georgia,serif;
  font-size:25px;
  line-height:1.08;
}

.theoryScene{
  margin-top:10px;
  max-width:55ch;
  color:#d0b8a7;
  font-size:13px;
  line-height:1.55;
}

.theoryMoodGrid{
  display:grid;
  grid-template-columns:1fr;
  gap:9px;
}

.theoryMoodCard{
  padding:11px 12px;
  border:1px solid rgba(176,118,96,0.26);
  border-radius:14px;
  background: linear-gradient(180deg, rgba(32,24,30,0.92), rgba(18,18,23,0.84));
}

.theoryMoodCard span{
  display:block;
  margin-bottom:5px;
  color:#d6ad86;
  font-size:10px;
  font-weight:700;
  letter-spacing:0.14em;
  text-transform:uppercase;
}

.theoryMoodCard strong{
  display:block;
  color:#e4d7cb;
  font-size:12px;
  line-height:1.45;
  font-weight:600;
}

.theoryChipBar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:0 0 14px;
}

.theoryChip{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(176,118,96,0.24);
  background: rgba(23,18,25,0.68);
  color:#cfb2a2;
  font-size:11px;
  letter-spacing:0.04em;
}

.theoryPanel label{
  color:#bea79b;
}

.theoryPanel select{
  background: rgba(17,14,21,0.84);
  border-color: rgba(176,118,96,0.28);
}

.theoryPanel .btn.secondary{
  border-color: rgba(176,118,96,0.3);
  background: linear-gradient(180deg, rgba(31,22,30,0.96), rgba(16,16,21,0.96));
}

.theoryPanel .toggleBtn.active{
  border-color: rgba(219,137,96,0.52);
  background: linear-gradient(180deg, rgba(68,34,32,0.96), rgba(27,18,17,0.96));
  box-shadow: 0 12px 30px rgba(154,78,54,0.22);
}

.theoryHint{
  font-size:12px;
  color:#bfa79a;
  border:1px dashed rgba(176,118,96,0.22);
  border-radius:12px;
  padding:10px 12px;
  background: rgba(24,19,24,0.52);
}

.theoryReport{
  margin-top:12px;
  border:1px solid rgba(176,118,96,0.28);
  border-radius:16px;
  background: linear-gradient(180deg, rgba(22,18,25,0.82), rgba(12,16,22,0.74));
  padding:12px;
  min-height:112px;
}

.theoryReportEmpty{
  color:#c8b2a2;
}

.theoryReportEmptyTitle{
  margin-bottom:6px;
  color:#f0dfcf;
  font-size:13px;
  font-weight:700;
  letter-spacing:0.04em;
}

.theoryReportEmptyCopy{
  font-size:12px;
  line-height:1.5;
}

.theoryStats{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:10px;
}

.theoryPill{
  font-size:11px;
  color:#f0dfcf;
  padding:5px 9px;
  border-radius:999px;
  border:1px solid rgba(176,118,96,0.22);
  background: rgba(25,18,24,0.56);
}

.theoryFindings{
  display:flex;
  flex-direction:column;
  gap:7px;
}

.theoryFinding{
  font-size:12px;
  line-height:1.45;
  color:#d4c1b5;
}

.theoryFinding.good{color:#b6f0d4}
.theoryFinding.warn{color:#ffd98d}
.theoryFinding.bad{color:#ff9aa7}

@media (max-width: 520px){
  .voiceRoutingGrid{grid-template-columns: 1fr}
  .voiceRouteGrid{grid-template-columns: 1fr}
}

@media (max-width: 860px){
  .theoryHero{grid-template-columns:1fr}
  .theoryLead{max-width:none; font-size:22px}
}

@media (max-width: 680px){
  .theoryPanel .row.three{
    flex-direction:column;
    align-items:stretch;
  }
}

.now{
  border:1px solid var(--border);
  background: rgba(10,14,20,0.65);
  border-radius:14px;
  padding:10px;
  min-height:64px;
  font-size:13px;
  color:var(--text);
}

.now .small{color:var(--muted); font-size:12px; margin-top:6px}

.history{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.histBtn{
  text-align:left;
  border:1px solid var(--border);
  background: rgba(10,14,20,0.55);
  color:var(--text);
  border-radius:12px;
  padding:10px 10px;
  cursor:pointer;
}
.histBtn:hover{filter:brightness(1.08)}
.histBtn .hTop{font-weight:800; letter-spacing:0.2px}
.histBtn .hSub{color:var(--muted); font-size:12px; margin-top:3px}

.foot{
  margin-top:14px;
  color:var(--muted2);
  font-size:12px;
  border-top:1px solid var(--border);
  padding-top:12px;
}

.chords{
  padding:14px;
}

.libraryBlock{
  margin-top:22px;
  padding-top:16px;
  border-top:1px solid rgba(138,160,189,0.18);
}

.chordsHead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  margin-bottom:12px;
}

.chordsTitle{
  font-size:16px;
  font-weight:800;
  letter-spacing:0.2px;
}

.chordsSub{
  font-size:12px;
  color:var(--muted);
}

.chordGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}

.bankModeTabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-bottom:12px;
}

.modeTab{
  border:1px solid var(--border);
  background:rgba(10,14,20,0.72);
  color:rgba(235,243,255,0.86);
  border-radius:10px;
  padding:9px 10px;
  font-weight:800;
  cursor:pointer;
}

.modeTab.active{
  color:#ffffff;
  background:linear-gradient(180deg, rgba(72,100,145,0.8), rgba(20,32,50,0.95));
  border-color:rgba(147,184,255,0.5);
}

.bankControls{
  display:grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(180px, 1fr) minmax(160px, 0.7fr);
  gap:10px;
  align-items:end;
  margin-bottom:12px;
}

.bankPlaySurface{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.filterLabel{
  font-size:11px;
  color:var(--muted);
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:0.08em;
}

.filterStrip{
  display:flex;
  gap:8px;
  overflow:auto;
  padding-bottom:2px;
}

.filterPill{
  border:1px solid rgba(138,160,189,0.22);
  background:rgba(10,14,20,0.7);
  color:#ffffff;
  border-radius:12px;
  min-width:76px;
  padding:8px 9px;
  display:grid;
  gap:2px;
  text-align:left;
  cursor:pointer;
  flex:0 0 auto;
}

.filterPill span{
  font-size:13px;
  font-weight:900;
}

.filterPill small{
  color:rgba(235,243,255,0.72);
  font-size:11px;
}

.filterPill em{
  color:rgba(147,184,255,0.92);
  font-size:11px;
  font-style:normal;
}

.filterPill.active{
  background:linear-gradient(180deg, rgba(38,73,121,0.92), rgba(14,28,47,0.98));
  border-color:rgba(147,184,255,0.55);
}

.filterPill:disabled{
  opacity:0.36;
  cursor:not-allowed;
}

.performancePadGrid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
  margin-top:2px;
}

.performancePad{
  min-height:128px;
  border:1px solid rgba(138,160,189,0.24);
  background:linear-gradient(180deg, rgba(20,32,49,0.98), rgba(8,13,20,0.98));
  color:#ffffff;
  border-radius:14px;
  padding:13px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:9px;
  text-align:left;
  cursor:pointer;
  transition:transform .06s ease, filter .12s ease, border-color .12s ease;
}

.performancePad:hover{
  filter:brightness(1.08);
  border-color:rgba(147,184,255,0.45);
}

.performancePad:active{transform:translateY(1px)}

.padTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.padFunction{
  color:#9fd0ff;
  font-weight:900;
  font-size:13px;
}

.padName{
  color:#ffffff;
  font-size:18px;
  line-height:1.15;
  font-weight:900;
}

.padMeta{
  color:rgba(235,243,255,0.84);
  font-size:12px;
}

.padFooter{
  color:rgba(235,243,255,0.58);
  font-size:11px;
}

.importedChordGrid{
  max-height: 760px;
  overflow:auto;
  padding-right:4px;
}

.importedChordBtn .chName{
  font-size:15px;
}

@media (min-width: 1100px){
  .chordGrid{grid-template-columns: repeat(3, minmax(0, 1fr))}
}

@media (max-width: 720px){
  .bankControls{grid-template-columns:1fr}
  .performancePadGrid{grid-template-columns:1fr}
}

.chordBtn{
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(16,24,36,0.95), rgba(10,14,20,0.95));
  color:#ffffff;
  border-radius:16px;
  padding:14px;
  cursor:pointer;
  transition: transform .06s ease, filter .12s ease, border-color .12s ease;
  min-height:96px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.chordBtn:hover{
  filter:brightness(1.08);
  border-color: rgba(147,184,255,0.35);
}

.chordBtn:active{transform: translateY(1px)}

.chName{
  font-size:18px;
  font-weight:900;
  letter-spacing:0.3px;
  color:#ffffff;
}

.chMeta{
  margin-top:6px;
  color:rgba(235,243,255,0.82);
  font-size:12px;
}

.chRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.badge{
  font-size:11px;
  color: rgba(215,227,244,0.95);
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(138,160,189,0.25);
  background: rgba(12,18,27,0.6);
}
