.jr-mcnp-root,
.jr-mcnp-root * {
	box-sizing: border-box;
}

.jr-mcnp-root::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: rgba(20, 16, 12, 0.22);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.jr-mcnp-root.is-open::before {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.jr-mcnp-tab {
	position: fixed;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10000;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 13px 14px 16px;
	border: 1px solid rgba(166, 88, 48, 0.28);
	border-right: 0;
	border-radius: 18px 0 0 18px;
	background: #fffaf5;
	color: #242424;
	font-size: 15px;
	font-weight: 900;
	line-height: 1;
	letter-spacing: 0.02em;
	box-shadow: 0 18px 38px rgba(37, 25, 16, 0.18);
	cursor: pointer;
	transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.jr-mcnp-tab:hover,
.jr-mcnp-tab:focus-visible,
.jr-mcnp-root.is-open .jr-mcnp-tab {
	background: #bd6f3d;
	color: #fff;
	box-shadow: 0 22px 48px rgba(37, 25, 16, 0.24);
}

.jr-mcnp-tab:focus-visible,
.jr-mcnp-close:focus-visible,
.jr-mcnp-chip:focus-visible,
.jr-mcnp-letter:focus-visible,
.jr-mcnp-letter-toggle:focus-visible {
	outline: 3px solid rgba(146, 183, 111, 0.55);
	outline-offset: 3px;
}

.jr-mcnp-tab-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(166, 88, 48, 0.12);
	color: #a65830;
	font-size: 14px;
	font-weight: 950;
}

.jr-mcnp-tab:hover .jr-mcnp-tab-icon,
.jr-mcnp-tab:focus-visible .jr-mcnp-tab-icon,
.jr-mcnp-root.is-open .jr-mcnp-tab-icon {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}

.jr-mcnp-tab-text {
	writing-mode: vertical-rl;
	text-orientation: mixed;
}

.jr-mcnp-panel {
	position: fixed;
	top: 92px;
	right: 18px;
	bottom: 42px;
	z-index: 10001;
	width: min(390px, calc(100vw - 36px));
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 22px;
	border: 1px solid rgba(35, 35, 35, 0.12);
	border-radius: 28px;
	background: rgba(255, 251, 246, 0.97);
	box-shadow: 0 28px 70px rgba(24, 18, 12, 0.28);
	transform: translateX(calc(100% + 36px));
	opacity: 0;
	visibility: hidden;
	transition: transform 0.24s ease, opacity 0.24s ease, visibility 0.24s ease;
	backdrop-filter: blur(10px);
}

.jr-mcnp-root.is-open .jr-mcnp-panel {
	transform: translateX(0);
	opacity: 1;
	visibility: visible;
}

.jr-mcnp-head {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	justify-content: space-between;
}

.jr-mcnp-head h3 {
	margin: 0 0 6px;
	color: #232323;
	font-size: 28px;
	font-weight: 950;
	line-height: 1.1;
	letter-spacing: 0.01em;
}

.jr-mcnp-head p {
	margin: 0;
	color: #746b63;
	font-size: 14px;
	font-weight: 650;
	line-height: 1.55;
}

.jr-mcnp-close {
	width: 46px;
	height: 46px;
	min-width: 46px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(35, 35, 35, 0.12);
	border-radius: 16px;
	background: #fff;
	color: #a65830;
	font-size: 30px;
	font-weight: 900;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 12px 28px rgba(24, 18, 12, 0.1);
}

.jr-mcnp-close:hover {
	background: #a65830;
	color: #fff;
}

.jr-mcnp-search-wrap {
	position: relative;
}

.jr-mcnp-search {
	width: 100%;
	min-height: 52px;
	padding: 13px 16px;
	border: 1px solid rgba(166, 88, 48, 0.24);
	border-radius: 18px;
	background: #fff;
	color: #222;
	font-size: 16px;
	font-weight: 750;
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 10px 28px rgba(24, 18, 12, 0.06);
}

.jr-mcnp-search::placeholder {
	color: rgba(52, 43, 35, 0.42);
}

.jr-mcnp-search:focus {
	border-color: rgba(166, 88, 48, 0.55);
	background: #fffdf9;
}


.jr-mcnp-letter-dropdown {
	border: 1px solid rgba(166, 88, 48, 0.15);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.72);
	box-shadow: 0 8px 22px rgba(24, 18, 12, 0.05);
	overflow: hidden;
}

.jr-mcnp-letter-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 48px;
	padding: 12px 14px;
	color: #242424;
	font-size: 14px;
	font-weight: 900;
	cursor: pointer;
	list-style: none;
}

.jr-mcnp-letter-toggle::-webkit-details-marker {
	display: none;
}

.jr-mcnp-letter-toggle::after {
	content: "⌄";
	margin-left: auto;
	color: #a65830;
	font-size: 18px;
	font-weight: 950;
	line-height: 1;
	transition: transform 0.18s ease;
}

.jr-mcnp-letter-dropdown[open] .jr-mcnp-letter-toggle::after {
	transform: rotate(180deg);
}

.jr-mcnp-letter-toggle strong {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 30px;
	padding: 5px 10px;
	border-radius: 999px;
	background: #5f865f;
	color: #fff;
	font-size: 13px;
	font-weight: 950;
}

