/* ══════════════════════════════════════════════════════════════════════
   Children's World — standalone full-screen chat page.
   No theme CSS is loaded on this page, so this file styles everything.
   ══════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
	--sky1: #5ec8ff;
	--sky2: #b8ecff;
	--ink: #23215c;
	--mute: #5a5890;
	--sun: #ffd23f;
	--pink: #ff5fa2;
	--green: #2ccf8e;
	--purple: #7a5cff;
	--lilac: #f3f1ff;
}

html, body { height: 100%; }
body.kw {
	margin: 0;
	min-height: 100%;
	background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 60%, #fff6dc 100%) fixed;
	color: var(--ink);
	font-family: "Baloo 2", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
	font-size: 18px;
	line-height: 1.4;
	-webkit-font-smoothing: antialiased;
	overflow: hidden; /* the chat scrolls, not the page */
}

/* ── Sky decorations ─────────────────────────────────────────────── */
.kw-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.kw-sun { position: absolute; top: -50px; right: -40px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, #fff3a8 0%, var(--sun) 55%, rgba(255,210,63,0) 72%); animation: kw-glow 6s ease-in-out infinite; }
@keyframes kw-glow { 50% { transform: scale(1.08); } }
.kw-cloud { position: absolute; width: 150px; height: 46px; background: #fff; border-radius: 46px; opacity: .92; animation: kw-drift 46s linear infinite; }
.kw-cloud::before, .kw-cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.kw-cloud::before { width: 64px; height: 64px; top: -30px; left: 24px; }
.kw-cloud::after { width: 48px; height: 48px; top: -20px; left: 76px; }
.kw-cloud--1 { top: 16%; left: -170px; }
.kw-cloud--2 { top: 42%; left: -170px; transform: scale(.75); animation-duration: 60s; animation-delay: -25s; opacity: .7; }
.kw-cloud--3 { top: 66%; left: -170px; transform: scale(.6); animation-duration: 75s; animation-delay: -50s; opacity: .6; }
@keyframes kw-drift { to { left: 110%; } }
.kw-star { position: absolute; color: var(--sun); font-size: 24px; animation: kw-twinkle 2.6s ease-in-out infinite; }
.kw-star--1 { top: 12%; left: 8%; }
.kw-star--2 { top: 30%; right: 9%; font-size: 18px; animation-delay: .9s; }
.kw-star--3 { top: 55%; left: 4%; font-size: 15px; animation-delay: 1.7s; }
@keyframes kw-twinkle { 50% { transform: scale(1.35) rotate(15deg); opacity: .55; } }
.kw-hills { position: absolute; left: -10%; right: -10%; bottom: -2px; height: 150px;
	background:
		radial-gradient(55% 150px at 18% 150px, #8be08f 98%, transparent 100%),
		radial-gradient(50% 130px at 82% 150px, #6fd17a 98%, transparent 100%); }

/* ── App frame: title / chat (scrolls) / composer ─────────────────── */
.kw-app {
	position: relative; z-index: 1;
	display: flex; flex-direction: column;
	height: 100vh; height: 100dvh;
	max-width: 820px; margin: 0 auto;
	padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
}
.kw-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 10px; flex: 0 0 auto; }
.kw-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kw-mascot { display: inline-grid; place-items: center; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 18px; background: var(--sun); font-size: 28px; box-shadow: 0 5px 0 #e6b100; transform: rotate(-6deg); animation: kw-bob 3s ease-in-out infinite; }
@keyframes kw-bob { 50% { transform: rotate(4deg) translateY(-4px); } }
.kw-title { margin: 0; font-size: clamp(28px, 6vw, 42px); font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 3px 0 var(--purple), 0 6px 0 rgba(35,33,92,.22); white-space: nowrap; }
.kw-quota { flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; background: #fff; color: var(--purple); font-weight: 800; font-size: 16px; box-shadow: 0 4px 0 rgba(35,33,92,.15); }
.kw-quota.is-empty { color: var(--pink); }
.kw-top-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.kw-home { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 999px; background: #fff; color: var(--purple); font-weight: 800; font-size: 16px; text-decoration: none; box-shadow: 0 4px 0 rgba(35,33,92,.15); transition: transform .1s ease, box-shadow .1s ease; }
.kw-home:hover { color: var(--purple); text-decoration: none; background: #f6f3ff; }
.kw-home:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(35,33,92,.15); }
.kw-home:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.kw-clear { flex: 0 0 auto; border: 0; cursor: pointer; padding: 6px 14px; border-radius: 999px; background: #e74c3c; color: #fff; font: inherit; font-weight: 800; font-size: 16px; box-shadow: 0 4px 0 #a93226; transition: transform .1s ease, box-shadow .1s ease; }
.kw-clear:hover { background: #ef5b4b; }
.kw-clear:active { transform: translateY(3px); box-shadow: 0 1px 0 #a93226; }
.kw-clear:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.kw-clear:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.kw-chat {
	flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
	padding: 14px 12px 18px; border-radius: 28px 28px 0 0;
	background: rgba(255,255,255,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
	border: 3px solid rgba(255,255,255,.8); border-bottom: 0;
	scroll-behavior: smooth;
}
.kw-chat::-webkit-scrollbar { width: 8px; }
.kw-chat::-webkit-scrollbar-thumb { background: rgba(122,92,255,.35); border-radius: 8px; }

/* Messages */
.kw-msg { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 14px; animation: kw-pop .28s ease-out; }
@keyframes kw-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.kw-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #fff; font-size: 24px; box-shadow: 0 3px 0 rgba(35,33,92,.12); }
.kw-bubble { max-width: min(80%, 560px); padding: 12px 16px; border-radius: 22px 22px 22px 6px; background: #fff; color: var(--ink); box-shadow: 0 4px 0 rgba(35,33,92,.10); font-size: 18px; word-wrap: break-word; }
.kw-bubble p { margin: 0 0 8px; }
.kw-bubble p:last-child { margin-bottom: 0; }
.kw-bubble ul { margin: 4px 0 8px; padding-left: 22px; }
.kw-msg--me { flex-direction: row-reverse; }
.kw-msg--me .kw-bubble { background: var(--purple); color: #fff; border-radius: 22px 22px 6px 22px; box-shadow: 0 4px 0 #5a3fe0; }
.kw-msg--me .kw-avatar { background: var(--sun); }
.kw-bubble.is-error { background: #ffe9f2; color: #b0275f; }
.kw-tag { display: inline-block; margin-bottom: 4px; padding: 1px 10px; border-radius: 999px; background: rgba(255,255,255,.25); font-size: 14px; font-weight: 700; }

/* Typing dots */
.kw-dots { display: inline-flex; gap: 6px; padding: 6px 2px; }
.kw-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--purple); opacity: .5; animation: kw-dot 1.2s infinite; }
.kw-dots i:nth-child(2) { animation-delay: .15s; }
.kw-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes kw-dot { 30% { transform: translateY(-6px); opacity: 1; } }

/* Movie making inside a bubble */
.kw-making { min-width: min(320px, 62vw); }
.kw-reel { display: inline-block; font-size: 34px; animation: kw-spin 2s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes kw-spin { to { transform: rotate(360deg); } }
.kw-making-line { font-weight: 700; }
.kw-pct { float: right; margin-left: 10px; font-weight: 900; font-size: 22px; color: var(--purple); font-variant-numeric: tabular-nums; line-height: 1.2; }
.kw-bar { height: 16px; margin-top: 10px; border-radius: 999px; background: var(--lilac); overflow: hidden; border: 2px solid #e2dcff; }
.kw-bar span { display: block; height: 100%; width: 4%; border-radius: 999px; transition: width 1s linear;
	background: repeating-linear-gradient(-45deg, var(--sun) 0 12px, #ffbf1f 12px 24px); background-size: 34px 34px; animation: kw-stripes 1s linear infinite; }
@keyframes kw-stripes { to { background-position: 34px 0; } }
.kw-video { display: block; width: 100%; max-width: 480px; margin-top: 8px; border-radius: 16px; background: #000; border: 6px solid var(--ink); }
.kw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Chips / buttons */
.kw-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px 48px; }
.kw-chip, .kw-btn {
	appearance: none; border: 0; cursor: pointer; text-decoration: none;
	display: inline-flex; align-items: center; gap: 6px;
	padding: 8px 14px; border-radius: 999px; background: #fff; color: var(--purple);
	font: 700 16px/1.2 inherit; font-family: inherit; box-shadow: 0 3px 0 #dcd6ff;
	transition: transform .1s ease;
}
.kw-chip:hover, .kw-btn:hover { transform: translateY(-2px); }
.kw-chip--movie { background: #fff0f7; color: #d63c80; box-shadow: 0 3px 0 #ffc9e1; }
.kw-btn--go { background: var(--green); color: #fff; box-shadow: 0 4px 0 #1fae76; }
.kw-btn--pink { background: var(--pink); color: #fff; box-shadow: 0 4px 0 #d63c80; font-size: 18px; padding: 11px 22px; }
.kw-btn[disabled] { opacity: .6; cursor: progress; transform: none; }

/* Plans offered inside the chat when out of movies */
.kw-plans { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 10px; }
.kw-plan { padding: 12px; border-radius: 18px; background: var(--lilac); border: 2px solid #e6e1ff; display: flex; flex-direction: column; gap: 2px; }
.kw-plan b { font-size: 18px; }
.kw-plan .kw-price { font-size: 26px; font-weight: 800; color: var(--purple); line-height: 1.1; }
.kw-plan small { color: var(--mute); font-size: 14px; }
.kw-plan .kw-btn { margin-top: 8px; justify-content: center; font-size: 15px; }

/* ── Composer ─────────────────────────────────────────────────────── */
.kw-composer {
	flex: 0 0 auto; padding: 10px 12px 12px;
	background: #fff; border-radius: 0 0 28px 28px;
	box-shadow: 0 10px 0 rgba(35,33,92,.12), 0 24px 40px -24px rgba(35,33,92,.45);
	border: 3px solid rgba(255,255,255,.8); border-top: 2px dashed #e6e1ff;
}
.kw-modes { display: flex; gap: 8px; margin-bottom: 8px; }
.kw-mode { appearance: none; border: 0; cursor: pointer; padding: 6px 16px; border-radius: 999px; background: var(--lilac); color: var(--mute); font: 800 16px/1.2 inherit; font-family: inherit; }
.kw-mode.is-active { background: var(--purple); color: #fff; box-shadow: 0 3px 0 #5a3fe0; }
.kw-mode[data-mode="movie"].is-active { background: var(--pink); box-shadow: 0 3px 0 #d63c80; }
.kw-styles { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.kw-styles::-webkit-scrollbar { display: none; }
.kw-style { flex: 0 0 auto; cursor: pointer; }
.kw-style input { position: absolute; opacity: 0; pointer-events: none; }
.kw-style span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #eefaf4; font-weight: 700; font-size: 15px; border: 2px solid transparent; white-space: nowrap; }
.kw-style input:checked + span { background: var(--green); color: #fff; border-color: #1fae76; }
.kw-style input:focus-visible + span { outline: 3px solid var(--purple); outline-offset: 2px; }
.kw-inputrow { display: flex; align-items: flex-end; gap: 8px; }
.kw-inputrow textarea {
	flex: 1 1 auto; min-width: 0; resize: none; max-height: 120px; margin: 0;
	padding: 12px 16px; border-radius: 22px; border: 3px solid #dcd6ff; background: #fbfaff; color: var(--ink);
	font: 600 18px/1.35 inherit; font-family: inherit;
}
.kw-inputrow textarea:focus { outline: none; border-color: var(--purple); background: #fff; }
.kw-movie-mode .kw-inputrow textarea:focus { border-color: var(--pink); }
.kw-round, .kw-send { appearance: none; border: 0; cursor: pointer; flex: 0 0 auto; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; font-size: 22px; }
.kw-round { background: var(--lilac); }
.kw-round.is-on { background: var(--pink); color: #fff; animation: kw-glow 1s ease-in-out infinite; }
.kw-send { background: var(--purple); color: #fff; box-shadow: 0 4px 0 #5a3fe0; font-size: 22px; }
.kw-movie-mode .kw-send { background: var(--pink); box-shadow: 0 4px 0 #d63c80; }
.kw-send:active { transform: translateY(3px); box-shadow: 0 1px 0 #5a3fe0; }
.kw-send[disabled] { opacity: .55; cursor: progress; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

/* ── Grown-up gate (sign in / join) ───────────────────────────────── */
.kw-gate {
	flex: 1 1 auto; min-height: 0; overflow-y: auto;
	padding: 22px 18px; border-radius: 28px; text-align: center;
	background: #fff; border: 4px solid #fff;
	box-shadow: 0 10px 0 rgba(35,33,92,.12), 0 30px 60px -30px rgba(35,33,92,.45);
}
.kw-gate-emoji { font-size: 52px; line-height: 1.1; }
.kw-gate h2 { margin: 4px 0 6px; font-size: 28px; font-weight: 800; }
.kw-gate > p { margin: 0 auto 16px; max-width: 440px; color: var(--mute); }
.kw-login { display: grid; gap: 10px; max-width: 360px; margin: 0 auto; text-align: left; }
.kw-login label { font-size: 15px; font-weight: 700; color: var(--mute); }
.kw-login input { width: 100%; margin-top: 2px; padding: 11px 14px; border-radius: 14px; border: 2px solid #dcd6ff; background: #fbfaff; font: 600 17px/1.3 inherit; font-family: inherit; color: var(--ink); }
.kw-login input:focus { outline: none; border-color: var(--purple); }
.kw-login .kw-btn { justify-content: center; }
.kw-login-msg { min-height: 1.2em; color: #c22b6b; font-weight: 700; font-size: 15px; text-align: center; }
.kw-or { margin: 12px 0 8px; color: var(--mute); font-size: 15px; }
.kw-social { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.kw-small { margin-top: 14px; font-size: 14px; color: var(--mute); }
.kw-small a { color: var(--purple); font-weight: 700; }

@media (max-width: 520px) {
	body.kw { font-size: 17px; }
	.kw-app { padding-left: 8px; padding-right: 8px; }
	.kw-mascot { width: 44px; height: 44px; font-size: 24px; border-radius: 14px; }
	.kw-quota { font-size: 14px; padding: 5px 10px; }
	.kw-clear { font-size: 14px; padding: 5px 10px; }
	.kw-bubble { max-width: 84%; font-size: 17px; }
	.kw-chips { margin-left: 0; }
	.kw-avatar { width: 34px; height: 34px; font-size: 20px; }
	.kw-round, .kw-send { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phone fit-ups */
.kw-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kw-inputrow textarea { min-height: 50px; }
@media (max-width: 520px) {
	.kw-title { font-size: clamp(19px, 5.8vw, 30px); }
	.kw-quota__word { display: none; }
	.kw-brand { gap: 8px; }
	.kw-top { gap: 6px; }
	.kw-quota { font-size: 13px; padding: 4px 9px; }
	.kw-clear { font-size: 15px; padding: 4px 8px; }
	.kw-clear__label { display: none; }
	.kw-home { font-size: 15px; padding: 4px 8px; }
	.kw-home__label { display: none; }
	.kw-mascot { display: none; }
	.kw-top-right { gap: 5px; }
	.kw-inputrow { gap: 6px; }
	.kw-round { width: 40px; height: 40px; font-size: 18px; }
	.kw-send { width: 46px; height: 46px; }
	.kw-inputrow textarea { padding: 11px 13px; font-size: 17px; min-height: 46px; }
}

@media (max-width: 379px) { .kw-mascot { display: none; } .kw-title { font-size: 17px; } .kw-top-right { gap: 4px; } .kw-quota, .kw-clear, .kw-home { padding: 4px 7px; } }
