/* Exhaust Sound Simulator */
/* 調整ポイント: --p-sound-size はボタン領域（デザインの 304px 四方）の一辺。内部の寸法はすべてこれを基準に比率で決める */
.p-sound {
	--p-sound-size: 304px;
	--p-sound-u: calc(var(--p-sound-size) / 304);
	--p-sound-glow: 0, 21, 255; /* script.js がモード色を "r, g, b" で上書きする */
	--p-sound-pulse: 1;
	position: relative;
	isolation: isolate;
	overflow: hidden;
	/* 調整ポイント: 背景写真は下端が黒に落ちているので、幅基準で拡縮し足りない高さは黒で埋める。
	   狭い画面では写真が小さくなりすぎないよう最小幅を持たせ左右を切る。
	   広い画面で写真の下端がセクション途中で切れても不自然にならないよう、最下部は黒へフェード */
	background:
		linear-gradient(transparent calc(100% - 160px), #000),
		#000 url(/INTEGRATYPE-S/sound_simulator/images/bg_sound_pc.jpg) center top / max(100%, 1400px) auto no-repeat;
	color: #fff;
	text-align: center
}
.p-sound::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	/* images/screen.svg と同じ内容（2px 四方の黒と透明の市松、不透明度 50%）を 4×4 のタイルにしてインライン化 */
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Cpath d='M0 0h2v2H0zM2 2h2v2H2z' fill-opacity='.5'/%3E%3C/svg%3E");
	mix-blend-mode: multiply;
	pointer-events: none
}
.p-sound__stage {
	display: flex;
	flex-direction: column;
	align-items: center
}
.p-sound__title {
	margin: 0;
	line-height: 0
}
.p-sound__title img {
	max-width: 100%;
	height: auto
}
.p-sound__lead,
.p-sound__caution {
	font-family: var(--font-normal)
}
/* グロー（絶対配置）より手前に文字を出す */
.p-sound__title,
.p-sound__lead,
.p-sound__caution,
.p-sound__mode {
	position: relative;
	z-index: 1
}

/* 中央ボタン: デザインの重なり順どおり 下から 黒の影＋グロー → 放射バー(canvas) → グロー → ボタン（グレー輪＋黒円） */
.p-sound__viz {
	position: relative;
	width: var(--p-sound-size);
	height: var(--p-sound-size)
}
/* デザインの drop-shadow（青: blur200/spread50 ×2枚、黒: blur250/spread100）。ボタンの黒円（246px）と同じ円に付ける */
.p-sound__glow {
	position: absolute;
	top: 50%;
	left: 50%;
	width: calc(var(--p-sound-u) * 246);
	height: calc(var(--p-sound-u) * 246);
	border-radius: 50%;
	transform: translate(-50%, -50%) scale(var(--p-sound-pulse));
	pointer-events: none
}
.p-sound__glow--back {
	box-shadow: 0 0 calc(var(--p-sound-u) * 200) calc(var(--p-sound-u) * 50) rgb(var(--p-sound-glow)), 0 0 calc(var(--p-sound-u) * 250) calc(var(--p-sound-u) * 100) #000
}
.p-sound__glow--front {
	box-shadow: 0 0 calc(var(--p-sound-u) * 200) calc(var(--p-sound-u) * 50) rgb(var(--p-sound-glow))
}
/* 調整ポイント: canvas はバーが伸びる余白ぶんボタン領域より大きく取る（script.js の CANVAS_RATIO と合わせる） */
.p-sound__canvas {
	position: absolute;
	top: 50%;
	left: 50%;
	width: calc(var(--p-sound-size) * 1.8);
	height: calc(var(--p-sound-size) * 1.8);
	transform: translate(-50%, -50%);
	pointer-events: none
}
.p-sound__button {
	position: absolute;
	top: 50%;
	left: 50%;
	width: calc(var(--p-sound-u) * 246);
	height: calc(var(--p-sound-u) * 246);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #000;
	box-shadow: 0 0 0 calc(var(--p-sound-u) * 11) rgba(53, 54, 59, .7);
	color: #fff;
	font-family: var(--font-bold);
	cursor: pointer;
	transform: translate(-50%, -50%);
	transition: transform .12s;
	-webkit-tap-highlight-color: transparent
}
.p-sound__button::before {
	content: "";
	position: absolute;
	top: 56.1%;
	left: 50%;
	width: 79.3%;
	height: 2px;
	background: #464646;
	transform: translateX(-50%)
}
/* 待機中のアテンション: マウスオン時と同じ 1.02倍へ 0.4秒で拡大し、0.48秒かけて戻したあと 3秒止まる（1周期 3.88秒）
   ホバー解除で最初から再生されたときに 1.02倍から自然に戻るよう、拡大した状態から始める */
