/* ==========================================
   スピログラフ CSS
   プレフィックス: spg-
   Version: 2.0.0（ヘッダー＋フルスクリーンcanvas＋右下ツールバー＋一本道ステップ構成）
   ========================================== */

.spg-root, .spg-root * { box-sizing: border-box; }

.spg-root {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "BIZ UDGothic", "M PLUS Rounded 1c", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background: #f5f7fa;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 9999;
}

/* ===== ヘッダー ===== */
.spg-root .spg-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px;
  background: #1e3a5f;
  color: #fff;
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 20;
}
.spg-root .spg-header h1 { font-size: 18px; font-weight: bold; flex: 1; margin: 0; }
.spg-root .spg-info { font-size: 13px; opacity: 0.85; white-space: nowrap; }

/* ===== フルスクリーンcanvas ===== */
.spg-root #spg-canvas-wrap {
  position: fixed;
  top: 52px; left: 0;
  width: 100vw;
  height: calc(100vh - 52px);
  background: #fff;
}
.spg-root #spg-canvas { display: block; }

/* ===== 常設コントロールパネル（スピード・色） ===== */
.spg-root .spg-control-panel {
  position: fixed;
  left: 16px; top: 64px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
  padding: 10px 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10;
}
.spg-root .spg-ctrl-row { display: flex; align-items: center; gap: 10px; }
.spg-root .spg-ctrl-label { font-size: 12px; font-weight: bold; color: #1e3a5f; width: 52px; flex-shrink: 0; }
.spg-root .spg-ctrl-row select {
  font-size: 12px; font-weight: bold; color: #1e3a5f;
  border: 2px solid #c8d4e8; border-radius: 8px; padding: 4px 6px;
  font-family: inherit; background: #fff;
}
.spg-root .spg-ctrl-row input[type="color"] {
  width: 34px; height: 28px; border: 2px solid #c8d4e8; border-radius: 8px;
  padding: 0; cursor: pointer; background: none;
}

/* ===== 右下ツールバー ===== */
.spg-root .spg-toolbar {
  position: fixed;
  right: 16px; bottom: 20px;
  display: flex; flex-direction: column;
  gap: 12px;
  z-index: 10;
}
.spg-root .spg-btn {
  width: 60px; height: 60px;
  border-radius: 999px;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  background: #fff; color: #7F8C8D; border: 2px solid #dde4ef;
}
.spg-root .spg-btn:active { transform: scale(0.92); }
.spg-root .spg-btn-setting { background: #fff; color: #1e3a5f; border: 2px solid #1e3a5f; }
.spg-root .spg-btn-play { background: #d4af37; color: #fff; border-color: #d4af37; }
.spg-root .spg-btn-delete { background: #fff; color: #c0392b; border: 2px solid #c0392b; }
.spg-root .spg-btn.spg-on { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }

/* ===== ステップ画面（オーバーレイ） ===== */
.spg-root .spg-overlay {
  position: fixed; inset: 0;
  background: rgba(30,58,95,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 12px;
  touch-action: pan-y;
}
.spg-root .spg-overlay.hidden { display: none; }
.spg-root .spg-dialog {
  background: #fff;
  border-radius: 16px;
  padding: 24px 24px 22px;
  width: min(92vw, 420px);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  text-align: center;
}
.spg-root .spg-dialog h2 { color: #1e3a5f; font-size: 19px; margin: 0 0 6px; }
.spg-root .spg-step-label {
  display: inline-block;
  background: #d4af37;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  border-radius: 999px;
  padding: 3px 14px;
  margin-bottom: 10px;
}
.spg-root .spg-hint { font-size: 13px; color: #5a708a; margin: 0 0 18px; }

.spg-root .spg-form { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; text-align: left; }
.spg-root .spg-slider-row { display: flex; align-items: center; gap: 10px; }
.spg-root .spg-slider-label { width: 78px; flex-shrink: 0; font-size: 13px; font-weight: bold; color: #1e3a5f; }
.spg-root .spg-slider-row input[type="range"] { flex: 1; }
.spg-root .spg-slider-val { width: 40px; flex-shrink: 0; text-align: right; font-size: 14px; font-weight: bold; color: #1e3a5f; }

.spg-root .spg-error-msg {
  display: none;
  font-size: 12px;
  color: #c0392b;
  background: #fdecea;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 14px;
  text-align: left;
}
.spg-root .spg-error-msg.spg-show { display: block; }

.spg-root .spg-decide-btn {
  width: 100%;
  padding: 14px 0;
  border-radius: 999px;
  border: none;
  background: #d4af37;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.spg-root .spg-decide-btn:active { transform: scale(0.97); }

.spg-root .hidden { display: none !important; }
