/* ========================================
   Dance Stage Maker - スタイルシート
   ======================================== */

/* ===== リセット & 基本 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #7c3aed;
  --primary-light: #a78bfa;
  --primary-dark: #5b21b6;
  --accent: #f472b6;
  --accent-light: #fbcfe8;
  --neon-pink: #ff2d95;
  --neon-blue: #00d4ff;
  --neon-green: #39ff14;
  --neon-yellow: #ffd700;
  --bg-dark: #0f0a1a;
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-card-hover: rgba(255, 255, 255, 0.12);
  --text: #f0e6ff;
  --text-muted: #a09bb0;
  --border: rgba(255, 255, 255, 0.1);
  --border-bright: rgba(124, 58, 237, 0.4);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'M PLUS Rounded 1c', 'Outfit', system-ui, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ===== 画面管理 ===== */
.screen {
  display: none;
  width: 100%;
  height: 100vh;
  overflow-y: auto;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ===== ホーム画面 ===== */
#home-screen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(124, 58, 237, 0.3) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(244, 114, 182, 0.2) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 60%),
              var(--bg-dark);
  position: relative;
  overflow: hidden;
}

.home-bg-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.floating-note {
  position: absolute;
  font-size: 2rem;
  opacity: 0.15;
  animation: floatNote 8s ease-in-out infinite;
}

.note-1 { top: 15%; left: 10%; animation-delay: 0s; font-size: 2.5rem; }
.note-2 { top: 25%; right: 15%; animation-delay: 1.5s; font-size: 1.8rem; }
.note-3 { bottom: 30%; left: 20%; animation-delay: 3s; font-size: 2.2rem; }
.note-4 { top: 60%; right: 10%; animation-delay: 4.5s; font-size: 1.5rem; }
.note-5 { bottom: 15%; left: 50%; animation-delay: 2s; font-size: 2rem; }
.note-6 { top: 40%; left: 5%; animation-delay: 5.5s; font-size: 1.6rem; }

@keyframes floatNote {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.15; }
  25% { transform: translateY(-30px) rotate(10deg); opacity: 0.3; }
  50% { transform: translateY(-15px) rotate(-5deg); opacity: 0.2; }
  75% { transform: translateY(-40px) rotate(15deg); opacity: 0.25; }
}

.home-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
}

.home-logo {
  margin-bottom: 3rem;
}

.logo-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.5));
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.app-title {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #a78bfa, #f472b6, #00d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-weight: 400;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  max-width: 360px;
  margin: 0 auto;
}

.home-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.btn-icon {
  font-size: 1.4rem;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.primary-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.6);
}

.secondary-btn {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.secondary-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: translateY(-2px);
}

.tertiary-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tertiary-btn:hover {
  color: var(--text);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

/* ===== 使い方画面 ===== */
.screen-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 10, 26, 0.95);
  backdrop-filter: blur(10px);
}

.screen-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.back-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.back-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

.howto-content {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  flex: 1;
  overflow-y: auto;
}

.howto-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.howto-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  position: relative;
  transition: all var(--transition);
}

.howto-step:hover {
  border-color: var(--border-bright);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.step-number {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: white;
}

.step-icon {
  font-size: 2.5rem;
  margin: 0.5rem 0;
}

.howto-step h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.howto-step p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.howto-tips {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.howto-tips h3 {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.howto-tips ul {
  list-style: none;
  padding: 0;
}

.howto-tips li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.howto-tips li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--primary-light);
}

/* ===== 保存一覧画面 ===== */
.saved-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

.saved-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}

.saved-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.saved-card-preview {
  height: 120px;
  overflow: hidden;
}

.saved-card-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.saved-char-count {
  background: rgba(0, 0, 0, 0.6);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  backdrop-filter: blur(4px);
}

.saved-card-info {
  padding: 0.75rem 1rem;
}

.saved-card-info h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.saved-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.saved-card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.75rem;
}

.saved-action-btn {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.85rem;
  transition: all var(--transition);
}

.saved-action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

.saved-action-btn.delete {
  flex: 0;
  min-width: 40px;
}

.saved-action-btn.delete:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.saved-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
}

.empty-icon {
  font-size: 4rem;
  opacity: 0.3;
}

.saved-empty p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ===== エディタ画面 ===== */
#editor-screen {
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(15, 10, 26, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 100;
}

.toolbar-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: scale(1.05);
}

.play-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
  width: 52px;
  height: 42px;
  font-size: 1.3rem;
}

.play-btn:hover {
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
}

.play-btn.playing {
  background: linear-gradient(135deg, #ef4444, #f97316);
  animation: playPulse 1.5s ease-in-out infinite;
}

@keyframes playPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.6); }
}

.toolbar-title {
  flex: 1;
}

