.apgss-learning-tool,
.apc-sentence-replacement {
	box-sizing: border-box;
	width: 100%;
	max-width: 800px;
	padding: 20px;
	border: 1px solid #dcdcde;
	border-radius: 8px;
}

.apgss-learning-tool *,
.apgss-learning-tool *::before,
.apgss-learning-tool *::after,
.apc-sentence-replacement *,
.apc-sentence-replacement *::before,
.apc-sentence-replacement *::after {
	box-sizing: border-box;
}

.apgss-learning-field,
.apc-answer {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 10px 12px;
	margin-bottom: 12px;
	box-sizing: border-box;
}

.apgss-learning-actions,
.apc-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: center;
}

.apgss-learning-actions button,
.apc-actions button {
	padding: 10px 16px;
	cursor: pointer;
}

.apgss-learning-feedback,
.apgss-learning-help,
.apc-feedback,
.apc-ai-help {
	margin-top: 16px;
}

.apgss-learning-success,
.apc-success {
	color: #008a20;
	font-weight: 700;
}

.apgss-learning-error,
.apc-error {
	color: #b00020;
	margin-bottom: 6px;
}

.apgss-learning-highlight,
.apc-correct-answer {
	margin-top: 10px;
	font-weight: 700;
}

.apgss-learning-box,
.apgss-learning-message,
.apc-ai-box,
.apc-message {
	padding: 12px;
	background: #f6f7f7;
	border-left: 4px solid #2271b1;
}

.apgss-learning-message,
.apc-message {
	border-left-color: #8c8f94;
}

.apc-game-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.apc-levels-toggle {
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	cursor: pointer;
}

.apc-levels-toggle:hover {
	border-color: #2271b1;
	color: #135e96;
}

.apc-levels-toggle::before {
	content: "☰";
	margin-right: 7px;
}

.apc-current-level {
	min-width: 0;
	color: #50575e;
	font-size: 14px;
	text-align: right;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.apc-levels-modal {
	display: none;
}

.apgss-learning-tool.is-levels-open .apc-levels-modal,
.apc-sentence-replacement.is-levels-open .apc-levels-modal {
	display: block;
}

.apc-levels-backdrop {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: rgba(0, 0, 0, 0.35);
}

.apc-levels-panel {
	position: fixed;
	top: 50%;
	left: 50%;
	z-index: 10001;
	display: flex;
	flex-direction: column;
	width: min(360px, calc(100vw - 32px));
	max-height: min(620px, calc(100vh - 48px));
	padding: 16px;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
	transform: translate(-50%, -50%);
}

.apc-levels-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.apc-levels-close {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.apc-levels-close:hover {
	border-color: #2271b1;
	color: #135e96;
}

.apc-levels {
	display: flex;
	flex-direction: column;
	gap: 6px;
	overflow-y: auto;
	padding-right: 4px;
}

.apc-level-button {
	display: grid;
	grid-template-columns: 28px minmax(0, 1fr);
	align-items: center;
	gap: 8px;
	width: 100%;
	min-height: 36px;
	padding: 6px 8px;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	text-align: left;
	cursor: pointer;
}

.apc-level-button:hover:not(:disabled),
.apc-level-button.is-current {
	border-color: #2271b1;
	color: #135e96;
}

.apc-level-button.is-current {
	background: #f0f6fc;
	font-weight: 700;
}

.apc-level-button.is-complete:not(.is-current) {
	border-color: #8cbe8c;
}

.apc-level-button:disabled {
	color: #8c8f94;
	background: #f6f7f7;
	cursor: not-allowed;
}

.apc-level-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 24px;
	border-radius: 999px;
	background: #f6f7f7;
	font-size: 12px;
}

.apc-level-name {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.apc-game-content {
	min-width: 0;
}

@media (max-width: 700px) {
	.apc-game-toolbar {
		align-items: stretch;
		flex-direction: column;
	}

	.apc-current-level {
		text-align: left;
		white-space: normal;
	}

	.apc-levels-panel {
		top: auto;
		right: 12px;
		bottom: 12px;
		left: 12px;
		width: auto;
		max-height: min(520px, calc(100vh - 24px));
		transform: none;
	}
}
