/* =========================================================
 *  キャンペーンポップアップ
 *  ※ レイアウトは固定px＋メディアクエリで構成（vw不使用＝横はみ出し防止）
 * ======================================================= */

.cpopup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: none;               /* JSで is-active を付与して表示 */
	align-items: center;
	justify-content: center;
	z-index: 99999;
	padding: 22px;
	box-sizing: border-box;
	opacity: 0;
	transition: opacity .3s ease;
	-webkit-tap-highlight-color: transparent;
}
.cpopup-overlay.is-active  { display: flex; }
.cpopup-overlay.is-visible { opacity: 1; }
.cpopup-overlay * { box-sizing: border-box; }

/* ---------- 画像モード ---------- */
.cpopup-box {
	position: relative;
	width: 100%;
	max-width: 380px;
	transform: translateY(12px) scale(.97);
	transition: transform .3s ease;
}
.cpopup-overlay.is-visible .cpopup-box { transform: none; }
.cpopup-imglink { display: block; line-height: 0; }
.cpopup-img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

/* ---------- HTMLモード カード ---------- */
.cpopup-card {
	position: relative;
	isolation: isolate;         /* 表示時は transform:none になるため明示的にスタッキングコンテキスト化（キラキラ z-index:-1 を背景より前面に保つ） */
	width: 100%;
	max-width: 380px;
	min-width: 0;
	background: #fffdf6;
	border: 3px dashed #efc84a;
	border-radius: 20px;
	padding: 50px 20px 26px;
	text-align: center;
	box-shadow: 0 14px 44px rgba(0, 0, 0, .35);
	transform: translateY(14px) scale(.96);
	transition: transform .3s ease;
	font-family: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro",
		"Rounded Mplus 1c", "Segoe UI", "Helvetica Neue", Meiryo, sans-serif;
	color: #5b4a3a;
	overflow: visible;          /* キャラがカード外にわずかに覗くため */
}
.cpopup-overlay.is-visible .cpopup-card { transform: none; }

