﻿/* ===== PDF Tools Online ===== */
.pto {
	--pto-main: #fa0f00;
	--pto-main-dark: #c80c00;
	--pto-light: #fff0ef;
	--pto-light-dark: #ffdcd9;
	--pto-bg: #f7f7f7;
	--pto-border: #dddddd;
	--pto-text: #333;
	--pto-sub: #6b7785;
	--pto-warn-bg: #efefef;
	--pto-warn: #444444;
	--pto-warn-border: #b5b5b5;
	--pto-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(--pto-text);
}
.pto * { box-sizing: border-box; }
.pto [hidden] { display: none !important; }

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

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

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

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

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

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

/* ---------- 設定 ---------- */
.pto__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(--pto-border); border-radius: 4px; background: var(--pto-bg); }
.pto__opts:empty { display: none; }
.pto__opt { display: flex; flex-direction: column; gap: 8px; font-size: .9em; }
.pto__optl { font-weight: 700; line-height: 1.6; }
.pto__opt input, .pto__opt select { width: 100%; padding: 10px 12px; border: 1px solid var(--pto-border); border-radius: 4px; background: #fff; font-size: 1em; color: var(--pto-text); }
.pto__opt input:focus, .pto__opt select:focus { border-color: var(--pto-main); outline: 2px solid var(--pto-light-dark); }
.pto__opt input[type="color"] { height: 42px; padding: 3px; }

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

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

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

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

/* ---------- スマホ ---------- */
@media (max-width: 600px) {
	.pto { margin: 1.5em auto; }
	.pto__drop { padding: 40px 16px; }
	.pto__opts { padding: 18px 16px; }
	.pto__item { padding: 12px; gap: 10px; }
	.pto__btn--large { width: 100%; min-width: 0; padding: 16px 12px; }
	.pto__actions .pto__btn { flex: 1 1 100%; }
	.pto__res { flex-direction: column; align-items: stretch; text-align: center; }
	.pto__results > .pto__btn--large { width: 100%; }
}

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