/* ===== Image Tools Online ===== */
.ito {
	--ito-main: #6d28d9;
	--ito-main-dark: #5b21b6;
	--ito-light: #f3edff;
	--ito-light-dark: #e4d7fb;
	--ito-bg: #f7f7f7;
	--ito-border: #dddddd;
	--ito-text: #333;
	--ito-sub: #6b7785;
	--ito-warn-bg: #efefef;
	--ito-warn: #444444;
	--ito-warn-border: #b5b5b5;
	--ito-danger: #b00020;
	max-width: 960px;
	margin: 2.5em auto;
	padding: 0 16px;
	font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
	font-size: 16px;
	line-height: 1.8;
	color: var(--ito-text);
}
.ito * { box-sizing: border-box; }
.ito [hidden] { display: none !important; }

/* ---------- ツール一覧 ---------- */
.ito__hub { display: grid; grid-template-columns: repeat(var(--ito-cols-pc, 4), minmax(0, 1fr)); gap: 24px; }
@media (max-width: 959px) { .ito__hub { grid-template-columns: repeat(var(--ito-cols-tab, 2), minmax(0, 1fr)); } }
@media (max-width: 599px) { .ito__hub { grid-template-columns: repeat(var(--ito-cols-sp, 1), minmax(0, 1fr)); gap: 16px; } }
.ito__tile { display: flex; flex-direction: column; gap: 8px; padding: 28px 24px; border: 1px solid var(--ito-border); border-top: 4px solid var(--ito-main); border-radius: 4px; background: #fff; color: var(--ito-text); text-decoration: none; transition: .15s; }
.ito__tile:hover { box-shadow: 0 8px 20px rgba(109, 40, 217, .15); transform: translateY(-2px); }
.ito__tile strong { font-size: 1.1em; color: var(--ito-main); line-height: 1.5; }
.ito__tile span { font-size: .875em; color: var(--ito-sub); line-height: 1.7; }
.ito__tile .ito__tileicon { font-size: 2em; line-height: 1.2; }

/* ツール一覧ページ（親ページ）: 画面の全幅に広げ、カードを大きくする */
.ito-hub-page { overflow-x: hidden; }
.ito--wide { box-sizing: border-box; max-width: none; width: 100vw; margin-left: calc(50% - 50vw); padding: 0 clamp(16px, 4vw, 64px); }
.ito--wide .ito__hub { max-width: 1600px; margin: 0 auto; gap: 32px; }
.ito--wide .ito__tile { gap: 12px; padding: 44px 32px; border-top-width: 6px; }
.ito--wide .ito__tile .ito__tileicon { font-size: 3.2em; }
.ito--wide .ito__tile strong { font-size: 1.35em; }
.ito--wide .ito__tile span { font-size: 1em; }
@media (max-width: 599px) {
	.ito--wide { width: auto; margin-left: 0; margin-right: 0; padding: 0; }
	.ito--wide .ito__hub { gap: 16px; }
	.ito--wide .ito__tile { padding: 28px 20px; }
	.ito--wide .ito__tile .ito__tileicon { font-size: 2.4em; }
}

/* ---------- 見出し ---------- */
.ito__head { margin-bottom: 32px; text-align: center; }
.ito__back { display: inline-block; margin-bottom: 12px; font-size: .875em; color: var(--ito-main); text-decoration: none; }
.ito__back:hover { text-decoration: underline; }
.ito__title { margin: 0 0 8px; font-size: 1.6em; line-height: 1.5; color: var(--ito-main); }
.ito__desc { margin: 0; color: var(--ito-sub); }

/* ---------- ファイルを選ぶ ---------- */
.ito__drop { border: 2px dashed #b794f4; border-radius: 4px; padding: 64px 24px; text-align: center; background: var(--ito-bg); transition: .15s; }
.ito__drop.is-over, .ito__drop:focus { border-color: var(--ito-main); background: var(--ito-light); outline: none; }
.ito__drop-title { margin: 0 0 8px; font-size: 1.2em; font-weight: 700; }
.ito__drop-or { margin: 0 0 20px; color: var(--ito-sub); }

/* ---------- ボタン ---------- */
.ito__btn { display: inline-block; padding: 10px 22px; border: 1px solid #c4a8f5; border-radius: 4px; background: var(--ito-light); color: var(--ito-main); font-size: .95em; font-weight: 700; line-height: 1.5; text-align: center; text-decoration: none; cursor: pointer; transition: .15s; }
.ito__btn:hover { background: var(--ito-light-dark); border-color: var(--ito-main); color: var(--ito-main-dark); }
.ito__btn--primary { background: var(--ito-main); border-color: var(--ito-main); color: #fff; }
.ito__btn--primary:hover { background: var(--ito-main-dark); border-color: var(--ito-main-dark); color: #fff; }
.ito__btn--reset { background: var(--ito-warn-bg); border-color: var(--ito-warn-border); color: var(--ito-warn); }
.ito__btn--reset:hover { background: #e2e2e2; border-color: var(--ito-warn); color: var(--ito-warn); }
.ito__btn--large { min-width: 280px; padding: 16px 40px; font-size: 1.1em; }
.ito__btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- ファイル一覧 ---------- */
.ito__hint { margin: 0 0 16px; color: var(--ito-sub); font-size: .875em; line-height: 1.7; }
.ito__list { list-style: none; margin: 0 0 28px; padding: 0; }
.ito__item { display: flex; align-items: center; gap: 16px; padding: 14px 18px; margin-bottom: 12px; border: 1px solid var(--ito-border); border-radius: 4px; background: #fff; }
.ito__list .ito__item[draggable="true"] { cursor: grab; }
.ito__item.is-dragging { opacity: .4; }
.ito__num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--ito-main); color: #fff; text-align: center; line-height: 30px; font-size: .85em; font-weight: 700; }
.ito__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ito__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.ito__meta { color: var(--ito-sub); font-size: .8em; }
.ito__ctrl { flex: none; display: flex; gap: 6px; }
.ito__ctrl button, .ito__cardctl button, .ito__itemctl button {
	width: 34px; height: 34px; padding: 0; border: 1px solid #c4a8f5; border-radius: 4px; background: var(--ito-light); color: var(--ito-main); font-size: .9em; line-height: 1; cursor: pointer; transition: .15s;
}
.ito__ctrl button:hover:not(:disabled), .ito__cardctl button:hover:not(:disabled), .ito__itemctl button:hover { background: var(--ito-light-dark); border-color: var(--ito-main); }
.ito__ctrl button:last-child { background: #efefef; border-color: #b5b5b5; color: #444; }
.ito__ctrl button:last-child:hover { background: #e2e2e2; border-color: #888; }
.ito__ctrl button:disabled, .ito__cardctl button:disabled { opacity: .35; cursor: default; }

/* ---------- 設定 ---------- */
.ito__opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px 28px; margin: 0 0 32px; padding: 24px; border: 1px solid var(--ito-border); border-radius: 4px; background: var(--ito-bg); }
.ito__opts:empty { display: none; }
.ito__opt { display: flex; flex-direction: column; gap: 8px; font-size: .9em; }
.ito__optl { font-weight: 700; line-height: 1.6; }
.ito__opt input, .ito__opt select { width: 100%; padding: 10px 12px; border: 1px solid var(--ito-border); border-radius: 4px; background: #fff; font-size: 1em; color: var(--ito-text); }
.ito__opt input:focus, .ito__opt select:focus { border-color: var(--ito-main); outline: 2px solid var(--ito-light-dark); }
.ito__opt input[type="color"] { height: 42px; padding: 3px; }

/* ---------- 実行エリア（中央配置） ---------- */
.ito__actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 12px; margin-bottom: 28px; }
.ito__center { text-align: center; }
.ito__run { display: flex; justify-content: center; }
.ito__status { min-height: 1.8em; margin: 24px 0 0; text-align: center; }
.ito__status.is-error { color: var(--ito-danger); }
.ito__results { margin-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ito__res { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border: 1px solid var(--ito-border); border-radius: 4px; background: #fff; }
.ito__resname { overflow: hidden; text-overflow: ellipsis; }
.ito__note { margin: 32px 0 0; font-size: .8em; color: var(--ito-sub); text-align: center; }

/* ---------- 整理 / ページ選択 ---------- */
.ito__custom { margin-bottom: 32px; }
.ito__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; margin-bottom: 16px; }
.ito__card { border: 1px solid var(--ito-border); border-radius: 4px; padding: 10px; background: #fff; text-align: center; }
.ito__card.is-del { opacity: .35; }
.ito__thumb { height: 160px; display: flex; align-items: center; justify-content: center; background: #eef2f6; margin-bottom: 8px; }
.ito__thumb canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); transition: transform .15s; }
.ito__cardnum { font-size: .8em; color: var(--ito-sub); }
.ito__cardctl { display: flex; justify-content: center; gap: 4px; margin-top: 8px; }
.ito__cardctl button { width: 30px; height: 30px; }

.ito__pickgrid { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin-bottom: 8px; }
.ito__pickgrid--gap { gap: 16px; }
.ito__pickgrid .ito__card { width: 128px; margin-bottom: 8px; cursor: pointer; user-select: none; }
.ito__pickgrid .ito__card:hover { border-color: var(--ito-main); }
.ito__card.is-sel { outline: 3px solid var(--ito-main); outline-offset: -1px; }
.ito__card--pick.is-del { opacity: .45; border-color: var(--ito-danger); background: #f3f3f3; }
.ito__sep { width: 32px; margin: 0 0 8px; padding: 0; border: 0; border-left: 2px dashed var(--ito-border); background: none; cursor: pointer; color: transparent; display: flex; align-items: center; justify-content: center; }
.ito__sep:hover { color: var(--ito-main); border-left-color: var(--ito-main); }
.ito__sep.is-cut { color: var(--ito-main); border-left: 3px solid var(--ito-main); }

/* ---------- 文字・署名 / 黒塗り ---------- */
.ito__toolbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin-bottom: 20px; }
.ito__toolbar .ito__hint { flex-basis: 100%; margin: 0; text-align: center; }
.ito__toolbar input[type="text"], .ito__toolbar input[type="number"] { padding: 10px 12px; border: 1px solid var(--ito-border); border-radius: 4px; font-size: 1em; }
.ito__toolbar input[type="number"] { width: 80px; }
.ito__toolbar input[type="color"] { width: 44px; height: 42px; padding: 3px; border: 1px solid var(--ito-border); border-radius: 4px; }
.ito__toolbar .ito__btn { padding: 9px 18px; }
.ito__grow { flex: 1; min-width: 160px; }
.ito__stage { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; border: 1px solid var(--ito-border); background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.ito__stage canvas { display: block; width: 100%; height: auto; max-width: 900px; }
.ito__layer { position: absolute; inset: 0; overflow: hidden; }
.ito__stage.is-placing .ito__layer { cursor: crosshair; outline: 2px solid var(--ito-main); outline-offset: -2px; }
.ito__layer .ito__item { position: absolute; display: block; padding: 0; margin: 0; border: 1px dashed transparent; background: none; cursor: move; touch-action: none; }
.ito__layer .ito__item:hover { border-color: var(--ito-main); }
.ito__layer .ito__item.is-selected { border-color: var(--ito-main); }
.ito__layer .ito__item img { display: block; width: 100%; height: auto; pointer-events: none; }
.ito__itemctl { position: absolute; right: 0; top: -36px; padding-bottom: 8px; display: none; gap: 4px; z-index: 2; }
.ito__itemctl button { width: 28px; height: 28px; }
.ito__layer .ito__item.is-top .ito__itemctl { top: 100%; bottom: auto; padding: 8px 0 0; }
.ito__layer .ito__item:hover .ito__itemctl, .ito__layer .ito__item.is-selected .ito__itemctl { display: flex; }
.ito__layer.is-draw { cursor: crosshair; touch-action: none; }
.ito__rect { position: absolute; cursor: move; touch-action: none; background: #000; outline: 1px solid rgba(255, 255, 255, .4); }
.ito__rect.is-tmp { background: rgba(0, 0, 0, .6); }
.ito__rect button { position: absolute; right: 2px; top: 2px; width: 22px; height: 22px; padding: 0; border: 1px solid #fff; border-radius: 50%; background: var(--ito-danger); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; opacity: 0; }
.ito__rect:hover button, .ito__rect button:focus { opacity: 1; }
@media (hover: none) { .ito__rect button { opacity: 1; } }
.ito__modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; z-index: 99999; padding: 16px; }
.ito__modalbox { background: #fff; border-radius: 4px; padding: 28px; width: 100%; max-width: 660px; }
.ito__modalbox .ito__toolbar { margin: 20px 0 0; }
.ito__pad { width: 100%; height: auto; border: 1px dashed #b794f4; border-radius: 4px; touch-action: none; background: repeating-linear-gradient(#fff, #fff 39px, #eef2f6 40px); }

/* ---------- スマホ ---------- */
@media (max-width: 600px) {
	.ito { margin: 1.5em auto; }
	.ito__drop { padding: 40px 16px; }
	.ito__opts { padding: 18px 16px; }
	.ito__item { padding: 12px; gap: 10px; }
	.ito__btn--large { width: 100%; min-width: 0; padding: 16px 12px; }
	.ito__actions .ito__btn { flex: 1 1 100%; }
	.ito__res { flex-direction: column; align-items: stretch; text-align: center; }
	.ito__results > .ito__btn--large { width: 100%; }
}

/* ---------- SWELL: ツールのページではサイドバーを出さず、本文を全幅にする ---------- */
.ito-page #sidebar { display: none !important; }
.ito-page .l-mainContent { width: 100% !important; max-width: 100% !important; }

/* ---------- 画像ツール用の追加 ---------- */
.ito__opt--check { flex-direction: row; align-items: center; gap: 10px; }
.ito__opt--check input { width: 20px; height: 20px; flex: none; }
.ito__opt input[type="range"] { padding: 0; accent-color: var(--ito-main); }
.ito__rangeval { color: var(--ito-sub); font-size: .85em; }
.ito__thumbimg { flex: none; width: 56px; height: 56px; object-fit: cover; border-radius: 4px; background: #eee; border: 1px solid var(--ito-border); }
.ito__res .ito__thumbimg { width: 48px; height: 48px; }
.ito__res .ito__resname { flex: 1; min-width: 0; }
.ito__previewcv { max-width: 100%; height: auto; }
.ito__stage canvas { touch-action: none; }
.ito__rect { background: rgba(109, 40, 217, .25); outline: 2px solid var(--ito-main); cursor: default; }
.ito__rect.is-crop { box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); background: transparent; }
.ito__rect.is-tmp { background: rgba(109, 40, 217, .3); }
.ito__rect button { opacity: 1; }
.ito__drop .ito__hint { margin: 16px 0 0; }
@media (max-width: 600px) { .ito__thumbimg { width: 44px; height: 44px; } }
.ito__stage canvas { width: 100%; max-width: none; height: auto; }

/* ---------- プレビュー付きツール: パソコンでは左に画像、右に設定 ---------- */
.ito--split { max-width: 1200px; }
.ito__split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.ito__split .ito__custom { margin-bottom: 0; min-width: 0; }
.ito__split .ito__panel { min-width: 0; }
.ito__split .ito__opts { grid-template-columns: 1fr; gap: 16px; margin-bottom: 20px; padding: 20px; }
.ito__split .ito__actions { margin-bottom: 20px; }
.ito__split .ito__btn--large { width: 100%; min-width: 0; }
.ito__split .ito__run { display: block; }
.ito__stage.is-movable canvas { cursor: move; touch-action: none; }
.ito__rect.is-fx { background: transparent; outline: 2px dashed var(--ito-main); }
.ito__rect.is-fx.is-tmp { background: rgba(109, 40, 217, .15); }
@media (min-width: 901px) { .ito__split .ito__custom { position: sticky; top: 16px; } }
@media (max-width: 900px) {
	.ito__split { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
