/* リスの島。
   全画面の遊びなので、辞典の体裁は持ち込まない。
   画面の上に重ねる部品だけをここで書く。 */

* { box-sizing: border-box; }

html, body {
	height: 100%;
	margin: 0;
	overflow: hidden;
	background: #8FC7E8;
	color: #201C16;
	font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
	-webkit-text-size-adjust: 100%;
	overscroll-behavior: none;
}

#view {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	touch-action: none;
}

/* 重ねる層。**押せる部品だけが押せるようにする** ——
   ここを素通しにしておかないと、画面のどこを押しても手榴弾が飛ばない */
.frame {
	position: fixed;
	inset: 0;
	pointer-events: none;
	padding: env(safe-area-inset-top) env(safe-area-inset-right)
		env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.frame button,
.frame a,
.frame input,
.frame details,
.panel { pointer-events: auto; }

/* --- 待ち合わせ --- */
.panel {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(92vw, 30rem);
	max-height: 92vh;
	overflow-y: auto;
	padding: 1.4rem 1.5rem 1.2rem;
	border-radius: 14px;
	background: rgba(252, 251, 247, .95);
	box-shadow: 0 18px 50px rgba(20, 30, 20, .3);
}
.panel[hidden] { display: none; }
.panel h1 {
	margin: 0 0 .3em;
	font-size: 1.5rem;
}
.panel h2 {
	margin: 1.2em 0 .4em;
	font-size: .95rem;
	color: #5A5245;
}
.lead {
	margin: 0 0 1em;
	font-size: .9rem;
	line-height: 1.65;
	color: #4A443A;
}
.who label {
	display: block;
	font-size: .82rem;
	color: #5A5245;
	margin-bottom: .3em;
}
.who-row {
	display: flex;
	gap: .5em;
}
#name-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: .5em .8em;
	border: 1px solid #C8BFAF;
	border-radius: 999px;
	background: #FFF;
	font-size: 1rem;
	font-family: inherit;
}
.panel button,
.again {
	padding: .5em 1.1em;
	border: 1px solid #C8BFAF;
	border-radius: 999px;
	background: #FFF;
	color: #333;
	font-size: .92rem;
	font-family: inherit;
	cursor: pointer;
}
.panel button:hover:not(:disabled) { background: #F0EBE0; }
.panel button:disabled { opacity: .45; cursor: default; }
.hint {
	margin: .5em 0 0;
	font-size: .75rem;
	color: #8A8274;
}
#lobby-count { color: #8A8274; font-weight: normal; }
#lobby-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: .4em .6em;
}
#lobby-list li {
	display: flex;
	align-items: center;
	gap: .4em;
	padding: .3em .8em;
	border-radius: 999px;
	background: #F1ECE1;
	font-size: .9rem;
}
#lobby-list i {
	width: .7em;
	height: .7em;
	border-radius: 50%;
}
.timer {
	margin: .8em 0 0;
	font-size: 1.05rem;
	font-weight: bold;
	color: #3C6E33;
}
.how {
	margin: 1.2em 0 0;
	font-size: .85rem;
	color: #4A443A;
}
.how summary { cursor: pointer; color: #2A5C9A; }
.how dl {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: .25em .8em;
	margin: .7em 0;
}
.how dt { font-weight: bold; }
.how dd { margin: 0; }
.how p { margin: .4em 0 0; font-size: .8rem; color: #6A6254; }
.back { margin: 1.2em 0 0; font-size: .82rem; }
.back a { color: #2A5C9A; }

.practice {
	margin: 1em 0 .6em;
	padding: .6em .8em;
	border-radius: 8px;
	background: #EDF6E6;
	font-size: .85rem;
	line-height: 1.6;
	color: #2F5A2A;
}
.practice small { color: #5A6E55; font-size: .78rem; }
.panel button.primary {
	width: 100%;
	padding: .6em 1.1em;
	border-color: #2F7A34;
	background: #3C8F41;
	color: #FFF;
	font-weight: bold;
}
.panel button.primary:hover:not(:disabled) { background: #2F7A34; }

/* 閉じた箱を呼び戻す釦。**画面の隅に小さく。** 練習の邪魔をしない */
.lobby-open {
	position: absolute;
	top: 2.6rem;
	left: 50%;
	transform: translateX(-50%);
	padding: .35em 1em;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, .55);
	color: #1A1712;
	font-size: .82rem;
	font-family: inherit;
	cursor: pointer;
}
.lobby-open[hidden] { display: none; }

/* 音の入り切り。**隅に小さく、いつでも押せるところに。**
   音の出る頁で、止め方が見つからないのがいちばん困る */
.mute {
	position: absolute;
	top: .6rem;
	right: .7rem;
	width: 2.2rem;
	height: 2.2rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .42);
	color: #1A1712;
	font-size: 1rem;
	line-height: 1;
	font-family: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.mute[aria-pressed="true"] { color: #8A8274; background: rgba(255, 255, 255, .25); }

/* --- 試合中の表示 --- */
.hud {
	position: absolute;
	top: .7rem;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: 1.2em;
	font-size: .95rem;
	font-weight: bold;
	text-shadow: 0 2px 6px rgba(0, 0, 0, .55);
	color: #FFF;
}
.hud[hidden] { display: none; }
/* 残弾。黒丸と白丸で数を出す。字より目で拾いやすい */
.hud-ammo {
	letter-spacing: .12em;
	color: #FFE9A8;
}

.banner {
	position: absolute;
	top: 34%;
	left: 0;
	right: 0;
	margin: 0;
	text-align: center;
	font-size: clamp(1.8rem, 8vw, 3.4rem);
	font-weight: bold;
	color: #FFF;
	text-shadow: 0 4px 18px rgba(0, 0, 0, .6);
}
.banner[hidden] { display: none; }

.again {
	position: absolute;
	top: 52%;
	left: 50%;
	transform: translateX(-50%);
	font-size: 1.05rem;
	padding: .6em 1.6em;
}
.again[hidden] { display: none; }

.error {
	position: absolute;
	bottom: 1rem;
	left: 50%;
	transform: translateX(-50%);
	margin: 0;
	padding: .5em 1em;
	border-radius: 999px;
	background: rgba(120, 40, 30, .85);
	color: #FFF;
	font-size: .85rem;
}
.error[hidden] { display: none; }

/* --- 手元の釦 --- */
.pad {
	position: absolute;
	inset: auto 0 0 0;
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	padding: 0 1rem 1.2rem;
}
.pad[hidden] { display: none; }
.pad-move {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .3rem;
}
.pad-lr { display: flex; gap: 3.2rem; }
.pad button {
	pointer-events: auto;
	width: 3.3rem;
	height: 3.3rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .34);
	color: #1A1712;
	font-size: 1.05rem;
	font-family: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: none;
	user-select: none;
}
.pad button.on { background: rgba(255, 255, 255, .68); }
.pad-jump {
	width: 4.4rem !important;
	height: 4.4rem !important;
	font-weight: bold;
}

@media (max-width: 420px) {
	.pad button { width: 2.9rem; height: 2.9rem; }
	.pad-lr { gap: 2.6rem; }
	.pad-jump { width: 3.8rem !important; height: 3.8rem !important; }
}
