/* akciali-kids-demo — shared styles. CSS lifted from the real akciali-kids app
   (themes, bubbles, blobs, decor) + demo-only chrome (explainer banner, badges).
   100% static showcase: fictional profiles, pre-generated conversations. */

:root {
  --bg1: #6c5ce7; --bg2: #00cec9;
  --card: #ffffff; --ink: #2d3436;
  --user: #6c5ce7; --user-ink: #ffffff;
  --bot: #ffffff; --bot-ink: #2d3436;
  --accent: #fd79a8;
  --panel: rgba(255,255,255,.88); --panel-ink: #2d3436;
  --font: 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI', sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  color: var(--ink);
  display: flex; flex-direction: column; align-items: center;
  overflow-x: hidden;
  height: 100dvh;
  touch-action: manipulation;
}

/* ---------- per-kid ambiances (same as the real app) ---------- */
body[data-theme="unicorn"] {
  --bg1: #ffd6f5; --bg2: #b3f0ff; --user: #e84393; --accent: #fd79a8;
}
body[data-theme="wednesday"] {
  --bg1: #544a6e; --bg2: #8d81ab; --user: #5f27cd; --accent: #b39ddb;
  --bot: #453c5e; --bot-ink: #f0ecf7; --panel: rgba(255,255,255,.16); --panel-ink: #f0ecf7;
  --font: Georgia, 'Times New Roman', serif;
}
body[data-theme="creative"] {
  --bg1: #efe9d8; --bg2: #b8cdb0; --user: #cd6133; --accent: #cd6133;
  --ink: #3d3d36; --font: 'Segoe UI', system-ui, sans-serif;
}
body[data-theme="kmystic"] {
  --bg1: #5c4d9e; --bg2: #b79ce0; --user: #8d7bff; --accent: #ff6ec7;
  --bot: #57499b; --bot-ink: #f8f5ff; --panel: rgba(255,255,255,.20); --panel-ink: #f8f5ff;
  --font: 'Segoe UI', system-ui, sans-serif;
}
body[data-size="mini"] { font-size: 18px; }
body[data-size="mini"] .msg { font-size: 1.12rem; border-radius: 26px; }

/* ---------- floating side decorations ---------- */
#decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.dec { position: absolute; animation: decfloat var(--dur, 8s) ease-in-out var(--delay, 0s) infinite alternate; user-select: none; }
@keyframes decfloat { from { transform: translateY(0) rotate(-7deg); } to { transform: translateY(-20px) rotate(7deg); } }
.dec.hangul { font-weight: bold; color: rgba(255,255,255,.8); text-shadow: 0 2px 8px rgba(0,0,0,.25); font-family: 'Segoe UI', system-ui, sans-serif; }

/* ---------- animated blobs (home) ---------- */
.blob { position: fixed; border-radius: 50%; filter: blur(70px); opacity: .45; z-index: 0; pointer-events: none; }
#b1 { width: 380px; height: 380px; background: #fd79a8; top: -90px; left: -90px; animation: drift1 18s ease-in-out infinite alternate; }
#b2 { width: 320px; height: 320px; background: #00d2ff; bottom: -70px; right: -70px; animation: drift2 22s ease-in-out infinite alternate; }
#b3 { width: 260px; height: 260px; background: #ffe27a; top: 45%; left: 62%; animation: drift3 26s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(70px, 90px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-80px, -60px) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-100px, 40px) scale(.9); } }

