/* Cosima Talk & Play. Calm, high-contrast, big targets. Light theme by design: symbols read best on warm paper. */
@font-face{font-family:"Fredoka";src:url("fredoka.woff2") format("woff2");font-weight:300 700;font-display:swap}
@font-face{font-family:"Nunito";src:url("nunito.woff2") format("woff2");font-weight:200 1000;font-display:swap}
:root{
  --bg:#FFF6E9; --panel:#FFFFFF; --ink:#1F2A44; --soft:#5C667A; --line:#EADFCB; --chip:#FFE9C7;
  --teal:#23737B; --coral:#C4492A; --sun:#FFC857; --purple:#6B4FC2;
  --pron:#F2B705; --verb:#3E9A3A; --desc:#2E86C1; --noun:#E8801A; --social:#D6477A; --neg:#C8352A;
  --display:"Fredoka","Trebuchet MS",system-ui,sans-serif; --body:"Nunito","Segoe UI",system-ui,sans-serif;
  --tile:108px; color-scheme:light;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--body);overscroll-behavior:none;user-select:none;-webkit-user-select:none}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none}
button:focus-visible{outline:3px solid var(--teal);outline-offset:2px}
img{display:block;max-width:100%}
[hidden]{display:none!important}
.app{height:100%;display:flex;flex-direction:column;max-width:1400px;margin-inline:auto}
.screen{flex:1;display:flex;flex-direction:column;min-height:0;padding:12px 16px 16px;gap:12px}

