/* cherish-tower (patch-tower-card.py) — 배틀홈 구름타워 카드.

   카드 = 구름 바다 그림 한 장. 다른 홈 카드(.menugroup)와 달리 껍데기를 직접 그린다 —
   그림이 카드 끝까지 차야 해서 .menugroup 의 배경·패딩을 그대로 쓸 수 없다.

   결정 기록 (2026-09-06, 시안 10차까지):
   - 목록을 왼쪽으로 몰아 오른쪽에 탑 자리를 비우는 안 → 폐기(어색). 빈 머리 띠 → 폐기(공간 낭비).
     지금은 **그림 구도**가 카드에 맞춰져 있다(탑이 오른쪽 위, 아래 2/3 는 빈 구름). 목록은 원래 폭 그대로.
   - 금색·입체·발광 전부 폐기 — 2000년대 초 게임 로고 느낌. 강조는 조용한 자주(--cw-tw-accent)만.
   - 제목은 워드마크 **그림**(tower-wordmark.png, Pretendard ExtraBold 단색). 없으면 글자 폴백.
   - 층 줄은 랭킹 4위 이하 행과 같은 격자(층·얼굴·이름·전적+막대). 상대 팀은 절대 안 보여준다. */
:root {
	--cw-tw-ink: #5f3d63;
	--cw-tw-ink-2: #8a6a8c;
	--cw-tw-glass: rgba(255, 255, 255, .62);
	--cw-tw-glass-line: rgba(255, 255, 255, .78);
	--cw-tw-accent: #8c5a86;
	--cw-tw-accent-line: rgba(140, 90, 134, .38);
}
.cw-tower {
	position: relative;
	box-sizing: border-box;
	margin: 0 auto 14px;
	padding: 0;
	overflow: hidden;
	border: 1px solid var(--cw-line, rgba(254, 205, 211, .9));
	border-radius: var(--cw-r, 20px);
	box-shadow: var(--cw-card-shadow, 0 4px 24px -4px rgba(190, 18, 60, .12));
	color: var(--cw-tw-ink);
	/* 그림이 없으면 파스텔 그라데이션 폴백 */
	background: url('/cherish/ui/tower-bg.webp?v=1') center top / cover no-repeat,
		linear-gradient(180deg, #f3ecff 0%, #ffeef4 55%, #fdf3f5 100%);
}
/* 그림 위 막 — 위(탑 자리)는 맑게, 아래(목록 자리)만 뽀얗게 */
.cw-tower::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		linear-gradient(180deg, rgba(255, 252, 255, .04) 0%, rgba(255, 252, 255, .2) 22%, rgba(255, 252, 255, .56) 40%, rgba(255, 252, 255, .66) 100%),
		radial-gradient(90% 60% at 8% 100%, rgba(226, 214, 255, .28), transparent 70%);
}
/* 빛 알갱이 — 26초에 걸쳐 아주 느리게 떠오른다. CSS 라 배경 그림이 뭐든 얹힌다 */
.cw-tower-motes {
	position: absolute;
	inset: -20% -5%;
	pointer-events: none;
	opacity: .5;
	background:
		radial-gradient(circle 3px at 12% 78%, rgba(255, 255, 255, .95), transparent),
		radial-gradient(circle 2px at 26% 42%, rgba(255, 255, 255, .8), transparent),
		radial-gradient(circle 4px at 41% 88%, rgba(255, 243, 250, .85), transparent),
		radial-gradient(circle 2px at 58% 30%, rgba(255, 255, 255, .75), transparent),
		radial-gradient(circle 3px at 73% 64%, rgba(247, 240, 255, .9), transparent),
		radial-gradient(circle 2px at 88% 22%, rgba(255, 255, 255, .7), transparent),
		radial-gradient(circle 3px at 94% 72%, rgba(255, 248, 252, .8), transparent),
		radial-gradient(circle 2px at 6% 20%, rgba(255, 255, 255, .65), transparent);
	animation: cw-tower-drift 26s ease-in-out infinite alternate;
}
@keyframes cw-tower-drift {
	from { transform: translate3d(0, 0, 0); }
	to { transform: translate3d(-10px, -22px, 0); }
}
@media (prefers-reduced-motion: reduce) { .cw-tower-motes { animation: none; } }
.cw-tower-in { position: relative; padding: 14px 16px; }

