/*
 * battle.css
 * -----------------------------------------------------------------------------
 * Edu Quiz RPG — ドラクエ3風のクラシック2Dスタイル。
 * 黒背景 + 白(#fff)テキスト・白枠のモノクロ・レトロUI。
 * -----------------------------------------------------------------------------
 */

/* ---- 全体コンテナ ------------------------------------------------------- */
.eqrpg-game {
	--eqrpg-fg: #ffffff;
	--eqrpg-bg: #000000;
	--eqrpg-dim: #9a9a9a;
	--eqrpg-accent: #ffe14d; /* レベルアップ等のわずかな彩り（任意演出） */

	box-sizing: border-box;
	position: relative;
	max-width: 640px;
	margin: 0 auto;
	padding: 12px;
	background: var(--eqrpg-bg);
	color: var(--eqrpg-fg);
	border: 3px solid var(--eqrpg-fg);
	border-radius: 4px;
	font-family: "MS Gothic", "Osaka-Mono", "Courier New", monospace;
	font-size: 16px;
	line-height: 1.6;
	letter-spacing: 0.04em;
	image-rendering: pixelated;
	user-select: none;
	-webkit-user-select: none;
}
.eqrpg-game *,
.eqrpg-game *::before,
.eqrpg-game *::after {
	box-sizing: border-box;
}

