/*
 * Cha Stall Adda v1.1 - scene layout: full-bleed day/night art, bottom dock,
 * popups (chat / TV channels / radio stations), in-scene TV, sign in/up.
 * Loaded after app.css; reuses its component styles (chat, cards, chips).
 */

.cs-v2 {
	--cs-pop-bg: rgba(52, 33, 22, 0.94);
	--cs-pop-bg-2: rgba(34, 21, 14, 0.96);
	--cs-serif: 'Noto Serif', 'Noto Serif Bengali', Georgia, 'Times New Roman', serif;
	position: relative;
	display: block;
	height: 100vh;
	height: 100dvh;
	min-height: 520px;
	overflow: hidden;
	background: #0d0907;
}

/* ---------- World (scene) ---------- */
.cs-v2 .cs-world { position: absolute; inset: 0; overflow: hidden; }
.cs-v2 .cs-box {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: max(100vw, calc(100dvh * var(--cs-ar, 1.7778)));
	height: max(100dvh, calc(100vw / var(--cs-ar, 1.7778)));
}
.cs-v2 .cs-art { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; object-fit: fill; }
.cs-v2.cs-theme-day img.cs-art.cs-day-only,
.cs-v2.cs-theme-day svg.cs-art { display: block; }
.cs-v2:not(.cs-theme-day) img.cs-art.cs-night-only { display: block; }
.cs-v2 .cs-vignette {
	position: absolute; inset: 0; pointer-events: none;
	background:
		linear-gradient(180deg, rgba(0, 0, 0, 0.38) 0%, rgba(0, 0, 0, 0) 22%),
		linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 26%),
		linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 38%);
}
.cs-v2 .cs-rain {
	position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
	background-image: repeating-linear-gradient(105deg, rgba(200, 225, 255, 0.55) 0 1px, transparent 1px 46px);
	background-size: 100% 100%;
	animation: cs-rain 0.9s linear infinite;
	mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
	-webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
}
.cs-v2.cs-theme-day .cs-rain { display: none; }
@keyframes cs-rain { from { background-position: 0 0; } to { background-position: -30px 60px; } }

/* ---------- In-scene TV ---------- */
.cs-v2 .cs-tv {
	position: absolute;
	left: var(--tv-x); top: var(--tv-y); width: var(--tv-w); height: var(--tv-h);
	z-index: 3;
	transform-origin: 50% 50%;
	transform: translate(var(--tvx, 0px), var(--tvy, 0px)) scale(var(--tvs, 1));
	transition: transform 320ms cubic-bezier(.2, .8, .2, 1);
	pointer-events: auto;
}
.cs-v2 .cs-tv[hidden] { display: none; }
.cs-v2 .cs-tv.is-big { z-index: 12; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), 0 0 0 3px rgba(20, 12, 8, 0.9); }
.cs-v2 .cs-tv .cs-tv-frame {
	position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto;
	border-radius: 2px; background: #050403; overflow: hidden;
}
.cs-v2 .cs-tv .cs-video { width: 100%; height: 100%; object-fit: contain; background: #050403; }
.cs-v2 .cs-tv:not(.is-big) .cs-tv-frame { border-radius: 3px; box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.55); }
.cs-v2 .cs-tv:not(.is-big) .cs-tv-frame::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 38%); }
.cs-v2.cs-theme-night .cs-tv:not(.is-big) .cs-video { filter: brightness(0.95) saturate(1.05); }
.cs-v2 .cs-tv .cs-tv-play { width: 38%; height: auto; aspect-ratio: 1; max-width: 64px; }
.cs-v2 .cs-tv .cs-tv-play svg { width: 55%; height: 55%; }
.cs-v2 .cs-tv .cs-tv-frame:fullscreen { width: 100vw; height: 100vh; }
.cs-v2 .cs-tv .cs-tv-frame:fullscreen .cs-video { object-fit: contain; }

