/* PATH — Play And Therapy. Warm, calm, child-first; the therapist chrome stays quiet. */
@font-face { font-family: Nunito; src: url(/fonts/nunito-latin.woff2) format('woff2'); font-weight: 400 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: Nunito; src: url(/fonts/nunito-latin-ext.woff2) format('woff2'); font-weight: 400 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB; }
@font-face { font-family: 'Baloo 2'; src: url(/fonts/baloo-latin.woff2) format('woff2'); font-weight: 400 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Baloo 2'; src: url(/fonts/baloo-latin-ext.woff2) format('woff2'); font-weight: 400 800; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #FBF6EE; --bg2: #F4ECDF; --card: #FFFFFF; --ink: #2E2A3B; --ink2: #5F5970; --muted: #8C8699; --line: #EADFCF;
  --teal: #2A9D8F; --teal-d: #1F7A6F; --teal-l: #D8F0EC; --coral: #EF6F5E; --coral-l: #FDE3DE; --sun: #F4B942; --sun-l: #FDF0CF;
  --lav: #8B7EC8; --lav-l: #ECE8F8; --sky: #4FA3E0; --sky-l: #DCEEFB; --mint: #7CCBA2; --rose: #E68AA8;
  --ok: #3AA76D; --warn: #E0962B; --bad: #D9534F;
  --r: 18px; --r-s: 12px; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 6px 18px rgba(60,40,20,.08);
  --shadow-l: 0 10px 40px rgba(60,40,20,.16);
  --f: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif; --fd: 'Baloo 2', Nunito, system-ui, sans-serif;
  --vh: 100dvh;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 16px; line-height: 1.45; }