.p-sound__button[aria-pressed="false"] {
	animation: p-sound-attention 3.88s ease-in-out infinite
}
@keyframes p-sound-attention {
	0%,
	100% {
		transform: translate(-50%, -50%) scale(1.02)
	}
	12.371%,
	89.691% {
		transform: translate(-50%, -50%)
	}
}
.p-sound__button:active {
	transform: translate(-50%, -50%) scale(.97);
	animation: none
}
.p-sound__button:focus-visible {
	outline: 2px solid rgb(var(--p-sound-glow));
	outline-offset: calc(var(--p-sound-u) * 14)
}
.p-sound__button-state {
	position: absolute;
	top: 30.7%;
	left: 0;
	width: 100%;
	transform: translateY(-50%)
}
.p-sound__button-sub {
	display: block;
	font-size: max(12px, calc(var(--p-sound-u) * 18));
	line-height: 1.333;
	letter-spacing: .1em
}
.p-sound__button-main {
	display: block;
	font-size: calc(var(--p-sound-u) * 34);
	line-height: 1.235;
	letter-spacing: .1em
}
.p-sound__button-mode {
	position: absolute;
	top: 75.6%;
	left: 0;
	width: 100%;
	font-size: max(12px, calc(var(--p-sound-u) * 21));
	line-height: 1;
	letter-spacing: .05em;
	color: rgb(var(--p-sound-glow));
	transform: translateY(-50%)
}

/* DRIVE MODE 切替 */
.p-sound__mode-label {
	font-family: var(--font-normal);
	font-size: 16px;
	line-height: 20px;
	letter-spacing: .1em
}
.p-sound__mode-text {
	margin-top: 18px;
	font-family: var(--font-normal);
	font-size: 20px;
	line-height: 20px;
	letter-spacing: .1em
}
.p-sound__mode-switch {
	display: flex;
	gap: 5px;
	margin-top: 33px;
	padding: 3px 4px;
	border: 1px solid #d9d9d9;
	border-radius: 24px
}
.p-sound__mode-button {
	flex: 1 1 0;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: transparent;
	color: #fff;
	font-family: var(--font-bold);
	letter-spacing: .1em;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent
}
/* 非選択は透過＋枠線（_ref/button-group.json の stroke: #35363b 1px 内側）、選択中はモードごとの塗り */
.p-sound__mode-button[aria-pressed="false"] {
	box-shadow: inset 0 0 0 1px #35363b
}
.p-sound__mode-button[data-mode="0"][aria-pressed="true"] {
	background: linear-gradient(0deg, rgba(0, 0, 0, .5) 0%, rgba(102, 102, 102, .5) 100%), rgba(0, 0, 192, .9)
}
.p-sound__mode-button[data-mode="1"][aria-pressed="true"] {
	background: linear-gradient(0deg, rgba(0, 0, 192, .6) 0%, rgba(255, 128, 0, .6) 100%), #ff8000
}
.p-sound__mode-button[data-mode="2"][aria-pressed="true"] {
	background: linear-gradient(0deg, rgba(0, 0, 192, .5) 0%, rgba(200, 0, 0, .5) 100%), #c80000
}
.p-sound__mode-button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px
}
.p-sound__note {
	font-family: var(--font-normal);
	font-size: 11px;
	line-height: 18px;
	color: #b4b4b4
}

@media(hover: hover) {
	.p-sound__button:hover {
		transform: translate(-50%, -50%) scale(1.02);
		animation: none
	}
	.p-sound__mode-button[aria-pressed="false"]:hover {
		background: rgba(255, 255, 255, .1)
	}
}

@media screen and (min-width: 769px) {
	/* 数値はデザイン（1900幅）の各要素の y 座標差 */
	.p-sound__stage {
		padding-top: 117px
	}
	.p-sound__title img {
		width: 645px
	}
	/* タイトル画像の差し替えで高さが 54→66.8 に増えた分（12.8）を引く（44→31.2）。説明文の位置は変えない */
	.p-sound__lead {
		margin-top: 31.2px;
		font-size: 20px;
		line-height: 40px
	}
	/* 注記は 30px 下げる。ボタンの位置は変えないため、下げた分を .p-sound__viz の margin から引く */
	.p-sound__caution {
		margin-top: 30px;
		font-size: 20px;
		line-height: 50px
	}
	/* 説明文は1つのテキスト（高さ 135）だが、行の高さ 40+40+50=130 で組まれるので、ボタンの y 座標（461）に合わせて 135 との差 5px を足す（69px）。注記を下げた 30px を引いて 39px */
	.p-sound__viz {
		margin-top: 39px
	}
	.p-sound__mode {
		margin-top: 92px
	}
	.p-sound__mode-switch {
		width: 521px
	}
	.p-sound__mode-button {
		font-size: 20px
	}
	.p-sound__note {
		margin-top: 44px;
		padding-bottom: 54px
	}
}