.jr-mcnp-letter-dropdown .jr-mcnp-letters {
	padding: 0 12px 12px;
}

.jr-mcnp-controls,
.jr-mcnp-letters {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.jr-mcnp-chip,
.jr-mcnp-letter {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(35, 35, 35, 0.1);
	background: #fff;
	color: #242424;
	font-weight: 900;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(24, 18, 12, 0.07);
	transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.jr-mcnp-chip:hover,
.jr-mcnp-letter:hover {
	transform: translateY(-1px);
}

.jr-mcnp-chip {
	min-height: 42px;
	padding: 9px 14px;
	border-radius: 15px;
	font-size: 14px;
}

.jr-mcnp-random {
	background: #f6efe7;
	color: #a65830;
}

.jr-mcnp-letter {
	width: 34px;
	height: 34px;
	border-radius: 12px;
	font-size: 12px;
}

.jr-mcnp-letter:first-child {
	width: auto;
	padding: 0 11px;
}

.jr-mcnp-chip.is-active,
.jr-mcnp-letter.is-active {
	background: #5f865f;
	border-color: rgba(95, 134, 95, 0.25);
	color: #fff;
}

.jr-mcnp-count {
	padding: 0 2px;
	color: #746b63;
	font-size: 13px;
	font-weight: 850;
}

.jr-mcnp-list {
	min-height: 0;
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-content: start;
	gap: 10px;
	padding: 4px 4px 8px;
}

.jr-mcnp-name {
	min-height: 46px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px 12px;
	border: 1px solid rgba(166, 88, 48, 0.13);
	border-radius: 16px;
	background: #fff;
	color: #242424;
	font-size: 15px;
	font-weight: 850;
	line-height: 1.2;
	text-align: center;
	box-shadow: 0 8px 22px rgba(24, 18, 12, 0.06);
	user-select: none;
}

.jr-mcnp-empty {
	grid-column: 1 / -1;
	padding: 22px;
	border: 1px dashed rgba(166, 88, 48, 0.35);
	border-radius: 18px;
	color: #746b63;
	font-weight: 850;
	text-align: center;
}

.jr-mcnp-foot {
	padding: 12px 14px;
	border: 1px solid rgba(166, 88, 48, 0.14);
	border-radius: 18px;
	background: #f6efe7;
	color: #6f645b;
	font-size: 13px;
	font-weight: 800;
	line-height: 1.45;
}

@media (max-width: 782px) {
	.jr-mcnp-root::before {
		z-index: 2147483000;
		background: rgba(21, 17, 13, 0.42);
		backdrop-filter: blur(7px);
		-webkit-backdrop-filter: blur(7px);
	}

	.jr-mcnp-tab {
		left: 50%;
		right: auto;
		bottom: calc(22px + env(safe-area-inset-bottom, 0px));
		top: auto;
		width: 66px;
		height: 66px;
		min-width: 66px;
		padding: 0;
		justify-content: center;
		transform: translateX(-50%);
		border: 1px solid rgba(166, 88, 48, 0.26);
		border-radius: 999px;
		z-index: 2147483001;
	}

	.jr-mcnp-root.is-open .jr-mcnp-tab {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
	}

	.jr-mcnp-tab-text {
		display: none;
	}

	.jr-mcnp-tab-icon {
		width: 42px;
		height: 42px;
		font-size: 16px;
	}

	.jr-mcnp-panel {
		top: calc(14px + env(safe-area-inset-top, 0px));
		left: 12px;
		right: 12px;
		bottom: calc(96px + env(safe-area-inset-bottom, 0px));
		width: auto;
		height: auto;
		max-height: calc(100dvh - 110px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
		padding: 18px;
		border: 2px solid rgba(166, 88, 48, 0.22);
		border-radius: 26px;
		background: rgba(255, 251, 246, 0.99);
		box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.74) inset;
		transform: translateY(18px) scale(0.98);
		z-index: 2147483002;
	}

	.jr-mcnp-root.is-open .jr-mcnp-panel {
		transform: translateY(0) scale(1);
	}

	.jr-mcnp-head {
		gap: 12px;
	}

	.jr-mcnp-head h3 {
		font-size: 24px;
	}

	.jr-mcnp-head p {
		font-size: 13px;
		line-height: 1.45;
	}

	.jr-mcnp-close {
		width: 52px;
		height: 52px;
		min-width: 52px;
		border-radius: 18px;
		font-size: 34px;
	}

	.jr-mcnp-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.jr-mcnp-name {
		min-height: 42px;
		font-size: 14px;
		border-radius: 14px;
	}

	.jr-mcnp-letter {
		width: 31px;
		height: 31px;
		border-radius: 11px;
	}
}

@media (max-width: 430px) {
	.jr-mcnp-panel {
		left: 10px;
		right: 10px;
		top: calc(10px + env(safe-area-inset-top, 0px));
		bottom: calc(96px + env(safe-area-inset-bottom, 0px));
		max-height: calc(100dvh - 106px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
	}

	.jr-mcnp-list {
		grid-template-columns: 1fr 1fr;
	}
}
