/* Minecraft Note Block Tuner Styles
 * All rules scoped under #tool-root #nbt to prevent interference and theme conflicts.
 */

#tool-root #nbt {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
  color: var(--fg, #0b1215);
  font-family: inherit;
}

#tool-root #nbt *,
#tool-root #nbt *::before,
#tool-root #nbt *::after {
  box-sizing: border-box;
}

/* Banner / Active Note Header */
#tool-root #nbt .nbt-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 16px 20px;
}

#tool-root #nbt .nbt-banner-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

#tool-root #nbt .nbt-banner-badge {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.15rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.2s ease;
}

#tool-root #nbt .nbt-banner-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#tool-root #nbt .nbt-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#tool-root #nbt .nbt-cur-name {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#tool-root #nbt .nbt-cur-alt {
  font-size: 1.05rem;
  opacity: 0.65;
}

#tool-root #nbt .nbt-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

#tool-root #nbt .nbt-banner-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  opacity: 0.85;
  flex-wrap: wrap;
}

#tool-root #nbt .nbt-stat-sep {
  opacity: 0.35;
}

#tool-root #nbt .nbt-btn-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand, #10b981);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

#tool-root #nbt .nbt-btn-play:hover {
  filter: brightness(1.08);
}

#tool-root #nbt .nbt-btn-play:active {
  transform: scale(0.97);
}

/* Main Grid Layout */
#tool-root #nbt .nbt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  #tool-root #nbt .nbt-grid {
    grid-template-columns: 1fr;
  }
}

#tool-root #nbt .nbt-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Panels */
#tool-root #nbt .nbt-panel {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#tool-root #nbt .nbt-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

#tool-root #nbt .nbt-panel-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#tool-root #nbt .nbt-heading {
  font-size: 1.15rem;
  font-weight: 700;
}

#tool-root #nbt .nbt-sub {
  font-size: 0.8rem;
  opacity: 0.65;
}

/* View Toggle Tabs */
#tool-root #nbt .nbt-view-toggle {
  display: inline-flex;
  background: var(--bg, #f1f5f9);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line, #e2e8f0);
}

#tool-root #nbt button.nbt-tab {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#tool-root #nbt button.nbt-tab.nbt-on,
#tool-root #nbt button.nbt-tab[aria-pressed="true"] {
  background: var(--surface, #ffffff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  color: var(--brand, #10b981);
}

/* Head Non-Tunable Notice */
#tool-root #nbt .nbt-head-notice {
  padding: 24px 20px;
  background: var(--bg-alt, rgba(0, 0, 0, 0.03));
  border: 1px dashed var(--line, #e2e8f0);
  border-radius: 8px;
  margin: 12px 0;
}

#tool-root #nbt .nbt-notice-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
  line-height: 1.5;
}

#tool-root #nbt .nbt-notice-box strong {
  font-size: 1.05rem;
  color: var(--fg, #0b1215);
}

/* Piano Keyboard */
#tool-root #nbt .nbt-piano-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 10px 4px 16px 4px;
  scrollbar-width: thin;
}

#tool-root #nbt .nbt-piano {
  position: relative;
  display: flex;
  height: 200px;
  min-width: 640px;
  user-select: none;
  background: var(--bg, #f8fafc);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 8px;
  padding: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Piano Keys */
#tool-root #nbt button.nbt-key {
  position: relative;
  border: 1px solid #94a3b8;
  border-radius: 0 0 5px 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 6px 2px 8px 2px;
  transition: transform 0.08s ease;
  outline: none;
}

#tool-root #nbt button.nbt-key:focus-visible {
  outline: 2px solid var(--brand, #10b981);
  outline-offset: 2px;
}

#tool-root #nbt button.nbt-key:active {
  transform: translateY(2px);
}

/* White Keys */
#tool-root #nbt button.nbt-key-white {
  flex: 1 1 0;
  min-width: 38px;
  height: 100%;
  background: #101814;
  color: #f8fafc;
  border-color: rgba(16, 185, 129, 0.34);
  z-index: 1;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
}