/* ---------- DEMO explainer banner (dynamic, on every page) ---------- */
#explain {
  position: relative; z-index: 5; width: 100%; max-width: 900px;
  margin: calc(10px + var(--sat)) auto 0; padding: 0 14px;
}
.explain-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  background: rgba(20, 24, 38, .82); color: #eef2ff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.25); border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.explain-glow {
  position: absolute; inset: -2px; z-index: 0; border-radius: 20px;
  background: linear-gradient(120deg, #fd79a8, #ffe27a, #00d2ff, #a29bfe, #fd79a8);
  background-size: 300% 300%;
  animation: bannerglow 8s linear infinite;
  filter: blur(14px); opacity: .35; pointer-events: none;
}
@keyframes bannerglow { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
.explain-ico { position: relative; font-size: 1.5rem; flex-shrink: 0; animation: icobeat 2.6s ease-in-out infinite; }
@keyframes icobeat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.explain-body { position: relative; flex: 1; min-width: 0; font-family: 'Segoe UI', system-ui, sans-serif; }
.explain-tag { font-size: .68rem; font-weight: bold; letter-spacing: .08em; text-transform: uppercase; color: #ffd166; }
.explain-msg { font-size: .88rem; line-height: 1.35; min-height: 2.5em; display: flex; align-items: center; }
.explain-msg span { animation: msgin .45s ease; }
@keyframes msgin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.explain-side { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.explain-dots { display: flex; gap: 5px; }
.explain-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.35); cursor: pointer; transition: background .2s, transform .2s; }
.explain-dots i.on { background: #ffd166; transform: scale(1.25); }
.langsw { display: flex; gap: 2px; background: rgba(255,255,255,.12); border-radius: 10px; padding: 2px; }
.langsw button {
  border: none; background: transparent; color: #cfd8ff; font-family: inherit; font-size: .72rem;
  font-weight: bold; padding: 4px 9px; border-radius: 8px; cursor: pointer;
}
.langsw button.on { background: #ffd166; color: #1e272e; }
@media (max-width: 560px) {
  .explain-msg { font-size: .8rem; }
  .explain-ico { font-size: 1.2rem; }
}

/* ---------- home : picker ---------- */
#picker { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 900px; padding: 10px calc(18px + var(--sar)) calc(18px + var(--sab)) calc(18px + var(--sal)); overflow-y: auto; }
.topbar { display: flex; align-items: center; width: 100%; padding: 6px 4px 0; }
.logo { color: #fff; font-weight: bold; font-size: 1.25rem; text-shadow: 0 2px 8px rgba(0,0,0,.3); letter-spacing: .02em; }
.logo .dot { color: #ffe27a; }
#parentsBtn {
  margin-left: auto; display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.35); color: #fff; font-family: inherit; font-size: .85rem;
  font-weight: bold; padding: 9px 16px; border-radius: 16px; cursor: pointer; transition: background .2s;
  text-decoration: none;
}
#parentsBtn:hover { background: rgba(255,255,255,.32); }

.hero { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 3vh 0 24px; text-align: center; }
.hero-ring {
  width: 130px; height: 130px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.14); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 2px solid rgba(255,255,255,.5);
  box-shadow: 0 0 45px rgba(255,255,255,.45), inset 0 0 25px rgba(255,255,255,.18);
  animation: heropulse 3.2s ease-in-out infinite;
}
@keyframes heropulse { 0%,100% { box-shadow: 0 0 35px rgba(255,255,255,.35), inset 0 0 22px rgba(255,255,255,.15); } 50% { box-shadow: 0 0 60px rgba(255,255,255,.6), inset 0 0 30px rgba(255,255,255,.25); } }
.hero-ring svg { width: 92px; height: 92px; animation: herofloat 4s ease-in-out infinite; }
@keyframes herofloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.hero h1 { color: #fff; font-size: 1.9rem; text-shadow: 0 2px 10px rgba(0,0,0,.3); }
.hero .tagline { color: rgba(255,255,255,.88); font-size: .9rem; }
.demo-pill {
  display: inline-block; margin-top: 4px; background: rgba(0,0,0,.3); color: #ffd166;
  font-family: 'Segoe UI', system-ui, sans-serif; font-size: .72rem; font-weight: bold;
  letter-spacing: .06em; padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255,209,102,.5);
}

#profileList { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; width: 100%; }
.profile-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: rgba(255,255,255,.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.4); border-radius: 24px;
  padding: 22px 14px 16px; font-family: inherit; color: #fff; cursor: pointer;
  transition: transform .18s, background .18s; overflow: hidden; text-decoration: none;
}
.profile-btn:hover { transform: translateY(-6px) scale(1.03); background: rgba(255,255,255,.3); }
@media (hover: none) {
  .profile-btn:hover { transform: none; background: rgba(255,255,255,.2); }
  .profile-btn:active { transform: scale(.97); background: rgba(255,255,255,.3); }
}
.profile-btn::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--pc, #fff); }
.profile-btn svg { width: 72px; height: 72px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); }
.profile-btn .pname { font-size: 1.25rem; font-weight: bold; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.profile-btn .page { font-size: .78rem; opacity: .85; }

footer.sitefoot {
  position: relative; z-index: 1; text-align: center; color: rgba(255,255,255,.85);
  font-size: .72rem; padding: 10px 16px calc(12px + var(--sab));
  font-family: 'Segoe UI', system-ui, sans-serif;
}
footer.sitefoot a { color: #ffd166; }

/* ---------- chat layout ---------- */
#chat { display: flex; flex-direction: row; width: 100%; height: 100%; position: relative; z-index: 1; flex: 1; min-height: 0; }
#main { flex: 1; display: flex; flex-direction: column; height: 100%; min-width: 0; min-height: 0; }

header.chathead { display: flex; align-items: center; gap: 10px; padding: 8px calc(18px + var(--sar)) 4px calc(18px + var(--sal)); color: #fff; }
header.chathead .title { font-size: 1.3rem; font-weight: bold; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
header.chathead .subtitle { font-size: .8rem; opacity: .9; }
.hbtn { background: rgba(255,255,255,.25); border: none; color: #fff; font-family: inherit; font-size: .85rem; font-weight: bold; padding: 8px 14px; border-radius: 14px; cursor: pointer; min-height: 42px; text-decoration: none; display: inline-flex; align-items: center; }
#replay { margin-left: auto; }
body[data-theme="creative"] header.chathead, body[data-theme="unicorn"] header.chathead { color: #4a4176; text-shadow: none; }
body[data-theme="creative"] .hbtn, body[data-theme="unicorn"] .hbtn { background: rgba(0,0,0,.14); color: #3d3d36; }
body[data-theme="unicorn"] .hbtn { color: #7c3a62; }

#mascotCol { width: 185px; display: flex; align-items: flex-start; justify-content: center; padding: 22px 14px 0 0; }
#mascotBox { width: 150px; height: 150px; perspective: 400px; cursor: pointer; }
#mascotBox svg { width: 150px; height: 150px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.3)); }
#mascotHdr { display: none; width: 52px; height: 52px; flex-shrink: 0; perspective: 300px; cursor: pointer; }
#mascotHdr svg { width: 52px; height: 52px; filter: drop-shadow(0 3px 8px rgba(0,0,0,.3)); }
@media (max-width: 980px) {
  #mascotCol { display: none; }
  #mascotHdr { display: block; }
}

/* mascot animations (same 10 as the real app) */
.anim1 { animation: m1 1.2s ease; } @keyframes m1 { 0%,100%{transform:translateY(0)} 30%{transform:translateY(-14px)} 55%{transform:translateY(0)} 75%{transform:translateY(-6px)} }
.anim2 { animation: m2 1.4s ease-in-out; } @keyframes m2 { to{transform:rotate(360deg)} }
.anim3 { animation: m3 1.2s ease; } @keyframes m3 { 0%,100%{transform:rotate(0)} 20%{transform:rotate(-16deg)} 40%{transform:rotate(13deg)} 60%{transform:rotate(-9deg)} 80%{transform:rotate(6deg)} }
.anim4 { animation: m4 1.1s ease; } @keyframes m4 { 0%,100%{transform:scale(1)} 50%{transform:scale(1.3)} }
.anim5 { animation: m5 .9s ease; } @keyframes m5 { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(3px)} }
.anim6 { animation: m6 1.3s ease; } @keyframes m6 { 0%,100%{transform:translateY(0) scale(1,1)} 25%{transform:translateY(0) scale(1.15,.8)} 50%{transform:translateY(-18px) scale(.95,1.1)} 75%{transform:translateY(0) scale(1.08,.88)} }
.anim7 { animation: m7 2.6s ease-in-out; } @keyframes m7 { 0%,100%{transform:translateY(0) rotate(0)} 50%{transform:translateY(-10px) rotate(5deg)} }
.anim8 { animation: m8 1.5s ease; } @keyframes m8 { 0%,100%{transform:rotate(0)} 30%,70%{transform:rotate(20deg)} }
.anim9 { animation: m9 1.3s ease; } @keyframes m9 { 0%,100%{transform:scale(1)} 18%{transform:scale(1.22)} 35%{transform:scale(1)} 52%{transform:scale(1.28)} 75%{transform:scale(1)} }
.anim10 { animation: m10 1.5s ease-in-out; } @keyframes m10 { to{transform:rotateY(360deg)} }

#langBar { display: flex; gap: 6px; padding: 0 calc(18px + var(--sar)) 6px calc(18px + var(--sal)); flex-wrap: wrap; }
.langchip { background: rgba(255,255,255,.22); border: 2px solid transparent; color: #fff; font-family: inherit; font-size: .85rem; padding: 8px 14px; border-radius: 14px; cursor: default; min-height: 38px; }
.langchip.active { border-color: #fff; background: rgba(255,255,255,.38); font-weight: bold; }
body[data-theme="creative"] .langchip, body[data-theme="unicorn"] .langchip { color: #3d3d36; background: rgba(0,0,0,.10); }
body[data-theme="creative"] .langchip.active, body[data-theme="unicorn"] .langchip.active { border-color: #3d3d36; background: rgba(0,0,0,.18); }

#messages { flex: 1; overflow-y: auto; padding: 12px calc(16px + var(--sar)) 12px calc(16px + var(--sal)); display: flex; flex-direction: column; gap: 10px; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 20px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.msg.bot { background: var(--bot); color: var(--bot-ink); border-bottom-left-radius: 6px; align-self: flex-start; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.msg.user { background: var(--user); color: var(--user-ink); border-bottom-right-radius: 6px; align-self: flex-end; }
.msg.bot .fakelink { color: var(--accent); font-weight: bold; word-break: break-all; text-decoration: underline; cursor: help; }
.msg .speakdemo { border: none; background: none; cursor: help; font-size: 1.05rem; opacity: .55; margin-left: 4px; }
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing span { width: 9px; height: 9px; border-radius: 50%; background: #b2bec3; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25;} 40% { opacity: 1;} }

#chips { display: flex; gap: 8px; padding: 8px calc(16px + var(--sar)) 8px calc(16px + var(--sal)); flex-wrap: wrap; }
.chip { background: var(--panel); color: var(--panel-ink); border: none; border-radius: 16px; padding: 10px 16px; font-family: inherit; font-size: .85rem; cursor: default; min-height: 42px; opacity: .9; }
form.chatform { display: flex; gap: 10px; padding: 0 calc(16px + var(--sar)) 10px calc(16px + var(--sal)); align-items: center; }
#input { flex: 1; border: none; border-radius: 22px; padding: 14px 18px; font-family: inherit; font-size: 1rem; outline: none; box-shadow: 0 2px 10px rgba(0,0,0,.15); background: var(--bot); color: var(--bot-ink); }
.roundbtn { border: none; border-radius: 50%; width: 52px; height: 52px; color: #fff; font-size: 1.3rem; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
#send { background: var(--accent); }
#mic, #photo { background: rgba(255,255,255,.3); }
footer.chatfoot { text-align: center; color: rgba(255,255,255,.85); font-size: .72rem; padding: 0 16px calc(10px + var(--sab)); }
body[data-theme="creative"] footer.chatfoot, body[data-theme="unicorn"] footer.chatfoot { color: rgba(0,0,0,.55); }

@media (max-width: 760px) {
  .blob { filter: blur(45px); opacity: .35; }
  #b3 { display: none; }
  .msg { max-width: 88%; }
  #chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }
}
@media (max-width: 480px) {
  header.chathead { gap: 8px; padding: 6px calc(12px + var(--sar)) 4px calc(12px + var(--sal)); }
  header.chathead .title { font-size: 1.15rem; }
  #profileList { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
  .hero { margin: 2vh 0 18px; }
  .hero-ring { width: 110px; height: 110px; }
  .hero-ring svg { width: 78px; height: 78px; }
  .hero h1 { font-size: 1.55rem; }
}
@media (prefers-reduced-motion: reduce) {
  .dec, .blob, .hero-ring, .hero-ring svg, #mascotBox svg, #mascotHdr svg, .explain-glow, .explain-ico { animation: none !important; }
}

/* ---------- homepage-only left explainer panel (max ~20vw, hidden on narrow) ---------- */
#archPanel {
  position: fixed; left: 18px; top: 50%; transform: translateY(-50%);
  width: clamp(230px, 18vw, 300px); max-width: 20vw;
  z-index: 4; display: flex; flex-direction: column; gap: 12px;
  background: rgba(20, 24, 38, .82); color: #eef2ff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.22); border-radius: 18px;
  padding: 18px 16px; font-family: 'Segoe UI', system-ui, sans-serif;
  box-shadow: 0 8px 28px rgba(0,0,0,.3);
}
.arch-tag { font-size: .66rem; font-weight: bold; letter-spacing: .1em; text-transform: uppercase; color: #ffd166; }
.arch-title { font-size: 1.05rem; font-weight: 600; line-height: 1.25; margin: 0; }
.arch-text { font-size: .8rem; line-height: 1.5; color: #c7d0ea; margin: 0; }
.arch-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px; padding: 10px 12px; color: #eef2ff; text-decoration: none;
  transition: border-color .18s, background .18s, transform .18s;
}
.arch-card:hover { border-color: #ffd166; background: rgba(255,209,102,.10); transform: translateY(-2px); }
.arch-card__ico { font-size: 1.25rem; flex-shrink: 0; }
.arch-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.arch-card__body b { font-size: .82rem; }
.arch-card__body span { font-size: .7rem; color: #aab4d4; line-height: 1.35; }
.arch-card__arrow { margin-left: auto; color: #ffd166; font-size: .9rem; flex-shrink: 0; }
@media (max-width: 1280px), (max-height: 560px) { #archPanel { display: none; } }

/* ---------- discreet legal link (chat + parent) ---------- */
#legal { position: fixed; right: 10px; bottom: 8px; z-index: 60; font: 11px/1 ui-monospace, monospace; opacity: .55; }
#legal a { color: inherit; text-decoration: none; }
#legal a:hover { text-decoration: underline; }
