/* ミニゲーム「ペーパー・アタッカー」の全画面（inc/game.php・template-parts/game-screen.php） */

.gn-game-body {
	--gn-game-ink: #3b2a4a;
	--gn-game-night: #2a1f3d;
	--gn-game-deep: #1a1326;
	--gn-game-cream: #fff4e6;
	--gn-game-gold: #fbbf24;
	margin: 0;
	height: 100%;
	overflow: hidden;
	overscroll-behavior: none;
	background: var(--gn-game-deep);
}
html:has(.gn-game-body) { height: 100%; background: #1a1326; }

.gn-game {
	position: fixed; inset: 0;
	display: flex; flex-direction: column;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
	/* 画面の外側は星空 */
	background:
		radial-gradient(1px 1px at 12% 18%, rgba(255, 244, 230, .7) 50%, transparent 51%),
		radial-gradient(1px 1px at 78% 12%, rgba(255, 244, 230, .6) 50%, transparent 51%),
		radial-gradient(1.5px 1.5px at 88% 64%, rgba(251, 191, 36, .6) 50%, transparent 51%),
		radial-gradient(1px 1px at 6% 72%, rgba(255, 244, 230, .5) 50%, transparent 51%),
		radial-gradient(1px 1px at 32% 90%, rgba(255, 244, 230, .4) 50%, transparent 51%),
		radial-gradient(ellipse at 50% 120%, #4a2a4f 0%, var(--gn-game-deep) 60%);
	color: var(--gn-game-cream);
	font-family: 'DotGothic16', 'Hiragino Sans', sans-serif;
	line-height: 1.6;
	-webkit-tap-highlight-color: transparent;
}
/* サイト共通の style.css は外しているので、ここで border-box にそろえる */
.gn-game, .gn-game *, .gn-game *::before, .gn-game *::after { box-sizing: border-box; }
.gn-game button { font: inherit; cursor: pointer; }
.gn-game a { color: inherit; }

/* 上のバー：もどる・スコア・ボタン */
.gn-game__bar {
	flex: none;
	display: flex; align-items: center; gap: 12px;
	height: 48px; padding: 0 12px;
	font-size: 14px;
}
.gn-game__back {
	flex: none;
	padding: 4px 12px 4px 8px;
	border: 1px solid rgba(255, 244, 230, .35); border-radius: 999px;
	text-decoration: none; font-size: 13px;
}
.gn-game__back:hover { background: rgba(255, 244, 230, .12); }
.gn-game__hud { flex: 1; display: flex; justify-content: center; gap: 14px; min-width: 0; white-space: nowrap; }
.gn-game__hud b { font-weight: 400; color: var(--gn-game-gold); }
.gn-game__lives { color: #fb7185; letter-spacing: 2px; }
.gn-game__tools { flex: none; display: flex; gap: 6px; min-width: 64px; justify-content: flex-end; }
.gn-game__tool {
	width: 30px; height: 30px; padding: 0;
	border: 1px solid rgba(255, 244, 230, .35); border-radius: 8px;
	background: none; color: inherit; font-size: 13px; line-height: 1;
}
.gn-game__tool[hidden] { display: none; }

/* ゲーム画面（大きさは game.js の fit() で 3:4 に合わせる） */
.gn-game__main {
	flex: 1; min-height: 0;
	display: grid; place-items: center;
	padding: 0 8px;
}
.gn-game__stage {
	position: relative;
	width: 180px; height: 240px;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 0 0 3px #3b2a4a, 0 0 0 6px #120c1b, 0 12px 40px rgba(0, 0, 0, .5);
	font-size: clamp(12px, calc(var(--gn-scale, 2) * 5.4px), 17px);
}
.gn-game__canvas {
	display: block; width: 100%; height: 100%;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
	touch-action: none;
	user-select: none; -webkit-user-select: none;
}

.gn-game__toast {
	position: absolute; left: 8px; right: 8px; top: 8px;
	padding: 6px 10px;
	background: rgba(255, 244, 230, .95); color: var(--gn-game-ink);
	border: 2px solid var(--gn-game-ink); border-radius: 6px;
	font-size: .85em; line-height: 1.5;
	opacity: 0; transform: translateY(-6px);
	transition: opacity .2s, transform .2s;
	pointer-events: none;
}
.gn-game__toast.is-show { opacity: 1; transform: none; }
.gn-game__toast small { display: block; font-size: .8em; color: #c2410c; }

/* スタート・あそびかた・ひと休み・おしまい */
.gn-game__screen {
	position: absolute; inset: 0;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3em;
	padding: 1.2em;
	background: rgba(26, 19, 38, .78);
	text-align: center;
	overflow-y: auto;
}
.gn-game__screen[hidden] { display: none; }
.gn-game__screen p { margin: 0 0 .6em; }
.gn-game__screen--over { justify-content: flex-start; padding-top: 1.8em; }
.gn-game__title {
	margin: 0 0 .4em;
	font-size: 1.9em; font-weight: 400; line-height: 1.25;
	color: var(--gn-game-gold); text-shadow: 3px 3px 0 #c2410c;
}
.gn-game__small { font-size: .8em; opacity: .85; }

.gn-game__btn {
	display: inline-block;
	padding: .45em 1.4em;
	border: 2px solid var(--gn-game-cream); border-radius: 8px;
	background: #ea580c; color: #fff;
	font-size: 1.1em; line-height: 1.4;
	box-shadow: 0 4px 0 #9a3412;
	text-decoration: none;
}
.gn-game__btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #9a3412; }
.gn-game__btn:focus-visible, .gn-game__link:focus-visible, .gn-game__back:focus-visible { outline: 2px dashed var(--gn-game-gold); outline-offset: 3px; }
.gn-game__btn--sub { background: var(--gn-game-night); box-shadow: 0 4px 0 #000; }
.gn-game__link {
	padding: .2em .4em; border: 0; background: none;
	color: var(--gn-game-cream); font-size: .85em;
	text-decoration: underline; text-underline-offset: 4px; opacity: .9;
}
.gn-game__actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .7em 1em; margin: .4em 0 1.2em; }

/* あそびかた */
.gn-game__card {
	width: 100%; max-width: 26em;
	margin: auto;
	padding: 1em 1em 1.2em;
	background: var(--gn-game-cream); color: var(--gn-game-ink);
	border: 3px solid var(--gn-game-ink); border-radius: 10px;
	box-shadow: 0 6px 0 rgba(0, 0, 0, .35);
	text-align: left;
}
.gn-game__card-title { margin: 0 0 .6em !important; text-align: center; font-size: 1.25em; color: #c2410c; }
.gn-game__steps { list-style: none; margin: 0 0 1em; padding: 0; display: grid; gap: .8em; }
.gn-game__steps li { display: flex; gap: .8em; align-items: center; font-size: .82em; line-height: 1.55; }
.gn-game__steps b { display: block; font-weight: 400; font-size: 1.1em; color: var(--gn-game-ink); }
.gn-game__steps span span { display: block; }
.gn-game__icons {
	flex: none; width: 5.2em; min-height: 2.6em; display: flex; justify-content: center; align-items: center; gap: .2em;
	padding: .3em 0; background: var(--gn-game-night); border-radius: 6px;
}
.gn-game__icons img { width: calc(var(--w, 11) * .2em); height: auto; image-rendering: pixelated; }
.gn-game__card .gn-game__btn { display: block; margin: 0 auto; }

/* おしまいの記事一覧 */
.gn-game__list-title { font-size: .9em; color: var(--gn-game-gold); }
.gn-game__list { list-style: none; margin: 0 0 1em; padding: 0; width: 100%; max-width: 26em; text-align: left; }
.gn-game__list li { margin: 0 0 .5em; }
.gn-game__list a {
	display: flex; gap: .7em; align-items: center;
	padding: .4em; border-radius: 8px;
	background: var(--gn-game-cream); color: var(--gn-game-ink);
	font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif; font-size: .85em; line-height: 1.5;
	text-decoration: none;
}
.gn-game__list img { flex-shrink: 0; width: 4.4em; height: 3.3em; object-fit: cover; border-radius: 4px; }
.gn-game__list small { display: block; color: #c2410c; font-size: .8em; }

/* 下のやり方 */
.gn-game__foot {
	flex: none;
	display: flex; justify-content: center; align-items: center; gap: 12px;
	min-height: 44px; padding: 4px 12px;
	font-size: 12px; color: rgba(255, 244, 230, .75);
}
.gn-game__foot p { margin: 0; min-width: 0; }
.gn-game__foot .gn-game__link { flex: none; white-space: nowrap; }
.gn-game__noscript { position: absolute; inset: auto 0 50%; text-align: center; }

/* 操作の説明は、タッチかキーボードかで出し分ける */
.gn-game__only-key { display: none !important; }
@media (hover: hover) and (pointer: fine) {
	.gn-game__only-touch { display: none !important; }
	.gn-game__only-key { display: inline !important; }
	.gn-game__steps .gn-game__only-key { display: block !important; }
}

/* 横向きのスマホなど、高さが足りないときは下のやり方をしまう */
@media (max-height: 520px) {
	.gn-game__bar { height: 40px; }
	.gn-game__foot { display: none; }
	.gn-game__main { padding-bottom: 6px; }
}
@media (max-width: 380px) {
	.gn-game__bar { gap: 6px; padding: 0 8px; font-size: 12px; }
	.gn-game__back { padding: 3px 8px 3px 6px; font-size: 12px; }
	.gn-game__hud { gap: 8px; }
	.gn-game__hud-label { display: none; }
	.gn-game__tools { min-width: 0; }
	.gn-game__tool { width: 26px; height: 26px; }
}