.stage-title-input {
  width: 100%;
  max-width: 300px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.4rem 0.6rem;
  transition: all var(--transition);
}

.stage-title-input:hover,
.stage-title-input:focus {
  border-color: var(--border);
  background: var(--bg-card);
  outline: none;
}

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
}

/* ===== エディタ本体 ===== */
.editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 左サイドバー ===== */
.editor-sidebar {
  width: 240px;
  min-width: 240px;
  background: rgba(15, 10, 26, 0.92);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  backdrop-filter: blur(10px);
}

.sidebar-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.sidebar-btn {
  width: 100%;
  padding: 0.75rem;
  border: 2px dashed var(--border-bright);
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.08);
  color: var(--primary-light);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.sidebar-btn:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary);
  transform: scale(1.02);
}

.sidebar-icon {
  font-size: 1.2rem;
}

/* 背景テーマリスト */
.bg-theme-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.bg-theme-btn {
  padding: 0.5rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.bg-theme-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

.bg-theme-btn.active {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.2);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

.bg-icon { font-size: 1.2rem; }
.bg-label { font-size: 0.7rem; }

/* 演出トグル */
.effect-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.effect-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.8rem;
}

.effect-toggle:hover {
  background: var(--bg-card-hover);
}

.effect-toggle input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* テンポ・同期・配置 */
.tempo-controls, .sync-controls, .preset-controls {
  display: flex;
  gap: 0.3rem;
}

.tempo-btn, .sync-btn, .preset-btn {
  flex: 1;
  padding: 0.45rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
}

.tempo-btn:hover, .sync-btn:hover, .preset-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.tempo-btn.active, .sync-btn.active {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}

.preset-btn {
  font-size: 0.9rem;
  letter-spacing: 2px;
}

.preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== ステージ ===== */
.stage-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

.stage {
  width: 100%;
  max-width: 900px;
  height: 100%;
  max-height: 600px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), inset 0 0 60px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

/* ステージ背景テーマ */
/* 豪華3Dステージ */
.bg-gorgeous-3d {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(124, 58, 237, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 10% 20%, rgba(255, 45, 149, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 20%, rgba(0, 212, 255, 0.15) 0%, transparent 40%),
    linear-gradient(180deg, #020108 0%, #0a0515 40%, #1a0b35 100%);
  position: relative;
  overflow: hidden;
  perspective: 1000px;
}

/* 背景LEDスクリーン群 */
.bg-gorgeous-3d::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 40%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,215,0,0.15) 0%, transparent 70%),
    repeating-linear-gradient(90deg, rgba(0, 240, 255, 0.05) 0px, rgba(0, 240, 255, 0.05) 2px, transparent 2px, transparent 10px),
    repeating-linear-gradient(0deg, rgba(0, 240, 255, 0.05) 0px, rgba(0, 240, 255, 0.05) 2px, transparent 2px, transparent 10px),
    #020108;
  border: 1px solid rgba(0, 240, 255, 0.5);
  border-radius: 4px;
  box-shadow:
    0 0 20px rgba(0, 240, 255, 0.4),
    inset 0 0 30px rgba(0, 240, 255, 0.2),
    /* 左パネル */
    -350px 10px 0 -10px rgba(5, 2, 16, 0.9),
    -350px 10px 20px -10px rgba(255, 45, 149, 0.5),
    -350px 10px 0 -9px rgba(255, 45, 149, 0.3),
    /* 右パネル */
    350px 10px 0 -10px rgba(5, 2, 16, 0.9),
    350px 10px 20px -10px rgba(0, 212, 255, 0.5),
    350px 10px 0 -9px rgba(0, 212, 255, 0.3);
  z-index: 0;
  animation: screenFlicker 6s infinite alternate;
}

@keyframes screenFlicker {
  0%, 100% { filter: brightness(1) hue-rotate(0deg); }
  50% { filter: brightness(1.2) hue-rotate(5deg); }
}

/* 3D円形ステージフロア */
.bg-gorgeous-3d::after {
  content: '';
  position: absolute;
  bottom: -15%;
  left: 50%;
  width: 140%;
  height: 60%;
  transform: translateX(-50%) rotateX(72deg);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(0, 240, 255, 0.2) 0%, transparent 60%),
    repeating-radial-gradient(circle at center, rgba(0, 240, 255, 0.1) 0, rgba(0, 240, 255, 0.1) 2px, transparent 2px, transparent 25px),
    #050210;
  border: 4px solid #00f0ff;
  box-shadow:
    0 0 40px #00f0ff,
    inset 0 0 60px rgba(0, 240, 255, 0.8),
    0 5px 0 #0088aa,
    0 15px 40px rgba(124, 58, 237, 0.8);
  z-index: 1;
}

