/*
 * style.css — D案 (コミカル太枠+パステル+丸ゴシック)
 * version 1.2 / last-modified 2026-04-28
 */

* { box-sizing: border-box; }

body {
	font-family: 'Yusei Magic', 'Hiragino Maru Gothic ProN', 'Noto Sans JP', sans-serif;
	background: #f4f1e8;
	color: #222;
	margin: 0;
	padding: 0;
	line-height: 1.5;
}

a { color: #222; }

.page {
	max-width: 720px;
	margin: 0 auto;
	padding: 16px;
}
.lv-break { display: none; }

/* Header */
.hd {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 0;
	margin-bottom: 8px;
	flex-wrap: wrap;
	gap: 8px;
}
.hd h1 {
	font-size: 18px;
	margin: 0;
}
@media (max-width: 600px) {
	.hd h1 { font-size: 14px; }
}
.hd-left {
	display: flex;
	align-items: center;
	gap: 6px;
}
.hd-left button,
.hd-actions button {
	background: #fff;
	border: 3px solid #222;
	padding: 6px 10px;
	cursor: pointer;
	font-family: inherit;
	font-size: 17px;
	box-sizing: border-box;
	min-width: 50px;
	text-align: center;
	transition: background 0.1s;
}
.hd-left button:hover,
.hd-actions button:hover {
	background: #d6ecff;
}
.hd-left button:active,
.hd-actions button:active {
	transform: translate(2px, 2px);
}
.hd-actions {
	display: flex;
	gap: 6px;
}

/* Steps */
.step {
	border: 3px solid #222;
	background: #fff;
	padding: 16px;
	margin: 12px 0;
	transition: opacity 0.3s;
}
.step h2 {
	margin-top: 0;
	font-size: 16px;
	padding: 4px 12px;
	background: #222;
	color: #fff;
	display: inline-block;
}
.step-locked {
	display: none;
}

/* Buttons */
.btn-gacha {
	font-size: 22px;
	font-weight: bold;
	padding: 18px 28px;
	background: #ffd966;
	border: 3px solid #222;
	cursor: pointer;
	font-family: inherit;
	display: block;
	margin: 30px auto;
	border-radius: 28px;
	line-height: 1.3;
}
.btn-gacha:hover {
	opacity: 0.7;
}
.btn-gacha:active {
	transform: translate(3px, 3px);
}
.btn-large {
	font-size: 20px;
	padding: 12px 28px;
	background: #a8e6cf;
	border: 3px solid #222;
	cursor: pointer;
	font-family: inherit;
}
.btn-large:active {
	transform: translate(3px, 3px);
}
.btn-small {
	padding: 4px 10px;
	font-size: 12px;
	background: #fff;
	border: 2px solid #222;
	margin-top: 8px;
	font-family: inherit;
	cursor: pointer;
}
.btn-yt-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	background: #ff6b6b;
	color: #fff;
	border: 2px solid #222;
	text-decoration: none;
	border-radius: 50%;
	font-size: 12px;
	flex-shrink: 0;
}
.book-meta-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 8px;
}

