/* =====================================================================
   style.css — 画像トリミング（切り抜き）ツール固有の微調整のみ。
   共通スタイルは /_shared/shirugear.css に任せる。
   ===================================================================== */

.sg-result-row__value {
  font-variant-numeric: tabular-nums;
}

/* 区切り線 */
.sg-hr {
  border: none;
  border-top: 1px solid var(--sg-border, #e5e7eb);
  margin: var(--sg-space-4) 0;
}

/* ドラッグ＆ドロップ枠 */
.ic-drop {
  border: 2px dashed var(--sg-border, #d1d5db);
  border-radius: var(--sg-radius, 8px);
  padding: 28px 16px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.ic-drop.is-dragover {
  border-color: var(--sg-primary, #3b5bdb);
  background: rgba(59, 91, 219, 0.06);
}
.ic-drop__text {
  margin: 0 0 12px;
  color: var(--sg-muted, #6b7280);
  font-size: 0.92rem;
  line-height: 1.6;
}
.ic-file-label {
  cursor: pointer;
}
.ic-drop__hint {
  margin-top: 12px;
}

.ic-privacy {
  margin-top: var(--sg-space-4);
}
.ic-msg {
  margin-top: var(--sg-space-2);
  color: var(--sg-danger, #b91c1c);
}

.ic-stage-hint {
  margin: 0 0 12px;
}

/* 切り抜きステージ（画像＋枠オーバーレイ） */
.ic-stage-wrap {
  text-align: center;
}
.ic-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  /* 透過画像が見やすいようチェッカー風の下地 */
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid var(--sg-border, #e5e7eb);
  border-radius: var(--sg-radius, 8px);
  touch-action: none; /* ポインタ操作をブラウザのスクロール/ズームに奪われない */
  user-select: none;
  -webkit-user-select: none;
}
.ic-stage__img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  height: auto;
  width: auto;
  -webkit-user-drag: none;
  user-select: none;
}

/* 切り抜き枠 */
.ic-crop {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.9);
  outline: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42); /* 枠外を暗く */
  cursor: move;
  touch-action: none;
}
/* 三分割ガイド */
.ic-crop::before,
.ic-crop::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ic-crop::before {
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  border-right: 1px solid rgba(255, 255, 255, 0.35);
  left: 33.333%;
  right: 33.333%;
}
.ic-crop::after {
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  top: 33.333%;
  bottom: 33.333%;
}

/* ハンドル */
.ic-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--sg-primary, #3b5bdb);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  touch-action: none;
  z-index: 2;
}
.ic-handle[data-handle="nw"] { left: -8px; top: -8px; cursor: nwse-resize; }
.ic-handle[data-handle="n"]  { left: 50%; top: -8px; transform: translateX(-50%); cursor: ns-resize; }
.ic-handle[data-handle="ne"] { right: -8px; top: -8px; cursor: nesw-resize; }
.ic-handle[data-handle="e"]  { right: -8px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.ic-handle[data-handle="se"] { right: -8px; bottom: -8px; cursor: nwse-resize; }
.ic-handle[data-handle="s"]  { left: 50%; bottom: -8px; transform: translateX(-50%); cursor: ns-resize; }
.ic-handle[data-handle="sw"] { left: -8px; bottom: -8px; cursor: nesw-resize; }
.ic-handle[data-handle="w"]  { left: -8px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

/* アスペクト比ラジオ */
.ic-ratios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: var(--sg-space-2);
}
.ic-ratios label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.ic-range {
  padding: 0;
}

.ic-target {
  margin-top: var(--sg-space-4);
  font-weight: 600;
}
.ic-run {
  margin-top: var(--sg-space-4);
  width: 100%;
}

/* プレビュー */
.ic-preview-wrap {
  text-align: center;
  margin-bottom: var(--sg-space-4);
}
.ic-preview {
  max-width: 100%;
  max-height: 320px;
  height: auto;
  border-radius: var(--sg-radius, 8px);
  border: 1px solid var(--sg-border, #e5e7eb);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.ic-warn {
  margin-top: var(--sg-space-2);
  color: var(--sg-danger, #b91c1c);
}
.ic-download {
  display: inline-block;
  margin-top: var(--sg-space-4);
  text-decoration: none;
}

/* ダークテーマ時のチェッカー下地を控えめに */
:root.sg-dark .ic-stage,
:root.sg-dark .ic-preview {
  background-color: #1f2430;
  background-image:
    linear-gradient(45deg, #2a3040 25%, transparent 25%),
    linear-gradient(-45deg, #2a3040 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a3040 75%),
    linear-gradient(-45deg, transparent 75%, #2a3040 75%);
}
