* { box-sizing: border-box; }
body {
  margin: 0; padding: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #14161c; color: #e6e8ee;
  overflow: hidden; height: 100vh;
}
header {
  padding: 12px 24px; background: #1c1f28; border-bottom: 1px solid #2b2f3c;
  display: flex; align-items: baseline; gap: 14px; flex: none;
}
h1 { margin: 0; font-size: 20px; }
.sub { color: #8a93a8; font-size: 13px; }
header { align-items: center; }
#langBtn { min-width: 48px; }
main {
  width: 100%; max-width: 980px; margin: 0 auto; padding: 14px 16px;
  display: grid; gap: 14px; overflow-y: auto;
}

/* collapsible settings panel */
#settingsPanel {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  max-height: 82vh;
  display: flex; flex-direction: column;
  background: rgba(20, 22, 28, 0.97);
  border-bottom: 1px solid #2b2f3c;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
}
#settingsPanel.collapsed { transform: translateY(-100%); }
#panelToggle {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: -30px;
  width: 72px; height: 30px; border-radius: 0 0 12px 12px;
  border: 1px solid #2b2f3c; border-top: none;
  background: #1c1f28; color: #8a93a8; font-size: 14px; line-height: 1;
}
#panelToggle:hover { color: #e6e8ee; background: #2a3040; }

/* note visualization + fixed piano */
#viz { position: fixed; top: 0; left: 0; z-index: 1; }
#pianoWrap {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2;
  height: 150px; background: #101218;
  border-top: 1px solid #2b2f3c; padding: 3px 3px 5px;
}

.card {
  background: #1c1f28; border: 1px solid #2b2f3c; border-radius: 10px; padding: 14px 18px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; color: #aab4cc; }

.row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.row input[type=range] { flex: 1; accent-color: #5b8cff; }
.row select { flex: 1; background: #12141a; color: #e6e8ee; border: 1px solid #2b2f3c; border-radius: 6px; padding: 6px; }
.val { min-width: 58px; text-align: right; color: #5b8cff; font-variant-numeric: tabular-nums; }
.check { user-select: none; }
.btns { flex-wrap: wrap; }
.spacer { flex: 1; }

button {
  background: #2a3040; color: #e6e8ee; border: 1px solid #3a4256; border-radius: 6px;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
}
button:hover { background: #354060; }
button:active { background: #40507a; }

#dropZone {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 2px dashed #3a4256; border-radius: 8px; padding: 14px; margin-bottom: 10px;
}
#dropZone.over { border-color: #5b8cff; background: #202636; }
.hint { color: #8a93a8; font-size: 12px; }
#status { font-size: 13px; color: #9ad17e; margin-bottom: 10px; }
#status.err { color: #ff7a7a; }
#rangeLabel { min-width: 76px; text-align: center; color: #aab4cc; }

.fxgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.fxgrid h3 { margin: 4px 0 8px; font-size: 14px; color: #cdd6ea; }
body.engine-tsf .fluid-only { display: none; }
body.engine-fluid .tsf-only { display: none; }

.dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #3a4256; margin-left: 6px; vertical-align: middle;
  transition: background 0.15s;
}
.dot.on { background: #9ad17e; }

/* piano */
#piano { position: relative; height: 100%; user-select: none; touch-action: none; }
.wkey, .bkey { position: absolute; top: 0; border-radius: 0 0 5px 5px; cursor: pointer; }
.wkey {
  height: 100%; background: linear-gradient(#f4f5f8, #dfe2e8);
  border: 1px solid #9aa0ad; z-index: 1;
}
.bkey {
  height: 60%; background: linear-gradient(#3a3d46, #16181d);
  border: 1px solid #000; z-index: 2;
}
.wkey.down { background: linear-gradient(#9db8f5, #7d9ff0); }
.bkey.down { background: linear-gradient(#5b8cff, #3b6cf0); }
.klabel {
  position: absolute; bottom: 4px; width: 100%; text-align: center;
  font-size: 10px; color: #6b7280; pointer-events: none;
}
