.pcvto-widget {
	--pcvto-primary: #d6336c;
	--pcvto-primary-dark: #a61e4d;
	--pcvto-bg: #ffffff;
	--pcvto-bg-soft: #faf7f8;
	--pcvto-border: #e7dde1;
	--pcvto-text: #2b2226;
	--pcvto-text-muted: #8a7a80;
	--pcvto-radius: 14px;
	box-sizing: border-box;
	max-width: 1100px;
	margin: 0 auto;
	color: var(--pcvto-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}
.pcvto-widget *, .pcvto-widget *::before, .pcvto-widget *::after { box-sizing: border-box; }

.pcvto-title {
	font-size: 1.5rem;
	margin: 0 0 16px;
	font-weight: 700;
}

.pcvto-app-inner {
	display: grid;
	grid-template-columns: 1fr 1.15fr;
	gap: 24px;
}
@media (max-width: 820px) {
	.pcvto-app-inner { grid-template-columns: 1fr; }
}

.pcvto-panel {
	background: var(--pcvto-bg);
	border: 1px solid var(--pcvto-border);
	border-radius: var(--pcvto-radius);
	padding: 18px;
}

/* --- 画像アップロード --- */
.pcvto-dropzone {
	border: 2px dashed #ddb9c8;
	border-radius: var(--pcvto-radius);
	background: var(--pcvto-bg-soft);
	padding: 36px 16px;
	text-align: center;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}
.pcvto-dropzone:hover, .pcvto-dropzone.pcvto-dragover {
	border-color: var(--pcvto-primary);
	background: #fdf1f5;
}
.pcvto-upload-icon { color: var(--pcvto-primary); margin-bottom: 8px; }
.pcvto-dropzone-text { font-weight: 600; margin: 4px 0; }
.pcvto-dropzone-sub { font-size: .82rem; color: var(--pcvto-text-muted); margin: 0; }

.pcvto-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border-radius: 999px;
	border: none;
	font-size: .92rem;
	font-weight: 600;
	padding: 10px 20px;
	cursor: pointer;
	transition: transform .08s ease, opacity .15s ease, background .15s ease;
	text-decoration: none;
}
.pcvto-btn:active { transform: scale(0.97); }
.pcvto-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.pcvto-btn-primary { background: var(--pcvto-primary); color: #fff; width: 100%; }
.pcvto-btn-primary:hover:not(:disabled) { background: var(--pcvto-primary-dark); }

.pcvto-btn-secondary { background: #f1e6ea; color: var(--pcvto-text); margin-top: 10px; width: 100%; }
.pcvto-btn-secondary:hover:not(:disabled) { background: #e7d5dc; }

.pcvto-btn-text { background: transparent; color: var(--pcvto-primary-dark); padding: 6px 10px; }
.pcvto-btn-text:hover { text-decoration: underline; }

.pcvto-camera-mount { margin-top: 10px; }
.pcvto-camera-mount:not(:empty) { border-radius: var(--pcvto-radius); overflow: hidden; }

.pcvto-preview-area { margin-top: 14px; }
.pcvto-image-compare {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4;
	border-radius: var(--pcvto-radius);
	overflow: hidden;
	background: #eee;
}
.pcvto-image-compare img {
	position: absolute;
	top: 0; left: 0;
	width: 100%; height: 100%;
	object-fit: cover;
	display: block;
	user-select: none;
	-webkit-user-drag: none;
}
.pcvto-img-after-wrap {
	position: absolute;
	top: 0; left: 0;
	width: 50%;
	height: 100%;
	overflow: hidden;
}
.pcvto-img-after-wrap img { width: var(--pcvto-compare-w, 100%); max-width: none; }
.pcvto-compare-slider {
	position: absolute;
	bottom: 10px;
	left: 5%;
	width: 90%;
	margin: 0;
}
.pcvto-preview-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 8px;
}

.pcvto-status {
	margin-top: 10px;
	font-size: .88rem;
	min-height: 1.2em;
}
.pcvto-status.is-error { color: #c0392b; }
.pcvto-status.is-info { color: var(--pcvto-text-muted); }
.pcvto-status.is-success { color: #2f9e44; }

/* --- タブ --- */
.pcvto-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	border-bottom: 1px solid var(--pcvto-border);
	padding-bottom: 12px;
	margin-bottom: 14px;
}
.pcvto-tab-btn {
	border: 1px solid var(--pcvto-border);
	background: #fff;
	border-radius: 999px;
	padding: 6px 14px;
	font-size: .85rem;
	cursor: pointer;
	color: var(--pcvto-text);
}
.pcvto-tab-btn.is-active {
	background: var(--pcvto-primary);
	border-color: var(--pcvto-primary);
	color: #fff;
}

.pcvto-tab-panel { display: none; }
.pcvto-tab-panel.is-active { display: block; }

.pcvto-enable-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}
.pcvto-enable-row label {
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}

/* パターン選択(サムネイル) */
.pcvto-pattern-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
	gap: 8px;
	margin-bottom: 14px;
	max-height: 220px;
	overflow-y: auto;
	padding: 2px;
}
.pcvto-pattern-item {
	border: 2px solid transparent;
	border-radius: 10px;
	overflow: hidden;
	cursor: pointer;
	background: #f4f0f1;
	position: relative;
	aspect-ratio: 1;
}
.pcvto-pattern-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcvto-pattern-item.is-selected { border-color: var(--pcvto-primary); }
.pcvto-pattern-item .pcvto-pattern-label {
	position: absolute;
	bottom: 0; left: 0; right: 0;
	font-size: .6rem;
	background: rgba(0,0,0,.55);
	color: #fff;
	padding: 2px 3px;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* パレット(色設定)カード */
.pcvto-palette-card {
	border: 1px solid var(--pcvto-border);
	border-radius: 10px;
	padding: 12px;
	margin-bottom: 12px;
	background: var(--pcvto-bg-soft);
}
.pcvto-palette-card-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
	font-size: .8rem;
	font-weight: 700;
	color: var(--pcvto-text-muted);
}

.pcvto-field-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}
.pcvto-field-row:last-child { margin-bottom: 0; }
.pcvto-field-label {
	flex: 0 0 118px;
	font-size: .82rem;
	color: var(--pcvto-text-muted);
}
.pcvto-field-control { flex: 1; display: flex; align-items: center; gap: 8px; }
.pcvto-field-control input[type="color"] {
	width: 38px; height: 30px; padding: 0; border: 1px solid var(--pcvto-border); border-radius: 6px; background: none; cursor: pointer;
}
.pcvto-field-control input[type="range"] { flex: 1; }
.pcvto-field-control output { font-size: .78rem; width: 30px; text-align: right; color: var(--pcvto-text-muted); }
.pcvto-field-control select {
	flex: 1;
	padding: 6px 8px;
	border-radius: 6px;
	border: 1px solid var(--pcvto-border);
	background: #fff;
}

