.ms-wrapper {
	max-width: 900px;
	margin: 24px auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", Roboto, sans-serif;
	background: linear-gradient(180deg, #0f1226 0%, #1b1f3b 100%);
	border-radius: 16px;
	padding: 14px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	color: #f5f6ff;
	box-sizing: border-box;
}

.ms-wrapper * {
	box-sizing: border-box;
}

.ms-hud {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 6px 10px 12px;
}

.ms-question {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	flex: 1 1 320px;
	color: #ffe27a;
}

.ms-stats {
	display: flex;
	gap: 14px;
	font-size: 14px;
	white-space: nowrap;
}

.ms-stats b {
	color: #7dffb3;
	font-size: 16px;
	margin-left: 4px;
}

.ms-canvas-holder {
	position: relative;
	width: 100%;
	border-radius: 12px;
	overflow: hidden;
	background: radial-gradient(ellipse at 50% 0%, #232a55 0%, #10132a 70%);
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.ms-canvas-holder canvas {
	display: block;
	width: 100%;
	height: auto;
	touch-action: none;
	cursor: crosshair;
}

.ms-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(10, 12, 30, 0.82);
	backdrop-filter: blur(2px);
	text-align: center;
	padding: 20px;
	transition: opacity 0.25s ease;
}

.ms-overlay.ms-hidden {
	display: none;
}

.ms-overlay-inner {
	max-height: 100%;
	overflow-y: auto;
	width: 100%;
	max-width: 440px;
}

.ms-overlay-inner h3 {
	margin: 0 0 8px;
	font-size: 22px;
}

.ms-overlay-inner p {
	margin: 6px 0;
	font-size: 14px;
	line-height: 1.6;
	color: #d7d9ff;
}

.ms-overlay-sub {
	color: #9ea1d6 !important;
	font-size: 13px !important;
}

.ms-btn {
	margin-top: 14px;
	padding: 10px 26px;
	font-size: 15px;
	font-weight: 700;
	border: none;
	border-radius: 999px;
	background: linear-gradient(135deg, #ff6a6a, #ffb347);
	color: #201400;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(255, 120, 80, 0.35);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ms-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(255, 120, 80, 0.45);
}

.ms-btn:active {
	transform: translateY(0);
}

.ms-help {
	text-align: center;
	font-size: 12px;
	color: #9ea1d6;
	margin: 10px 0 2px;
}

.ms-score-pop {
	position: absolute;
	font-weight: 800;
	pointer-events: none;
	color: #7dffb3;
}

/* 단원 선택 그리드 */
.ms-cat-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
	margin: 16px 0;
}

.ms-cat-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 14px 8px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(122, 209, 255, 0.35);
	border-radius: 12px;
	color: #f5f6ff;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.ms-cat-btn:hover {
	transform: translateY(-2px);
	background: rgba(122, 209, 255, 0.14);
	border-color: #7ad1ff;
}

.ms-cat-icon {
	font-size: 22px;
}

.ms-cat-all {
	grid-column: span 3;
	flex-direction: row;
	justify-content: center;
	background: linear-gradient(135deg, rgba(255, 106, 106, 0.18), rgba(255, 179, 71, 0.18));
	border-color: rgba(255, 179, 71, 0.5);
}

.ms-home-actions {
	display: flex;
	justify-content: center;
	gap: 10px;
	margin-top: 6px;
	flex-wrap: wrap;
}

.ms-btn-secondary {
	background: rgba(255, 255, 255, 0.08);
	color: #f5f6ff;
	box-shadow: none;
	border: 1px solid rgba(255, 255, 255, 0.2);
}

.ms-btn-secondary:hover {
	background: rgba(255, 255, 255, 0.16);
	box-shadow: none;
}

/* 랭킹 화면 */
.ms-tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin: 10px 0 14px;
}

.ms-tab {
	padding: 6px 12px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: transparent;
	color: #d7d9ff;
	cursor: pointer;
}

.ms-tab-active {
	background: #7ad1ff;
	color: #0f1226;
	border-color: #7ad1ff;
}

.ms-lb-list {
	max-height: 260px;
	overflow-y: auto;
	margin-bottom: 8px;
}

.ms-lb-loading,
.ms-lb-empty {
	font-size: 13px;
	color: #9ea1d6;
	text-align: center;
	padding: 20px 0;
}

.ms-lb-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.ms-lb-table th,
.ms-lb-table td {
	padding: 7px 8px;
	text-align: center;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ms-lb-table th {
	color: #9ea1d6;
	font-weight: 600;
	font-size: 12px;
}

.ms-lb-table td:nth-child(2) {
	text-align: left;
	color: #ffe27a;
	font-weight: 700;
}

/* 게임 오버 - 닉네임 입력 */
.ms-nick-row {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 14px;
}

.ms-nick-input {
	padding: 9px 12px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	background: rgba(255, 255, 255, 0.08);
	color: #f5f6ff;
	font-size: 14px;
	min-width: 180px;
}

.ms-nick-input:focus {
	outline: none;
	border-color: #7ad1ff;
}

.ms-save-msg {
	min-height: 18px;
	font-size: 13px;
	margin: 8px 0 0;
	color: #7dffb3;
}

/* 콤보 표시 */
.ms-combo-wrap {
	color: #ff9ad1;
	font-weight: 700;
	animation: ms-pulse 0.6s ease infinite;
}

.ms-combo-wrap b {
	color: #ff9ad1;
	font-size: 16px;
}

@keyframes ms-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.12); }
}

/* 뮤트 버튼 */
.ms-mute-btn {
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 999px;
	color: #f5f6ff;
	font-size: 14px;
	padding: 4px 9px;
	cursor: pointer;
	line-height: 1;
}

.ms-mute-btn:hover {
	background: rgba(255, 255, 255, 0.16);
}

/* 파워업 버프 상태 */
.ms-buffs {
	display: flex;
	gap: 6px;
	justify-content: center;
	flex-wrap: wrap;
	min-height: 22px;
	margin: 2px 0 6px;
}

.ms-buff {
	font-size: 12px;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
}

.ms-buff-shield { color: #7ad1ff; }
.ms-buff-rapid { color: #ffe27a; }
.ms-buff-double { color: #ff9ad1; }

/* 챌린지(보스) 라운드 강조 */
.ms-question-boss {
	color: #ff9a4d !important;
	animation: ms-boss-glow 0.8s ease infinite alternate;
}

@keyframes ms-boss-glow {
	from { text-shadow: 0 0 4px rgba(255, 154, 77, 0.3); }
	to { text-shadow: 0 0 12px rgba(255, 154, 77, 0.8); }
}

/* 게임오버 랭크 / 신기록 */
.ms-rank-title {
	font-size: 17px;
	font-weight: 800;
	color: #ffe27a;
	margin: 2px 0 8px;
}

.ms-newbest {
	font-size: 14px;
	font-weight: 800;
	color: #7dffb3;
	margin: 0 0 4px;
	animation: ms-pulse 0.7s ease infinite;
}
