/* ==========================================================
   Y.T.C 刺繍シミュレーター
   サイト共通トーン：ネイビー #001E3D / 角丸カード / Yusei Magic 見出し
   ========================================================== */

.ytc-sim {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
	gap: 24px;
	align-items: start;
}

/* ---- プレビュー ---- */
.ytc-sim__stage {
	position: sticky;
	top: 90px;
}
.ytc-sim__canvas-wrap {
	background: #eef1f5;
	border: 1px solid #dde3ea;
	border-radius: 12px;
	overflow: hidden;
	touch-action: none; /* ドラッグ中のページスクロールを防ぐ */
}
.ytc-sim__canvas-wrap .canvas-container {
	margin: 0 auto;
}
/* ベースごとの注意事項（赤枠） */
.ytc-sim__note-box {
	margin: 10px 0 0;
	padding: 10px 14px;
	border: 2px solid #d6453f;
	background: #fdf1f0;
	border-radius: 8px;
	color: #8a2a25;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.7;
}
.ytc-sim__note-box::before {
	content: '注意事項：';
}
.ytc-sim__disclaimer {
	margin: 8px 0 0;
	font-size: 12px;
	color: #667;
}

/* ---- パネル ---- */
.ytc-sim__panel {
	display: flex;
	flex-direction: column;
	gap: 18px;
}
.ytc-sim__sec {
	background: #fff;
	border: 1px solid #e3e8ee;
	border-radius: 12px;
	padding: 18px 18px 20px;
}
.ytc-sim__h {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 14px !important;
	padding: 0 !important;
	border: none !important;
	background: none !important;
	font-size: 17px;
	font-weight: 700;
	color: #001E3D;
}
.ytc-sim__h::before,
.ytc-sim__h::after {
	content: none !important; /* SWELLの見出し装飾を打ち消す */
}
.ytc-sim__step {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #001E3D;
	color: #fff;
	font-size: 15px;
	flex: 0 0 auto;
}
.ytc-sim__label {
	margin: 12px 0 6px;
	font-size: 13px;
	font-weight: 700;
	color: #334;
}
.ytc-sim__label small {
	font-weight: 400;
	color: #889;
}
.ytc-sim__help {
	margin: 6px 0 10px;
	font-size: 13px;
	color: #445;
	line-height: 1.7;
}
.ytc-sim__help small {
	color: #778;
}

/* ---- ベース選択 ---- */
.ytc-sim__garments {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}
.ytc-sim__garment {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 10px 6px;
	background: #f6f8fa;
	border: 2px solid #e3e8ee;
	border-radius: 10px;
	cursor: pointer;
	transition: border-color .15s;
}
.ytc-sim__garment img {
	width: 100%;
	max-width: 90px;
	height: auto;
	aspect-ratio: 5 / 6;
	object-fit: contain;
}
.ytc-sim__garment span {
	font-size: 12px;
	font-weight: 700;
	color: #334;
}
.ytc-sim__garment.is-active {
	border-color: #001E3D;
	background: #fff;
}

/* ---- スウォッチ（生地・糸色） ---- */
.ytc-sim__swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.ytc-sim__swatch {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 2px solid rgba(0, 0, 0, .15);
	cursor: pointer;
	padding: 0;
	transition: transform .1s;
}
/* 糸色スウォッチも生地カラーと同じサイズに統一（--sm クラスは互換のため残置） */
.ytc-sim__swatch.is-active {
	border-color: #001E3D;
	box-shadow: 0 0 0 2px #fff inset, 0 0 0 3px #001E3D;
	transform: scale(1.08);
}