/* top bar */
.bar{display:flex;align-items:center;gap:10px;min-height:56px}
.bar h1{font-family:var(--display);font-size:26px;margin:0;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.round{width:52px;height:52px;border-radius:18px;background:var(--panel);display:grid;place-items:center;box-shadow:0 3px 0 var(--line);flex:none}
.round svg{width:26px;height:26px}
.round:active{transform:translateY(2px);box-shadow:none}

/* home */
.home-hero{display:flex;align-items:center;gap:14px;padding:8px 4px}
.home-hero img{width:88px}
.home-hero h1{font-family:var(--display);font-size:clamp(26px,5vw,40px);margin:0;line-height:1.05}
.home-hero p{margin:4px 0 0;color:var(--soft);font-weight:700}
.rooms{flex:1;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr auto;gap:14px;min-height:0}
.room{border-radius:28px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:14px;color:#fff;
  font-family:var(--display);font-size:clamp(24px,4.4vw,38px);font-weight:700;box-shadow:0 6px 0 rgba(0,0,0,.12);min-height:0}
.room img{width:min(42%,150px);max-height:45%;object-fit:contain;filter:drop-shadow(0 6px 8px rgba(0,0,0,.15))}
.room small{font-family:var(--body);font-size:15px;font-weight:700;opacity:.92}
.room:active{transform:translateY(3px);box-shadow:0 2px 0 rgba(0,0,0,.12)}
.r-sign{background:#2E86C1;grid-column:1/-1;flex-direction:row;gap:18px;padding:10px 14px}
.r-sign img{width:64px;max-height:none}
.r-talk{background:var(--teal)} .r-learn{background:#E09A12} .r-color{background:var(--coral)} .r-watch{background:var(--purple)}
.home-foot .links{display:flex;gap:8px}
.link{background:var(--panel);border-radius:999px;padding:8px 14px;font-weight:800;font-size:14px;color:var(--ink);box-shadow:0 2px 0 var(--line)}
.home-foot{display:flex;justify-content:space-between;align-items:center;color:var(--soft);font-size:13px;font-weight:700}

/* talk */
.strip{flex:1;min-height:76px;background:var(--panel);border-radius:20px;display:flex;align-items:center;gap:6px;padding:6px 8px;overflow-x:auto;box-shadow:inset 0 0 0 2px var(--line)}
.strip:empty::before{content:"Tap pictures to talk";color:var(--soft);font-weight:700;padding-left:8px}
.chip{flex:none;display:flex;flex-direction:column;align-items:center;width:62px;font-size:12px;font-weight:800}
.chip img{width:44px;height:44px;object-fit:contain}
.speak{background:var(--teal);color:#fff;width:76px;height:76px;border-radius:22px;display:grid;place-items:center;flex:none;box-shadow:0 4px 0 #185A60}
.speak svg{width:36px;height:36px}
.quick{display:grid;grid-template-columns:repeat(10,1fr);gap:8px}
.tabs{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px}
.tab{flex:none;display:flex;align-items:center;gap:8px;background:var(--panel);border-radius:16px;padding:6px 14px 6px 6px;font-family:var(--display);font-weight:600;font-size:17px;box-shadow:0 3px 0 var(--line)}
.tab img{width:34px;height:34px;object-fit:contain}
.tab[aria-selected="true"]{background:var(--ink);color:#fff;box-shadow:none}
.grid{flex:1;min-height:0;overflow-y:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--tile),1fr));gap:10px;align-content:start;padding:2px}
.cell{background:var(--panel);border-radius:20px;border:5px solid var(--c,var(--line));display:flex;flex-direction:column;align-items:center;justify-content:center;padding:8px 6px 6px;gap:4px;aspect-ratio:1/1;min-width:0;box-shadow:0 3px 0 rgba(0,0,0,.08)}
.cell img{width:72%;aspect-ratio:1/1;object-fit:contain;pointer-events:none}
.cell span{font-family:var(--display);font-weight:600;font-size:clamp(13px,1.6vw,18px);line-height:1.1;text-align:center;overflow-wrap:anywhere}
.cell.pressed{transform:scale(.94)}
.quick .cell{border-width:4px;border-radius:16px;padding:4px}
.quick .cell span{font-size:clamp(11px,1.4vw,15px)}
.t-pron{--c:var(--pron)} .t-verb{--c:var(--verb)} .t-desc{--c:var(--desc)} .t-noun{--c:var(--noun)} .t-social{--c:var(--social)} .t-neg{--c:var(--neg)} .t-mine{--c:var(--purple)} .t-sign{--c:#2E86C1}
.add{border-style:dashed;--c:var(--soft);color:var(--soft)}
.add b{font-size:44px;line-height:1;font-family:var(--display)}

/* sign */
.sign-note{background:#E3F0FA;border-radius:18px;padding:12px 16px;font-size:15px;font-weight:600;line-height:1.45}
.signs{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
.sign-card{display:flex;flex-direction:column;gap:8px;min-width:0}
.watch-sign{background:#2E86C1;color:#fff;border-radius:14px;padding:10px 8px;font-family:var(--display);font-weight:600;font-size:15px}
.watch-sign.alt{background:var(--chip);color:var(--ink)}

/* learn */
.sets{flex:1;min-height:0;grid-auto-rows:max-content;display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px;overflow-y:auto}
.set{background:var(--panel);border-radius:22px;padding:12px;display:flex;flex-direction:column;align-items:center;gap:8px;box-shadow:0 4px 0 var(--line);font-family:var(--display);font-weight:600;font-size:19px}
.set img{width:96px;height:96px;object-fit:contain}
.card-stage{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px}
.big-card{background:var(--panel);border-radius:36px;width:min(78vw,52vh,440px);aspect-ratio:1/1;display:grid;place-items:center;box-shadow:0 8px 0 var(--line);position:relative}
.big-card img{width:78%}
.big-card:active{transform:scale(.97)}
.word{font-family:var(--display);font-weight:700;font-size:clamp(40px,8vw,72px);line-height:1}
.stars{display:flex;gap:10px;height:40px}
.stars i{width:40px;height:40px;background:#EADFCB;clip-path:polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);transition:background .3s}
.stars i.on{background:var(--sun)}
.pager{display:flex;gap:14px;align-items:center}
.pager .round{width:64px;height:64px}
.hint{color:var(--soft);font-weight:800}

/* color */
.pages{grid-auto-rows:max-content;display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:12px;overflow-y:auto;align-content:start}
.page-t{background:#fff;border-radius:18px;padding:8px;box-shadow:0 4px 0 var(--line);aspect-ratio:1/1}
.page-t img{width:100%;height:100%;object-fit:contain}
.section-title{font-family:var(--display);font-size:20px;margin:6px 2px 0}
.paint{flex:1;min-height:0;display:flex;gap:12px}
.canvas-wrap{flex:1;min-width:0;min-height:0;display:grid;place-items:center}
.stack{position:relative;width:min(100%,calc(100vh - 170px));aspect-ratio:1/1;background:#fff;border-radius:22px;overflow:hidden;box-shadow:0 6px 0 var(--line);touch-action:none}
.stack canvas{position:absolute;inset:0;width:100%;height:100%}
.stack canvas.lines{pointer-events:none}
.tools{display:flex;flex-direction:column;gap:10px;width:132px;flex:none}
.palette{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.sw{aspect-ratio:1/1;border-radius:50%;box-shadow:inset 0 0 0 3px rgba(0,0,0,.12)}
.sw[aria-pressed="true"]{outline:4px solid var(--ink);outline-offset:2px}
.mode{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.tool{background:var(--panel);border-radius:14px;padding:8px 4px;font-weight:800;font-size:13px;display:flex;flex-direction:column;align-items:center;gap:2px;box-shadow:0 3px 0 var(--line)}
.tool svg{width:26px;height:26px}
.tool[aria-pressed="true"]{background:var(--ink);color:#fff;box-shadow:none}

/* watch */
.eps{flex:1;min-height:0;grid-auto-rows:max-content;display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px;overflow-y:auto;align-content:start}
.ep{display:block;width:100%;background:var(--panel);border-radius:20px;overflow:hidden;box-shadow:0 4px 0 var(--line);text-align:left}
.ep img{aspect-ratio:16/9;width:100%;object-fit:cover}
.ep div{padding:10px 12px 12px;font-family:var(--display);font-weight:600;font-size:17px}
.ep small{display:block;font-family:var(--body);font-weight:800;color:var(--soft);font-size:13px;margin-top:2px}

/* sheets: grown-up gate, add word, settings */
.sheet{position:fixed;inset:0;background:rgba(31,42,68,.45);display:grid;place-items:center;padding:16px;z-index:10}
.sheet-card{background:var(--panel);border-radius:26px;padding:22px;width:min(460px,100%);display:grid;gap:14px;max-height:90vh;overflow-y:auto}
.sheet-card h2{font-family:var(--display);margin:0;font-size:24px}
.sheet-card p{margin:0;color:var(--soft);font-weight:600}
.hold{position:relative;overflow:hidden;background:var(--ink);color:#fff;border-radius:18px;padding:18px;font-family:var(--display);font-size:20px;font-weight:600;touch-action:none}
.hold i{position:absolute;inset:0;background:var(--teal);transform-origin:left;transform:scaleX(0)}
.hold span{position:relative}
.field{display:grid;gap:6px;font-weight:800}
.field input[type=text]{font:inherit;font-size:18px;padding:12px 14px;border-radius:14px;border:2px solid var(--line)}
.btn{background:var(--teal);color:#fff;border-radius:16px;padding:14px;font-family:var(--display);font-weight:600;font-size:18px}
.btn.ghost{background:var(--chip);color:var(--ink)}
.btn.danger{background:#FBE3DE;color:var(--neg)}
.row{display:flex;gap:10px;flex-wrap:wrap}
.row>*{flex:1}
.preview{width:120px;height:120px;border-radius:18px;background:var(--chip);display:grid;place-items:center;overflow:hidden;justify-self:center}
.preview img{width:100%;height:100%;object-fit:cover}
.seg{display:flex;background:var(--chip);border-radius:14px;padding:4px;gap:4px}
.seg button{flex:1;padding:10px;border-radius:10px;font-weight:800}
.seg button[aria-pressed="true"]{background:#fff;box-shadow:0 2px 0 var(--line)}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:var(--ink);color:#fff;padding:12px 18px;border-radius:14px;font-weight:800;z-index:20}

@media (max-width:760px){
  .quick{grid-template-columns:repeat(5,1fr)}
  .paint{flex-direction:column}
  .tools{width:auto;flex-direction:row;flex-wrap:wrap;align-items:center}
  .palette{grid-template-columns:repeat(9,1fr);flex:1 1 100%}
  .mode{grid-template-columns:repeat(5,1fr);flex:1 1 100%}
  .stack{width:min(100%,calc(100vh - 330px))}
  :root{--tile:92px}
  .talkbar{flex-wrap:wrap}
  .talkbar .strip{order:5;flex:1 1 100%;min-height:68px}
  .talkbar .speak{width:56px;height:56px;border-radius:18px;margin-left:auto}
  .talkbar .speak svg{width:28px;height:28px}
}
@media (max-width:430px){ .rooms{gap:10px} .room small{display:none} }
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
