/* Illustrated school stationery. Objects use flat color; reading stays upright.
   Shared screens only: individual game boards retain their own mechanics/materials. */
:root {
  --sb-ink:#59493e; --sb-muted:#756151; --sb-paper:#fbf1dc;
  --sb-sage:#bfd1ac; --sb-peach:#efbaa2; --sb-lilac:#d8cce5;
  --sb-display:"Klee","Bradley Hand","Chalkboard SE",cursive;
}
:root :is(.enroll-screen,.map-screen,.scene-screen,.phone-modal,.stamps-modal,.binary-modal) {
  --paper:var(--sb-ink); --haze:var(--sb-muted); --title:var(--sb-ink);
  --card:var(--sb-paper); --card-2:#f0e3cb; --panel:#f4e7cd;
  --hairline:#b49a80; --edge-rgb:89,73,62; --glass-rgb:251,241,220;
  --field-bg:#fff9ed; --field-fg:var(--sb-ink); --emph-fg:var(--sb-paper);
  --magenta:#986074; --gold:#e7c579;
}
/* Nine-slice drawing keeps the folded corners intact as a letter grows. */
:root :is(.enroll-card,.dlg,.stamps-card,.binary-card) {
  color:var(--sb-ink); background:none; border:18px solid transparent;
  border-image:url('../art/ui/storybook/letter.svg') 22 fill / 22px / 0 stretch;
  border-radius:0; box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none;
}
:root .enroll-card { gap:16px; padding:22px 18px; width:min(460px,100%); }
:root .enroll-card::before { background:url('../art/ui/storybook/stamp.svg') center/contain no-repeat;
  width:64px; height:64px; top:-29px; right:13px; left:auto; transform:rotate(9deg); }
:root .enroll-card::after { display:block; width:105px; height:88px; top:auto; right:-48px; bottom:-34px; left:auto;
  background:url('../art/ui/storybook/fox.svg') center/contain no-repeat; transform:rotate(7deg); z-index:3; }
:root .enroll-screen .title-wordmark { color:#703e48 !important; text-shadow:2px 3px 0 #f2cb71 !important;
  font-family:var(--han); letter-spacing:.02em; transform:rotate(-1deg); }
:root .enroll-screen .title-latin { display:inline-block; margin-top:1px !important; padding:6px 20px 7px;
  color:var(--sb-ink) !important; background:#efbaa2; border:1px solid #9b735f; border-radius:4px 9px 3px 7px;
  font-family:var(--sb-display); font-size:17px !important; letter-spacing:.08em !important;
  text-transform:none !important; text-shadow:none !important; transform:rotate(1.5deg); }