#tool-root #nbt button.nbt-key-white:hover {
  background: #18241e;
  color: #ffffff;
}

#tool-root #nbt button.nbt-key-white.nbt-active {
  background: #1f3328;
  color: #ffffff;
  border-color: var(--grass-bright, #34d399);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] #tool-root #nbt button.nbt-key-white {
  background: #ffffff;
  color: #0f172a;
  border-color: #94a3b8;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] #tool-root #nbt button.nbt-key-white:hover {
  background: #f1f5f9;
  color: #0f172a;
}

:root[data-theme="light"] #tool-root #nbt button.nbt-key-white.nbt-active {
  background: #e2e8f0;
  color: #0f172a;
  border-color: var(--brand, #10b981);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Black Keys */
#tool-root #nbt button.nbt-key-black {
  position: absolute;
  top: 4px;
  width: 28px;
  height: 60%;
  background: #1e293b;
  color: #f8fafc;
  z-index: 2;
  border: 1px solid #475569;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] #tool-root #nbt button.nbt-key-black {
  border-color: #0f172a;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
}

#tool-root #nbt button.nbt-key-black:hover {
  background: #334155;
  color: #ffffff;
}

#tool-root #nbt button.nbt-key-black.nbt-active {
  background: #334155;
  color: #ffffff;
  border-color: var(--brand, #10b981);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Key Label Details */
#tool-root #nbt .nbt-key-name {
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.1;
  color: inherit;
}

#tool-root #nbt .nbt-key-clicks {
  font-size: 0.7rem;
  color: inherit;
}

#tool-root #nbt .nbt-key-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
}

#tool-root #nbt .nbt-keyboard-hint {
  font-size: 0.8rem;
  opacity: 0.65;
  line-height: 1.4;
}

/* Chromatic Grid View */
#tool-root #nbt .nbt-grid-wrap {
  width: 100%;
}

#tool-root #nbt .nbt-note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 8px;
}

#tool-root #nbt button.nbt-grid-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 6px;
  background: var(--bg, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

#tool-root #nbt button.nbt-grid-card:hover {
  border-color: var(--brand, #10b981);
}

#tool-root #nbt button.nbt-grid-card.nbt-active {
  border-color: var(--brand, #10b981);
  background: rgba(16, 185, 129, 0.08);
  font-weight: 600;
}

#tool-root #nbt .nbt-card-top {
  display: flex;
  align-items: center;
  gap: 5px;
}

#tool-root #nbt .nbt-card-name {
  font-weight: 700;
  font-size: 0.95rem;
}

#tool-root #nbt .nbt-card-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

#tool-root #nbt .nbt-card-clicks {
  font-size: 0.72rem;
  opacity: 0.7;
}

#tool-root #nbt .nbt-card-pitch {
  font-size: 0.72rem;
  font-family: monospace;
  opacity: 0.8;
}

/* Melody Sequencer */
#tool-root #nbt .nbt-melody-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#tool-root #nbt .nbt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  color: inherit;
  cursor: pointer;
  transition: all 0.12s ease;
}

#tool-root #nbt .nbt-btn:hover {
  border-color: var(--brand, #10b981);
}

#tool-root #nbt .nbt-btn-primary {
  background: var(--brand, #10b981);
  color: #ffffff;
  border-color: var(--brand, #10b981);
}

#tool-root #nbt .nbt-btn-primary:hover {
  filter: brightness(1.08);
}

#tool-root #nbt .nbt-btn-ghost {
  border-color: transparent;
  background: transparent;
  opacity: 0.7;
}

#tool-root #nbt .nbt-btn-ghost:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.04);
}

#tool-root #nbt .nbt-seq-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

#tool-root #nbt .nbt-seq-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#tool-root #nbt .nbt-label {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.8;
}

#tool-root #nbt .nbt-select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  color: inherit;
  font-size: 0.85rem;
  outline: none;
}

#tool-root #nbt .nbt-select:focus {
  border-color: var(--brand, #10b981);
}