/* 光のパーティクル・星降るエフェクト */
.bg-gorgeous-3d .stage-effects::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 15% 15%, #fff, transparent),
    radial-gradient(2px 2px at 30% 30%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 45% 45%, rgba(0, 240, 255, 0.9), transparent),
    radial-gradient(2.5px 2.5px at 60% 60%, rgba(244, 114, 182, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 75% 75%, #fff, transparent),
    radial-gradient(2px 2px at 90% 90%, rgba(124, 58, 237, 0.8), transparent),
    radial-gradient(1px 1px at 20% 80%, #fff, transparent),
    radial-gradient(2px 2px at 80% 20%, rgba(0, 240, 255, 0.6), transparent);
  background-size: 150px 150px;
  animation: starryBg 30s linear infinite;
  z-index: 0;
  opacity: 0.6;
}

@keyframes starryBg {
  0% { transform: translateY(0); }
  100% { transform: translateY(-150px); }
}

/* 上部からの神々しい後光・スポットライト */
.bg-gorgeous-3d .stage-effects::after {
  content: '';
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 120%;
  background:
    conic-gradient(from 150deg at 50% -10%, transparent 0deg, rgba(255, 45, 149, 0.15) 30deg, transparent 60deg),
    conic-gradient(from 180deg at 50% -10%, transparent 0deg, rgba(0, 212, 255, 0.15) 30deg, transparent 60deg),
    conic-gradient(from 210deg at 50% -10%, transparent 0deg, rgba(124, 58, 237, 0.15) 30deg, transparent 60deg);
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
}

.bg-live-stage {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 100, 50, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 100%, rgba(124, 58, 237, 0.2) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 100%, rgba(0, 212, 255, 0.2) 0%, transparent 40%),
    linear-gradient(180deg, #1a0a2e 0%, #0d051a 60%, #1a1a2e 100%);
}

.bg-live-stage::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(0deg, rgba(60, 30, 80, 0.6) 0%, transparent 100%);
  border-top: 1px solid rgba(124, 58, 237, 0.3);
  z-index: 0;
}

.bg-neon {
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 45, 149, 0.3) 0%, transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.3) 0%, transparent 30%),
    radial-gradient(circle at 50% 50%, rgba(57, 255, 20, 0.1) 0%, transparent 40%),
    linear-gradient(135deg, #0a0015 0%, #150025 50%, #0a0020 100%);
  animation: neonShift 6s ease-in-out infinite;
}

@keyframes neonShift {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(20deg); }
}

.bg-pop-room {
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 182, 193, 0.4) 0%, transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(173, 216, 230, 0.3) 0%, transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(255, 218, 185, 0.3) 0%, transparent 30%),
    linear-gradient(180deg, #ffe4f0 0%, #ffd4e8 40%, #e8d0ff 100%);
}

.bg-club {
  background:
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(124, 58, 237, 0.05) 0deg 10deg, transparent 10deg 20deg),
    radial-gradient(ellipse at 50% 0%, rgba(255, 45, 149, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.8) 0%, transparent 60%),
    linear-gradient(180deg, #0a0020 0%, #15002e 100%);
}

.bg-club::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 60px,
    rgba(124, 58, 237, 0.03) 60px,
    rgba(124, 58, 237, 0.03) 62px
  );
  z-index: 0;
  pointer-events: none;
}

.bg-simple {
  background: linear-gradient(180deg, #f8f8f8 0%, #e8e8e8 100%);
}

.bg-japanese {
  background:
    radial-gradient(circle at 80% 20%, rgba(220, 50, 50, 0.15) 0%, transparent 30%),
    radial-gradient(circle at 20% 80%, rgba(200, 160, 80, 0.2) 0%, transparent 30%),
    linear-gradient(180deg, #1a0a0a 0%, #2a1515 50%, #1a0a0a 100%);
}

.bg-japanese::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 85% 15%, rgba(220, 50, 50, 0.6) 0%, rgba(220, 50, 50, 0.6) 30px, transparent 30px),
    radial-gradient(circle at 15% 85%, rgba(255, 200, 150, 0.3) 0%, rgba(255, 200, 150, 0.3) 20px, transparent 20px);
  z-index: 0;
  pointer-events: none;
}

/* ステージ内要素 */
.stage-characters {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.stage-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  color: var(--text-muted);
  gap: 0.75rem;
}

.placeholder-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.stage-placeholder p {
  font-size: 0.95rem;
  opacity: 0.6;
}

.add-first-btn {
  padding: 0.6rem 1.5rem;
  border: 2px dashed var(--border-bright);
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.1);
  color: var(--primary-light);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.add-first-btn:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: var(--primary);
  transform: scale(1.05);
}

/* キャラクター */
.stage-character {
  position: absolute;
  cursor: grab;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  transition: filter 0.15s ease;
}

.stage-character:active {
  cursor: grabbing;
}