/* カスタムカラー（自由指定）スウォッチ */
.ytc-sim__swatch--custom {
	position: relative;
	overflow: hidden;
	background: conic-gradient(#f44, #fb0, #6c0, #0cc, #36f, #c3f, #f44);
}
.ytc-sim__swatch--custom::after {
	content: '+';
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
	text-shadow: 0 0 3px rgba(0, 0, 0, .55);
	pointer-events: none;
}
.ytc-sim__swatch--custom.has-color::after {
	content: '';
}
.ytc-sim__colorpicker {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	border: none;
	padding: 0;
	cursor: pointer;
}

/* ---- 刺繍位置（面のサムネイル選択） ---- */
.ytc-sim__views {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
}
.ytc-sim__view {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 8px 4px;
	background: #f6f8fa;
	border: 2px solid #e3e8ee;
	border-radius: 10px;
	cursor: pointer;
	transition: border-color .15s, background-color .15s;
}
.ytc-sim__view.is-active {
	border-color: #001E3D;
	background: #fff;
}
/* デザインが入っている面：チェックバッジ＋薄い色付き背景 */
.ytc-sim__view.has-design {
	background: #eef7ee;
}
.ytc-sim__view.has-design.is-active {
	background: #f4fbf4;
}
.ytc-sim__view.has-design::after {
	content: '✓';
	position: absolute;
	top: -7px;
	right: -7px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #2e7d32;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.ytc-sim__view-thumb {
	position: relative;
	display: block;
	width: 100%;
	max-width: 84px;
	aspect-ratio: 5 / 6;
}
.ytc-sim__view-thumb img,
.ytc-sim__view-canvas {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}
.ytc-sim__view-zone {
	position: absolute;
	border: 1.5px solid #d6453f;
	background: rgba(214, 69, 63, 0.04);
	pointer-events: none;
}
.ytc-sim__view-label {
	font-size: 12px;
	font-weight: 700;
	color: #334;
}

/* ---- タブ（文字／画像） ---- */
.ytc-sim__tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin: 16px 0 14px;
}
.ytc-sim__tab {
	padding: 10px 8px;
	border-radius: 8px;
	border: 1.5px solid #b9c3cf;
	background: #f6f8fa;
	color: #334;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}
.ytc-sim__tab.is-active {
	background: #001E3D;
	border-color: #001E3D;
	color: #fff;
}
.ytc-sim__tabbody {
	display: none;
}
.ytc-sim__tabbody.is-active {
	display: block;
}

/* ---- 入力・書体 ---- */
.ytc-sim__input {
	width: 100%;
	padding: 10px 12px;
	border: 1.5px solid #b9c3cf;
	border-radius: 8px;
	font-size: 16px; /* iOSのズーム防止に16px以上 */
}
.ytc-sim__fonts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.ytc-sim__font {
	padding: 7px 12px;
	border-radius: 8px;
	border: 1.5px solid #b9c3cf;
	background: #fff;
	color: #223;
	font-size: 14px;
	cursor: pointer;
}
.ytc-sim__font.is-active {
	border-color: #001E3D;
	box-shadow: 0 0 0 1.5px #001E3D;
}

/* ---- トグル（刺繍風表示） ---- */
.ytc-sim__toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 14px 0 0;
	font-size: 13px;
	font-weight: 700;
	color: #334;
	cursor: pointer;
}
.ytc-sim__toggle input {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: #001E3D;
	flex: 0 0 auto;
}
.ytc-sim__toggle small {
	font-weight: 400;
	color: #889;
}

