/* ==========================================
   立方体ブロック3Dツール CSS
   プレフィックス: cube3d-
   Version: 2.0.0（ヘッダー＋フルスクリーンcanvas＋右下ツールバー＋一本道ステップ構成）
   ========================================== */

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

.cube3d-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;
  color: #2C3E50;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 9999;
}

/* ===== ヘッダー ===== */
.cube3d-root .cube3d-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: 10;
}
.cube3d-root .cube3d-header h1 { font-size: 18px; font-weight: bold; flex: 1; margin: 0; }

/* 修正: 右端の状態表示＝タップで答え（のこりの個数）を表示するバッジ */
.cube3d-root .cube3d-info {
  font-size: 13px;
  font-weight: bold;
  background: rgba(255,255,255,0.15);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.cube3d-root .cube3d-info.cube3d-revealed {
  background: #d4af37;
}

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

/* ===== 右下ツールバー ===== */
/* 修正: ⚙設定 / 🗑削除 / ✋モード切替 / 👻ゴースト表示 / 📷記録 の5個構成 */
.cube3d-root .cube3d-toolbar {
  position: fixed;
  right: 16px; bottom: 20px;
  display: flex; flex-direction: column;
  gap: 12px;
  z-index: 10;
}
.cube3d-root .cube3d-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;
  position: relative;
}
.cube3d-root .cube3d-btn:active { transform: scale(0.92); }
.cube3d-root .cube3d-btn-setting  { background: #fff; color: #1e3a5f; border: 2px solid #1e3a5f; }
.cube3d-root .cube3d-btn-delete   { background: #fff; color: #c0392b; border: 2px solid #c0392b; }
.cube3d-root .cube3d-btn-mode     { background: #1e3a5f; color: #fff; }
.cube3d-root .cube3d-btn-mode.cube3d-active { background: #00b8d4; }
.cube3d-root .cube3d-btn-ghost    { background: #fff; color: #7F8C8D; border: 2px solid #c8d4e8; }
.cube3d-root .cube3d-btn-ghost.cube3d-active { background: #d4af37; color: #fff; border-color: #d4af37; }
.cube3d-root .cube3d-btn-snapshot { background: #d4af37; color: #fff; }
.cube3d-root .cube3d-btn:disabled { opacity: 0.35; cursor: default; }
.cube3d-root .cube3d-btn:disabled:active { transform: none; }

/* 選択中の個数バッジ（🗑ボタンの左上に重ねる） */
.cube3d-root .cube3d-sel-badge {
  position: absolute;
  top: -6px; right: -6px;
  background: #00b8d4;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.cube3d-root .cube3d-sel-badge.hidden { display: none; }

/* 修正: 間かくスライダーをツールバー最上部の縦スライダーに変更
   （ローズ曲線ジェネレーターのサイズスライダーと同じ手法） */
.cube3d-root .cube3d-slider-tool {
  position: relative;
  width: 60px;
  height: 160px;
  background: #fff;
  border: 2px solid #1e3a5f;
  border-radius: 30px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  color: #1e3a5f;
}
.cube3d-root .cube3d-slider-tool-icon {
  position: absolute;
  top: 10px; left: 0; right: 0;
  text-align: center;
  font-size: 16px;
}
.cube3d-root .cube3d-slider-tool-val {
  position: absolute;
  bottom: 10px; left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}
.cube3d-root .cube3d-slider-tool input[type="range"] {
  position: absolute;
  top: 50%; left: 50%;
  width: 100px;
  transform: translate(-50%, -50%) rotate(-90deg);
  accent-color: #1e3a5f;
}

/* 操作モードの説明チップ（左下） */
.cube3d-root .cube3d-mode-tip {
  position: fixed;
  left: 16px; bottom: 20px;
  background: rgba(30,58,95,0.85);
  color: #fff;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 10;
  pointer-events: none;
  max-width: 60vw;
}

/* ===== ステップ画面（オーバーレイ） ===== */
.cube3d-root .cube3d-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;
}
.cube3d-root .cube3d-overlay.hidden { display: none; }
.cube3d-root .cube3d-dialog {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 24px 24px 22px;
  width: min(92vw, 460px);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  text-align: center;
}
.cube3d-root .cube3d-dialog h2 { color: #1e3a5f; font-size: 19px; margin: 0 0 6px; }
.cube3d-root .cube3d-step-label {
  display: inline-block;
  background: #d4af37;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  border-radius: 999px;
  padding: 3px 14px;
  margin-bottom: 10px;
}
.cube3d-root .cube3d-hint { font-size: 13px; color: #5a708a; margin: 0 0 16px; }

.cube3d-root .cube3d-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 999px;
  border: none;
  background: #eef2f6;
  color: #5a708a;
  font-size: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* 修正: ステップ画面に埋め込みプレビューを追加。たて・よこ・たかさを動かすと
   その場で3D形状が更新される（決定ボタンを押す前に確認できる） */
.cube3d-root .cube3d-preview-title {
  font-size: 13px; font-weight: bold; color: #1e3a5f;
  text-align: left; margin: 2px 0 6px;
}
.cube3d-root .cube3d-preview-box {
  width: 100%;
  height: 190px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dbe2ea;
  background: #e8edf4;
  margin-bottom: 18px;
}
.cube3d-root .cube3d-preview-box canvas { display: block; width: 100%; height: 100%; }

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

.cube3d-root .cube3d-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;
}
.cube3d-root .cube3d-decide-btn:active { transform: scale(0.97); }

/* 記録一覧 */
.cube3d-root .cube3d-snap-title {
  margin: 22px 0 8px;
  font-size: 14px;
  font-weight: bold;
  color: #1e3a5f;
  text-align: left;
}
.cube3d-root .cube3d-snap-list { display: flex; flex-direction: column; gap: 8px; }
.cube3d-root .cube3d-snap-item {
  display: flex; align-items: center; justify-content: space-between;
  background: #f5f7fa;
  border-radius: 10px;
  padding: 8px 10px;
  gap: 8px;
}
.cube3d-root .cube3d-snap-name { font-size: 13px; font-weight: bold; color: #1e3a5f; }
.cube3d-root .cube3d-snap-detail { font-size: 11px; color: #7F8C8D; }
.cube3d-root .cube3d-snap-btns { display: flex; gap: 6px; flex-shrink: 0; }
.cube3d-root .cube3d-snap-btn {
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cube3d-root .cube3d-snap-load { background: #1e3a5f; color: #fff; }
.cube3d-root .cube3d-snap-del  { background: #fff; color: #c0392b; border: 1px solid #c0392b; }
.cube3d-root .cube3d-snap-empty { font-size: 12px; color: #7F8C8D; text-align: left; }

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