/* =========================================================
   メルレ体験チャット
   LINE風UI ／ モーダル ／ 3往復ラリー分岐
   ========================================================= */

/* ---------- 全体ラップ ---------- */
.mrl-chat-wrap {
	margin: 40px auto;
	max-width: 640px;
	isolation: isolate; /* 目次プラグイン等の干渉を軽減 */
}

/* ---------- ランチャーセクション ---------- */
.mrl-launcher {
	position: relative;
	overflow: hidden;
	border-radius: 20px;
	padding: 4px;
	background: linear-gradient(135deg, #c5eef8 0%, #38b6db 35%, #1495c0 70%, #0e7490 100%);
	background-size: 200% 200%;
	animation: mrlGradient 8s ease infinite;
	box-shadow: 0 16px 40px rgba(20, 149, 192, 0.28);
}
@keyframes mrlGradient {
	0%, 100% { background-position: 0% 50%; }
	50%      { background-position: 100% 50%; }
}

.mrl-launcher__inner {
	position: relative;
	background: #fff;
	border-radius: 17px;
	padding: 26px 22px 22px;
	text-align: center;
	z-index: 1;
}

/* 装飾絵文字 */
.mrl-launcher__deco {
	position: absolute;
	font-size: 28px;
	opacity: .35;
	pointer-events: none;
	animation: mrlFloat 4s ease-in-out infinite;
	z-index: 0;
}
.mrl-launcher__deco--1 { top: 12px;    left: 18px;  animation-delay: 0s;    font-size: 24px; }
.mrl-launcher__deco--2 { top: 20px;    right: 22px; animation-delay: 1s;    font-size: 26px; }
.mrl-launcher__deco--3 { bottom: 22px; left: 26px;  animation-delay: 2s;    font-size: 22px; }
.mrl-launcher__deco--4 { bottom: 14px; right: 18px; animation-delay: 1.5s;  font-size: 26px; }
@keyframes mrlFloat {
	0%, 100% { transform: translateY(0)   rotate(-3deg); }
	50%      { transform: translateY(-8px) rotate(3deg);  }
}

.mrl-launcher__badge {
	display: inline-block;
	background: linear-gradient(135deg, #38b6db, #1495c0);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .5px;
	padding: 5px 14px;
	border-radius: 999px;
	margin-bottom: 12px;
	box-shadow: 0 4px 12px rgba(20, 149, 192, 0.35);
}

/* コンテンツタイトル(divで代用、見出しタグは使わない) */
.mrl-chat-wrap .mrl-launcher__title {
	font-size: 22px;
	font-weight: 800;
	color: #0e3a52;
	margin: 0 0 8px;
	line-height: 1.4;
	letter-spacing: .5px;
	padding: 0;
	background: none;
	border: none;
}

.mrl-launcher__lead {
	font-size: 13px;
	color: #6a6a80;
	line-height: 1.7;
	margin: 0 0 18px;
}

/* プレビュー吹き出し */
.mrl-launcher__preview {
	background: linear-gradient(180deg, #eaf7fb 0%, #dfeef3 100%);
	border-radius: 14px;
	padding: 14px 12px;
	margin: 0 auto 18px;
	max-width: 320px;
	text-align: left;
	display: flex; flex-direction: column; gap: 8px;
}
.mrl-launcher__msg {
	font-size: 13px;
	padding: 8px 12px;
	border-radius: 14px;
	max-width: 80%;
	line-height: 1.4;
}
.mrl-launcher__msg--them {
	background: #fff;
	color: #333;
	border-top-left-radius: 4px;
	align-self: flex-start;
	box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.mrl-launcher__msg--me {
	background: linear-gradient(135deg, #6bc9e5 0%, #1495c0 100%);
	color: #fff;
	border-top-right-radius: 4px;
	align-self: flex-end;
	box-shadow: 0 2px 6px rgba(20, 149, 192, 0.25);
}

/* ---------- 起動ボタン ---------- */
.mrl-chat-launch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 16px 32px;
	font-size: 16px;
	font-weight: 700;
	color: #fff;
	background: linear-gradient(135deg, #ff6f9a 0%, #b56cff 100%);
	border: none;
	border-radius: 999px;
	cursor: pointer;
	line-height: 1;
	box-shadow: 0 10px 24px rgba(181, 108, 255, 0.4);
	transition: transform .15s ease, box-shadow .15s ease;
	animation: mrlPulse 2.4s ease-in-out infinite;
}
.mrl-chat-launch:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 28px rgba(181, 108, 255, 0.5);
	animation: none;
}
/* 高さ揃え: 全要素をline-height:1に統一し、flex中央寄せ */
.mrl-chat-launch__icon,
.mrl-chat-launch__text,
.mrl-chat-launch__arrow {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}
.mrl-chat-launch__icon  { font-size: 18px; }
.mrl-chat-launch__arrow {
	font-size: 22px;
	margin-left: 2px;
	transition: transform .2s ease;
	transform: translateY(-1px);
}
.mrl-chat-launch:hover .mrl-chat-launch__arrow { transform: translateY(-1px) translateX(3px); }
@keyframes mrlPulse {
	0%, 100% { box-shadow: 0 10px 24px rgba(181, 108, 255, 0.4); }
	50%      { box-shadow: 0 10px 24px rgba(181, 108, 255, 0.4), 0 0 0 10px rgba(181, 108, 255, 0.08); }
}

.mrl-launcher__note {
	margin-top: 10px;
	font-size: 11px;
	color: #7fb3c9;
	letter-spacing: .5px;
}

@media (max-width: 480px) {
	.mrl-launcher__inner { padding: 22px 16px 20px; }
	.mrl-chat-wrap .mrl-launcher__title { font-size: 19px; }
	.mrl-launcher__lead { font-size: 12px; }
	.mrl-chat-launch { padding: 14px 24px; font-size: 15px; }
	.mrl-launcher__deco { font-size: 20px !important; }
}

/* =========================================================
   モーダル (LINE風チャット)
   ========================================================= */
.mrl-chat-modal[hidden] { display: none; }
.mrl-chat-modal {
	position: fixed; inset: 0;
	z-index: 99999;
	display: flex; align-items: center; justify-content: center;
	padding: 16px;
}
.mrl-chat-modal__backdrop {
	position: absolute; inset: 0;
	background: rgba(20, 20, 30, 0.55);
	backdrop-filter: blur(3px);
	animation: mrlFade .2s ease;
}
.mrl-chat-modal__panel {
	position: relative;
	width: min(100%, 420px);
	max-height: 88vh;
	background: #7f9bc1;
	border-radius: 18px;
	overflow: hidden;
	display: flex; flex-direction: column;
	box-shadow: 0 24px 60px rgba(0,0,0,0.35);
	animation: mrlPop .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes mrlFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes mrlPop  { from { opacity: 0; transform: translateY(20px) scale(.96) } to { opacity: 1; transform: translateY(0) scale(1) } }

/* ---------- ヘッダー(LINE風) ---------- */
.mrl-chat-header {
	display: flex; align-items: center; gap: 10px;
	padding: 10px 12px;
	background: #f5f6f8;
	border-bottom: 1px solid #e0e2e6;
}
.mrl-chat-header__back {
	background: none; border: none;
	font-size: 22px; color: #333; cursor: pointer;
	line-height: 1; padding: 0 4px;
	font-weight: 400;
}
.mrl-chat-header__avatar {
	width: 36px; height: 36px; border-radius: 50%;
	background: linear-gradient(135deg, #7a8fb5, #4a5b7a);
	color: #fff; font-weight: 700;
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
	font-size: 15px;
}
.mrl-chat-header__meta { flex: 1; min-width: 0; }
.mrl-chat-header__name { font-size: 15px; font-weight: 700; color: #222; }
.mrl-chat-header__age { font-size: 12px; color: #888; margin-left: 4px; font-weight: 500; }
.mrl-chat-header__status {
	font-size: 11px; color: #6a6a6a;
	display: flex; align-items: center; gap: 5px;
	margin-top: 2px;
}
.mrl-chat-header__dot {
	width: 8px; height: 8px; border-radius: 50%;
	background: #2ecc71;
	box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}
.mrl-chat-header__close {
	width: 30px; height: 30px; border-radius: 50%;
	border: none; background: transparent;
	font-size: 22px; color: #666; cursor: pointer;
	line-height: 1;
}
.mrl-chat-header__close:hover { background: #e5e7eb; }

/* ---------- 会話本体(LINE風ブルーグレー背景) ---------- */
.mrl-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 14px 12px 20px;
	background:
		radial-gradient(circle at 20% 10%, rgba(255,255,255,0.08) 0%, transparent 40%),
		radial-gradient(circle at 80% 60%, rgba(255,255,255,0.06) 0%, transparent 40%),
		linear-gradient(180deg, #8ba7cb 0%, #7f9bc1 100%);
	scroll-behavior: smooth;
}

/* 日付チップ */
.mrl-chat-datechip {
	display: block;
	width: fit-content;
	margin: 4px auto 12px;
	padding: 3px 14px;
	background: rgba(60, 75, 100, 0.35);
	color: #fff;
	font-size: 11px;
	border-radius: 999px;
	letter-spacing: .5px;
}

/* ---------- イントロブロック ---------- */
.mrl-chat-intro {
	background: rgba(255,255,255,0.92);
	border-radius: 12px;
	padding: 14px 16px;
	text-align: center;
	box-shadow: 0 1px 2px rgba(0,0,0,0.06);
	margin-bottom: 6px;
}
.mrl-chat-intro__title {
	font-size: 14px; font-weight: 700; color: #1495c0;
	margin-bottom: 6px;
}
.mrl-chat-intro__text {
	font-size: 13px; color: #444; line-height: 1.7;
}

/* ---------- 吹き出し ---------- */
.mrl-msg {
	display: flex;
	margin-top: 12px;
	animation: mrlSlide .3s ease;
	align-items: flex-end;
	gap: 6px;
}
@keyframes mrlSlide { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: translateY(0) } }

/* 相手(かけるさん) = 左 */
.mrl-msg--them { justify-content: flex-start; }
.mrl-msg--them .mrl-msg__avatar {
	width: 36px; height: 36px; border-radius: 50%;
	background: linear-gradient(135deg, #7a8fb5, #4a5b7a);
	color: #fff; font-size: 13px; font-weight: 700;
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
}
.mrl-msg__stack { display: flex; flex-direction: column; min-width: 0; }
.mrl-msg__name {
	font-size: 11px; color: #f0f4fa;
	margin-left: 4px; margin-bottom: 3px;
	text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.mrl-msg__row {
	display: flex; align-items: flex-end; gap: 4px;
}
.mrl-msg--them .mrl-msg__bubble {
	background: #fff;
	color: #222;
	border-radius: 16px;
	border-top-left-radius: 4px;
	padding: 9px 13px;
	font-size: 14px; line-height: 1.6;
	max-width: 240px;
	word-break: break-word;
	white-space: pre-wrap;
	box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* 自分(メルレ) = 右 */
.mrl-msg--me {
	justify-content: flex-end;
	align-items: flex-end;
}
.mrl-msg--me .mrl-msg__meta {
	display: flex; flex-direction: column; align-items: flex-end;
	font-size: 10px; color: #f0f4fa;
	margin-right: 4px; margin-bottom: 2px;
	text-shadow: 0 1px 2px rgba(0,0,0,0.15);
	line-height: 1.3;
}
.mrl-msg--me .mrl-msg__read { color: #f0f4fa; }
.mrl-msg--me .mrl-msg__bubble {
	background: #85e070;
	color: #222;
	border-radius: 16px;
	border-top-right-radius: 4px;
	padding: 9px 13px;
	font-size: 14px; line-height: 1.6;
	max-width: 240px;
	word-break: break-word;
	white-space: pre-wrap;
	box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 相手側時刻 */
.mrl-msg--them .mrl-msg__time {
	font-size: 10px; color: #f0f4fa;
	text-shadow: 0 1px 2px rgba(0,0,0,0.15);
	line-height: 1.3;
	white-space: nowrap;
}

/* タイピング */
.mrl-typing .mrl-msg__bubble {
	display: inline-flex; gap: 4px;
	padding: 12px 14px;
}
.mrl-typing__dot {
	width: 6px; height: 6px; border-radius: 50%;
	background: #b0b8c4;
	animation: mrlBlink 1.2s infinite ease-in-out;
}
.mrl-typing__dot:nth-child(2) { animation-delay: .15s; }
.mrl-typing__dot:nth-child(3) { animation-delay: .3s; }
@keyframes mrlBlink {
	0%, 60%, 100% { opacity: .3; transform: translateY(0) }
	30% { opacity: 1; transform: translateY(-3px) }
}

/* 区切り */
.mrl-divider {
	text-align: center;
	color: #f0f4fa;
	font-size: 12px;
	margin: 20px 0 10px;
	letter-spacing: .5px;
	text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* エンドCTA */
.mrl-end {
	margin-top: 10px;
	background: #fff;
	border: 2px solid #c7ecf5;
	border-radius: 14px;
	padding: 16px;
	text-align: center;
	animation: mrlSlide .35s ease;
}
.mrl-end__text {
	font-size: 13px; color: #0e7490; font-weight: 600;
	line-height: 1.7; margin-bottom: 12px;
}
.mrl-end__btn {
	display: inline-block;
	padding: 12px 26px;
	background: linear-gradient(135deg, #ff6f9a 0%, #b56cff 100%);
	color: #fff !important;
	font-size: 14px; font-weight: 700;
	font-family: inherit;
	border: none; border-radius: 999px;
	cursor: pointer;
	text-decoration: none !important;
	box-shadow: 0 6px 16px rgba(181, 108, 255, 0.35);
	transition: transform .15s ease, box-shadow .15s ease;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.mrl-end__btn:hover,
.mrl-end__btn:focus,
.mrl-end__btn:visited {
	color: #fff !important;
	text-decoration: none !important;
}
.mrl-end__btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(181, 108, 255, 0.45);
}
.mrl-end__btn:active { transform: translateY(0); }

/* ---------- 選択肢 ---------- */
.mrl-chat-choices {
	padding: 10px 12px 4px;
	background: rgba(245, 246, 248, 0.98);
	display: flex; flex-direction: column; gap: 8px;
	border-top: 1px solid rgba(0,0,0,0.06);
}
.mrl-chat-choices:empty { padding: 0; border: none; }

.mrl-choice {
	background: #fff;
	border: 1.5px solid #c7ecf5;
	color: #0e7490;
	font-size: 13px;
	font-weight: 600;
	padding: 12px 14px;
	border-radius: 12px;
	cursor: pointer;
	text-align: left;
	line-height: 1.5;
	transition: all .15s ease;
}
.mrl-choice:hover {
	background: #eaf7fb;
	border-color: #1495c0;
	transform: translateY(-1px);
}
.mrl-choice__label {
	display: block;
	font-size: 11px;
	color: #5eaac5;
	font-weight: 700;
	margin-bottom: 3px;
	letter-spacing: .3px;
}

/* ---------- フッター ---------- */
.mrl-chat-footer {
	padding: 8px 14px 12px;
	background: #f5f6f8;
	text-align: center;
}
.mrl-chat-restart {
	background: transparent;
	border: none;
	color: #888;
	font-size: 12px;
	cursor: pointer;
	padding: 6px 10px;
}
.mrl-chat-restart:hover { color: #555; }

body.mrl-lock { overflow: hidden; }

/* =========================================================
   目次プラグイン干渉対策
   ランチャー・モーダル内のdivタイトル等を目次に含めない
   ========================================================= */
.mrl-chat-wrap [class*="toc"],
.mrl-chat-wrap .p-toc,
.mrl-chat-wrap .rtoc,
.mrl-chat-wrap .ez-toc-container,
.mrl-chat-wrap #toc_container {
	display: none !important;
}