/* Tempo level picker (太鼓画像オーバーレイ) */
.level-pick {
	display: flex;
	gap: 8px;
	margin: 8px auto;
	justify-content: center;
	flex-wrap: wrap;
}
.lv-btn {
	width: 80px;
	height: 80px;
	border: none;
	background: url("../images/taiko-s.png") center/contain no-repeat;
	box-shadow: none;
	cursor: pointer;
	font-family: inherit;
	font-weight: bold;
	color: #fff;
	font-size: 18px;
	text-shadow:
		 1px  1px 0 #222,
		-1px  1px 0 #222,
		 1px -1px 0 #222,
		-1px -1px 0 #222,
		 0 0 4px #222;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0 0 20px 0;
	transition: transform 0.1s;
	--tint: brightness(1);
	filter: var(--tint);
}
.lv-btn[data-level="mochi"]  { --tint: hue-rotate(180deg) saturate(1.5); }
.lv-btn[data-level="yuru"]   { --tint: hue-rotate(110deg) saturate(1.3); }
.lv-btn[data-level="normal"] { --tint: brightness(1); }
.lv-btn[data-level="haya"]   { --tint: hue-rotate(-15deg) saturate(1.6); }
.lv-btn[data-level="oni"]    { --tint: hue-rotate(-35deg) saturate(2.2); }
.lv-btn:hover {
	transform: scale(1.05);
}
.lv-btn.active {
	transform: scale(1.1);
	filter: var(--tint) drop-shadow(0 0 8px #ffd966) drop-shadow(0 0 4px #ffd966);
}
.lv-btn small {
	display: block;
	font-size: 10px;
	font-weight: normal;
	margin-top: 2px;
}

/* Result areas */
.result-area:empty {
	display: none;
}
.bubble {
	background: #fff;
	border: 3px solid #222;
	padding: 8px 12px;
	margin: 6px 0;
	max-width: 90%;
	display: inline-block;
}
.bubble-host {
	background: #ffd966;
}
.bubble-anchor {
	background: #a8e6cf;
}
.char-bubble {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 6px 0;
}
.char-host {
	flex-direction: row;
}
.char-anchor {
	flex-direction: row-reverse;
}
.char-img {
	width: 64px;
	height: auto;
	flex-shrink: 0;
}
@media (max-width: 600px) {
	.char-img { width: 48px; }
}

.big-title {
	font-size: 28px;
	font-weight: bold;
	text-align: center;
	padding: 8px 14px;
	border: 3px solid #222;
	background: #fff;
	margin: 0;
	overflow-wrap: break-word;
	word-break: keep-all;
}
.book-meta {
	font-size: 18px;
	font-weight: bold;
	color: #222;
}
.big-number {
	font-size: 48px;
	font-weight: bold;
	text-align: center;
	color: #fff;
	line-height: 1.1;
	text-shadow:
		 2px  2px 0 #222,
		-2px  2px 0 #222,
		 2px -2px 0 #222,
		-2px -2px 0 #222,
		 0 0 8px #222;
}
.big-number .unit {
	font-size: 14px;
	color: #fff;
	display: block;
	margin-top: 2px;
}
.big-key {
	font-size: 56px;
	font-weight: bold;
	text-align: center;
	color: #fff;
	margin-bottom: 10px;
	text-shadow:
		 2px  2px 0 #222,
		-2px  2px 0 #222,
		 2px -2px 0 #222,
		-2px -2px 0 #222,
		 0 0 8px #222;
}

/* テンポ + キー 横並び (taiko.png 背景) */
.tempo-key-row {
	display: flex;
	gap: 12px;
	justify-content: center;
	margin-top: 50px;
}
.tempo-key-row .step {
	flex: 1;
	max-width: 220px;
}
.taiko-bg {
	position: relative;
	background: none;
	border: none;
	box-shadow: none;
	min-height: 180px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 0 30px 0;
	margin: 0;
}
.taiko-bg::before {
	content: '';
	position: absolute;
	inset: 0;
	background: url("../images/taiko.png") center/contain no-repeat;
	mix-blend-mode: multiply;
	z-index: -1;
}
.taiko-bg.step-locked {
	visibility: hidden;
}
.taiko-bg:not(.step-locked):hover {
	transform: scale(1.05);
	filter: drop-shadow(0 0 8px #ffd966);
	transition: transform 0.1s, filter 0.1s;
}
.taiko-bg .result-area:empty {
	display: none;
}

/* メトロノーム = taiko ボタン */
.metro-taiko {
	background: none;
	border: none;
	cursor: pointer;
	color: #fff;
	font-family: inherit;
	font-weight: bold;
	font-size: 38px;
	line-height: 1;
	text-align: center;
	padding: 0;
	transform: translate(2px, -4px);
	text-shadow:
		 2px  2px 0 #222,
		-2px  2px 0 #222,
		 2px -2px 0 #222,
		-2px -2px 0 #222,
		 0 0 8px #222;
}
.meta {
	text-align: center;
	font-size: 12px;
	color: #666;
	margin-top: 4px;
}

/* Modal */
.modal {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
}
.modal-bg {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
}
.modal-card {
	position: relative;
	background: #fff;
	border: 3px solid #222;
	padding: 20px;
	max-width: 90vw;
	max-height: 80vh;
	overflow-y: auto;
	min-width: 280px;
}
.modal-card h2 {
	margin: 0 0 10px;
}
.modal-close {
	margin-top: 12px;
	padding: 4px 12px;
	border: 2px solid #222;
	background: #fff;
	cursor: pointer;
	font-family: inherit;
}
.history-list {
	list-style: none;
	padding: 0;
}
.history-list li {
	padding: 6px;
	border-bottom: 1px dashed #ccc;
}
.history-list .meta {
	display: block;
	font-size: 11px;
	color: #666;
	text-align: left;
	margin-top: 2px;
}

/* Manage modal (import + delete) */
.mgmt-modal { padding: 12px 16px; }
.mgmt-section {
	margin: 6px 0;
}
.mgmt-section h3 {
	font-size: 13px;
	margin: 0 0 4px;
	padding: 2px 8px;
	background: #222;
	color: #fff;
	display: inline-block;
}
.mgmt-modal hr {
	border: none;
	border-top: 1px dashed #aaa;
	margin: 8px 0;
}
.form-block {
	display: block;
	margin: 6px 0;
}
.lbl-text {
	display: block;
	font-size: 11px;
	font-weight: bold;
	margin-bottom: 3px;
}
.form-block input[type="text"] {
	width: 100%;
	padding: 6px 8px;
	border: 2px solid #222;
	background: #fff;
	font-family: inherit;
	font-size: 13px;
}
/* Joined input + button (border 共有) */
.join {
	display: flex;
	align-items: stretch;
	border: 2px solid #222;
	background: #fff;
}
.join > input,
.join > select {
	flex: 1 1 auto;
	min-width: 0;
	border: none;
	background: transparent;
	padding: 6px 8px;
	font-family: inherit;
	font-size: 13px;
	outline: none;
}
.join > input[type="file"] {
	font-size: 11px;
	padding: 4px 6px;
}
.join-btn {
	flex: 0 0 auto;
	border: none;
	border-left: 2px solid #222;
	background: #ffd966;
	font-family: inherit;
	font-weight: bold;
	font-size: 13px;
	padding: 6px 14px;
	cursor: pointer;
}
.join-btn:hover {
	opacity: 0.7;
}
.join-btn:active {
	transform: translate(1px, 1px);
}
.join-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}
.join-btn:disabled:hover {
	opacity: 0.4;
}
.btn-danger {
	background: #ff6b6b;
	color: #fff;
}
.err-box {
	background: #ffe2e2;
	border: 2px solid #ff6b6b;
	padding: 6px 8px;
	margin-bottom: 6px;
	font-size: 12px;
}
.err-box ul {
	margin: 4px 0 0;
	padding-left: 18px;
	max-height: 140px;
	overflow-y: auto;
}
.ok-msg {
	background: #d8f3dc;
	border: 2px solid #2d6a4f;
	padding: 6px 8px;
	margin: 0 0 6px;
	font-size: 12px;
}

/* Book pick modal (📖 複数選択) */
.book-pick-modal { padding: 16px 20px; }
.book-pick-list {
	list-style: none;
	padding: 0;
	margin: 8px 0;
	max-height: 50vh;
	overflow-y: auto;
}
.book-pick-list li {
	padding: 4px 0;
	border-bottom: 1px dashed #ccc;
}
.book-pick-list label {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	font-size: 14px;
}
.book-pick-list input[type="checkbox"] {
	width: 18px;
	height: 18px;
	cursor: pointer;
}
.book-pick-list .cnt {
	font-size: 11px;
	color: #666;
	margin-left: auto;
}
.book-pick-actions {
	display: flex;
	gap: 8px;
	margin-top: 12px;
	align-items: stretch;
}
.book-pick-actions > button {
	height: 36px;
	padding: 0 16px;
	font-family: inherit;
	font-size: 13px;
	border: 2px solid #222;
	background: #fff;
	cursor: pointer;
	margin: 0;
}
.book-pick-actions > button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}
.book-pick-actions > #book-pick-ok {
	background: #ffd966;
	font-weight: bold;
}
.book-pick-actions > #book-pick-ok:hover:not(:disabled) {
	opacity: 0.7;
}