body { min-height: var(--vh); }
h1, h2, h3, .display { font-family: var(--fd); font-weight: 600; letter-spacing: .1px; margin: 0; }
a { color: var(--teal-d); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.center { display: grid; place-items: center; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 11px 20px;
  font-weight: 800; background: var(--teal); color: #fff; box-shadow: 0 2px 0 var(--teal-d); transition: transform .08s, filter .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.05); } .btn:active { transform: translateY(1px); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink2); box-shadow: none; border: 1.5px solid var(--line); }
.btn.soft { background: var(--teal-l); color: var(--teal-d); box-shadow: none; }
.btn.coral { background: var(--coral); box-shadow: 0 2px 0 #c9523f; }
.btn.sun { background: var(--sun); color: #5a3d00; box-shadow: 0 2px 0 #c9922a; }
.btn.lav { background: var(--lav); box-shadow: 0 2px 0 #6b5fa6; }
.btn.sm { padding: 7px 14px; font-size: 14px; }
.btn.lg { padding: 15px 28px; font-size: 18px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); transition: transform .08s; }
.icon-btn:active { transform: scale(.94); }
.icon-btn.off { background: var(--coral); color: #fff; }
.icon-btn.end { background: var(--bad); color: #fff; }
.icon-btn svg { width: 22px; height: 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--bg2); color: var(--ink2);
  font-size: 13px; font-weight: 700; border: 1.5px solid transparent; }
button.chip { cursor: pointer; }
.chip.on { background: var(--teal); color: #fff; }
.tag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--lav-l); color: #5c4fa0; text-transform: uppercase; letter-spacing: .4px; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.input { width: 100%; padding: 12px 14px; border-radius: var(--r-s); border: 1.5px solid var(--line); background: #fff; outline: none; }
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-l); }
label.f { display: block; font-weight: 800; font-size: 14px; margin: 14px 0 6px; color: var(--ink2); }

/* brand */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo svg { width: 34px; height: 34px; }
.logo b { font-family: var(--fd); font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.logo span { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .5px; }

/* toasts */
#toasts { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow-l);
  animation: toastIn .25s ease-out; pointer-events: auto; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(46,42,59,.35); backdrop-filter: blur(3px); z-index: 900; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--card); border-radius: 24px; box-shadow: var(--shadow-l); padding: 24px; width: min(520px, 100%); max-height: calc(var(--vh) - 32px); overflow: auto; }

/* ============ ROOM ============ */
.room { height: var(--vh); display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--card); border-bottom: 1px solid var(--line); min-height: 58px; }
.topbar .logo svg { width: 28px; height: 28px; } .topbar .logo b { font-size: 20px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px #3aa76d33; } .status-dot.warn { background: var(--warn); } .status-dot.bad { background: var(--bad); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink2); }
.room-body { display: grid; grid-template-columns: 1fr 340px; grid-template-rows: auto 1fr; min-height: 0; }
.room.child .room-body { grid-template-columns: 1fr 320px; }
.stage-wrap { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto 1fr; grid-column: 1; grid-row: 1 / 3; }
.room-body > .videos { grid-column: 2; grid-row: 1; background: var(--bg2); border-left: 1px solid var(--line); }
.room-body > .side { grid-column: 2; grid-row: 2; }
.stage-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 0; min-height: 50px; }
.stage-head h2 { font-size: 22px; }
.stage { position: relative; min-height: 0; overflow: auto; padding: 12px 16px 16px; }
.side { border-left: 1px solid var(--line); background: var(--bg2); display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.room.child .side { grid-template-rows: 1fr; }

/* video */
.videos { padding: 12px; display: grid; gap: 10px; }
.vtile { position: relative; border-radius: 16px; overflow: hidden; background: #3b3549; aspect-ratio: 4/3; box-shadow: var(--shadow); }
.vtile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #3b3549; }
.vtile.self video { transform: scaleX(-1); }
.vtile .vname { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.45); color: #fff; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; display: flex; gap: 6px; align-items: center; }
.vtile .vph { position: absolute; inset: 0; display: grid; place-items: center; color: #d9d3e8; text-align: center; padding: 12px; font-weight: 700; }
.vtile .vph .big { font-size: 46px; line-height: 1; margin-bottom: 6px; }
.vtile.self { position: absolute; width: 34%; right: 20px; top: 20px; aspect-ratio: 4/3; border: 2px solid #fff; z-index: 2; cursor: grab; }
.vgrid { position: relative; }
.vbar { display: flex; gap: 10px; justify-content: center; }
.qual { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 2px; align-items: flex-end; }
.qual i { width: 4px; background: #fff8; border-radius: 1px; } .qual i:nth-child(1){height:5px} .qual i:nth-child(2){height:8px} .qual i:nth-child(3){height:11px}
.qual.q3 i { background: #7ee2a8; } .qual.q2 i:nth-child(-n+2) { background: #f4c542; } .qual.q1 i:nth-child(1) { background: #ff7a6b; }
.speaking { box-shadow: 0 0 0 3px var(--mint), var(--shadow); }

/* therapist panel */
.tabs { display: flex; gap: 4px; padding: 0 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 10px; font-weight: 800; font-size: 13.5px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; position: relative; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--teal); }
.tabs .badge { position: absolute; top: 4px; right: 0; background: var(--coral); color: #fff; font-size: 10px; border-radius: 999px; padding: 0 5px; }
.panel { overflow: auto; padding: 12px 14px 20px; min-height: 0; }
.panel h3 { font-size: 16px; margin: 14px 0 6px; } .panel h3:first-child { margin-top: 0; }
.guide p, .guide li { font-size: 14px; color: var(--ink2); } .guide ul { padding-left: 18px; margin: 6px 0; }
.guide .q { background: var(--card); border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 14px; border-left: 3px solid var(--lav); cursor: pointer; }
.guide .q:hover { background: var(--lav-l); }
.guide .caution { background: var(--sun-l); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.log { display: grid; gap: 6px; }
.log .e { font-size: 13.5px; background: var(--card); border-radius: 10px; padding: 7px 10px; display: grid; grid-template-columns: 44px 1fr; gap: 6px; }
.log .e time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 1px; }
.log .e.sys { background: transparent; color: var(--muted); padding: 2px 10px; }
.log .e.note { border-left: 3px solid var(--sun); }
.log .e.snap { border-left: 3px solid var(--sky); white-space: pre-wrap; }
.log .e.c { border-left: 3px solid var(--teal); }
.stickers { display: flex; flex-wrap: wrap; gap: 6px; }
.stickers button { font-size: 26px; width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--card); box-shadow: var(--shadow); }
.stickers button:active { transform: scale(.9); }
.chat { display: grid; grid-template-rows: 1fr auto; height: 100%; min-height: 200px; gap: 8px; }
.chat .msgs { overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.chat .m { max-width: 85%; padding: 7px 12px; border-radius: 14px; background: var(--card); font-size: 14.5px; align-self: flex-start; }
.chat .m.me { align-self: flex-end; background: var(--teal); color: #fff; }

/* knock (waiting room) banner */
.knock { position: fixed; right: 16px; bottom: 16px; z-index: 800; width: min(360px, calc(100vw - 32px)); padding: 16px; border-radius: 20px;
  background: var(--card); box-shadow: var(--shadow-l); border: 2px solid var(--teal); animation: toastIn .3s; }
.knock .who { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.knock .av { font-size: 40px; }

/* library grid */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.gcard { border: 0; text-align: left; padding: 16px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); display: grid; gap: 8px; align-content: start;
  transition: transform .12s, box-shadow .12s; position: relative; overflow: hidden; }
.gcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-l); }
.gcard .gi { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 30px; }
.gcard h4 { margin: 0; font-family: var(--fd); font-size: 18px; font-weight: 600; }
.gcard p { margin: 0; font-size: 13.5px; color: var(--ink2); }
.gcard .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.gcard.cur { outline: 3px solid var(--teal); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }

/* child home */
.hello { height: 100%; display: grid; place-items: center; text-align: center; }
.hello .sunny { font-size: 90px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(4deg); } }
.hello h1 { font-size: clamp(28px, 5vw, 46px); }

/* big reward fx */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 950; overflow: hidden; }
.fx-big { position: absolute; left: 50%; top: 45%; font-size: 150px; transform: translate(-50%,-50%); animation: pop 1.8s ease-out forwards; }
@keyframes pop { 0% { transform: translate(-50%,-50%) scale(.2); opacity: 0; } 20% { transform: translate(-50%,-50%) scale(1.15); opacity: 1; }
  35% { transform: translate(-50%,-50%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%,-80%) scale(1); opacity: 0; } }
.confetti { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* partner cursor */
.pcur { position: absolute; z-index: 50; pointer-events: none; transition: left .08s linear, top .08s linear; }
.pcur::before { content: ''; position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--lav); border: 2px solid #fff; box-shadow: var(--shadow); }
.pcur span { position: absolute; left: 10px; top: 8px; background: var(--lav); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }

/* pre-join */
.prejoin { min-height: var(--vh); display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 500px at 10% -10%, var(--teal-l), transparent), radial-gradient(900px 500px at 110% 110%, var(--sun-l), transparent), var(--bg); }
.prejoin .card { padding: 28px; width: min(560px, 100%); }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatars button { font-size: 34px; aspect-ratio: 1; border: 2px solid transparent; border-radius: 16px; background: var(--bg2); }
.avatars button.on { border-color: var(--teal); background: var(--teal-l); transform: scale(1.06); }
.preview { position: relative; border-radius: 18px; overflow: hidden; background: #3b3549; aspect-ratio: 16/10; margin-top: 12px; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.meter { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 3px; align-items: flex-end; height: 22px; }
.meter i { width: 5px; border-radius: 2px; background: #fff7; height: 6px; transition: height .08s; }
.waitroom { text-align: center; }
.breath-orb { width: 150px; height: 150px; border-radius: 50%; margin: 20px auto; background: radial-gradient(circle at 35% 35%, #fff, var(--teal-l) 40%, var(--teal) 100%);
  animation: orb 8s ease-in-out infinite; box-shadow: 0 0 60px #2a9d8f55; }
@keyframes orb { 0%,100% { transform: scale(.7); } 45%,55% { transform: scale(1.05); } }

/* emotion memory cards (flip + deal) */
.mgrid { display: grid; gap: 14px; justify-content: center; }
.mcard { aspect-ratio: 5/6; border: 0; padding: 0; background: none; perspective: 900px; animation: deal .45s both ease-out; }
.mcard .in { position: relative; width: 100%; height: 100%; transition: transform .5s cubic-bezier(.3,.7,.3,1.2); transform-style: preserve-3d; }
.mcard.up .in { transform: rotateY(180deg); }
.mcard .f, .mcard .b { position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; box-shadow: var(--shadow); overflow: hidden; }
.mcard .f { transform: rotateY(180deg); background: #fff; }
.mcard .b { background: radial-gradient(circle at 30% 25%, #ffffff33 0 18%, transparent 19%), radial-gradient(circle at 75% 80%, #ffffff22 0 22%, transparent 23%), linear-gradient(135deg, var(--lav), var(--sky)); border: 5px solid #fff; }
.mcard .b span { font-family: var(--fd); font-size: clamp(40px, 6vw, 64px); color: #fff; font-weight: 700; text-shadow: 0 3px 0 #0002; }
.mcard:not(.up):hover .in { transform: translateY(-3px) rotate(-1deg); }
.mcard.done .f { box-shadow: 0 0 0 4px var(--ec), var(--shadow); animation: matched .6s; }
@keyframes deal { from { opacity: 0; transform: translateY(24px) scale(.85) rotate(-6deg); } }
@keyframes matched { 40% { transform: rotateY(180deg) scale(1.08); } }

/* ============ responsive ============ */
@media (max-width: 980px) {
  .room-body, .room.child .room-body { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; right: 0; bottom: 0; height: 62vh; z-index: 600; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0; box-shadow: var(--shadow-l); transform: translateY(105%); transition: transform .25s ease; }
  .side.open { transform: none; }
  .room.child .side { display: none; }
  .room-body > .videos { position: fixed; right: 10px; top: 66px; z-index: 500; width: 150px; padding: 0; gap: 6px; background: none; border: 0; }
  .room-body > .videos .vtile.self { position: absolute; width: 45%; right: 6px; top: auto; bottom: 6px; border-width: 1.5px; }
  .room-body > .videos .vbar { gap: 6px; } .room-body > .videos .icon-btn { width: 36px; height: 36px; }
  .room-body > .videos .vname { font-size: 10px; padding: 2px 7px; }
  .stage { padding: 8px 10px 80px; }
  .mob-only { display: inline-flex !important; }
  .lib { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
.mob-only { display: none !important; }
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 6px 10px; } .topbar .logo span, .hide-s { display: none; }
  .room-body > .videos { width: 124px; }
}
