* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #000; }
canvas { display: block; }

#crosshair {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  pointer-events: none;
  mix-blend-mode: difference;
}
#crosshair::before, #crosshair::after {
  content: ''; position: absolute;
  background: #fff;
}
#crosshair::before { width: 2px; height: 100%; left: 50%; transform: translateX(-50%); }
#crosshair::after  { width: 100%; height: 2px; top: 50%; transform: translateY(-50%); }

/* ── パネル開閉ボタン ── */
#panel-toggle {
  position: fixed;
  bottom: 20px; left: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  z-index: 20;
}
#panel-toggle:hover { background: rgba(60,60,60,0.8); }

/* ── コントロールパネル ── */
#control-panel {
  position: fixed;
  bottom: 70px; left: 20px;
  width: 270px;
  max-height: 78vh;
  overflow-y: auto;
  background: rgba(0,0,0,0.72);
  color: #fff;
  font-family: sans-serif;
  font-size: 12px;
  padding: 10px 12px 14px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 19;
}
#control-panel.hidden { display: none; }

.sec {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1.2px;
  opacity: 0.45;
  text-transform: uppercase;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 7px;
  margin-top: 3px;
}
.sec:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lbl {
  width: 58px;
  flex-shrink: 0;
  opacity: 0.65;
}
.row input[type=range] {
  flex: 1;
  height: 4px;
  accent-color: #7af;
  cursor: pointer;
}
.val {
  width: 38px;
  text-align: right;
  font-size: 11px;
  opacity: 0.75;
}

.btn {
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,0.2); }
.btn.on { background: rgba(80,160,255,0.3); border-color: rgba(80,160,255,0.6); }

.fname {
  flex: 1;
  font-size: 10px;
  opacity: 0.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#bg-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bg-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
.bg-item:hover { background: rgba(255,255,255,0.07); }
.bg-item.sel { background: rgba(80,160,255,0.18); }
.bg-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-del { opacity: 0.4; font-size: 10px; padding: 0 3px; }
.bg-del:hover { opacity: 0.9; color: #f66; }

#models-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.model-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
.model-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.8;
}

#control-panel::-webkit-scrollbar,
#models-list::-webkit-scrollbar { width: 4px; }
#control-panel::-webkit-scrollbar-track,
#models-list::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
}
#control-panel::-webkit-scrollbar-thumb,
#models-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
}
#control-panel::-webkit-scrollbar-thumb:hover,
#models-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.5);
}

input[type=color] {
  width: 36px; height: 22px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  cursor: pointer;
  background: none;
  padding: 1px;
}

#lyrics-input {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 5px;
  padding: 5px 6px;
  font-size: 12px;
  resize: vertical;
  min-height: 52px;
  font-family: sans-serif;
}
#lyrics-input::placeholder { color: rgba(255,255,255,0.3); }

#charge-ring {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  pointer-events: none;
  display: none;
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

/* ── メモポップアップ ── */
#memo-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
}
#memo-overlay.open { display: flex; }

#memo-popup {
  position: relative;
  background: rgba(20,20,20,0.95);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 20px 24px 24px;
  max-width: 540px;
  width: 90vw;
  max-height: 75vh;
  overflow-y: auto;
  color: #ddd;
  font-family: sans-serif;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}
#memo-popup::-webkit-scrollbar { width: 4px; }
#memo-popup::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); border-radius: 2px; }
#memo-popup::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 2px; }

#memo-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
#memo-close:hover { color: #fff; }