/* 제목 — 워드마크 그림. 그림이 안 오면 .no-img 가 붙어 글자가 대신 나온다 */
.cw-tower-head { display: flex; flex-direction: column; align-items: flex-start; }
.cw-tower-head .cw-eyebrow { display: block; font-size: 7.5pt; letter-spacing: .28em; text-transform: uppercase; color: var(--cw-tw-accent); font-weight: 800; }
.cw-tower-title { margin: 2px 0 0; line-height: 0; }
.cw-tower-wordmark { display: block; height: 26px; width: auto; }
.cw-tower-title-text { display: none; font: 400 15pt/1.2 'Cafe24Dongdong', 'Pretendard', sans-serif; color: var(--cw-tw-ink); }
.cw-tower-title.no-img { line-height: 1.2; }
.cw-tower-title.no-img .cw-tower-title-text { display: block; }

.cw-tower-since { margin: 9px 0 0; padding: 7px 12px; border-radius: 10px; background: rgba(255, 255, 255, .68); border: 1px solid rgba(255, 255, 255, .8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: 9.5pt; color: var(--cw-accent-dark, #be123c); font-weight: 700; word-break: keep-all; }

/* 정상 + 남은 기회 한 줄 */
.cw-tower-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 9px 0 8px; }
.cw-tower-summit { display: flex; align-items: baseline; gap: 8px; font: 800 8pt/1 'Pretendard', sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--cw-tw-accent); text-shadow: 0 0 14px rgba(255, 255, 255, .9); }
.cw-tower-summit b { font: 400 13.5pt/1 'Cafe24Dongdong', 'Pretendard', sans-serif; letter-spacing: 0; color: var(--cw-ink, #881337); font-variant-numeric: tabular-nums; }
.cw-tower-summit span { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--cw-tw-ink-2); }
.cw-tower-chance { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 11px; border-radius: 999px; background: rgba(255, 255, 255, .68); border: 1px solid rgba(255, 255, 255, .8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.cw-tower-chance-label { font-size: 8pt; color: var(--cw-tw-ink-2); font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.cw-tower-balls { display: inline-flex; gap: 4px; }
.cw-tower-ball { display: block; width: 19px; height: 19px; filter: drop-shadow(0 1px 2px rgba(95, 61, 99, .35)); }
.cw-tower-ball.is-used { filter: none; opacity: .55; }

/* 층 줄 — 랭킹 4위 이하 행과 같은 격자 */
.cw-tower-rungs { display: flex; flex-direction: column; gap: 5px; }
/* 층 목록은 상자 안에서 스크롤한다 (2026-09-15). 카드 높이가 늘 같고, 열면 내 층이 가운데 와 있다.
   위아래 끝은 mask 로 녹여 「더 있다」를 스크롤바보다 조용하게 말한다. */
.cw-tower-scroll {
	position: relative;
	max-height: 246px;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 2px 4px 2px 2px;
	margin: 0 -4px 0 -2px;
	-webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
	mask-image: linear-gradient(180deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
	scrollbar-width: thin;
	scrollbar-color: rgba(140, 90, 134, .35) transparent;
}
.cw-tower-scroll::-webkit-scrollbar { width: 6px; }
.cw-tower-scroll::-webkit-scrollbar-thumb { background: rgba(140, 90, 134, .32); border-radius: 999px; }
.cw-tower-scroll::-webkit-scrollbar-track { background: transparent; }
.cw-tower-rung {
	display: grid;
	grid-template-columns: 26px 32px minmax(0, 1fr) 96px auto;
	gap: 10px;
	align-items: center;
	padding: 7px 12px 7px 9px;
	border-radius: 12px;
	background: var(--cw-tw-glass);
	border: 1px solid var(--cw-tw-glass-line);
	box-shadow: 0 4px 16px -12px rgba(95, 61, 99, .6);
	color: var(--cw-tw-ink);
	-webkit-backdrop-filter: blur(9px) saturate(1.15);
	backdrop-filter: blur(9px) saturate(1.15);
}
.cw-tower-rung-no { text-align: center; font: 400 13.5px/1 'Cafe24Dongdong', 'Pretendard', sans-serif; color: var(--cw-tw-ink-2); font-variant-numeric: tabular-nums; }
.cw-tower-face-wrap { width: 32px; height: 32px; }
.cw-tower-face { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: rgba(255, 255, 255, .7); box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 3px 8px -4px rgba(95, 61, 99, .5); }
/* 익명 줄은 api 가 폴백 얼굴만 준다. 여기서 한 번 더 지운다 — 얼굴이 곧 신원이면 안 된다 */
.cw-tower-rung.is-anon .cw-tower-face { filter: grayscale(1) brightness(1.08); opacity: .6; }
.cw-tower-who { min-width: 0; }
.cw-tower-name-line { display: flex; align-items: center; min-width: 0; gap: 7px; }
.cw-tower-name { min-width: 0; font-size: 10pt; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-tower-rung.is-anon .cw-tower-name { font-style: italic; color: var(--cw-tw-ink-2); }
.cw-tower-fatigue { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border-radius: 999px; border: 1px solid rgba(140, 90, 134, .36); background: radial-gradient(circle at 35% 25%, #fff 0 35%, #fce7f3 70%, #f5d0fe 100%); color: #7e3a86; font-size: 11px; cursor: pointer; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6), 0 5px 12px -7px rgba(126, 58, 134, .7); }
.cw-tower-fatigue.is-active { color: #be123c; border-color: rgba(190, 18, 60, .48); background: radial-gradient(circle at 35% 25%, #fff 0 32%, #ffe4e6 68%, #fecdd3 100%); box-shadow: 0 0 0 2px rgba(255, 255, 255, .65), 0 0 0 5px rgba(244, 63, 94, .12), 0 6px 14px -7px rgba(190, 18, 60, .85); }
.cw-tower-fatigue:hover, .cw-tower-fatigue:focus { background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(140, 90, 134, .2), 0 6px 14px -7px rgba(126, 58, 134, .8); }
.cw-tower-def { text-align: right; }
.cw-tower-def-txt { display: block; font-size: 8pt; color: var(--cw-tw-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cw-tower-stat { display: block; }
.cw-tower-track { display: block; margin-top: 4px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 1px rgba(95, 61, 99, .08); overflow: hidden; }
.cw-tower-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #c9aee9, #f2a9c4); }
.cw-tower-rung.is-dim { background: rgba(255, 255, 255, .4); border-color: rgba(255, 255, 255, .55); box-shadow: none; padding: 5px 12px 5px 9px; }
.cw-tower-rung.is-dim .cw-tower-name { font-size: 9pt; color: var(--cw-tw-ink-2); }
.cw-tower-rung.is-dim .cw-tower-face-wrap { width: 26px; height: 26px; }
/* 바로 위층 — 흰 카드 + 도전 버튼 */
.cw-tower-rung.is-target { background: rgba(255, 255, 255, .88); border: 1px solid var(--cw-tw-accent-line); box-shadow: 0 0 22px -6px rgba(140, 90, 134, .28), 0 10px 26px -16px rgba(95, 61, 99, .55); padding: 9px; }
.cw-tower-rung.is-target .cw-tower-rung-no { color: var(--cw-tw-accent); font-size: 16px; }
.cw-tower-rung.is-target .cw-tower-face-wrap { width: 38px; height: 38px; }
.cw-tower-rung.is-target .cw-tower-name { font-size: 11.5pt; color: var(--cw-ink, #881337); }
.cw-tower-tag { display: block; font-size: 7pt; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--cw-tw-accent); margin-bottom: 1px; }
/* 도전 버튼 — 자동매칭 CTA 와 같은 배경 그림·질감 */
.cw-tower-go {
	position: relative;
	border: 0;
	border-radius: 12px;
	padding: 10px 16px;
	color: #fff;
	font: 400 11pt/1 'Cafe24Dongdong', 'Pretendard', sans-serif;
	white-space: nowrap;
	cursor: pointer;
	overflow: hidden;
	background: url('/cherish/ui/cta-bg.png?v=1') center / 100% 100% no-repeat,
		var(--cw-cta-grad, linear-gradient(135deg, #fb7185 0%, #e11d48 52%, #be123c 100%));
	box-shadow: 0 10px 22px -10px rgba(225, 29, 72, .75), inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.cw-tower-go::before { content: ""; position: absolute; inset: 0; background: url('/cherish/ui/cta-texture.png?v=1') repeat 0 0 / 128px 128px; opacity: .14; pointer-events: none; }
.cw-tower-go:disabled { opacity: .55; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); filter: saturate(.6); cursor: default; }
/* 내 층 — 체리 */
.cw-tower-rung.is-mine { background: var(--cw-cta-grad, linear-gradient(135deg, #fb7185, #be123c)); border-color: rgba(255, 255, 255, .55); color: #fff; box-shadow: 0 0 24px -8px rgba(251, 113, 133, .7), 0 12px 24px -14px rgba(190, 18, 60, .6); }
.cw-tower-rung.is-mine .cw-tower-rung-no, .cw-tower-rung.is-mine .cw-tower-def-txt { color: rgba(255, 255, 255, .92); }
.cw-tower-rung.is-mine .cw-tower-track { background: rgba(255, 255, 255, .3); box-shadow: none; }
.cw-tower-rung.is-mine .cw-tower-fill { background: rgba(255, 255, 255, .85); }
.cw-tower-rung.is-mine .cw-tower-face { box-shadow: 0 0 0 2px rgba(255, 255, 255, .95), 0 3px 8px -4px rgba(120, 10, 40, .5); }

.cw-tower-foot { display: flex; align-items: center; gap: 12px; margin-top: 11px; flex-wrap: wrap; }
.cw-tower-anon { font-size: 9.5pt; color: var(--cw-tw-ink); display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .68); border: 1px solid rgba(255, 255, 255, .8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); cursor: pointer; }
.cw-tower-list-toggle { margin-left: auto; background: none; border: 0; padding: 0; color: var(--cw-tw-ink-2); font-size: 9.5pt; text-decoration: underline; cursor: pointer; }
.cw-tower-note { margin: 9px 0 0; font-size: 9pt; color: var(--cw-tw-ink-2); word-break: keep-all; }
/* 첫 등반 상자 (2026-09-24) — 자리 없는 졸업생에게만. 발광·금색 없이 유리 판 + 조용한 자주 테두리 */
.cw-tower-first { display: flex; gap: 11px; align-items: flex-start; margin: 10px 0 2px; padding: 11px 12px; border-radius: 14px; background: rgba(255, 255, 255, .86); border: 1px solid var(--cw-tw-accent-line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.cw-tower-first-ic { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #f5e8ff, #ffe4ec); color: var(--cw-tw-accent); font-size: 17px; }
.cw-tower-first-txt { min-width: 0; font-size: 9.5pt; line-height: 1.5; color: var(--cw-tw-ink); word-break: keep-all; }
.cw-tower-first-txt b { display: block; font-size: 10.5pt; color: var(--cw-ink, #881337); margin-bottom: 1px; }
.cw-tower-first-txt p { margin: 0; }
.cw-tower-first-chip { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 999px; background: #fff3f6; border: 1px solid #fecdd3; color: var(--cw-accent-dark, #be123c); font-size: 8.5pt; font-weight: 700; }
.cw-tower-rung.is-target.is-first { box-shadow: 0 0 0 2px rgba(140, 90, 134, .32), 0 10px 26px -16px rgba(95, 61, 99, .55); }
.cw-tower-err { margin: 8px 0 0; font-size: 9.5pt; color: #c0392b; font-weight: 700; }

@media (max-width: 700px) {
	.cw-tower-rung { grid-template-columns: 22px 28px minmax(0, 1fr) auto; gap: 8px; padding: 6px 10px 6px 8px; }
	/* 모바일에도 **모든 층** 전적을 보인다 (2026-09-09 사용자: PC 는 다 보이는데 모바일은 윗층만 보였다).
	   폭이 좁아 승률 막대와 「방어」 라벨은 뺀다 — 숫자만으로도 읽힌다. */
	.cw-tower-rung .cw-tower-def { display: block; }
	.cw-tower-rung .cw-tower-track { display: none; }
	.cw-tower-def-label { display: none; }
	.cw-tower-def-txt { font-size: 7.5pt; }
	.cw-tower-stat { display: inline; }
	.cw-tower-stat + .cw-tower-stat::before { content: " / "; }
	.cw-tower-rung.is-target { grid-template-columns: 22px 34px minmax(0, 1fr); }
	.cw-tower-rung.is-target .cw-tower-def { display: block; text-align: left; grid-column: 2 / -1; }
	/* 대상 줄은 이름 아래 전체폭이라 여유가 있다 — 막대·라벨을 그대로 둔다 (모바일 회귀 방지) */
	.cw-tower-rung.is-target .cw-tower-track { display: block; }
	.cw-tower-rung.is-target .cw-tower-def-label { display: inline; }
	.cw-tower-go { grid-column: 1 / -1; margin-top: 6px; text-align: center; }
	.cw-tower-list-toggle { margin-left: 0; }
	.cw-tower-chance-label { display: none; }
	.cw-tower-wordmark { height: 23px; }
	.cw-tower { background-position: 62% top; }
}