.pcvto-add-color-btn {
	background: #fff;
	border: 1px dashed var(--pcvto-primary);
	color: var(--pcvto-primary-dark);
	border-radius: 8px;
	padding: 8px;
	width: 100%;
	cursor: pointer;
	font-size: .82rem;
	font-weight: 600;
}
.pcvto-remove-palette-btn {
	background: none;
	border: none;
	color: #c0392b;
	font-size: .75rem;
	cursor: pointer;
	text-decoration: underline;
}

.pcvto-apply-bar { margin-top: 16px; }

.pcvto-powered-by {
	text-align: center;
	font-size: .72rem;
	color: var(--pcvto-text-muted);
	margin-top: 14px;
}

/* トグルスイッチ */
.pcvto-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.pcvto-switch input { opacity: 0; width: 0; height: 0; }
.pcvto-switch-slider {
	position: absolute; cursor: pointer; inset: 0;
	background-color: #ccc; transition: .15s; border-radius: 999px;
}
.pcvto-switch-slider::before {
	position: absolute; content: "";
	height: 16px; width: 16px; left: 3px; bottom: 3px;
	background-color: white; transition: .15s; border-radius: 50%;
}
.pcvto-switch input:checked + .pcvto-switch-slider { background-color: var(--pcvto-primary); }
.pcvto-switch input:checked + .pcvto-switch-slider::before { transform: translateX(18px); }

.pcvto-spinner {
	display: inline-block;
	width: 14px; height: 14px;
	border: 2px solid rgba(255,255,255,.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: pcvto-spin .7s linear infinite;
}
@keyframes pcvto-spin { to { transform: rotate(360deg); } }
