/* ============================================================================
 * Debug Tuning Panel (?debug or F2)
 * ========================================================================== */
.tuning-panel {
  position: fixed;
  top: 244px;
  right: 12px;
  width: 312px;
  max-height: calc(100vh - 356px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--stone-base);
  border: 1px solid var(--stone-edge);
  border-top: 2px solid var(--brass-dim);
  border-bottom: 2px solid var(--stone-ledge);
  border-radius: var(--radius-outer);
  padding: 12px;
  box-shadow: 0 5px 0 var(--stone-ledge);
  z-index: 30;
}

body:has(#title-overlay.visible) .tuning-panel {
  top: 20px;
  right: 20px;
  width: 320px;
  max-height: calc(100vh - 40px);
}

.tuning-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  white-space: nowrap;
}

.tuning-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.tuning-btns button {
  appearance: none;
  background: var(--stone-deep);
  color: var(--ink-main);
  border: 1px solid var(--stone-edge);
  border-radius: var(--radius-inner);
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 150ms var(--ease-ui), background-color 140ms var(--ease-ui);
}

.tuning-btns button:not(:disabled):active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .tuning-btns button:hover {
    background: var(--stone-raised);
    border-color: var(--brass-dim);
  }
}

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

.tune-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--brass);
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #242936;
}

.tune-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.tune-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
}

.tune-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.tune-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tune-changed {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--brass);
  display: inline-block;
  opacity: 0;
  transition: opacity 140ms var(--ease-ui);
}

.tune-row.is-changed .tune-changed {
  opacity: 1;
}

.tune-val {
  color: var(--ink-main);
}

.tune-row input[type="range"] {
  width: 100%;
  accent-color: var(--brass);
}

.tuning-status {
  margin-top: 8px;
  font-size: 11px;
  color: var(--vital-green);
  min-height: 14px;
}

.tune-boss-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 2px;
}

.tune-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-muted);
}

.tune-select-label {
  flex-shrink: 0;
  font-weight: 600;
}

.tune-select {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--stone-deep);
  color: var(--ink-main);
  border: 1px solid var(--stone-edge);
  border-radius: var(--radius-inner);
  padding: 4px 6px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}

.tune-select:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 1px;
}

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

.tune-boss-btn {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  text-align: left;
  background: var(--stone-deep);
  color: var(--ink-main);
  border: 1px solid var(--stone-edge);
  border-left: 2px solid var(--brass-dim);
  border-bottom: 2px solid var(--stone-ledge);
  border-radius: var(--radius-inner);
  padding: 6px 8px;
  cursor: pointer;
  transition: transform 150ms var(--ease-ui), background-color 140ms var(--ease-ui), border-color 140ms var(--ease-ui);
}

.tune-boss-btn.is-mid {
  border-left-color: #7d93b5;
}

.tune-boss-btn.is-final {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-color: var(--brass-dim);
  border-left: 2px solid #d9534f;
  background: #1a171c;
}

.tune-boss-btn:not(:disabled):active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .tune-boss-btn:hover {
    background: var(--stone-raised);
    border-color: var(--brass);
  }
  .tune-boss-btn.is-final:hover {
    background: #241b20;
    border-color: var(--brass-bright);
  }
}

.tune-boss-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-main);
  line-height: 1.25;
}

.tune-boss-meta {
  font-size: 10px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.tune-bgm-now {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: var(--stone-deep);
  border: 1px solid var(--stone-edge);
  border-left: 2px solid var(--brass-dim);
  border-radius: var(--radius-inner);
  font-size: 11px;
}

.tune-bgm-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.tune-bgm-dot {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--stone-edge);
  display: inline-block;
  transition: background-color 160ms var(--ease-ui);
}

.tune-bgm-dot.is-playing {
  background: var(--brass-bright);
}

.tune-bgm-title {
  color: var(--ink-main);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