:root .enroll-head { border:0; padding:8px 0; }
:root .enroll-title { font-family:var(--sb-display); color:var(--sb-ink); }
:root .enroll-eyebrow { color:#895c4e; }
:root .enroll-sub, :root .enroll-hint, :root .enroll-label { color:var(--sb-muted); }
:root .enroll-namewrap input { background:#fff9ed; color:var(--sb-ink); border:1px solid #aa8b70;
  border-radius:3px 9px 4px 6px; box-shadow:none; }
:root .enroll-lang { background:#f4e6cd; border:1px solid #ae9379; border-radius:8px 3px 7px 4px; box-shadow:none; }
:root .enroll-lang.sel { background:var(--sb-lilac); border-color:#816c8c; box-shadow:none; }
:root .enroll-lang b,:root .enroll-lang span,:root .enroll-lang.sel span { color:var(--sb-ink); }
:root .enroll-go { background:var(--sb-sage); border:1.5px solid #7e8b6d;
  color:var(--sb-ink); border-radius:5px 13px 7px 10px; box-shadow:none; font-family:var(--sb-display); }
:root .enroll-card .daily-entry { background:#e1d4e8; color:var(--sb-ink); border:1.5px dashed #826d8a;
  border-radius:5px 12px 4px 9px; box-shadow:none; font-family:var(--sb-display); transform:rotate(-.7deg); }
:root .enroll-langrow .enroll-lang:nth-child(1) { transform:rotate(-1deg); }
:root .enroll-langrow .enroll-lang:nth-child(2) { transform:rotate(.8deg); }
:root .enroll-langrow .enroll-lang:nth-child(3) { transform:rotate(-.5deg); background:#dce5c9; }
/* Map: a sketched sign for each real location, and one date note. */
:root .day-banner { background:var(--sb-paper); color:var(--sb-ink); border:1px solid #947a62;
  border-radius:5px 11px 4px 8px; box-shadow:none; }
:root .day-banner b,:root .day-banner span { color:var(--sb-ink); }
:root .phone-btn { background:var(--sb-peach); color:var(--sb-ink); border:1px solid #94715e;
  border-radius:7px 4px 10px 5px; box-shadow:none; min-height:44px; }
:root .mapnode { background:url('../art/ui/storybook/sign.svg') center/100% 100% no-repeat;
  border:0; border-radius:0; padding:12px 19px 12px 30px; box-shadow:none; min-height:48px; }
:root .mapnode:hover,:root .mapnode.sel { background:url('../art/ui/storybook/sign.svg') center/100% 100% no-repeat; filter:brightness(1.06); box-shadow:none; }
:root .mapnode::before { display:none; }
:root .mapnode .han,:root .mapnode .mn-en { color:var(--sb-ink); text-shadow:none; }
:root .mapnode .mn-en { font-family:var(--sb-display); letter-spacing:0; }
:root .mapnode.shut { filter:saturate(.35); opacity:.85; }
:root .map-hint { color:var(--sb-ink); background:var(--sb-paper); border:1px dashed #b99b80; box-shadow:none; }
:root .slot-hint { background:var(--sb-paper); color:var(--sb-ink); border:1px solid #947a62;
  border-radius:5px 10px 4px 8px; box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; }
:root .slot-hint b,:root .slot-hint .han { color:var(--sb-ink); }
:root .scene-card { background:var(--sb-paper); border:1px solid #aa9079; color:var(--sb-ink);
  border-radius:3px 9px 5px 7px; box-shadow:none; }
:root .scene-card.promposal { background:#f5dfdf; }
:root .scene-card :is(.sc-name,.sc-en,.dim) { color:var(--sb-muted); }
/* Dialogue is a passed note, with one personal detail at its edge. */
:root .scene-screen .dlg { padding:20px 17px 14px; margin-bottom:18px; overflow:visible; isolation:isolate; }
:root .dlg-name { background:var(--sb-peach) !important; color:var(--sb-ink); box-shadow:none;
  border:1px solid #a17e67; border-radius:4px 9px 5px 12px; font-family:var(--sb-display);
  top:-30px; left:17px; padding:8px 18px; min-height:40px; }
:root .dlg-name .han { color:var(--sb-ink); }
:root .dlg-name[data-character="coco"] { width:255px; min-height:68px; top:-51px; left:8px;
  padding:27px 14px 8px 95px; background:url('../art/ui/storybook/fox-letter-tab.svg') center/100% 100% no-repeat !important;
  border:0; border-radius:0; font-size:17px; }
:root .dlg-name[data-character="coco"]::before { content:""; position:absolute; width:62px; height:55px;
  display:none; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg::after { content:""; position:absolute;
  right:-68px; top:-76px; width:150px; height:430px; z-index:-1; pointer-events:none;
  background:url('../art/ui/storybook/fox-tail.svg') center/contain no-repeat; transform:rotate(-3deg); }
:root .scene-screen :is(.line.char,.line.player,.line-en,.scene-purpose,.conversation-question,.conversation-recovery) { color:var(--sb-ink); }
:root .scene-screen .line.player { background:#e9dfed; border:0; border-radius:9px 3px 10px 4px; }
:root .scene-screen .dlg-log { scrollbar-color:#b99d7e transparent; }
:root .scene-screen :is(.scene-purpose,.conversation-question) { background:transparent; border:0; box-shadow:none; padding-left:0; padding-right:0; }
:root .scene-screen .dlg-input { background:#fff9ed; border:1px solid #baa088; border-radius:4px 9px 2px 5px;
  box-shadow:none; padding:8px; gap:8px; flex-wrap:wrap; }
:root .scene-screen #say { color:var(--sb-ink); background:transparent; border:0; border-radius:0; min-width:100px; }
:root .scene-screen #say::placeholder { color:#877563; }
:root .scene-screen .sendbtn { background:url('../art/ui/storybook/envelope.svg') center/100% 100% no-repeat;
  color:#43513d; width:112px; min-height:57px; height:auto; padding:24px 12px 10px; border:0; border-radius:0; box-shadow:none;
  font-family:var(--sb-display); font-size:16px; }
:root .scene-screen .primary-help { background:url('../art/ui/storybook/pencil.svg') center/100% 100% no-repeat;
  border:0; border-radius:0; min-width:172px; min-height:46px; padding:10px 28px 10px 17px; box-shadow:none;
  font-family:var(--sb-display); color:var(--sb-ink); }
:root .scene-screen :is(.tool,.scene-tools summary,.micbtn,.line-say) { color:var(--sb-ink); box-shadow:none; }
:root .scene-screen .reply-help { color:var(--sb-ink); background:#f0e6f2; border:1px dashed #b8a4c4; border-radius:5px 9px 4px 8px; box-shadow:none; }
:root .scene-screen .conversation-recovery { background:#f6dfd6; border:1px dashed #b47a69;
  color:#75433d; border-radius:4px 11px 5px 8px; padding:8px 10px; font-size:13px; }
:root .scene-screen .scene-banner { background:var(--sb-paper); color:var(--sb-ink); border:1px solid #947a62; box-shadow:none; }
:root .scene-screen .scene-banner :is(b,span,.han) { color:var(--sb-ink); }
:root .scene-screen :is(.hh-mood,.hh-bond) { color:var(--sb-ink); border:1px solid #aa9079;
  border-radius:3px 8px 4px 6px; box-shadow:none; font-family:var(--sb-display); }
:root .scene-screen .hh-mood { background:#f5e1a9; transform:rotate(-2deg); }
:root .scene-screen .hh-bond { background:#f0c4b1; transform:rotate(1.5deg); }
:root .scene-screen :is(.hh-k,.hh-mood b,.hh-rel,.hh-bond em) { color:var(--sb-ink); }
:root .scene-screen .leavebtn { background:url('../art/ui/storybook/sign.svg') center/100% 100% no-repeat;
  border:0; border-radius:0; padding:12px 16px 12px 32px; color:var(--sb-ink); min-height:48px; box-shadow:none; }
/* Journal: real memories remain photographs; tabs look like page markers. */
:root .phone-modal .phone { --paper:var(--sb-ink); --haze:var(--sb-muted); --card:var(--sb-paper); --card-2:#f0e3cb;
  --glass-rgb:251,241,220; --edge-rgb:89,73,62; --field-bg:#fff9ed; --field-fg:var(--sb-ink);
  background:
    linear-gradient(90deg,transparent calc(50% - 2px),#c6a98d calc(50% - 1px),#e5ccb0 50%,transparent calc(50% + 2px)),
    repeating-linear-gradient(0deg,#fbf1dc 0,#fbf1dc 30px,#eadcc4 31px);
  color:var(--sb-ink); border:2px solid #9a806b;
  border-left:9px solid #9b89ae; border-radius:8px 18px 15px 5px; box-shadow:none; }
:root .phone-modal .phone-tabs { background:#efe1c9; border-bottom:1px solid #b99c7e; padding-top:16px; overflow:visible; }
:root .phone-modal .phone .ptab { background:#ead4bf; color:var(--sb-ink); border:1px solid #a68b73;
  border-radius:8px 5px 0 0; min-height:44px; font-family:var(--sb-display); box-shadow:none; }
:root .phone-modal .phone .ptab:nth-child(3n+2) { background:#d5dfc2; }
:root .phone-modal .phone .ptab:nth-child(3n) { background:#e1d4e8; }
:root .phone-modal .phone .ptab:nth-child(2n) { transform:rotate(1deg) translateY(1px); }
:root .phone-modal .phone .ptab:nth-child(3n) { transform:rotate(-1.2deg); }
:root .phone-modal .phone .ptab.sel { border-bottom:3px solid #8a677b; color:var(--sb-ink); background:#fff7e6; }
:root .phone-modal .phone .ptab.close { background:var(--sb-paper); color:var(--sb-ink); }
:root .phone-modal .contact { position:relative; margin:10px 6px 17px; background:#fff8e9;
  color:var(--sb-ink); border:1px dashed #bfa78e; border-radius:5px 10px 4px 7px; box-shadow:none; }
:root .phone-modal .contact::before { content:""; position:absolute; width:52px; height:13px; top:-8px; left:26px;
  background:#d8cce5cc; transform:rotate(-4deg); }
:root .phone-modal .contact:nth-child(even)::before { left:auto; right:28px; background:#bfd1accc; transform:rotate(3deg); }
:root .phone-modal .contact-art { padding:5px 5px 17px; background:#fff9ed; border:1px solid #b59c83; transform:rotate(-2deg); }
:root .pola { background:#fff9ed; color:var(--sb-ink); border:1px solid #a38b73; border-radius:2px; box-shadow:0 2px 3px #59493e18; padding-bottom:16px; }
:root .pola-line { font-family:var(--sb-display); }
:root .phone-modal .im-back { color:var(--sb-ink); background:url('../art/ui/storybook/sign.svg') center/100% 100% no-repeat; padding:12px 20px 12px 30px; border:0; }
/* Incoming messages arrive as pinned school notes instead of system glass. */
:root .notif { background:#fbf1dc; color:var(--sb-ink); border:1.5px dashed #9f7d69;
  border-radius:5px 12px 4px 9px; box-shadow:2px 3px 0 #6f514733; transform:rotate(.35deg); }
:root .notif-ico { border-radius:4px 9px 5px 7px; box-shadow:0 0 0 2px #efbaa2; }
:root .notif-ico :is(.pav,img,svg,.notif-appicon) { border-radius:3px 8px 4px 6px; }
:root .notif-top b,:root .notif-body p { color:var(--sb-ink); }
:root .notif-top b { font-family:var(--sb-display); }
:root .notif-top span { color:#986074; }
:root .notif-x { color:var(--sb-ink); background:#e7d6bd; border-radius:4px 7px 3px 6px; }
/* Results: an earned record on a letter, with actual reward stamps. */
:root .stamps-card { padding:20px 20px 18px; }
:root .stamps-card h3 { font-family:var(--sb-display); color:var(--sb-ink); }
:root .stamps-card .stamp { border:1.5px dashed #a78070; border-radius:3px; background:#f6e3cf; color:var(--sb-ink); box-shadow:none; }
:root .stamps-card .stamp.hearts { background:#efd7da; }
:root .stamps-card .bigbtn,:root .binary-card .bigbtn { background:var(--sb-sage); color:var(--sb-ink);
  border:1px solid #849271; border-radius:6px 12px 5px 8px; box-shadow:none; font-family:var(--sb-display); min-height:48px; }
:root :is(.phone-modal,.scene-screen,.enroll-screen,.map-screen,.stamps-modal) :is(button,input,summary):focus-visible {
  outline:3px solid #82629b; outline-offset:3px;
}
@media(max-width:700px) {
  :root .scene-screen .dlg { width:calc(100% - 20px); margin:35px 10px 12px; padding:16px 5px 8px; }
  :root .dlg-name { left:1px; }
  :root .dlg-name[data-character="coco"] { width:230px; min-height:62px; top:-47px;
    padding:25px 12px 7px 86px; font-size:16px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg::after {
    right:-48px; top:-34px; width:103px; height:285px; opacity:.94; }
  :root .scene-screen .dlg-input { padding:5px; }
  :root .scene-screen .sendbtn { width:94px; }
  :root .enroll-card { padding:18px 8px; }
  :root .mapnode { padding:10px 13px 10px 23px; }
  :root .map-screen .slot-hint { top:102px; width:min(265px,calc(100vw - 28px)); padding:8px 12px; }
  :root .phone-modal .phone { max-height:92dvh; }
  :root .phone-modal .phone-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr));
    gap:4px; padding:12px 52px 7px 8px; overflow:visible; position:relative; }
  :root .phone-modal .phone .ptab { min-width:0; width:100%; padding:7px 4px;
    overflow:hidden; text-overflow:ellipsis; }
  :root .phone-modal .phone .ptab.close { position:absolute; right:6px; top:12px;
    width:44px; min-height:44px; padding:4px; border-radius:5px 8px 4px 7px; }
  :root .phone-modal .phone .phone-bug { position:static; width:100%; margin:0; }
  :root .scene-screen #say { min-height:48px; padding:10px 6px; }
}

/* Conversation-first compromise: retain the gouache scene and character, but
   give Coco one ordinary, generous conversation sheet beneath her. The painted
   desk frame made the chat controls ornaments instead of clear controls. */
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg,
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg {
  position:relative; width:min(760px, calc(100% - 24px)); height:auto; min-height:0; aspect-ratio:auto;
  margin:0 auto max(16px, env(safe-area-inset-bottom)); padding:28px 20px 18px;
  background:linear-gradient(135deg, rgba(255,250,234,.98), rgba(245,232,203,.98));
  border:2px solid #8d735d; border-radius:12px 18px 10px 16px;
  box-shadow:7px 8px 0 rgba(65,44,34,.22), 0 12px 28px rgba(35,24,18,.2);
  filter:none; overflow:visible; isolation:isolate;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-name {
  position:absolute; top:-24px; left:16px; width:auto; min-height:44px; padding:10px 16px;
  background:#f2d2bf !important; border:2px solid #8d735d; border-radius:8px 12px 7px 10px;
  font-family:var(--sb-display); font-size:18px; z-index:3;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) :is(.scene-purpose,.dlg-log,.dlg-input,.dlg-tools,.field-wrap) {
  position:static; width:auto; height:auto; max-height:none; padding:0; margin:0;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-purpose {
  margin:0 0 10px; font-size:16px; line-height:1.45; text-align:left; font-family:var(--sb-display); overflow:visible;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log {
  height:auto; min-height:150px; max-height:min(310px, 34dvh); padding:0 4px 12px 0; overflow-y:auto;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .line.char { font-size:20px; line-height:1.6; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .line-en { font-size:14px; text-align:left; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools {
  display:flex; flex-wrap:wrap; gap:6px; padding:8px 0; border-top:1px dashed #b99b80;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools .tool {
  width:auto; min-width:44px; min-height:44px; padding:7px 11px; background:#f5e8c8; color:var(--sb-ink);
  border:1px solid #a78569; border-radius:7px 10px 6px 9px; font-family:var(--sb-display); font-size:14px;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-input {
  display:flex; align-items:center; gap:8px; padding:8px; background:#fff9ed; border:1px solid #b99b80;
  border-radius:7px 12px 6px 10px;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) #say { flex:1; min-width:0; height:48px; padding:0 10px; font-size:17px; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .micbtn { position:static; transform:none; width:auto; min-width:82px; height:48px; padding:0 10px; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .sendbtn { position:static; width:auto; min-width:74px; height:48px; min-height:48px; padding:0 14px;
  background:#d94c3f; color:#fff9ed; border:1px solid #9e3d33; border-radius:7px 10px 6px 9px; font-family:var(--sb-display); font-size:16px;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) :is(.reply-help,.imebar) { position:static; }

@media(max-width:700px) {
  :root .scene-screen:has(.dlg-name[data-character="coco"]) { overflow-y:auto; overflow-x:hidden; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg { width:calc(100% - 16px); margin:0 8px max(10px, env(safe-area-inset-bottom)); padding:28px 12px 12px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log { min-height:116px; max-height:28dvh; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools .tool { width:100%; justify-content:center; font-size:13px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-input { gap:6px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .micbtn { min-width:48px; width:48px; padding:0; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .micbtn span { display:none; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .sendbtn { min-width:58px; padding:0 8px; }
}
@media(min-width:900px) {
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-stage {
    justify-content:flex-start; padding-left:4vw; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg {
    width:min(620px,49vw); min-height:61vh; margin:0 5vw 5vh auto;
    padding:34px 30px 22px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log {
    max-height:min(275px,31dvh); min-height:150px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .line.char { font-size:22px; }
}
@media(prefers-reduced-motion:reduce) {
  :root :is(.enroll-screen,.map-screen,.scene-screen,.phone-modal,.stamps-modal) * { scroll-behavior:auto; }
}

/* Coco reference composition -------------------------------------------------
   The approved concept is a single illustrated desk arrangement. The PNG is
   deliberately blank; live text and native controls remain HTML above it. */
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg {
  width:min(820px,62vw); min-height:0; aspect-ratio:4/3; margin:0 1.5vw 1.5vh auto;
  padding:16% 12% 10% 25%; border:0; background:url('../art/ui/storybook/coco-conversation-frame.png') center/100% 100% no-repeat;
  filter:drop-shadow(0 8px 7px #33251f33); overflow:visible; isolation:isolate;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg::after { display:none; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-name {
  top:4.5%; left:22%; width:35%; min-height:9%; padding:2.7% 2% 1.2% 10%;
  background:none !important; border:0; font-size:clamp(16px,1.55vw,23px); z-index:3;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-purpose {
  position:absolute; left:32%; top:24%; width:51%; margin:0;
  max-height:16%; overflow:hidden; font-family:var(--sb-display);
  font-size:clamp(17px,1.55vw,23px); line-height:1.35; text-align:center; opacity:1;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log {
  position:absolute; left:32%; top:42%; width:51%; height:16%; min-height:0; max-height:none;
  padding:0 1% 0 0; overflow:auto;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .line.char {
  font-size:clamp(20px,2vw,30px); line-height:1.48;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .line-en {
  font-family:var(--sb-display); font-size:clamp(15px,1.35vw,20px); text-align:center;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-input {
  position:absolute; left:20%; bottom:12%; width:54%; height:24%; padding:4.5% 4% 2%;
  display:block; background:transparent; border:0; overflow:visible;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .field-wrap {
  width:100%; height:58%; background:transparent; border:0;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) #say {
  width:100%; height:100%; padding:0 8% 0 0; font-size:clamp(17px,1.6vw,23px);
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .sendbtn {
  position:absolute; right:-48%; bottom:-30%; width:58%; height:88%; min-height:0;
  padding:19% 4% 3%; background:none; color:#2e4d37; font-size:clamp(18px,1.8vw,26px);
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools {
  position:absolute; left:34%; bottom:2.2%; width:31%; height:13%; z-index:4;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .primary-help {
  width:100%; height:100%; min-width:0; min-height:0; padding:14% 8% 4%;
  background:none; font-size:clamp(15px,1.4vw,21px); transform:rotate(-2deg);
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-tools {
  position:absolute; right:-111%; top:-111%; width:max-content;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-tools summary {
  padding:8px 12px; background:transparent; border:0; border-radius:0;
  font-family:var(--sb-display); transform:rotate(2deg);
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) :is(.reply-help,.imebar) {
  position:absolute; left:23%; right:24%; z-index:6;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .reply-help { bottom:31%; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .imebar { bottom:11%; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .chip-stack { right:1.5%; top:19%; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .leavebtn { font-size:0; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .leavebtn::after {
  content:"Back"; font-family:var(--sb-display); font-size:18px;
}

@media(max-width:700px) {
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-stage { align-items:flex-start; padding-top:78px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) { overflow-y:auto; overflow-x:hidden; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .portrait-wrap { max-height:45dvh; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg {
    width:104vw; height:380px; aspect-ratio:auto; margin:37dvh -2vw 0;
    padding:72px 53px 38px 102px; background-size:100% 100%;
  }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-name {
    top:16px; left:62px; width:205px; min-height:40px; padding:13px 7px 4px 58px; font-size:16px;
  }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-purpose {
    display:block; left:84px; top:78px; width:221px; height:36px; max-height:36px;
    font-size:13px; line-height:1.25; text-align:center;
    display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log {
    left:84px; top:121px; width:221px; height:85px; max-height:none;
  }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .line.char { font-size:17px; line-height:1.38; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .line-en { font-size:14px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-input {
    left:77px; bottom:41px; width:213px; height:92px; padding:22px 15px 8px;
  }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) #say { font-size:16px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .sendbtn {
    right:-52%; bottom:-27%; width:65%; height:91%; padding-top:28px; font-size:17px;
  }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools {
    left:139px; bottom:4px; width:124px; height:52px;
  }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .primary-help { padding-top:16px; font-size:14px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-tools {
    left:190px; right:auto; top:-122px;
  }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .chip-stack { top:35%; right:5px; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) :is(.reply-help,.imebar) { left:68px; right:68px; }
}

/* Alternate review skin: colored gouache boundaries replace the inked frame. */
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg {
  background-image:url('../art/ui/storybook/coco-conversation-frame-riso.png');
  filter:drop-shadow(0 7px 10px #4a352229);
}
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) :is(.scene-banner,.hh-mood,.hh-bond) {
  border-color:#a88f785c; box-shadow:none;
}
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .rail-label {
  border-color:#a88f7866; box-shadow:none;
}

/* the painted sheet has two real writing areas. give each one its own measure;
   preserving the old percentages made the english prompt pay for the fox tail. */
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .scene-purpose {
  left:24%; top:20%; width:64%; max-height:23%; overflow:auto;
}
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log {
  left:27%; top:45%; width:59%; height:17%;
}
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .field-wrap {
  width:calc(100% - 48px);
}
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) #say {
  padding-right:8px; font-size:clamp(15px,1.4vw,18px);
}
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .field-wrap .micbtn {
  right:-50px; background:#f3dfbd; color:#355b4b; border:0;
  border-radius:48% 52% 46% 54%;
}

@media(max-width:700px) {
  /* the sheet still has to land above the home indicator. its three blocks fit
     by spending the painted gaps, not by shrinking the words again. */
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg {
    height:390px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-name {
    font-size:0;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-name .han {
    font-size:20px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .scene-purpose {
    left:86px; top:54px; width:258px; height:108px; max-height:108px;
    overflow:auto; font-size:15px; line-height:1.35; -webkit-line-clamp:unset;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log {
    left:90px; top:170px; width:250px; height:62px; padding-top:4px; box-sizing:border-box; overflow:auto;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .line.char {
    font-size:18px; line-height:1.38;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .line-en {
    font-size:15px; line-height:1.4;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-input {
    left:70px; bottom:38px; width:258px; height:104px; padding:16px 14px 8px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .field-wrap {
    width:214px; height:48px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) #say {
    padding:0 8px; font-size:14px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .field-wrap .micbtn {
    right:-44px; top:50%;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .sendbtn {
    right:-27%; bottom:-18%; width:52%; height:78%; padding-top:27px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools {
    left:139px; bottom:18px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .primary-help {
    height:52px; min-height:52px; padding:10px 6px 4px;
    color:#3f3158; font-size:13px; line-height:1;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .scene-tools {
    left:190px; right:auto; top:-83px; width:68px; height:38px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .scene-tools summary {
    width:68px; height:38px; min-height:0; padding:0; display:flex; align-items:center; justify-content:center; gap:4px;
  }
  :root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .scene-tools summary::after {
    margin-left:0;
  }
}

/* The conversation sheet is deliberately ordinary: the artwork frames the
   scene, while the learner's words live in one clear panel under Coco. */
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg,
:root[data-storybook-art="riso"] .scene-screen:has(.dlg-name[data-character="coco"]) .dlg {
  position:relative !important; width:min(760px, calc(100% - 24px)) !important; height:auto !important;
  min-height:0 !important; aspect-ratio:auto !important; margin:0 auto max(16px, env(safe-area-inset-bottom)) !important;
  padding:28px 20px 18px !important; background:linear-gradient(135deg, #fff9ea, #f5e8cb) !important;
  border:2px solid #8d735d !important; border-radius:12px 18px 10px 16px !important;
  box-shadow:7px 8px 0 rgba(65,44,34,.22), 0 12px 28px rgba(35,24,18,.2) !important; filter:none !important;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-name {
  top:-24px !important; left:16px !important; width:auto !important; min-height:44px !important; padding:10px 16px !important;
  background:#f2d2bf !important; border:2px solid #8d735d !important; border-radius:8px 12px 7px 10px !important; font-size:18px !important;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) :is(.scene-purpose,.dlg-log,.dlg-input,.dlg-tools,.field-wrap,.reply-help,.imebar) {
  position:static !important; width:auto !important; height:auto !important; max-height:none !important; padding:0; margin:0;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .scene-purpose { margin:0 0 10px !important; font-size:16px !important; line-height:1.45 !important; text-align:left !important; overflow:visible !important; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log { min-height:150px !important; max-height:min(310px, 34dvh) !important; padding:0 4px 12px 0 !important; overflow-y:auto !important; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .line.char { font-size:20px !important; line-height:1.6 !important; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .line-en { font-size:14px !important; text-align:left !important; }
/* The sheet is light paper, so no child may inherit the dialogue's former
   light-on-dark reading token. Keep every spoken line and its annotations inked. */
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg :is(.line.char, .line.char .w, .line-en, .line.sys, .line.sys .nudge-note, .line.sys .nudge-note .han, .gesture, .line-say) {
  color:var(--sb-ink) !important;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg .line.char .w.kara,
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg .line.char .w.kara-done {
  color:#a33f36 !important;
}
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools { display:flex !important; flex-wrap:wrap !important; gap:6px !important; padding:8px 0 !important; border-top:1px dashed #b99b80; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools .tool { width:auto !important; min-width:44px !important; min-height:44px !important; padding:7px 11px !important; background:#f5e8c8 !important; color:var(--sb-ink) !important; border:1px solid #a78569 !important; border-radius:7px 10px 6px 9px !important; font-size:14px !important; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-input { display:flex !important; align-items:center !important; gap:8px !important; padding:8px !important; background:#fff9ed !important; border:1px solid #b99b80 !important; border-radius:7px 12px 6px 10px !important; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) #say { flex:1 !important; min-width:0 !important; height:48px !important; padding:0 10px !important; font-size:17px !important; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .micbtn { position:static !important; transform:none !important; width:auto !important; min-width:82px !important; height:48px !important; padding:0 10px !important; }
:root .scene-screen:has(.dlg-name[data-character="coco"]) .sendbtn { position:static !important; width:auto !important; min-width:74px !important; height:48px !important; min-height:48px !important; padding:0 14px !important; background:#d94c3f !important; color:#fff9ed !important; border:1px solid #9e3d33 !important; border-radius:7px 10px 6px 9px !important; font-size:16px !important; }
@media(max-width:700px) {
  :root .scene-screen:has(.dlg-name[data-character="coco"]) { overflow-y:auto; overflow-x:hidden; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg { width:calc(100% - 16px) !important; margin:0 8px max(10px, env(safe-area-inset-bottom)) !important; padding:28px 12px 12px !important; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-log { min-height:116px !important; max-height:28dvh !important; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools { display:grid !important; grid-template-columns:repeat(2, minmax(0, 1fr)) !important; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-tools .tool { width:100% !important; justify-content:center !important; font-size:13px !important; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .dlg-input { gap:6px !important; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .micbtn { min-width:48px !important; width:48px !important; padding:0 !important; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .micbtn span { display:none; }
  :root .scene-screen:has(.dlg-name[data-character="coco"]) .sendbtn { min-width:58px !important; padding:0 8px !important; }
}
