.msi-wrapper {
	max-width: 900px;
	margin: 24px auto;
	font-family: "Courier New", ui-monospace, Consolas, monospace;
	background: #05060f;
	border-radius: 10px;
	padding: 14px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 255, 140, 0.15);
	color: #baffc9;
	box-sizing: border-box;
}

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

.msi-hidden {
	display: none !important;
}

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

.msi-question {
	font-size: 13px;
	font-weight: 700;
	line-height: 1.5;
	flex: 1 1 320px;
	color: #ffe27a;
	letter-spacing: 0.2px;
}

.msi-stats {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 12px;
	white-space: nowrap;
}

.msi-stats b {
	color: #39ff88;
	font-size: 15px;
	margin-left: 4px;
	text-shadow: 0 0 6px rgba(57, 255, 136, 0.6);
}

.msi-streak-wrap {
	color: #ff5fd1;
	font-weight: 700;
	animation: msi-pulse 0.6s ease infinite;
}

.msi-streak-wrap b {
	color: #ff5fd1;
	text-shadow: 0 0 6px rgba(255, 95, 209, 0.7);
}

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

.msi-mute-btn {
	background: rgba(57, 255, 136, 0.08);
	border: 1px solid rgba(57, 255, 136, 0.4);
	border-radius: 4px;
	color: #baffc9;
	font-size: 13px;
	padding: 3px 8px;
	cursor: pointer;
	line-height: 1;
}

.msi-mute-btn:hover {
	background: rgba(57, 255, 136, 0.18);
}

.msi-buffs {
	display: flex;
	gap: 6px;
	justify-content: center;
	flex-wrap: wrap;
	min-height: 20px;
	margin: 0 0 6px;
}

.msi-buff {
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 3px;
	background: rgba(57, 255, 136, 0.08);
	border: 1px solid rgba(57, 255, 136, 0.3);
}

.msi-buff-shield { color: #4dd9ff; }
.msi-buff-rapid { color: #ffe27a; }
.msi-buff-double { color: #ff5fd1; }

.msi-canvas-holder {
	position: relative;
	width: 100%;
	border-radius: 6px;
	overflow: hidden;
	background: #04050c;
	border: 1px solid rgba(57, 255, 136, 0.25);
	box-shadow: inset 0 0 40px rgba(57, 255, 136, 0.06);
}

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

/* 스캔라인 연출 */
.msi-canvas-holder::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: repeating-linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0) 0px,
		rgba(0, 0, 0, 0) 2px,
		rgba(0, 0, 0, 0.12) 3px
	);
	mix-blend-mode: multiply;
}

.msi-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(2, 4, 10, 0.9);
	text-align: center;
	padding: 18px;
	z-index: 2;
}

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

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

.msi-overlay-inner h3 {
	margin: 0 0 8px;
	font-size: 20px;
	color: #39ff88;
	text-shadow: 0 0 10px rgba(57, 255, 136, 0.6);
	letter-spacing: 1px;
}

.msi-overlay-inner p {
	margin: 6px 0;
	font-size: 12.5px;
	line-height: 1.7;
	color: #c9d6ff;
}

.msi-overlay-sub {
	color: #7d8bbf !important;
	font-size: 11.5px !important;
}

.msi-btn {
	margin-top: 12px;
	padding: 10px 24px;
	font-size: 13px;
	font-weight: 700;
	font-family: inherit;
	border: 2px solid #39ff88;
	border-radius: 4px;
	background: rgba(57, 255, 136, 0.1);
	color: #39ff88;
	cursor: pointer;
	text-shadow: 0 0 6px rgba(57, 255, 136, 0.5);
	transition: background 0.15s ease, transform 0.15s ease;
	letter-spacing: 0.5px;
}

.msi-btn:hover {
	background: rgba(57, 255, 136, 0.25);
	transform: translateY(-1px);
}

.msi-btn-secondary {
	border-color: rgba(255, 255, 255, 0.35);
	background: rgba(255, 255, 255, 0.05);
	color: #d7d9ff;
	text-shadow: none;
}

.msi-btn-secondary:hover {
	background: rgba(255, 255, 255, 0.12);
}

.msi-help {
	text-align: center;
	font-size: 11px;
	color: #6c7aa8;
	margin: 10px 0 2px;
}

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

.msi-cat-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	padding: 12px 6px;
	background: rgba(57, 255, 136, 0.05);
	border: 1px solid rgba(57, 255, 136, 0.3);
	border-radius: 6px;
	color: #baffc9;
	font-size: 11.5px;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease;
}

.msi-cat-btn:hover {
	transform: translateY(-2px);
	background: rgba(57, 255, 136, 0.15);
}

.msi-cat-icon {
	font-size: 20px;
}

.msi-cat-all {
	grid-column: span 3;
	flex-direction: row;
	justify-content: center;
	background: rgba(255, 95, 209, 0.08);
	border-color: rgba(255, 95, 209, 0.4);
	color: #ff5fd1;
}

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

/* 랭킹 화면 */
.msi-tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 5px;
	margin: 8px 0 12px;
}

.msi-tab {
	padding: 5px 10px;
	font-size: 11px;
	font-weight: 700;
	border-radius: 3px;
	border: 1px solid rgba(57, 255, 136, 0.3);
	background: transparent;
	color: #c9d6ff;
	cursor: pointer;
	font-family: inherit;
}

.msi-tab-active {
	background: #39ff88;
	color: #04050c;
	border-color: #39ff88;
}

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

.msi-lb-loading,
.msi-lb-empty {
	font-size: 12px;
	color: #6c7aa8;
	text-align: center;
	padding: 18px 0;
}

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

.msi-lb-table th,
.msi-lb-table td {
	padding: 6px 6px;
	text-align: center;
	border-bottom: 1px solid rgba(57, 255, 136, 0.12);
}

.msi-lb-table th {
	color: #6c7aa8;
	font-weight: 700;
	font-size: 10.5px;
}

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

/* 게임오버 */
.msi-rank-title {
	font-size: 15px;
	font-weight: 800;
	color: #ffe27a;
	margin: 2px 0 8px;
	text-shadow: 0 0 8px rgba(255, 226, 122, 0.4);
}

.msi-newbest {
	font-size: 13px;
	font-weight: 800;
	color: #39ff88;
	margin: 0 0 4px;
	animation: msi-pulse 0.7s ease infinite;
}

.msi-nick-row {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 12px;
}

.msi-nick-input {
	padding: 8px 10px;
	border-radius: 4px;
	border: 1px solid rgba(57, 255, 136, 0.4);
	background: rgba(255, 255, 255, 0.04);
	color: #baffc9;
	font-size: 13px;
	font-family: inherit;
	min-width: 170px;
}

.msi-nick-input:focus {
	outline: none;
	border-color: #39ff88;
}

.msi-save-msg {
	min-height: 16px;
	font-size: 12px;
	margin: 8px 0 0;
	color: #39ff88;
}