/* ---- ボタン ---- */
.ytc-sim__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin-top: 14px;
	padding: 12px 16px;
	border: none;
	border-radius: 8px;
	background: #001E3D;
	color: #fff !important;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none !important;
	transition: opacity .15s;
}
.ytc-sim__btn:hover {
	opacity: .85;
}
.ytc-sim__btn--file {
	background: #fff;
	color: #001E3D !important;
	border: 2px solid #001E3D;
}
.ytc-sim__btn--primary {
	margin-top: 12px;
	padding: 13px 16px;
	font-size: 15px;
	background: linear-gradient(135deg, #001E3D 0%, #14456e 100%);
}
/* お問い合わせCTA（サイト共通のCTAと同じオレンジ系グラデーション） */
.ytc-sim__btn--cta {
	margin-top: 0;
	padding: 16px 16px;
	font-size: 16px;
	background: linear-gradient(135deg, #f7971e 0%, #ee6b0c 100%);
	box-shadow: 0 2px 8px rgba(238, 107, 12, .35);
}
.ytc-sim__btn--cta:disabled {
	opacity: .6;
	cursor: wait;
}
.ytc-sim__sec--actions {
	background: #f2f6fa;
}
/* 完了：作成内容の確認（デザインを入れた面のまとめ） */
.ytc-sim__label--summary {
	margin-top: 0;
}
.ytc-sim__summary {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin-bottom: 16px;
}
.ytc-sim__summary-empty {
	grid-column: 1 / -1;
	margin: 0;
}
.ytc-sim__sumcard {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 10px 6px;
	background: #fff;
	border: 1px solid #e3e8ee;
	border-radius: 10px;
}
.ytc-sim__sumcard canvas {
	width: 100%;
	max-width: 150px;
	aspect-ratio: 5 / 6;
	display: block;
}
.ytc-sim__sumcard span {
	font-size: 12px;
	font-weight: 700;
	color: #334;
}
/* すべてリセット（控えめな危険操作ボタン） */
.ytc-sim__btn--reset {
	margin-top: 14px;
	padding: 9px 16px;
	font-size: 13px;
	background: #fff;
	color: #99333a !important;
	border: 1.5px solid #d0a3a7;
}
.ytc-sim__btn--reset:hover {
	opacity: 1;
	border-color: #b32d2e;
	color: #b32d2e !important;
}

/* ---- 選択中オブジェクト操作 ---- */
.ytc-sim__objctrl {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px dashed #ccd4dd;
}
.ytc-sim__objbtns {
	display: flex;
	gap: 8px;
}
.ytc-sim__minibtn {
	padding: 7px 14px;
	border-radius: 8px;
	border: 1.5px solid #b9c3cf;
	background: #fff;
	color: #334;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}
.ytc-sim__minibtn:hover {
	border-color: #001E3D;
	color: #001E3D;
}

/* ---- 下書きの復元バー ---- */
.ytc-sim__restore {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	padding: 12px 16px;
	background: #fff8e6;
	border: 1.5px solid #e6c229;
	border-radius: 10px;
	font-size: 14px;
	color: #333;
}
.ytc-sim__restore-msg small {
	color: #886;
}
.ytc-sim__restore-btns {
	display: inline-flex;
	gap: 8px;
	flex: 0 0 auto;
}
.ytc-sim__minibtn--primary {
	background: #001E3D;
	border-color: #001E3D;
	color: #fff;
}
.ytc-sim__minibtn--primary:hover {
	background: #14456e;
	color: #fff;
}

/* ---- スマホ用ステップウィザード ---- */
/* PCでは非表示。スマホではJSが .ytc-sim--wizard を付与し、1ステップずつ表示する。
   並び順（orderで制御）: ステップバー → 操作エリア → プレビュー → 戻る/次へ */
.ytc-sim__stepnav,
.ytc-sim__wiznav {
	display: none;
}
@media (max-width: 959px) {
	/* JSがウィザード有効化した場合のみ表示（JS無効時は従来の一覧表示に自動フォールバック） */
	.ytc-sim--wizard .ytc-sim__stepnav {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 6px;
		order: 1;
		/* ステップ切替時のスクロール先。SWELL固定ヘッダーに隠れない位置へ */
		scroll-margin-top: calc(var(--swl-fix_headerH, 0px) + 8px);
	}
	.ytc-sim--wizard .ytc-sim__panel {
		order: 2;
	}
	.ytc-sim--wizard .ytc-sim__stage {
		order: 3;
	}
	.ytc-sim--wizard .ytc-sim__wiznav {
		order: 4;
	}
	/* 完了ステップ：確認まとめと重複するため大きなプレビューは隠す
	   （注意事項・免責文は最終確認用に残す） */
	.ytc-sim--wizfinal .ytc-sim__canvas-wrap {
		display: none;
	}
	/* 2ステップ目以降：シミュレーター前の説明文を隠す（JSが付与） */
	.ytc-sim-intro-hidden {
		display: none !important;
	}
	.ytc-sim__stepbtn {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 3px;
		padding: 8px 2px;
		border: 1.5px solid #dde3ea;
		border-radius: 10px;
		background: #f6f8fa;
		color: #667;
		font-size: 11px;
		font-weight: 700;
		line-height: 1.2;
	}
	.ytc-sim__stepbtn span {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 22px;
		height: 22px;
		border-radius: 50%;
		background: #c9d2dc;
		color: #fff;
		font-size: 12px;
	}
	.ytc-sim__stepbtn.is-active {
		border-color: #001E3D;
		background: #fff;
		color: #001E3D;
	}
	.ytc-sim__stepbtn.is-active span {
		background: #001E3D;
	}
	.ytc-sim__stepbtn.is-done span {
		background: #2e7d32;
		font-size: 0; /* 数字を消して✓だけ表示する */
	}
	.ytc-sim__stepbtn.is-done span::before {
		content: '✓';
		font-size: 12px;
	}
	.ytc-sim--wizard .ytc-sim__sec {
		display: none;
	}
	.ytc-sim--wizard .ytc-sim__sec.is-wizstep {
		display: block;
	}
	/* ステップ名はインジケーターにあるため、セクション見出しは省略して縦幅を節約 */
	.ytc-sim--wizard .ytc-sim__h {
		display: none;
	}
	.ytc-sim--wizard .ytc-sim__wiznav {
		display: grid;
		grid-template-columns: 1fr 1.6fr;
		gap: 10px;
	}
	.ytc-sim__wizbtn {
		padding: 11px 10px;
		border-radius: 10px;
		font-size: 15px;
		font-weight: 700;
		cursor: pointer;
	}
	.ytc-sim__wizbtn--prev {
		border: 1.5px solid #b9c3cf;
		background: #fff;
		color: #334;
	}
	.ytc-sim__wizbtn--prev:disabled {
		opacity: .4;
		cursor: default;
	}
	.ytc-sim__wizbtn--next {
		border: none;
		background: #001E3D;
		color: #fff;
	}
}

/* ---- スマホ ---- */
@media (max-width: 959px) {
	.ytc-sim {
		/* minmax(0,1fr)：1fr だと min-width:auto でキャンバス(1000px)が列幅を押し広げてしまう */
		grid-template-columns: minmax(0, 1fr);
	}
	.ytc-sim__stage {
		position: static;
	}
	/* 縦長画面でキャンバスが画面を占有しすぎないよう、高さ基準で上限を設ける。
	   単位は svh（アドレスバーの開閉で変化しない小さい方の高さ）を使う。
	   vh だとスクロールのたびに幅が変わってしまうため。 */
	.ytc-sim__canvas-wrap {
		max-width: calc(52vh * 5 / 6);
		max-width: calc(52svh * 5 / 6);
		margin: 0 auto;
	}
	.ytc-sim__sec {
		padding: 14px 14px 16px;
	}
	/* タップしやすいサイズに拡大 */
	.ytc-sim__swatch {
		width: 38px;
		height: 38px;
	}
	.ytc-sim__font {
		padding: 9px 12px;
	}
	.ytc-sim__minibtn {
		padding: 10px 16px;
	}
	.ytc-sim__tab {
		font-size: 13px;
		padding: 10px 4px;
	}
}