.stage-character.selected {
  filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.8)) drop-shadow(0 0 16px rgba(244, 114, 182, 0.4));
}

.stage-character.selected::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--primary-light);
  border-radius: 8px;
  pointer-events: none;
  animation: selectPulse 1.5s ease-in-out infinite;
}

@keyframes selectPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.char-img-wrapper {
  transform-origin: center bottom;
}

.char-img-wrapper img {
  width: 120px;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  pointer-events: none;
}

/* ===== 演出エフェクト ===== */
.stage-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.effect { position: absolute; inset: 0; }
.effect.hidden { display: none; }

/* スポットライト */
.spotlight-effect.active {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 200, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 0%, rgba(255, 200, 150, 0.1) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 0%, rgba(200, 200, 255, 0.1) 0%, transparent 40%);
  animation: spotlightMove 4s ease-in-out infinite;
}

@keyframes spotlightMove {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* 点滅ライト */
.flash-effect.active {
  animation: flashPulse 0.8s ease-in-out infinite;
}

@keyframes flashPulse {
  0%, 100% { background: transparent; }
  50% { background: rgba(255, 255, 255, 0.05); }
}

/* 紙吹雪 */
.confetti-piece {
  position: absolute;
  top: -10px;
  border-radius: 2px;
  animation: confettiFall linear infinite;
  opacity: 0.8;
}

@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 0.9; }
  100% { transform: translateY(600px) rotate(720deg); opacity: 0; }
}

/* スモーク */
.smoke-effect.active {
  background:
    radial-gradient(ellipse at 20% 100%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(200, 200, 255, 0.1) 0%, transparent 60%);
  animation: smokeWave 5s ease-in-out infinite;
}

@keyframes smokeWave {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-10px); }
}

/* 観客 */
.audience-effect.active {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.audience-person {
  position: absolute;
  bottom: 5px;
  font-size: 1.4rem;
  opacity: 0.3;
  animation: audienceBounce 1.5s ease-in-out infinite;
}

@keyframes audienceBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* ===== 右パネル（キャラ設定） ===== */
.character-panel {
  width: 260px;
  min-width: 260px;
  background: rgba(15, 10, 26, 0.95);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.character-panel.hidden {
  width: 0;
  min-width: 0;
  padding: 0;
  border: none;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.panel-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
}

.panel-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
}

.panel-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.panel-content {
  padding: 0.75rem;
}

.panel-section {
  margin-bottom: 1rem;
}

.panel-section label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

/* ダンス選択ボタン */
.dance-select-btn {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.1);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dance-select-btn:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary);
}

.dance-arrow {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* サイズプリセット */
.size-presets {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.size-presets button {
  flex: 1;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.size-presets button:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

/* レンジスライダー */
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  margin: 0.3rem 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.range-label {
  font-size: 0.75rem;
  color: var(--primary-light);
  font-weight: 600;
}

/* トグルボタン */
.toggle-btn {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-btn.active {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* z-index操作 */
.zindex-controls {
  display: flex;
  gap: 0.35rem;
}

.zindex-controls button {
  flex: 1;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.zindex-controls button:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
}

/* 削除ボタン */
.delete-btn {
  width: 100%;
  padding: 0.55rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  transform: scale(1.02);
}

/* ===== ダンス選択モーダル ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1;
  background: rgba(20, 12, 35, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.dance-categories {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.dance-cat-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.dance-cat-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.dance-cat-btn.active {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}

.dance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
  padding: 1.25rem;
}

.dance-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  font-family: var(--font);
}

.dance-card:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.dance-card.active {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.15);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.dance-card-icon {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}

.dance-card-label {
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.dance-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.dance-card-tags {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  flex-wrap: wrap;
}

.dance-tag {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

/* ===== トースト ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(20, 12, 35, 0.95);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 9999;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== bg-simple のテキスト色調整 ===== */
.bg-simple .stage-placeholder,
.bg-simple .stage-placeholder p {
  color: #444;
}

.bg-pop-room .stage-placeholder,
.bg-pop-room .stage-placeholder p {
  color: #666;
}

/* ===== レスポンシブ ===== */
@media (max-width: 900px) {
  .editor-body {
    flex-direction: column;
  }

  .editor-sidebar {
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem;
    gap: 0.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 120px;
  }

  .sidebar-section {
    min-width: 180px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding-right: 0.75rem;
    padding-bottom: 0;
  }

  .character-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid var(--border);
    z-index: 50;
  }

  .character-panel.hidden {
    max-height: 0;
    border: none;
  }

  .stage-container {
    padding: 0.5rem;
  }
}

@media (max-width: 600px) {
  .app-title {
    font-size: 2rem;
  }

  .app-subtitle {
    font-size: 0.95rem;
  }

  .howto-steps {
    grid-template-columns: 1fr 1fr;
  }

  .dance-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
