/* ===== Epoxy Flake Simulator ===== */

#simulator {
  padding-bottom: 60px;
  background: #202020;
  text-align: center;
}

.sim-subheading {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 40px;
  line-height: 1.6;
}

/* ---- アップロードエリア ---- */
#simUploadArea {
  max-width: 480px;
  margin: 0 auto 24px;
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 40px 20px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

#simUploadArea:hover,
#simUploadArea.sim-dragover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.09);
}

.sim-upload-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.sim-upload-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
}

.sim-upload-note {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
  margin-bottom: 20px;
}

.sim-privacy-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

/* ---- ボタン ---- */
.sim-btn-primary {
  display: inline-block;
  background: #ffffff;
  color: #202020;
  border: none;
  border-radius: 50px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

.sim-btn-primary:hover {
  background: #e0e0e0;
}

.sim-btn-primary:disabled {
  background: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
}

.sim-btn-secondary {
  display: inline-block;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  padding: 10px 24px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  margin: 0 6px;
}

.sim-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.55);
}

/* ---- ML ローディング ---- */
#simLoadingArea {
  display: none;
  max-width: 480px;
  margin: 0 auto 24px;
  padding: 48px 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sim-spinner {
  display: block;
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: sim-spin 0.9s linear infinite;
  margin: 0 auto 16px;
}

@keyframes sim-spin {
  to { transform: rotate(360deg); }
}

.sim-loading-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 6px;
}

.sim-loading-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* ---- ペイント選択エリア ---- */
#simPaintArea {
  display: none;
  max-width: 820px;
  margin: 0 auto;
}

.sim-paint-hint {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
  line-height: 1.6;
}

/* ブラシサイズ行 */
.sim-brush-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sim-brush-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

#simBrushSize {
  width: 130px;
  cursor: pointer;
  accent-color: #ffffff;
}

.sim-brush-preview {
  display: inline-block;
  background: rgb(0, 200, 160);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transition: width 0.1s, height 0.1s;
}

#simPaintContainer {
  position: relative;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  touch-action: none;
}

/* 写真ベースキャンバス */
#simPaintBg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ペイントオーバーレイ（写真の上に重ねる） */
#simPaintOverlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: auto;
  border-radius: 8px;
  opacity: 0.5;
  cursor: none;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.7));
}

/* ---- ブラシカーソルリング ---- */
#simCursorRing {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -50%);
  z-index: 20;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.5);
}

/* ---- 消しゴムボタン ---- */
.sim-btn-eraser {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.sim-btn-eraser:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.55);
}

.sim-btn-eraser.active {
  background: #ffffff;
  color: #202020;
  border-color: #ffffff;
}

.sim-paint-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- 結果エリア ---- */
#simResult {
  display: none;
  max-width: 820px;
  margin: 0 auto;
}

.sim-label-row {
  display: flex;
  justify-content: space-between;
  max-width: 820px;
  margin: 0 auto 6px;
  padding: 0 4px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* ---- Before/After スライダーコンテナ ---- */
#simSliderContainer {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  max-width: 100%;
  cursor: ew-resize;
  touch-action: pan-y;
  margin: 0 auto;
}

/* Before Canvas（ベース・常に全表示・コンテナ高さの基準） */
#simBefore {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* After Canvas（clip-path でスライドする・Before と同一寸法で重ねる） */
#simAfter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  border-radius: 8px;
  clip-path: inset(0 0 0 50%);
  pointer-events: none;
}

/* ---- 仕切り線＋ハンドル ---- */
#simDivider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff;
  transform: translateX(-50%);
  cursor: ew-resize;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

#simDivider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#simDivider::after {
  content: '◀ ▶';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: #555;
  white-space: nowrap;
  letter-spacing: -2px;
}

/* ---- アクションボタン行 ---- */
.sim-action-row {
  margin-top: 20px;
}

/* ---- レスポンシブ ---- */
@media (max-width: 600px) {
  #simulator {
    padding-bottom: 40px;
  }

  #simUploadArea {
    padding: 28px 16px;
  }
}