/* 上部フラッグガーランド */
.cpopup-flags {
	position: absolute;
	top: 16px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 4px;
	padding-top: 6px;
	border-top: 2px solid #2d9cdb;   /* 紐 */
	max-width: 86%;
}
.cpopup-flag {
	width: 0;
	height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-top: 13px solid #ccc;
}
.cpopup-flag-0 { border-top-color: #a0c238; }  /* 黄緑 */
.cpopup-flag-1 { border-top-color: #ef858c; }  /* ピンク */
.cpopup-flag-2 { border-top-color: #5bc2e7; }  /* 水色 */
.cpopup-flag-3 { border-top-color: #f4b400; }  /* からし */
.cpopup-flag-4 { border-top-color: #f0876a; }  /* オレンジ */

/* キャラクター（マスコット）装飾 */
.cpopup-char {
	position: absolute;
	height: auto;
	z-index: 2;
	pointer-events: none;
	filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .18));
}
.cpopup-char-joy {
	width: 84px;            /* 大喜びキャラ：左上から覗く */
	top: -18px;
	left: -8px;
	transform: rotate(-6deg);
}
.cpopup-char-guts {
	width: 80px;            /* ガッツポーズキャラ：右下から登場 */
	bottom: -12px;
	right: -8px;
}

/* キラキラ星（4方向の輝き） */
.cpopup-spark {
	position: absolute;
	background: currentColor;
	clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
	z-index: -1;                /* 文字より背面へ（価格などのテキストに被らせない） */
	pointer-events: none;
}
.cpopup-spark-1 { top: 25%;  left: 13%;  color: #5bc2e7; width: 18px; height: 18px; }
.cpopup-spark-2 { top: 22%;  left: 81%;  color: #ef99a0; width: 13px; height: 13px; }
.cpopup-spark-3 { top: 31%;  left: 85%;  color: #f4c430; width: 11px; height: 11px; }

/* リード */
.cpopup-lead-1 { margin: 0; font-size: 14px; font-weight: 600; color: #6b5a48; }
.cpopup-lead-2 { margin: 2px 0 6px; font-size: 19px; font-weight: 800; color: #5b4a3a; }

/* 見出し */
.cpopup-title {
	margin: 4px 0 22px;          /* 見出しの下に隙間を確保 */
	line-height: 1.16;
	color: #f18d00;
	font-weight: 900;
	text-shadow:
		2px 2px 0 #fff, -2px 2px 0 #fff, 2px -2px 0 #fff, -2px -2px 0 #fff,
		0 3px 0 #f7d27a;
}
.cpopup-title-top  { display: block; font-size: 25px; }
.cpopup-title-main {
	display: block;
	font-size: 31px;             /* キャンペーン名をひとまわり大きく（1行に収める） */
	-webkit-text-stroke: .5px #f18d00;   /* 線を足して太く・くっきり見せる */
}

/* 価格 */
.cpopup-price {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin: 6px 0;
}
.cpopup-price-label {
	background: #9b9b9b;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	padding: 5px 11px;
	border-radius: 6px;
	white-space: nowrap;
}
.cpopup-price-body { display: inline-flex; align-items: center; gap: 6px; }
.cpopup-price-old {
	color: #8a8a8a;
	text-decoration: line-through;
	font-size: 17px;
	font-weight: 700;
	white-space: nowrap;
}
.cpopup-arrow { color: #f18d00; font-size: 22px; font-weight: 900; line-height: 1; }
.cpopup-price-new {
	position: relative;
	color: #e60012;
	font-size: 38px;
	font-weight: 900;
	line-height: 1;
	white-space: nowrap;
}
.cpopup-ruby {
	position: absolute;
	left: 50%;
	top: -.95em;
	transform: translateX(-50%);
	font-size: .26em;
	font-weight: 700;
	color: #e60012;
	letter-spacing: .35em;
	white-space: nowrap;
}

/* 区切り */
.cpopup-divider {
	border: 0;
	border-top: 2px dotted #ecc94b;
	margin: 14px auto;
	width: 88%;
}

/* 期間 */
.cpopup-period-label {
	display: inline-block;
	background: #9b9b9b;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	padding: 5px 14px;
	border-radius: 6px;
	margin-bottom: 8px;
}
.cpopup-period { margin: 0; font-size: 18px; font-weight: 800; color: #5b4a3a; }

/* ボタン */
.cpopup-btn {
	display: block;
	position: relative;
	z-index: 1;
	margin-top: 18px;
	background: #27a4dd;
	color: #fff;
	font-size: 17px;
	font-weight: 800;
	text-decoration: none;
	padding: 15px 12px;
	border-radius: 12px;
	box-shadow: 0 4px 0 #1d87b8;
	transition: filter .15s ease, transform .08s ease, box-shadow .08s ease;
}
.cpopup-btn:hover  { filter: brightness(1.05); color: #fff; }
.cpopup-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1d87b8; }

/* 閉じるボタン */
.cpopup-close {
	position: absolute;
	top: -14px;
	right: -14px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: none;
	background: #fff;
	color: #333;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 3;
}
.cpopup-close:hover { background: #f3f3f3; }

/* ---------- スマホ（〜420px） ---------- */
@media (max-width: 420px) {
	.cpopup-card { padding: 46px 16px 22px; }
	.cpopup-lead-1 { font-size: 13px; }
	.cpopup-lead-2 { font-size: 17px; }
	.cpopup-title-top  { font-size: 21px; }
	.cpopup-title-main { font-size: 28px; }
	.cpopup-price { margin-top: 12px; }
	.cpopup-price-old { font-size: 15px; }
	.cpopup-arrow { font-size: 19px; }
	.cpopup-price-new { font-size: 32px; }
	.cpopup-period { font-size: 16px; }
	.cpopup-btn { font-size: 16px; padding: 14px 10px; }
	.cpopup-char-joy  { width: 72px; top: -14px; left: -6px; }
	.cpopup-char-guts { width: 66px; bottom: -16px; right: -6px; }
	.cpopup-close { top: -10px; right: -10px; width: 32px; height: 32px; font-size: 20px; }
}

/* ---------- 極小幅（〜340px） ---------- */
@media (max-width: 340px) {
	.cpopup-title-top  { font-size: 19px; }
	.cpopup-title-main { font-size: 24px; }
	.cpopup-price-new { font-size: 28px; }
	.cpopup-btn { font-size: 15px; padding: 13px 8px; }
	.cpopup-char-joy  { width: 60px; }
	.cpopup-char-guts { width: 54px; bottom: -16px; right: -4px; }
}
