@font-face{font-family:"Lora";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/Lora-400-latin.woff2) format("woff2")}
@font-face{font-family:"Lora";font-style:italic;font-weight:400;font-display:swap;src:url(fonts/Lora-400i-latin.woff2) format("woff2")}
@font-face{font-family:"Lora";font-style:normal;font-weight:600;font-display:swap;src:url(fonts/Lora-600-latin.woff2) format("woff2")}
@font-face{font-family:"Neucha";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/Neucha-400-latin.woff2) format("woff2")}
@font-face{font-family:"Mystery Quest";font-style:normal;font-weight:400;font-display:swap;src:url(fonts/MysteryQuest-400-latin.woff2) format("woff2")}

:root{
  --teal:#00929d;
  --teal-dark:#087781;
  --beige:#efe6d5;
  --beige-dark:#e1d4ba;
  --ink:#3a3a3a;
  --bar:#16636b;
  --bar-h:52px;
  --top-h:52px;
}
*{box-sizing:border-box}
html{background:#0b6f78}
html,body{height:100%}
body{
  margin:0;
  height:100vh;height:100dvh;
  display:grid;grid-template-rows:var(--top-h) minmax(0,1fr) var(--bar-h);grid-template-columns:minmax(0,1fr);
  background:radial-gradient(circle at 50% 30%,#2fb5bf 0%,#0d8f9a 55%,#0b6f78 100%);
  color:#fff;
  font-family:Lora,Georgia,serif;
  touch-action:manipulation;
  overflow:hidden;
  -webkit-tap-highlight-color:transparent;
}
#top,#bar{display:flex;align-items:center;justify-content:space-between;padding:0 12px;padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
#top{padding-top:env(safe-area-inset-top,0px);box-sizing:content-box}
#bar{padding-bottom:env(safe-area-inset-bottom,0px);box-sizing:content-box;justify-content:center;gap:18px}
.logo img{height:38px;width:auto;display:block;filter:drop-shadow(0 1px 1px rgba(0,0,0,.25))}
.tools{display:flex;gap:8px}
button{font:inherit;cursor:pointer;border:0;border-radius:999px;background:rgba(255,255,255,.18);color:#fff;padding:8px 14px;line-height:1;min-height:40px;min-width:40px}
button:hover{background:rgba(255,255,255,.3)}
#btn-prev,#btn-next{font-size:30px;width:56px;padding:0}
#btn-fs{padding:0;display:inline-flex;align-items:center;justify-content:center}
#pageinfo{font-family:Neucha,cursive;font-size:19px;min-width:9ch;text-align:center;opacity:.95}

#stage{position:relative;display:grid;place-items:center;overflow:hidden;padding:6px}
#book{position:relative;filter:drop-shadow(0 12px 22px rgba(0,0,0,.35))}
#book .stf__wrapper{position:relative;width:100%;height:100%}

.page{
  container-type:inline-size;
  background:var(--beige);
  overflow:hidden;
  user-select:none;-webkit-user-select:none;
}
.sheet{
  position:absolute;inset:0;
  display:grid;grid-template-rows:auto minmax(0,1fr) auto;
  background:radial-gradient(ellipse at 50% 42%,#f7f1e6 0%,var(--beige) 55%,var(--beige-dark) 100%);
}
.txt{padding:4.5cqw 5.5cqw;font-size:3.8cqw;line-height:1.38;color:var(--ink)}
.txt.top{padding-bottom:1.5cqw}
.txt.bottom{padding-top:1.5cqw;padding-bottom:5cqw}
.page.dense .txt{font-size:3.4cqw;line-height:1.34}
.txt p{margin:0 0 .7em}
.txt p:last-child{margin-bottom:0}
.txt .h{font-family:Neucha,cursive;font-size:1.5em;line-height:1.2;color:var(--teal-dark);margin:0 0 .4em}
.txt .q{font-style:italic}
.txt .small{font-size:.85em;opacity:.9}
.name{font-family:Neucha,cursive;color:var(--teal-dark);font-size:1.1em}
.fig{position:relative;min-height:0;display:flex;align-items:center;justify-content:center}
.fig img{display:block;max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;pointer-events:none}
.deco{position:absolute;top:4cqw;right:5cqw;font-family:Neucha,cursive;font-size:6.5cqw;line-height:1;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.35);transform:rotate(-12deg)}
.film{
  position:absolute;right:4cqw;bottom:4cqw;
  display:inline-flex;align-items:center;gap:1.6cqw;
  background:var(--teal);color:#fff;font-family:Neucha,cursive;font-size:3.6cqw;
  padding:2cqw 3.6cqw;border-radius:999px;box-shadow:0 2px 6px rgba(0,0,0,.3);
  min-height:0;min-width:0;
}
.film::before{content:"▶";font-size:.9em}
.pn{position:absolute;left:0;right:0;bottom:1.4cqw;text-align:center;font-size:2.6cqw;color:#8a7f6a;pointer-events:none}

.page.cover .sheet{grid-template-rows:auto minmax(0,1fr) auto;background:linear-gradient(180deg,#f3ecdc 0%,#e7dcc3 46%,#2fb5bf 60%,#0d8f9a 100%)}
.cover .title{text-align:center;padding:6cqw 4cqw 0}
.cover .emily{display:block;font-family:"Mystery Quest",cursive;font-size:21cqw;line-height:1;color:#1d1d1d}
.cover .sub{display:block;font-family:Neucha,cursive;font-size:7cqw;line-height:1.1;color:var(--teal);margin-top:1cqw}
.cover .fig{padding:0 4cqw}
.cover .claim{text-align:center;font-family:Neucha,cursive;font-size:9cqw;line-height:1;color:#fff;text-shadow:0 2px 4px rgba(0,0,0,.3);padding:2cqw 0 1cqw}
.cover .authors{text-align:center;font-family:Neucha,cursive;font-size:3.4cqw;color:#fff;opacity:.95;padding-bottom:2cqw}
.cover .hint{text-align:center;font-size:2.8cqw;color:#fff;opacity:.85;padding-bottom:4cqw}

.page.back .sheet{display:block;background:url(img/pages/rueckseite-s.jpg) center/cover;color:#fff;padding:7cqw 7cqw}
.back .h{font-family:Neucha,cursive;font-size:6.2cqw;line-height:1.15;margin:0 0 3cqw}
.back p{font-size:3.6cqw;line-height:1.4;margin:0 0 2.5cqw}
.back .credits{font-family:Neucha,cursive;font-size:3.4cqw;margin-top:6cqw}
.back .links{margin-top:5cqw;display:flex;flex-wrap:wrap;gap:2cqw}
.back a,.back button{display:inline-block;background:rgba(255,255,255,.92);color:var(--teal-dark);text-decoration:none;font-family:Neucha,cursive;font-size:3.8cqw;padding:2cqw 4cqw;border-radius:999px;min-height:0;min-width:0}

dialog{border:0;border-radius:18px;padding:18px 20px 20px;max-width:min(92vw,560px);color:var(--ink);background:#fff;box-shadow:0 20px 50px rgba(0,0,0,.4)}
dialog::backdrop{background:rgba(6,50,55,.72)}
#film{text-align:center}
#film img{display:block;margin:0 auto;max-width:100%;max-height:70vh;width:auto;height:auto}
#film .film-title{font-family:Neucha,cursive;font-size:22px;color:var(--teal-dark);margin:6px 36px 12px}
#film .close{position:absolute;top:8px;right:8px;background:#eee;color:#333;font-size:24px;width:40px;padding:0}
#namedlg label{display:block;font-family:Neucha,cursive;font-size:24px;color:var(--teal-dark)}
#namedlg input{display:block;width:100%;margin-top:10px;font:inherit;font-size:20px;padding:10px 12px;border:2px solid #cfd8d9;border-radius:12px}
#namedlg menu{display:flex;justify-content:flex-end;gap:10px;margin:18px 0 0;padding:0}
#namedlg button{background:var(--teal);color:#fff;padding:10px 18px}
#namedlg button.secondary{background:#e7ecec;color:#333}

.tools button svg{width:22px;height:22px;fill:currentColor;display:block}
#btn-sound .off{display:none}
#btn-sound.muted .on{display:none}
#btn-sound.muted .off{display:block}
#btn-read.speaking{background:#fff;color:var(--teal-dark)}

.fig{container-type:size}
.art{position:relative;width:min(100cqw,calc(100cqh * var(--r,1)));aspect-ratio:var(--r,1);margin:auto}
.art>img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill}
.art.shake{animation:shake .5s ease-in-out}
@keyframes shake{0%,100%{transform:translateX(0)}20%{transform:translateX(-1.5%) rotate(-.6deg)}40%{transform:translateX(1.5%) rotate(.6deg)}60%{transform:translateX(-1%)}80%{transform:translateX(1%)}}
.hot{position:absolute;background:transparent;border:0;padding:0;min-width:0;min-height:0;border-radius:0;cursor:pointer}
.hot:hover{background:transparent}
.hot.door{left:12%;top:16%;width:52%;height:78%}
.hot.door::after{content:"";position:absolute;left:73%;top:60%;width:14%;aspect-ratio:1;border-radius:50%;border:.5cqw solid rgba(255,255,255,.9);box-shadow:0 0 0 .4cqw rgba(0,146,157,.6);transform:translate(-50%,-50%);animation:pulse 1.6s ease-in-out infinite}
@keyframes pulse{0%,100%{transform:translate(-50%,-50%) scale(.8);opacity:.55}50%{transform:translate(-50%,-50%) scale(1.15);opacity:1}}
.wear{position:absolute;transform:translate(-50%,-50%);pointer-events:none;filter:drop-shadow(0 .4cqw .8cqw rgba(0,0,0,.25))}
.wear img{display:block;width:100%;height:auto}
.wear.pop{animation:popin .45s cubic-bezier(.2,1.4,.4,1)}
@keyframes popin{0%{transform:translate(-50%,-50%) scale(.3);opacity:0}100%{transform:translate(-50%,-50%) scale(1);opacity:1}}
.glow{position:absolute;left:50%;top:62%;width:70%;aspect-ratio:1;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;background:radial-gradient(circle,rgba(255,255,210,.95) 0%,rgba(190,255,120,.5) 35%,rgba(190,255,120,0) 70%);animation:glow 1.6s ease-out forwards}
@keyframes glow{0%{opacity:0;transform:translate(-50%,-50%) scale(.4)}30%{opacity:1}100%{opacity:0;transform:translate(-50%,-50%) scale(1.3)}}
.smoke{position:absolute;left:50%;top:60%;width:60%;aspect-ratio:1;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;background:radial-gradient(circle,rgba(120,60,160,.9) 0%,rgba(90,40,120,.6) 40%,rgba(90,40,120,0) 70%);animation:smoke 1.8s ease-out forwards}
@keyframes smoke{0%{opacity:0;transform:translate(-50%,-30%) scale(.3)}25%{opacity:1}100%{opacity:0;transform:translate(-50%,-110%) scale(1.5)}}
.fly{position:fixed;z-index:50;pointer-events:none;transform:translate(-50%,-50%);filter:drop-shadow(0 4px 8px rgba(0,0,0,.3))}
.fly img{display:block;width:100%;height:auto}

.tray{display:flex;flex-wrap:wrap;justify-content:center;gap:1.4cqw;margin:1.2cqw 0}
.tray button{width:12.5cqw;height:12.5cqw;padding:1cqw;min-width:0;min-height:0;border-radius:2.2cqw;background:rgba(255,255,255,.55);box-shadow:0 .3cqw .8cqw rgba(0,0,0,.12);position:relative}
.tray button:hover{background:rgba(255,255,255,.8)}
.tray button img{width:100%;height:100%;object-fit:contain;display:block}
.tray button.sel{outline:.7cqw solid var(--teal);background:#fff}
.tray button.done{opacity:.3}
.tray.big button{width:22cqw;height:16cqw}
.game{padding:1.5cqw 5.5cqw 4cqw}
.game .h{font-family:Neucha,cursive;font-size:4.6cqw;line-height:1.2;color:var(--teal-dark);margin:0 0 .4em}
.game .msg{font-family:Neucha,cursive;font-size:4.4cqw;line-height:1.25;color:var(--teal-dark);margin:.3em 0 0;min-height:1.2em}
.game .msg.bad{color:#b23a3a}
.game .row{display:flex;flex-wrap:wrap;gap:2cqw;align-items:center;justify-content:center;margin-top:1.2cqw}
.game .btn{font-family:Neucha,cursive;font-size:4cqw;background:var(--teal);color:#fff;padding:1.6cqw 4cqw;border-radius:999px;min-height:0;min-width:0;box-shadow:0 .3cqw .8cqw rgba(0,0,0,.2)}
.game .btn.secondary{background:#fff;color:var(--teal-dark)}
.game .btn[disabled]{opacity:.45}
.game .count{font-size:3.4cqw;color:#7a6f5c}
.slot{position:absolute;width:15%;transform:translate(-50%,-50%) rotate(var(--rot,0deg));pointer-events:none;filter:drop-shadow(0 .3cqw .6cqw rgba(0,0,0,.25))}
.slot img{display:block;width:100%;height:auto}