#tool-root #nbt .nbt-track-container {
  min-height: 80px;
  background: var(--bg, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

#tool-root #nbt .nbt-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#tool-root #nbt .nbt-note-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.82rem;
  transition: all 0.1s ease;
}

#tool-root #nbt .nbt-note-chip.nbt-chip-playing {
  border-color: var(--brand, #10b981);
  background: rgba(16, 185, 129, 0.18);
  transform: scale(1.05);
}

#tool-root #nbt .nbt-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

#tool-root #nbt .nbt-chip-name {
  font-weight: 700;
}

#tool-root #nbt .nbt-chip-inst {
  font-size: 0.7rem;
  opacity: 0.65;
}

#tool-root #nbt .nbt-chip-del {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.45;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
}

#tool-root #nbt .nbt-chip-del:hover {
  opacity: 1;
  color: #ef4444;
}

#tool-root #nbt .nbt-track-empty {
  font-size: 0.85rem;
  opacity: 0.6;
  text-align: center;
  padding: 24px 12px;
}

/* Instrument Picker */
#tool-root #nbt .nbt-inst-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

#tool-root #nbt button.nbt-chip {
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  transition: all 0.12s ease;
}

#tool-root #nbt button.nbt-chip.nbt-on,
#tool-root #nbt button.nbt-chip[aria-pressed="true"] {
  background: var(--brand, #10b981);
  color: #ffffff;
  border-color: var(--brand, #10b981);
}

#tool-root #nbt .nbt-inst-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

#tool-root #nbt .nbt-inst-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line, #f1f5f9);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.1s ease;
}

#tool-root #nbt .nbt-inst-item:last-child {
  border-bottom: none;
}

#tool-root #nbt .nbt-inst-item:hover {
  background: var(--bg, #f8fafc);
}

#tool-root #nbt .nbt-inst-item.nbt-selected {
  background: rgba(16, 185, 129, 0.1);
  font-weight: 600;
}

#tool-root #nbt .nbt-inst-item-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

#tool-root #nbt .nbt-inst-item-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--line, #e2e8f0);
}

#tool-root #nbt .nbt-inst-details {
  background: var(--bg, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}

#tool-root #nbt .nbt-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

#tool-root #nbt .nbt-detail-key {
  opacity: 0.65;
}

#tool-root #nbt .nbt-detail-val {
  font-weight: 600;
  text-align: right;
}

#tool-root #nbt .nbt-detail-code {
  font-family: monospace;
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 4px;
  border-radius: 4px;
}

/* Commands Generator */
#tool-root #nbt .nbt-cmd-params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#tool-root #nbt .nbt-cmd-param {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#tool-root #nbt .nbt-input {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  color: inherit;
  font-size: 0.85rem;
  outline: none;
}

#tool-root #nbt .nbt-input:focus {
  border-color: var(--brand, #10b981);
}

#tool-root #nbt .nbt-cmd-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  padding: 10px 12px;
}

#tool-root #nbt .nbt-cmd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#tool-root #nbt .nbt-cmd-name {
  font-weight: 700;
  font-size: 0.85rem;
}

#tool-root #nbt .nbt-btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  color: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

#tool-root #nbt .nbt-btn-copy:hover {
  border-color: var(--brand, #10b981);
}

#tool-root #nbt .nbt-cmd-code-wrap {
  overflow-x: auto;
  padding-top: 2px;
}

#tool-root #nbt .nbt-cmd-code {
  font-family: monospace;
  font-size: 0.82rem;
  white-space: nowrap;
  user-select: all;
  display: block;
}

#tool-root #nbt .nbt-status {
  min-height: 20px;
  font-size: 0.8rem;
  color: #10b981;
  font-weight: 600;
  text-align: right;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#tool-root #nbt .nbt-status.nbt-show {
  opacity: 1;
}

/* Help & Information Section */
#tool-root #nbt .nbt-help {
  margin-top: 10px;
  font-size: 0.9rem;
  line-height: 1.65;
  max-width: 80ch;
  opacity: 0.85;
}

#tool-root #nbt .nbt-help p {
  margin: 0;
}
