/*
	SIAM WORKS ゲームコーナー
	白い床と白い筐体に、赤・黄・青・緑のはっきりした原色を置く。
	暗い背景と光るふちは使わない。影は薄く、形は丸く、押せるものは押した手ごたえを返す。
*/

:root {
	--red: #e6141e;
	--red-deep: #ad0c15;
	--ink: #2a2a2e;
	--sub: #686d76;
	--paper: #ffffff;
	--mist: #eef2f6;
	--line: #e3e7ec;
	--f: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
	--reserve: 240px;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--mist);
	color: var(--ink);
	font-family: var(--f);
	font-weight: 700;
	line-height: 1.6;
}

button {
	font: inherit;
	color: inherit;
}

/* ───────── ローダー ─────────
   筐体の操作台と同じ絵（レバーと 3 つのボタン）。レバーが左右に倒れ、ボタンが順に押される */

.loader {
	display: none;
	position: fixed;
	z-index: 10;
	inset: 0;
	place-content: center;
	justify-items: center;
	gap: 22px;
	background: #fff;
}

.is-loading .loader,
.loader.is-done {
	display: grid;
}

/* 用意ができたら、幕が丸く閉じて消える */
.loader.is-done {
	pointer-events: none;
	animation: iris .7s cubic-bezier(.65, 0, .9, .45) forwards;
}

.loader__panel {
	display: flex;
	align-items: center;
	gap: 14px;
	height: 86px;
	padding: 0 26px 0 22px;
	background: #25272c;
	border-radius: 26px;
	box-shadow: 0 6px 0 #101114;
}