/* Help modal (?) */
.help-modal { padding: 16px 20px; }
.help-section {
	margin: 8px 0 12px;
}
.help-section h3 {
	font-size: 13px;
	margin: 0 0 4px;
	padding: 2px 8px;
	background: #222;
	color: #fff;
	display: inline-block;
}
.help-section p {
	margin: 4px 0;
	font-size: 12px;
	line-height: 1.5;
}
.help-section ul {
	margin: 4px 0;
	padding-left: 20px;
	font-size: 12px;
	line-height: 1.6;
}
.help-section code {
	background: #f4f1e8;
	border: 1px solid #ccc;
	padding: 0 4px;
	font-family: monospace;
	font-size: 11px;
}

/* Lock during chain */
body.chain-locked .step button,
body.chain-locked .hd-actions button,
body.chain-locked .hd-left button,
body.chain-locked .lv-btn,
body.chain-locked .btn-gacha,
body.chain-locked .taiko-bg {
	pointer-events: none;
	opacity: 0.6;
}
#step-tempo:not(.step-locked),
#step-key:not(.step-locked) {
	cursor: pointer;
}
.lv-roulette {
	background: url("../images/rulet.png") center/contain no-repeat;
	padding: 0;
}

/* Footer (画面下固定 / 白背景 / 罫線 / Powered by + ロゴ 縦センター) */
body { padding-bottom: 56px; }
footer {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	margin: 0;
	padding: 4px 0;
	background: #fff;
	border-top: 1px solid #ddd;
	z-index: 50;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 56px;
}
.footer-tag {
	font-size: 10px;
	color: #666;
	line-height: 1;
	margin-bottom: 2px;
}
.footer-logo {
	display: inline-block;
	line-height: 0;
}
.footer-logo img {
	height: 28px;
	width: auto;
	display: block;
}