/* ---- 上半分：敵フィールド ---------------------------------------------- */
.eqrpg-field {
	min-height: 200px;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 16px 8px 24px;
	background:
		radial-gradient(ellipse at 50% 120%, #1a1a1a 0%, #000 70%);
	border-bottom: 2px solid var(--eqrpg-fg);
}
.eqrpg-enemy {
	text-align: center;
}
/* 敵スプライト（ダミードット絵プレースホルダー）: JSが背景画像を差し込む */
.eqrpg-enemy-sprite {
	width: 128px;
	height: 128px;
	margin: 0 auto 10px;
	image-rendering: pixelated;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.25));
	transition: opacity 0.12s linear, transform 0.12s linear;
}
/* 被弾フラッシュ演出 */
.eqrpg-enemy-sprite.is-hit {
	animation: eqrpg-shake 0.32s steps(2) 0s 2, eqrpg-flash 0.16s steps(1) 0s 2;
}
.eqrpg-enemy-sprite.is-dead {
	opacity: 0;
	transform: translateY(6px) scale(0.9);
}
@keyframes eqrpg-shake {
	0% { transform: translateX(-6px); }
	100% { transform: translateX(6px); }
}
@keyframes eqrpg-flash {
	0% { filter: brightness(3) drop-shadow(0 0 4px #fff); }
	100% { filter: none; }
}

.eqrpg-enemy-info {
	display: inline-block;
	min-width: 200px;
}
.eqrpg-enemy-name {
	display: block;
	font-size: 18px;
	margin-bottom: 4px;
}
.eqrpg-enemy-hptext {
	display: block;
	font-size: 13px;
	color: var(--eqrpg-dim);
	margin-top: 2px;
}
/* HPバー */
.eqrpg-hpbar {
	height: 12px;
	border: 2px solid var(--eqrpg-fg);
	background: #000;
	overflow: hidden;
}
.eqrpg-hpbar-fill {
	height: 100%;
	width: 100%;
	background: var(--eqrpg-fg);
	transition: width 0.3s ease-out;
}
.eqrpg-hpbar-fill.is-low {
	background: repeating-linear-gradient(
		45deg, #fff 0, #fff 3px, #555 3px, #555 6px
	);
}

/* ---- 下半分：ウィンドウ群 ---------------------------------------------- */
.eqrpg-bottom {
	display: flex;
	gap: 10px;
	margin-top: 10px;
	align-items: stretch;
}

/* 共通ウィンドウ枠（角丸の白二重枠風） */
.eqrpg-window {
	background: #000;
	border: 3px solid var(--eqrpg-fg);
	border-radius: 6px;
	padding: 12px 14px;
	box-shadow: inset 0 0 0 2px #000, inset 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* ステータスウィンドウ */
.eqrpg-status-window {
	flex: 0 0 130px;
}
.eqrpg-status-name {
	font-size: 16px;
	margin-bottom: 8px;
	border-bottom: 1px dotted var(--eqrpg-dim);
	padding-bottom: 4px;
}
.eqrpg-status-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.eqrpg-status-list li {
	display: flex;
	justify-content: space-between;
	font-size: 15px;
	padding: 1px 0;
}
.eqrpg-stat-label {
	color: var(--eqrpg-dim);
	margin-right: 8px;
}

/* 右側パネル（コマンド/クイズ/メッセージを内包） */
.eqrpg-panel {
	flex: 1 1 auto;
	min-width: 0;
	position: relative;
}
.eqrpg-panel > .eqrpg-window {
	height: 100%;
}
[hidden] {
	display: none !important;
}

/* コマンドウィンドウ */
.eqrpg-command-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px 18px;
}
.eqrpg-command-list li:last-child {
	grid-column: 1 / -1;
}
.eqrpg-cmd,
.eqrpg-choice,
.eqrpg-modal-close,
.eqrpg-overlay-btn {
	font-family: inherit;
	font-size: 16px;
	color: var(--eqrpg-fg);
	background: transparent;
	border: none;
	padding: 4px 6px 4px 22px;
	width: 100%;
	text-align: left;
	cursor: pointer;
	position: relative;
	line-height: 1.5;
}
/* DQ風の選択カーソル「▶」 */
.eqrpg-cmd::before,
.eqrpg-choice::before {
	content: "";
	position: absolute;
	left: 4px;
	top: 50%;
	transform: translateY(-50%);
	opacity: 0;
}
.eqrpg-cmd:hover::before,
.eqrpg-cmd:focus::before,
.eqrpg-choice:hover::before,
.eqrpg-choice:focus::before {
	content: "\25B6"; /* ▶ */
	opacity: 1;
}
.eqrpg-cmd:focus,
.eqrpg-choice:focus,
.eqrpg-modal-close:focus,
.eqrpg-overlay-btn:focus {
	outline: none;
	text-shadow: 0 0 6px #fff;
}
.eqrpg-cmd[disabled] {
	color: #555;
	cursor: not-allowed;
}

/* クイズウィンドウ */
.eqrpg-quiz-question {
	margin: 0 0 10px;
	font-size: 15px;
	line-height: 1.7;
	border-bottom: 1px dotted var(--eqrpg-dim);
	padding-bottom: 8px;
}
.eqrpg-quiz-choices {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px 12px;
}
.eqrpg-choice {
	border: 1px solid transparent;
	border-radius: 4px;
}
.eqrpg-choice:hover,
.eqrpg-choice:focus {
	border-color: var(--eqrpg-dim);
}
/* 正解/不正解の一瞬のフィードバック */
.eqrpg-choice.is-correct {
	background: #fff;
	color: #000;
}
.eqrpg-choice.is-wrong {
	text-decoration: line-through;
	color: var(--eqrpg-dim);
}

/* メッセージウィンドウ（メッセージ送り） */
.eqrpg-message-window {
	min-height: 88px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.eqrpg-message-text {
	margin: 0;
	font-size: 16px;
	line-height: 1.7;
	white-space: pre-wrap;
}
.eqrpg-message-cursor {
	align-self: flex-end;
	font-size: 12px;
	animation: eqrpg-blink 0.8s steps(1) infinite;
}
.eqrpg-message-cursor[hidden] {
	display: none !important;
}
@keyframes eqrpg-blink {
	0%, 50% { opacity: 1; }
	51%, 100% { opacity: 0; }
}

/* ---- 解説モーダル ------------------------------------------------------- */
.eqrpg-modal,
.eqrpg-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.72);
	padding: 16px;
	z-index: 10;
}
.eqrpg-modal-box,
.eqrpg-overlay-box {
	background: #000;
	border: 3px solid var(--eqrpg-fg);
	border-radius: 6px;
	padding: 16px 18px;
	max-width: 92%;
	box-shadow: 0 0 0 2px #000, 0 0 0 3px rgba(255, 255, 255, 0.2);
}
.eqrpg-modal-title {
	margin: 0 0 10px;
	font-size: 16px;
	text-align: center;
}
.eqrpg-modal-body {
	margin: 0 0 14px;
	font-size: 15px;
	line-height: 1.75;
}
.eqrpg-modal-close,
.eqrpg-overlay-btn {
	width: auto;
	display: inline-block;
	text-align: center;
	padding: 6px 20px;
	border: 2px solid var(--eqrpg-fg);
	border-radius: 4px;
	margin: 0 auto;
}
.eqrpg-modal-close {
	display: block;
}
.eqrpg-modal-close:hover,
.eqrpg-overlay-btn:hover {
	background: #fff;
	color: #000;
}

/* ---- リザルトオーバーレイ ---------------------------------------------- */
.eqrpg-overlay-box {
	text-align: center;
}
.eqrpg-overlay-text {
	margin: 0 0 16px;
	font-size: 17px;
	line-height: 1.8;
	white-space: pre-wrap;
}
.eqrpg-overlay-text .eqrpg-levelup {
	color: var(--eqrpg-accent);
	text-shadow: 0 0 8px var(--eqrpg-accent);
}

/* ---- 通知・ローディング ------------------------------------------------- */
.eqrpg-notice,
.eqrpg-loading {
	color: var(--eqrpg-fg);
	background: #000;
	border: 2px solid var(--eqrpg-fg);
	padding: 12px;
	text-align: center;
	font-family: "MS Gothic", "Courier New", monospace;
}

/* セーブ中インジケータ */
.eqrpg-saving {
	position: absolute;
	right: 10px;
	bottom: 8px;
	font-size: 11px;
	color: var(--eqrpg-dim);
}

/* ---- 小さい画面への調整 ------------------------------------------------- */
@media (max-width: 480px) {
	.eqrpg-bottom {
		flex-direction: column;
	}
	.eqrpg-status-window {
		flex-basis: auto;
	}
	.eqrpg-status-list {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 4px;
	}
	.eqrpg-status-list li {
		flex-direction: column;
		align-items: center;
	}
	.eqrpg-command-list,
	.eqrpg-quiz-choices {
		grid-template-columns: 1fr;
	}
}