.loader__stick {
	position: relative;
	width: 46px;
	height: 46px;
	margin-right: 12px;
	background: radial-gradient(circle, #111216 0 30%, #aeb5bf 31% 62%, #6d747e 63%);
	border-radius: 50%;
}

.loader__stick i {
	position: absolute;
	left: 50%;
	bottom: 50%;
	width: 8px;
	height: 40px;
	margin-left: -4px;
	background: #cfd4db;
	border-radius: 4px;
	transform-origin: 50% 100%;
	animation: stick 1.1s ease-in-out infinite alternate;
}

.loader__stick i::after {
	content: "";
	position: absolute;
	left: 50%;
	top: -22px;
	width: 34px;
	height: 34px;
	margin-left: -17px;
	background: radial-gradient(circle at 34% 28%, #ff9ba1 0 10%, var(--red) 45%, #a70d15 100%);
	border-radius: 50%;
}

.loader__btn {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	animation: press 1.2s ease-in-out infinite;
}

.loader__btn--1 { background: #ffc400; box-shadow: 0 5px 0 #b98c00; animation-delay: 0s; }
.loader__btn--2 { background: #1f9ff0; box-shadow: 0 5px 0 #136fa9; animation-delay: .18s; margin-top: -16px; }
.loader__btn--3 { background: #2fb457; box-shadow: 0 5px 0 #1f7d3b; animation-delay: .36s; }

.loader__bar {
	width: 220px;
	height: 12px;
	overflow: hidden;
	background: #e7ebf0;
	border-radius: 999px;
}

.loader__fill {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--red);
	border-radius: 999px;
	transform: scaleX(0);
	transform-origin: 0 50%;
	transition: transform .35s ease-out;
	/* 本体が動き出すまでは、少しずつ進んで見せる */
	animation: creep 6s ease-out forwards;
}

.loader__text {
	margin: -8px 0 0;
	color: var(--sub);
	font-size: .85rem;
	font-weight: 800;
	letter-spacing: .2em;
}

/* 読み込み中は、うしろの一覧とロゴを見せない */
.is-loading .games,
.is-loading .top {
	visibility: hidden;
}

/* ───────── 3D が使えるとき ───────── */

.stage,
.now,
.veil {
	display: none;
}

.has-3d,
.has-3d body {
	height: 100%;
	overflow: hidden;
	overscroll-behavior: none;
}

.has-3d .stage {
	display: block;
	position: fixed;
	inset: 0;
	background:
		radial-gradient(70% 55% at 50% 42%, #ffffff 0 34%, rgba(255, 255, 255, 0) 100%),
		linear-gradient(180deg, #f4f7fa 0%, #e6ecf2 100%);
}

.stage canvas {
	display: block;
	width: 100%;
	height: 100%;
	cursor: grab;
	touch-action: pan-y;
	-webkit-tap-highlight-color: transparent;
	outline: none;
}

.stage canvas.is-over {
	cursor: pointer;
}

.stage canvas.is-grabbing {
	cursor: grabbing;
}

/* ロゴ */
.top {
	padding: 18px 20px 0;
}

.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.has-3d .top {
	position: fixed;
	z-index: 3;
	top: 0;
	left: 0;
	right: 0;
	padding: calc(12px + env(safe-area-inset-top)) 18px 0;
	pointer-events: none;
}

/* プライバシーのページへ（右上の小さなリンク） */
.top__link {
	margin-left: auto;
	padding: .3em 1em .26em;
	background: rgba(255, 255, 255, .88);
	border-radius: 999px;
	color: var(--sub);
	font-size: .72rem;
	font-weight: 800;
	letter-spacing: .04em;
	text-decoration: none;
	pointer-events: auto;
}

.top__link:focus-visible {
	outline: 3px solid var(--ink);
	outline-offset: 3px;
}

/* せまい画面では、塔の看板がロゴの役をする。文字のロゴは読み上げ用に残して見えなくする */
@media (max-width: 759px) {
	.has-3d .logo {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

.logo {
	margin: 0;
	color: var(--red);
	font-size: clamp(1.1rem, .95rem + .8vw, 1.6rem);
	font-weight: 900;
	letter-spacing: .05em;
	line-height: 1.2;
}

/* 前へ・次へ（案内の上の段、点の両わき） */
.now__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.nav {
	display: grid;
	place-items: center;
	flex: none;
	width: 40px;
	height: 40px;
	padding: 0;
	background: var(--mist);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 3px 0 #d3d9e0;
	cursor: pointer;
	transition: transform .08s, box-shadow .08s;
}

.nav::before {
	content: "";
	width: 11px;
	height: 11px;
	border: solid var(--red);
	border-width: 0 0 4px 4px;
	border-radius: 2px;
	transform: translateX(2px) rotate(45deg);
}

.nav--next::before {
	transform: translateX(-2px) rotate(-135deg);
}

.nav:active {
	transform: translateY(3px);
	box-shadow: 0 0 0 #d3d9e0;
}

/* いま正面にある台の案内 */
.has-3d .now {
	display: grid;
	gap: 12px;
	position: fixed;
	z-index: 3;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
	background: var(--paper);
	border-radius: 28px 28px 0 0;
	box-shadow: 0 -6px 30px rgba(30, 40, 60, .1);
}

.dots {
	display: flex;
	justify-content: center;
	gap: 7px;
}

.dot {
	width: 8px;
	height: 8px;
	padding: 0;
	background: #d5dbe2;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: width .2s, background-color .2s;
}

.dot.is-on {
	width: 22px;
	background: var(--red);
}

.now__text.is-swap {
	animation: swap .32s cubic-bezier(.3, 1.5, .5, 1);
}

.now__title {
	margin: 0;
	font-size: clamp(1.45rem, 1.2rem + 1.2vw, 2rem);
	font-weight: 900;
	line-height: 1.25;
	letter-spacing: .01em;
}

.now__genre {
	display: inline-block;
	margin: .45em 0 0;
	padding: .14em .8em .1em;
	background: var(--mist);
	border-radius: 999px;
	color: var(--sub);
	font-size: .76rem;
	font-weight: 800;
}

.now__desc {
	margin: .5em 0 0;
	font-size: .95rem;
	line-height: 1.6;
	word-break: auto-phrase;
	text-wrap: balance;
}

.now__hold {
	display: flex;
	align-items: center;
	gap: .45em;
	margin: .35em 0 0;
	color: var(--sub);
	font-size: .78rem;
}

.phone {
	flex: none;
	border: 2px solid currentColor;
	border-radius: 3px;
}

.phone--tate { width: 10px; height: 16px; }
.phone--yoko { width: 16px; height: 10px; }

/* 「あそぶ」：押すと沈む */
.play {
	display: grid;
	place-items: center;
	height: 58px;
	background: var(--red);
	border-radius: 999px;
	box-shadow: 0 6px 0 var(--red-deep), 0 12px 20px rgba(230, 20, 30, .22);
	color: #fff;
	font-size: 1.3rem;
	font-weight: 900;
	letter-spacing: .16em;
	text-decoration: none;
	transition: transform .07s, box-shadow .07s;
	-webkit-tap-highlight-color: transparent;
}

.play:active {
	transform: translateY(5px);
	box-shadow: 0 1px 0 var(--red-deep), 0 4px 8px rgba(230, 20, 30, .22);
}

.play:focus-visible,
.nav:focus-visible,
.dot:focus-visible,
.games a:focus-visible {
	outline: 3px solid var(--ink);
	outline-offset: 3px;
}

/* 飛び込むとき：案内を引っこめて、最後に白で包む */
.has-3d .veil {
	display: block;
	position: fixed;
	z-index: 6;
	inset: 0;
	background: #fff;
	opacity: 0;
	pointer-events: none;
	transition: opacity .26s;
}

.is-veiled .veil {
	opacity: 1;
}

/* 案内は、登場のときに下から弾んで出て、飛び込むときに下へ引っこむ */
.has-3d:not(.is-ready) .now {
	transform: translateY(110%);
}

.has-3d .top {
	transition: opacity .2s;
}

.is-ready .now {
	transition: transform .6s cubic-bezier(.3, 1.35, .5, 1) .9s;
}

.is-diving .now {
	transition: transform .28s cubic-bezier(.4, 0, .8, .4);
}

.is-diving .top {
	opacity: 0;
}

.is-diving .now {
	transform: translateY(105%);
}

/* 3D のとき、一覧は見えなくするが、読み上げとキーボードには残す */
.has-3d .games {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ───────── 広い画面 ───────── */

@media (min-width: 760px) {
	.has-3d .top {
		padding: 22px 30px 0;
	}

	.has-3d .now {
		grid-template-columns: 1fr auto;
		grid-template-areas: "head head" "text play";
		align-items: center;
		gap: 10px 28px;
		left: 50%;
		right: auto;
		bottom: 26px;
		width: min(760px, calc(100% - 180px));
		padding: 14px 28px 22px 32px;
		transform: translateX(-50%);
		border-radius: 28px;
		box-shadow: 0 5px 0 #d3d9e0, 0 18px 40px rgba(30, 40, 60, .14);
	}

	.has-3d:not(.is-ready) .now,
	.is-diving .now {
		transform: translateX(-50%) translateY(150%);
	}

	.now__head { grid-area: head; }
	.now__text { grid-area: text; }

	.play {
		grid-area: play;
		width: 190px;
		height: 66px;
		font-size: 1.45rem;
	}

}

/* ───────── 3D が使えないとき：ふつうの一覧 ───────── */

.games {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
	max-width: 1100px;
	margin: 0 auto;
	padding: 20px;
	list-style: none;
}

.games a {
	display: block;
	height: 100%;
	overflow: hidden;
	background: var(--paper);
	border-radius: 20px;
	box-shadow: 0 4px 0 #d3d9e0;
	color: inherit;
	text-decoration: none;
}

.games img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.games span {
	display: block;
	padding: 0 16px;
}

.g-title {
	margin-top: 12px;
	font-size: 1.2rem;
	font-weight: 900;
	line-height: 1.3;
}

.g-genre,
.g-hold {
	color: var(--sub);
	font-size: .78rem;
}

.g-desc {
	margin: .3em 0;
	font-size: .9rem;
}

.g-hold {
	padding-bottom: 14px;
}

/* ───────── 文章のページ（プライバシー） ───────── */

.doc-page {
	background: var(--paper);
	font-weight: 500;
}

.doc-top {
	padding: 20px 20px 0;
}

.doc-top .logo {
	text-decoration: none;
}

.doc {
	max-width: 40rem;
	margin: 0 auto;
	padding: 28px 20px 24px;
	line-height: 1.95;
}

.doc h1 {
	margin: 0 0 1.2em;
	font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem);
	font-weight: 900;
	line-height: 1.35;
}

.doc h2 {
	margin: 2.4em 0 .5em;
	font-size: 1.12rem;
	font-weight: 900;
	line-height: 1.5;
}

.doc p {
	margin: 0 0 1em;
}

.doc a {
	color: var(--red);
	text-underline-offset: .2em;
}

.doc-foot {
	max-width: 40rem;
	margin: 0 auto;
	padding: 8px 20px 56px;
}

.doc-back {
	display: inline-block;
	padding: .7em 1.6em .62em;
	background: var(--red);
	border-radius: 999px;
	box-shadow: 0 5px 0 var(--red-deep);
	color: #fff;
	font-weight: 900;
	text-decoration: none;
	transition: transform .07s, box-shadow .07s;
}

.doc-back:active {
	transform: translateY(4px);
	box-shadow: 0 1px 0 var(--red-deep);
}

.doc a:focus-visible,
.doc-back:focus-visible,
.doc-top .logo:focus-visible {
	outline: 3px solid var(--ink);
	outline-offset: 3px;
}

/* ───────── 動き ───────── */

@keyframes iris {
	from { clip-path: circle(125% at 50% 46%); }
	to { clip-path: circle(0% at 50% 46%); }
}

@keyframes stick {
	from { transform: rotate(-24deg); }
	to { transform: rotate(24deg); }
}

@keyframes press {
	0%, 30%, 100% { transform: none; }
	14% { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
}

@keyframes creep {
	to { transform: scaleX(.26); }
}

@keyframes swap {
	0% { opacity: 0; transform: translateY(8px) scale(.97); }
	100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.now__text.is-swap {
		animation: none;
	}

	.has-3d .top,
	.has-3d .now,
	.has-3d .veil {
		transition: none;
	}

	.loader.is-done {
		animation: none;
		display: none;
	}

	.loader__stick i,
	.loader__btn {
		animation: none;
	}
}