/* ============================================================
 * Mobile overrides (≤600px) — 最後に置いて確実に上書きさせる
 * ============================================================ */
@media (max-width: 600px) {
	.page { padding: 8px; }

	/* header: スマホでも PC と同サイズ */
	.hd { gap: 4px; padding: 6px 0; flex-wrap: nowrap; }
	.hd-left { gap: 4px; }
	.hd-actions { gap: 4px; }

	/* Book pick modal: list 高さ控えめ */
	.book-pick-list { max-height: 55vh; }
	.book-pick-modal { padding: 12px 14px; }

	/* Manage modal: 内パディング詰め */
	.mgmt-modal { padding: 10px 12px; }
	.join > input[type="file"] { font-size: 10px; }

	/* Help modal: コンパクト */
	.help-modal { padding: 12px 14px; }
	.help-section ul { padding-left: 18px; }

	/* ガチャボタン: padding 半分、文字 80%、改行禁止 */
	.btn-gacha {
		padding: 9px 14px;
		font-size: 18px;
		margin: 20px auto;
		white-space: nowrap;
	}

	/* テンポ・キー・メトロ上マージン縮小 */
	.tempo-key-row { margin-top: 20px; }

	/* 餅〜鬼: 上2 下3 段組 */
	.lv-break {
		display: block;
		flex-basis: 100%;
		width: 0;
		height: 0;
	}

	/* テンポ・キー文字 75% */
	.big-number {
		font-size: 36px;
		white-space: normal;
		line-height: 1.1;
	}
	.big-number .unit {
		font-size: 11px;
		display: block;
		margin-left: 0;
		margin-top: 2px;
	}
	.big-key { font-size: 42px; }

	/* 曲名ブロック下マージン */
	#song-result { margin-bottom: 20px; }

	/* 太鼓3連 控えめ */
	.taiko-bg { min-height: 130px; padding-bottom: 22px; }
	.metro-taiko { font-size: 29px; }

	.book-meta { font-size: 14px; }
	.btn-yt-icon { width: 24px; height: 24px; font-size: 10px; }
	.big-title { font-size: 22px; padding: 6px 10px; }

	/* footer (mobile: 控えめサイズ) */
	footer { height: 48px; }
	.footer-tag { font-size: 9px; }
	.footer-logo img { height: 22px; }
	body { padding-bottom: 48px; }
}