@media screen and (max-width: 768px) {
	/* 数値は SP デザイン（750幅・2倍）の各要素の y 座標差を 1/2 にした値。375px 基準で固定。12px 未満になる文字は 12px
	   縦の余白4か所（ヘッダー下→タイトル／タイトル→説明文／説明文→ボタン／ボタン→DRIVE MODE）は基本デザイン値（151 / 16.6 / 88.5 / 48.5、合計 304.6）。
	   画面の高さが足りないときだけ、DRIVE MODE の切替が下部固定メニューの上に収まるよう4か所を同じ比率で縮める（説明文→ボタン以外の3か所は最小値 16 / 8 / 10 で止める）。
	   --p-sound-sp-free = 余白に使える高さ。554.4px = ヘッダー 113 + 下部固定メニュー 69.5 + 固定メニューとの間隔 4 + 余白以外の要素 367.9（旧タイトルで 375幅実測 361.1 → タイトル画像の高さ増 6.4 を加算） */
	.p-sound {
		--p-sound-size: 152px;
		--p-sound-sp-free: calc(100svh - 554.4px);
		/* 説明文→ボタンの余白（注記の分を含む） */
		--p-sound-sp-lead-gap: clamp(0px, calc(var(--p-sound-sp-free) * 88.5 / 304.6), 88.5px);
		padding: 0 16px;
		background:
			#000 url(/INTEGRATYPE-S/sound_simulator/images/bg_sound_sp.jpg) center top / 100% auto no-repeat
	}
	.p-sound__stage {
		padding-top: clamp(16px, calc(var(--p-sound-sp-free) * 151 / 304.6), 151px)
	}
	.p-sound__title img {
		width: 323px
	}
	.p-sound__lead {
		margin-top: clamp(8px, calc(var(--p-sound-sp-free) * 16.6 / 304.6), 16.6px);
		font-size: 12px;
		line-height: 2
	}
	/* 注記は 16px 下げる（余白が 16px に満たない高さでは余白の分だけ）。ボタンの位置は変えないため、下げた分を .p-sound__viz の margin から引く */
	.p-sound__caution {
		margin-top: min(16px, var(--p-sound-sp-lead-gap));
		font-size: 12px;
		line-height: 2.5
	}
	/* 説明文→ボタンは PC と同じく説明文の高さを 130（デザイン 2倍値）として計算 */
	.p-sound__viz {
		margin-top: max(0px, calc(var(--p-sound-sp-lead-gap) - 16px))
	}
	/* ボタンの文字は PC より小さいデザイン（PUSH 14 / START 28、行の高さ 20 / 40） */
	.p-sound__button-sub {
		font-size: max(12px, calc(var(--p-sound-u) * 14));
		line-height: 1.43
	}
	.p-sound__button-main {
		font-size: calc(var(--p-sound-u) * 28);
		line-height: 1.43
	}
	.p-sound__mode {
		margin-top: clamp(10px, calc(var(--p-sound-sp-free) * 48.5 / 304.6), 48.5px)
	}
	.p-sound__mode-label {
		font-size: 12px;
		line-height: 1.43
	}
	.p-sound__mode-text {
		margin-top: 9px;
		font-size: 12px;
		line-height: 1.25
	}
	/* 切替は文字をデザイン（1/2 で 10px）から 12px にした比率 1.2 で、寸法も同じ比率で拡大
	   デザイン1/2: 外枠 260.5×24 / 内側の余白 横2.5・縦2（枠線込み） / ボタン 83.5×20 / 間隔 2.5 / 角丸 12・10 */
	.p-sound__mode-switch {
		width: 312.6px;
		gap: 3px;
		margin-top: 10.2px;
		padding: 1.4px 2px;
		border-radius: 14.4px
	}
	.p-sound__mode-button {
		height: 24px;
		border-radius: 12px;
		font-size: 12px;
		line-height: 1
	}
	.p-sound__note {
		margin-top: 104px;
		padding-bottom: 25.5px;
		font-size: 12px;
		line-height: 1.64
	}
}

@media(prefers-reduced-motion: reduce) {
	.p-sound__button {
		transition: none;
		animation: none !important
	}
}