.cs-v2 .cs-tv-bar {
	position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
	z-index: 40; display: flex; align-items: center; gap: 6px;
	padding: 6px 8px 6px 14px; max-width: calc(100% - 20px);
	border-radius: 999px; border: 1px solid var(--cs-border-strong);
	background: var(--cs-pop-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
	box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5); color: var(--cs-text);
}
.cs-v2 .cs-tv-bar[hidden] { display: none; }
.cs-v2 .cs-tv-bar-info { display: flex; flex-direction: column; min-width: 0; max-width: 150px; margin-right: 4px; }
.cs-v2 .cs-tv-bar-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-v2 .cs-tv-bar-info span { font-size: 11px; }
.cs-v2 .cs-tvb {
	display: grid; place-items: center; width: 34px; height: 34px; flex: none;
	border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: var(--cs-text); cursor: pointer;
}
.cs-v2 .cs-tvb:hover { background: var(--cs-accent); color: #2a1a08; }
.cs-v2 .cs-tvb svg { width: 18px; height: 18px; }
.cs-v2 #cs-tv-size { width: 90px; accent-color: var(--cs-accent); }

/* ---------- Top bar / brand / notes ---------- */
.cs-v2 .cs-topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 6; }
.cs-v2 .cs-brand { position: absolute; left: 0; top: 52px; z-index: 5; max-width: min(620px, 56vw); pointer-events: none; }
.cs-v2 .cs-brand-bn {
	font-family: var(--cs-serif); font-weight: 700; color: #fff;
	font-size: clamp(2.6rem, 8.2vw, 6.4rem); line-height: 1.02; letter-spacing: -0.01em;
	text-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
}
.cs-v2 .cs-brand-en { font-family: var(--cs-serif); font-weight: 700; letter-spacing: 0.32em; font-size: clamp(0.8rem, 2vw, 1.2rem); color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
.cs-v2 .cs-tagline { font-family: var(--cs-serif); font-size: clamp(0.95rem, 2.2vw, 1.5rem); color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7); }
.cs-v2 .cs-sign {
	position: absolute; z-index: 4; right: clamp(60px, 10vw, 200px); top: 32%;
	max-width: 190px; padding: 14px 12px; text-align: center;
	font-size: 13px; line-height: 1.35; color: #1d1a17;
	background: rgba(255, 255, 255, 0.28); border: 1px solid rgba(190, 70, 60, 0.7); border-radius: 6px;
	backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); pointer-events: none;
}
.cs-v2.cs-theme-night .cs-sign { color: #e8e2da; background: rgba(160, 170, 190, 0.35); }
.cs-v2 .cs-teapill {
	position: absolute; z-index: 6; left: 50%; bottom: 96px; transform: translateX(-50%);
	display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 14px;
	border-radius: 999px; background: rgba(20, 12, 8, 0.72); color: #fff; font-size: 13px; font-family: var(--cs-serif);
	backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); white-space: nowrap;
}
.cs-v2 .cs-teapill[hidden] { display: none; }
.cs-v2 .cs-teapill .cs-yes { padding: 3px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.22); color: #fff; font-weight: 700; text-decoration: none; }
.cs-v2 .cs-teapill .cs-no { border: 0; background: transparent; color: #fff; cursor: pointer; font: inherit; padding: 3px 8px; }
.cs-v2.has-pop .cs-teapill, .cs-v2.has-tv-bar .cs-teapill { display: none; }

/* ---------- Dock ---------- */
.cs-v2 .cs-dock {
	position: absolute; z-index: 20; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom));
	transform: translateX(-50%); width: min(1060px, calc(100% - 20px));
	display: flex; align-items: stretch; gap: 10px;
}
.cs-v2 .cs-radio-pill {
	flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px;
	border-radius: 16px; border: 1px solid rgba(255, 220, 180, 0.18);
	background: linear-gradient(180deg, rgba(104, 56, 36, 0.92), rgba(70, 36, 24, 0.94));
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); color: #fff;
}
.cs-v2 .cs-stations-btn {
	position: relative; flex: none; display: grid; place-items: center; width: 34px; height: 46px;
	border: 0; background: transparent; color: rgba(255, 255, 255, 0.85); cursor: pointer; padding: 0;
}
.cs-v2 .cs-stations-btn svg { width: 22px; height: 22px; }
.cs-v2 .cs-stations-btn svg:first-child { position: absolute; top: -2px; width: 18px; height: 18px; }
.cs-v2 .cs-stations-btn svg:last-child { margin-top: 12px; }
.cs-v2 .cs-radio-pill .cs-disc { width: 52px; height: 52px; flex: none; margin: 0; }
.cs-v2 .cs-radio-pill .cs-radio-meta { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cs-v2 .cs-radio-pill .cs-radio-meta strong { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-v2 .cs-radio-pill .cs-radio-meta > span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(255, 255, 255, 0.72); }
.cs-v2 .cs-prog { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.cs-v2 .cs-prog i { display: block; height: 100%; width: 0; background: #fff; border-radius: 4px; transition: width 400ms linear; }
.cs-v2 .cs-time { flex: none; font-size: 11.5px; color: rgba(255, 255, 255, 0.78); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-v2 .cs-radio-pill .cs-radio-controls { display: flex; align-items: center; gap: 6px; flex: none; margin: 0; }
.cs-v2 .cs-radio-pill .cs-eq { display: none; }
.cs-v2 .cs-radio-pill .cs-round-primary { background: #fff; color: #3b2314; width: 46px; height: 46px; }
.cs-v2 .cs-dock-btn {
	flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-width: 150px; padding: 0 22px; border-radius: 16px; cursor: pointer;
	border: 1px solid rgba(255, 220, 180, 0.2);
	background: linear-gradient(180deg, rgba(104, 56, 36, 0.92), rgba(70, 36, 24, 0.94));
	color: #fff; font-family: var(--cs-serif); font-weight: 700; font-size: 17px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
	transition: transform 160ms ease, background 160ms ease;
}
.cs-v2 .cs-dock-btn svg { width: 22px; height: 22px; }
.cs-v2 .cs-dock-btn:hover { background: linear-gradient(180deg, rgba(130, 70, 44, 0.96), rgba(88, 46, 30, 0.96)); }
.cs-v2 .cs-dock-btn:active { transform: scale(0.97); }
.cs-v2 .cs-dock-btn.is-on { outline: 2px solid var(--cs-accent); }
.cs-v2 .cs-dock-tv { min-width: 110px; }

/* ---------- Popups ---------- */
.cs-v2 .cs-pop {
	position: absolute; z-index: 25; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
	transform: translateX(-50%); width: min(880px, calc(100% - 20px));
	height: min(62dvh, 470px); max-height: calc(100% - 150px);
	display: flex; flex-direction: column;
	border-radius: 16px; border: 1px solid rgba(255, 220, 180, 0.2);
	background: linear-gradient(180deg, var(--cs-pop-bg), var(--cs-pop-bg-2));
	backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
	box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6); color: var(--cs-text);
	animation: cs-pop-in 220ms ease-out;
}
.cs-v2 .cs-pop[hidden] { display: none; }
@keyframes cs-pop-in { from { opacity: 0; transform: translateX(-50%) translateY(14px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.cs-v2 .cs-pop-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 8px 14px; border-bottom: 1px solid rgba(255, 220, 180, 0.14); }
.cs-v2 .cs-pop-head h2 { margin: 0; font-family: var(--cs-serif); font-size: 1.15rem; }
.cs-v2 .cs-pop-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 14px; scrollbar-width: thin; scrollbar-color: var(--cs-border-strong) transparent; }
.cs-v2 .cs-pop-chat .cs-pop-body { display: flex; flex-direction: column; }
.cs-v2 .cs-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--cs-text-soft); font-size: 26px; line-height: 1; cursor: pointer; }
.cs-v2 .cs-x:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.cs-v2 .cs-pop .cs-panel {
	flex: 1 1 auto; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
	backdrop-filter: none; -webkit-backdrop-filter: none; animation: none; min-height: 0;
}
.cs-v2 .cs-pop .cs-panel[hidden] { display: none; }
.cs-v2 .cs-tabs { margin: 0; padding: 0; border: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; gap: 4px; }
.cs-v2 .cs-tab { padding: 8px 16px; min-height: 36px; font-family: var(--cs-serif); font-size: 15px; font-weight: 700; color: var(--cs-text-soft); }
.cs-v2 .cs-tab[aria-selected='true'] { background: #f3dfc3; color: #3b2314; box-shadow: none; }

.cs-v2 .cs-nickrow { margin-bottom: 4px; }
.cs-v2 .cs-nickrow .cs-input { max-width: none; flex: 1; }
.cs-v2 .cs-nickwarn { margin: 0 0 8px; font-size: 11.5px; color: var(--cs-muted); }
.cs-v2[data-auth='in'] .cs-nickrow, .cs-v2[data-auth='in'] .cs-nickwarn { display: none; }
.cs-v2 .cs-presence-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 6px; }
.cs-v2 .cs-presence { padding: 3px 10px; font-size: 12px; }
.cs-v2 .cs-pop .cs-chat { min-height: 110px; max-height: none; flex: 1 1 auto; border-radius: 10px; background: rgba(0, 0, 0, 0.18); padding: 8px; }
.cs-v2 .cs-pop .cs-compose { margin-top: 8px; }
.cs-v2 .cs-pop .cs-songs { padding-bottom: 6px; }
.cs-v2 .cs-pop .cs-channel-grid, .cs-v2 .cs-pop .cs-station-grid { max-height: none; }
.cs-v2.gate-chat #cs-compose, .cs-v2.gate-memory #cs-memory-form { display: none; }
.cs-v2 .cs-memory-list .cs-msg { max-width: 100%; }

/* ---------- Auth ---------- */
.cs-v2 .cs-auth {
	flex: none; margin: 0 14px 12px; padding: 12px 14px 10px; text-align: center;
	border-radius: 14px; border: 1px solid rgba(255, 220, 180, 0.14); background: rgba(0, 0, 0, 0.22);
}
.cs-v2 .cs-auth[hidden], .cs-v2 .cs-me[hidden], .cs-v2 .cs-google[hidden] { display: none; }
.cs-v2 .cs-auth-title { margin: 0; font-weight: 700; font-size: 15px; color: #fff; }
.cs-v2 .cs-auth-sub { margin: 2px 0 8px; font-size: 11.5px; color: var(--cs-muted); }
.cs-v2 .cs-auth-tabs { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); margin-bottom: 8px; }
.cs-v2 .cs-auth-tab { border: 0; background: transparent; color: var(--cs-text-soft); padding: 6px 18px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; }
.cs-v2 .cs-auth-tab.is-active { background: var(--cs-accent); color: #2a1a08; }
.cs-v2 .cs-auth-form { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cs-v2 .cs-auth-form .cs-input { flex: 1 1 170px; min-height: 40px; max-width: 260px; }
.cs-v2 .cs-auth-form [data-only='register'] { display: none; }
.cs-v2 .cs-auth.is-register .cs-auth-form [data-only='register'] { display: block; }
.cs-v2 .cs-auth-err { flex: 1 1 100%; margin: 0; min-height: 0; font-size: 12.5px; color: var(--cs-danger); }
.cs-v2 .cs-auth-err:empty { display: none; }
.cs-v2 .cs-btn-primary { flex: 1 1 100%; max-width: 260px; min-height: 40px; border: 0; border-radius: 999px; background: var(--cs-accent); color: #2a1a08; font-weight: 700; font-size: 14px; cursor: pointer; }
.cs-v2 .cs-btn-primary:disabled { opacity: 0.6; cursor: wait; }
.cs-v2 .cs-google { margin-top: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cs-v2 .cs-or { font-size: 11.5px; color: var(--cs-muted); }
.cs-v2 .cs-auth-legal { margin: 8px 0 0; font-size: 11px; color: var(--cs-muted); }
.cs-v2 .cs-me { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px 10px; font-size: 13px; color: var(--cs-text-soft); border-top: 1px solid rgba(255, 220, 180, 0.12); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
	.cs-v2 .cs-dock { flex-wrap: wrap; gap: 8px; }
	.cs-v2 .cs-radio-pill { flex: 1 1 100%; order: 1; padding: 6px 10px 6px 6px; gap: 8px; }
	.cs-v2 .cs-dock-btn { order: 2; flex: 1 1 0; min-width: 0; padding: 12px 10px; font-size: 15px; }
	.cs-v2 .cs-time, .cs-v2 .cs-prog { display: none; }
	.cs-v2 .cs-pop { bottom: calc(150px + env(safe-area-inset-bottom)); height: min(58dvh, 440px); max-height: calc(100% - 200px); }
	.cs-v2 .cs-tv-bar { bottom: 150px; flex-wrap: wrap; justify-content: center; border-radius: 18px; }
	.cs-v2 .cs-teapill { bottom: 150px; }
	.cs-v2 .cs-sign { display: none; }
	.cs-v2 .cs-brand { max-width: 80vw; }
	.cs-v2 .cs-tab { padding: 7px 10px; font-size: 13px; }
}
@media (max-height: 560px) { .cs-v2 .cs-brand-bn { font-size: 2.2rem; } .cs-v2 .cs-tagline, .cs-v2 .cs-brand-en { display: none; } }
@media (prefers-reduced-motion: reduce) { .cs-v2 .cs-tv, .cs-v2 .cs-pop, .cs-v2 .cs-rain { animation: none; transition: none; } }
