* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html,
body {
	height: 100%;
	margin: 0;
	padding: 0;
	font-family: sans-serif;
	/* 誤操作防止（選択禁止は含めない＝通常ブラウザでは選択可） */
	touch-action: manipulation;
	overscroll-behavior: none;
}

body {
	display: flex;
	height: 100vh;
	overflow: hidden;
}

/* アプリ（ホーム画面起動＝standalone）の時だけ選択・ロングタップを無効化 */
@media (display-mode: standalone) {

	html,
	body {
		user-select: none;
		-webkit-user-select: none;
		-webkit-touch-callout: none;
	}
}

/* 左サイドバー */
.sidebar {
	flex: 0 0 175px;
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 12px;
	background-color: #767676;
}

.sidebar h1 {
	margin: 0 0 8px;
	color: #fff;
	font-size: 16px;
}

.sidebar h2 {
	margin: 16px 0 4px;
	padding-top: 12px;
	border-top: 1px solid #444;
	color: #ddd;
	font-size: 13px;
}

.nav_link {
	display: block;
	padding: 16px 4px;
	border-radius: 6px;
	background-color: #333;
	color: #fff;
	font-size: 14px;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.nav_link.is_active {
	background-color: #e8512f;
}

/* サイドバーの区切り線（経線） */
.side_line {
	margin: 4px 0;
	border: none;
	border-top: 1px solid #444;
}

/* サイドバーのリロードボタン（背景色グループの直下） */
.reload_btn {
	padding: 9px 4px;
	border: none;
	border-radius: 6px;
	background-color: #c9c9c9;
	color: #000;
	font-size: 14px;
	cursor: pointer;
	margin-top: 26px;
}

.reload_btn:active {
	background-color: #222;
}

/* メインエリア（各ビューを内包） */
.content {
	position: relative;
	flex: 1 1 auto;
	overflow: hidden;
}

.view {
	position: absolute;
	inset: 0;
	display: none;
	background-color: #fff;
}

.view.is_active {
	display: block;
}

/* 数字パネル（十字・マス目共通） */
.num_panel {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	padding: 24px;
	background-color: #fff;
}

.num_panel p {
	margin: 17px 0 9px;
	font-size: 28px;
	color: #111;
	font-weight: bold;
	line-height: 100%;
}

.num_panel p:first-child {
	margin-top: 0;
}

.num_grid {
	display: flex;
	flex-wrap: nowrap;
	/* 幅が足りない時は縮めて必ず1行に収める */
	gap: clamp(6px, 1.6vw, 16px);
	justify-content: center;
	width: 100%;
}

.num_btn {
	/* 最大 16vmin まで。画面が狭ければ縮んで1行を維持 */
	flex: 1 1 0;
	min-width: 0;
	max-width: 16vmin;
	height: 16vmin;
	border: none;
	border-radius: 12px;
	background-color: #000;
	color: #fff;
	font-size: 7vmin;
	font-weight: bold;
	white-space: nowrap;
	cursor: pointer;
}

#gridCount .num_btn,
#crossCount .num_btn {
	background-color: #730000;
}

.num_btn.time,
.num_btn.prob {
	height: 10vmin;
	font-size: 4vmin;
}

/* 「ずっと」ボタンは文字が長いので小さめ */
.num_btn.endless {
	font-size: 4vmin;
}

.num_btn.is_sel {
	background-color: #e8512f;
}

/* 色切り替えの間隔ボタンは小さめ（1行に収める。A/Bには影響させないためID指定） */
#color1Min .num_btn,
#color1Max .num_btn,
#color2Min .num_btn,
#color2Max .num_btn {
	max-width: 13vmin;
	height: 12vmin;
	font-size: 3vmin;
}

/* ボタン内の補助テキスト（秒数を小さく） */
.btn_sub {
	display: block;
	margin-top: 2px;
	font-size: 0.55em;
	font-weight: normal;
}

/* スタートボタン（色切り替えの開始）＝大きめ */
.start_go {
	margin-top: 62px;
	padding: 28px 88px;
	border: none;
	border-radius: 12px;
	background-color: #8a0000;
	color: #fff;
	font-size: 8vmin;
	font-weight: bold;
	cursor: pointer;
	width: 80%;
}

/* 待機中の中央ドット（十字） */
.dot {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
}

.dot span {
	width: 40vmin;
	height: 40vmin;
	border-radius: 50%;
	background-color: #111;
}

/* 矢印 */
.arrow {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
}

.arrow svg {
	width: 88vmin;
	height: 88vmin;
	fill: #ffe100;
}

/* 同じ方向が2回続いた時に一度点滅 */
@keyframes arrowBlink {

	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0;
	}
}

.arrow.is_blink svg {
	animation: arrowBlink 0.35s ease;
}

/* 文字表示（白背景・黒文字） */
.word {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background-color: #fff;
	color: #111;
	font-size: 45vmin;
	line-height: 1;
	font-weight: bold;
	text-align: center;
	white-space: nowrap;
}

/* カウントダウン */
.countdown {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	font-size: 50vmin;
	font-weight: bold;
	color: #111;
}

/* 色切り替え画面の矢印は黒（黄・青どちらの背景でも見えるように） */
#view-color1 .arrow svg,
#view-color2 .arrow svg {
	fill: #111;
}

/* 左下の経過秒数カウンター（十字・マス目） */
.sec_corner {
	position: absolute;
	left: 24px;
	bottom: 24px;
	z-index: 10;
	display: none;
	align-items: center;
	justify-content: center;
	min-width: 39.6vmin;
	padding: 6px 19px;
	border-radius: 33px;
	background-color: #000;
	color: #fff;
	font-size: 243px;
	font-weight: bold;
	line-height: 100%;
	letter-spacing: -6%;
	pointer-events: none;
}

/* リセットボタン（右下・丸形・端から離す） */
.reset_btn {
	position: absolute;
	right: 70px;
	bottom: 70px;
	z-index: 10;
	display: none;
	align-items: center;
	justify-content: center;
	width: 76px;
	height: 76px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background-color: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 14px;
	cursor: pointer;
}

.is_show {
	display: flex;
}

/* アプリ（ホーム画面起動＝standalone）で縦持ちの時は強制的に横向き表示にする */
@media all and (display-mode: standalone) and (orientation: portrait) {
	html {
		overflow: hidden;
	}

	body {
		position: absolute;
		top: 0;
		left: 100%;
		width: 100vh;
		height: 100vw;
		transform: rotate(90deg);
		transform-origin: left top;
		overflow: hidden;
	}
}
