@import url("type.css");
:root{ --ink:#2a2233; --paper:#fffaf0; --green:#2f8f4e; --gold:#f6d04d; --red:#e0574f; --blue:#3d7fd9; }
*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body{ margin:0; height:100%; background:#1d1830; color:#fff; font-family:var(--mq-font), Verdana, sans-serif; overflow:hidden; overscroll-behavior:none; }
body{ touch-action:manipulation; -webkit-user-select:none; user-select:none; }
button{ font:inherit; cursor:pointer; }
[hidden]{ display:none !important; }
#app{ height:100%; display:flex; flex-direction:column; padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#topbar{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:6px 10px; background:#2a2233; border-bottom:3px solid #120e1f; }
.tb-title{ font-weight:bold; color:var(--gold); letter-spacing:1px; text-shadow:2px 2px 0 #000; }
.tb-right{ display:flex; gap:6px; }
.tb-btn{ background:#4b3d5e; color:#fff; border:2px solid #120e1f; box-shadow:inset -2px -2px 0 #352a45, inset 2px 2px 0 #6d5a85; padding:5px 10px; font-size:14px; text-decoration:none; border-radius:0; }
.tb-btn:active{ transform:translateY(1px); }
#stage{ flex:1; min-height:0; display:flex; align-items:stretch; justify-content:center; gap:8px; padding:8px; }
#frame-box{ flex:1; min-width:0; min-height:0; display:flex; align-items:center; justify-content:center; }
#frame{ position:relative; width:480px; height:320px; background:#000; border:4px solid #120e1f; box-shadow:0 0 0 4px #4b3d5e, 0 10px 30px rgba(0,0,0,.5); overflow:hidden; font-size:12px; }
#screen{ width:100%; height:100%; display:block; image-rendering:pixelated; image-rendering:crisp-edges; }

/* touch controls */
.touch{ display:none; }
@media (pointer:coarse){ .touch{ display:flex; } }
.pad-side{ flex-direction:column; align-items:center; justify-content:center; gap:16px; width:150px; flex:none; }
#dpad{ position:relative; width:140px; height:140px; touch-action:none; }
#dpad .dp{ position:absolute; background:#4b3d5e; border:3px solid #120e1f; box-shadow:inset -3px -3px 0 #352a45, inset 3px 3px 0 #6d5a85; }
#dpad .up{ left:47px; top:0; width:46px; height:50px; } #dpad .down{ left:47px; bottom:0; width:46px; height:50px; }
#dpad .left{ top:47px; left:0; width:50px; height:46px; } #dpad .right{ top:47px; right:0; width:50px; height:46px; }
#dpad .mid{ left:44px; top:44px; width:52px; height:52px; box-shadow:none; border-color:#4b3d5e; }
#dpad[data-dir="up"] .up, #dpad[data-dir="down"] .down, #dpad[data-dir="left"] .left, #dpad[data-dir="right"] .right{ background:#7a6898; }
.abtns{ display:flex; gap:14px; align-items:center; }
.pbtn{ touch-action:none; border:3px solid #120e1f; color:#fff; font-weight:bold; }
.pbtn.a, .pbtn.b{ width:62px; height:62px; border-radius:0; font-size:22px; }
.pbtn.a{ background:var(--red); box-shadow:inset -4px -4px 0 #a83a33; margin-top:-26px; }
.pbtn.b{ background:var(--blue); box-shadow:inset -4px -4px 0 #2a5ea8; margin-top:20px; }
.pbtn.menu{ background:#4b3d5e; padding:8px 16px; font-size:14px; border-radius:0; }
.pbtn.down{ transform:translateY(2px); filter:brightness(1.2); }
@media (pointer:coarse) and (orientation:portrait){
  #stage{ display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr auto; grid-template-areas:"f f" "l r"; }
  #frame-box{ grid-area:f; align-items:flex-end; } #pad-left{ grid-area:l; width:auto; } #pad-right{ grid-area:r; width:auto; }
}

/* in-frame UI (sizes in em; JS sets frame font-size from scale) */
#toast{ position:absolute; top:2.4em; left:50%; transform:translate(-50%,-30%); opacity:0; visibility:hidden; background:var(--paper); color:var(--ink); border:.25em solid var(--ink); padding:.25em .9em; font-weight:bold; transition:transform .25s, opacity .25s, visibility .25s; white-space:nowrap; }
#toast.show{ transform:translate(-50%,0); opacity:1; visibility:visible; }
#hud-world{ position:absolute; top:.4em; left:.4em; background:rgba(42,34,51,.85); border:.18em solid #120e1f; padding:.2em .5em; font-size:.75em; display:flex; gap:.5em; align-items:center; }
#hud-name{ font-weight:bold; color:var(--gold); }
.hud-c{ display:flex; align-items:center; gap:.3em; } .lbl{ font-size:.8em; opacity:.9; }
.barwrap{ display:inline-block; width:5em; height:.6em; background:#3a3046; border:.12em solid #120e1f; position:relative; }
.bar{ display:block; height:100%; width:100%; background:#5fd36a; transition:width .5s ease; }
.bar.mid{ background:#f6c445; } .bar.low{ background:#e0574f; }
.bar.courage{ background:#ff7fae; } .bar.courage.low{ background:#e0574f; }
.hud-q b{ color:var(--gold); }

#hud-battle .bbox{ position:absolute; background:var(--paper); color:var(--ink); border:.25em solid var(--ink); box-shadow:inset -.2em -.2em 0 #e6dcc6; padding:.25em .5em; width:46%; font-size:.85em; }
#hud-battle .enemy{ top:.5em; left:.5em; }
#hud-battle .player{ top:16.5%; left:.5em; width:40%; }
.brow{ display:flex; align-items:center; justify-content:space-between; gap:.4em; margin:.1em 0; }
.bbox .barwrap{ flex:1; height:.7em; }
.type{ color:#fff; font-size:.75em; padding:.05em .4em; border:.12em solid var(--ink); font-weight:bold; }
.xpwrap{ flex:1; height:.35em; background:#d8d0c0; position:relative; } #bp-xp{ display:block; height:100%; background:var(--blue); transition:width .5s; }
#bp-num{ font-size:.85em; font-weight:bold; }

#dialog{ position:absolute; left:.35em; right:.35em; bottom:.35em; height:32%; z-index:28; background:var(--paper); color:var(--ink); border:.3em solid var(--ink); box-shadow:inset 0 0 0 .2em #d9c79b; padding:.5em .8em; line-height:1.35; cursor:pointer; }
#dlg-name{ position:absolute; top:-1.6em; left:.5em; background:var(--green); color:#fff; border:.22em solid var(--ink); padding:.1em .6em; font-weight:bold; font-size:.9em; border-radius:0;
  background-image:none !important; -webkit-text-fill-color:#fff !important; color:#fff !important; -webkit-text-stroke:0 !important;
  text-shadow:none !important; -webkit-background-clip:border-box !important; background-clip:border-box !important; letter-spacing:0; }
#dlg-text{ font-size:1em; position:absolute; left:.8em; right:2.4em; top:.45em; bottom:2.9em; overflow-y:auto; overflow-x:hidden; overflow-wrap:anywhere; }
#dlg-next{ position:absolute; right:.6em; bottom:.25em; line-height:1.2; animation:bob .6s infinite alternate; color:var(--red); }
@keyframes bob{ to{ transform:translateY(.2em); } }

.optlist{ display:flex; flex-direction:column; gap:.25em; }
.opt{ text-align:left; background:var(--paper); color:var(--ink); border:.2em solid var(--ink); padding:.35em .6em; font-size:.9em; line-height:1.25; border-radius:0; }
.opt.hi{ background:#ffe680; box-shadow:inset .35em 0 0 var(--red); }
.opt:hover{ background:#fff1b8; }
#choices{ position:absolute; right:.4em; left:12%; bottom:calc(32% + .7em); max-height:62%; overflow:auto; padding:.2em; z-index:28; }
#choices .opt{ box-shadow:.15em .15em 0 rgba(0,0,0,.4); }
#choices .opt.hi{ box-shadow:inset .35em 0 0 var(--red), .15em .15em 0 rgba(0,0,0,.4); }
#bmenu{ position:absolute; right:.8em; bottom:.8em; width:30%; height:calc(32% - .9em); justify-content:space-between; z-index:28; }
#bmenu .opt{ flex:1; font-weight:bold; text-align:center; padding:.1em; }
#bskills{ position:absolute; left:.35em; right:.35em; bottom:.35em; height:34%; z-index:28; background:var(--paper); border:.3em solid var(--ink); padding:.3em; display:grid; grid-template-columns:1fr 1fr 1fr; grid-auto-rows:min-content; gap:.25em; overflow:auto; }
#bskills .opt{ font-weight:bold; padding:.2em .4em; font-size:.8em; display:flex; align-items:center; gap:.3em; }
.dot{ display:inline-block; width:.7em; height:.7em; border:.12em solid var(--ink); flex:none; background:#ccc; }
#bdesc{ position:absolute; left:.35em; right:.35em; bottom:calc(34% + .3em); z-index:28; background:#2a2233; color:#fff; border:.2em solid #120e1f; padding:.3em .6em; font-size:.8em; line-height:1.3; }

.panel{ position:absolute; inset:6% 10%; z-index:28; background:var(--paper); color:var(--ink); border:.3em solid var(--ink); box-shadow:0 0 0 .2em #fff, .4em .4em 0 rgba(0,0,0,.5); padding:.6em .9em; display:flex; flex-direction:column; gap:.4em; }
.panel h2{ margin:0; font-size:1.2em; color:var(--green); }
.box-x{ position:absolute; top:.28em; right:.28em; z-index:40; width:1.7em; height:1.7em; padding:0; border:.15em solid var(--ink); border-radius:0; background:#ff5f7a; color:#fff; font:inherit; font-weight:900; font-size:1.05em; line-height:1; cursor:pointer; box-shadow:inset 0 -.12em 0 rgba(0,0,0,.18), 0 .12em 0 var(--ink); text-shadow:0 .06em 0 #9a1030; }
.box-x:hover, .box-x:focus-visible{ transform:translateY(-.05em); }
.box-x:active{ transform:translateY(.08em); }
@media (pointer:coarse){ .box-x{ width:2.15em; height:2.15em; font-size:1.15em; } }
@media (prefers-reduced-motion: reduce){ .box-x:hover, .box-x:focus-visible, .box-x:active{ transform:none; } }
#menu .box-x{ top:.35em; right:.4em; }
#dialog .box-x{ top:.12em; right:.12em; }
#choices, #bmenu, #bskills{ position:absolute; } /* already are */
#choices .box-x, #bmenu .box-x, #bskills .box-x{ top:-1.6em; right:0; }
#select .box-x, #codebox .box-x{ top:.4em; right:.4em; }
.bm-btns .bm-x{ min-width:2.2em; min-height:2.2em; font-weight:900; font-size:1.15rem; }
#menu-body{ flex:1; overflow:auto; font-size:.85em; line-height:1.4; }
#menu-body:empty{ display:none; }
#menu-body p{ margin:.3em 0; }
#menu-list{ flex:none; }
#menu-body:empty + #menu-list{ flex:1; overflow:auto; }
.book, .log{ list-style:none; padding:0; margin:0; }
.book li, .log li{ border-bottom:.12em dashed #d9c79b; padding:.35em 0; }
.book .locked{ opacity:.45; } .tag{ font-size:.75em; background:var(--green); color:#fff; padding:0 .3em; }
.log li.done{ color:#2f7a3a; }

.screen{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.5em; text-align:center; padding:1em; }
#title{ background:linear-gradient(rgba(29,24,48,.2), rgba(29,24,48,.6)); }
.logo{ margin:0; font-size:3em; line-height:1; letter-spacing:.05em; color:var(--gold); text-shadow:.08em .08em 0 #b8572b, .14em .14em 0 var(--ink); }
.logo span:last-child{ color:#fff; text-shadow:.08em .08em 0 var(--green), .14em .14em 0 var(--ink); }
.sub{ margin:0 0 .5em; font-size:.9em; text-shadow:1px 1px 0 #000; max-width:80%; }
#title-menu{ min-width:55%; } #title-menu .opt{ text-align:center; font-weight:bold; font-size:1.05em; }
.hint{ font-size:.7em; opacity:.85; margin:.2em 0 0; text-shadow:1px 1px 0 #000; }
#select{ background:rgba(29,24,48,.92); }
#select h2{ margin:0; color:var(--gold); font-size:1.3em; }
#looks{ display:flex; gap:.4em; flex-wrap:wrap; justify-content:center; }
.look{ background:#4b3d5e; border:.2em solid #120e1f; padding:.2em; }
.look canvas{ width:3.4em; height:3.4em; image-rendering:pixelated; display:block; }
.look.hi{ background:var(--gold); box-shadow:0 0 0 .2em #fff; }
#select{ overflow:auto; justify-content:flex-start; padding:1.6em .7em .6em; gap:.35em; }
#select h2{ flex:none; }
.look-preview{ background:#fff8e7; border:.2em solid var(--ink); border-radius:0; box-shadow:0 .2em 0 var(--ink); padding:.2em; }
.look-preview canvas{ width:5.5em; height:5.5em; image-rendering:pixelated; display:block; }
.look-sliders{ display:flex; flex-direction:column; gap:.28em; width:min(22em, 96%); }
.look-sliders label{ display:flex; flex-direction:column; align-items:stretch; gap:.12em; font-size:.72em; font-weight:900; color:#fff; text-shadow:0 .08em 0 #000; text-align:left; }
.look-sliders input[type=range]{ -webkit-appearance:none; appearance:none; width:100%; height:1.55em; margin:0; border-radius:0; border:.16em solid var(--ink);
  background:var(--track, #fff); box-shadow:inset 0 -.15em 0 rgba(0,0,0,.12), 0 .12em 0 var(--ink); cursor:pointer; }
.look-sliders input[type=range]::-webkit-slider-thumb{ -webkit-appearance:none; appearance:none; width:1.85em; height:1.85em; border-radius:0;
  border:.16em solid var(--ink); background:radial-gradient(circle at 35% 30%, #fff 0 28%, var(--thumb, #ffd23f) 40%, #e0a010 100%);
  box-shadow:0 .12em 0 var(--ink); }
.look-sliders input[type=range]::-moz-range-thumb{ width:1.85em; height:1.85em; border-radius:0; border:.16em solid var(--ink);
  background:radial-gradient(circle at 35% 30%, #fff 0 28%, var(--thumb, #ffd23f) 40%, #e0a010 100%); box-shadow:0 .12em 0 var(--ink); }
@media (pointer:coarse){ .look-sliders input[type=range]{ height:1.85em; } .look-sliders input[type=range]::-webkit-slider-thumb, .look-sliders input[type=range]::-moz-range-thumb{ width:2.15em; height:2.15em; } }
#select label{ font-size:.85em; }
.name-roll{ display:flex; flex-direction:column; align-items:center; gap:.15em; width:min(22em, 96%); padding:.35em .6em .4em; border:.2em solid var(--ink); border-radius:0;
  background:linear-gradient(#fff6c8, #ffd36a); color:var(--ink); font:inherit; font-weight:900; box-shadow:0 .18em 0 var(--ink); cursor:pointer; }
.name-roll .name-shown, #name-shown{ display:block; font-size:1.45em; line-height:1.1; letter-spacing:.01em; }
.name-roll .dice-row{ display:inline-flex; align-items:center; gap:.3em; font-size:.72em; }
.name-roll .dice{ width:1.3em; height:1.3em; display:inline-block; background-size:contain; background-repeat:no-repeat; }
#hs-dice.name-roll{ width:100%; margin:.2em 0; }
.err{ color:#ff9a9a; margin:0; font-size:.8em; }
.big{ background:var(--red); color:#fff; border:.2em solid var(--ink); box-shadow:inset -.2em -.2em 0 #a83a33; padding:.35em 1.4em; font-weight:bold; font-size:1.1em; }
.cert{ background:rgba(29,24,48,.85); }
.cert-inner{ background:#fffaf0; color:var(--ink); border:.4em double var(--green); outline:.25em solid var(--gold); padding:.6em 1.2em; max-width:92%; max-height:96%; overflow:auto; }
.cert-inner p{ margin:.2em 0; font-size:.8em; } .cert-inner h2{ margin:.1em 0; color:var(--green); }
.cert-top{ font-weight:bold; letter-spacing:.1em; text-transform:uppercase; }
#cert-sprite{ width:3em; height:3em; image-rendering:pixelated; }
.cert-name{ font-size:1.5em !important; font-weight:bold; color:var(--red); }
.cert-skills{ font-size:.7em !important; color:#555; } .cert-stats{ font-size:.7em !important; }
.cert-btns{ display:flex; gap:.6em; justify-content:center; margin-top:.4em; }
.cert-btns button:not(.big){ background:var(--paper); border:.2em solid var(--ink); padding:.3em 1em; }
@media print{
  body{ background:#fff; } #topbar, .touch, .cert-btns, #screen, #btn-play-menu{ display:none !important; }
  #frame{ border:none; box-shadow:none; width:100% !important; height:auto !important; font-size:18px !important; background:#fff; }
  #ending{ position:static; background:#fff; }
}

/* v2: read-aloud, calm bar, journal */
.bar.calm{ background:linear-gradient(90deg,#7fd3f5,#7be07a); }
.calmnum{ font-size:.75em; font-weight:bold; color:#2f7a3a; }
#dlg-speak, #dlg-speak.candy-speak{ position:absolute; right:1.75em; bottom:.2em; top:auto; width:1.85em; height:1.85em; padding:0; display:inline-flex; align-items:center; justify-content:center;
  border-radius:0; border:.15em solid var(--ink); cursor:pointer; color:#fff;
  background:#3d7fd9;
  box-shadow:inset -0.12em -0.12em 0 #2a5ea8, inset 0.12em 0.12em 0 #8ec8ff, 0.12em 0.12em 0 var(--ink);
  transform:none; }
#dlg-speak .spk-ico{ width:1.05em; height:1.05em; display:block; image-rendering:pixelated; filter:none; }
#dlg-speak:hover, #dlg-speak:focus-visible{ filter:none; background:#4d8fe9; }
#dlg-speak:active, #dlg-speak.press{ transform:translate(0.08em, 0.08em); box-shadow:inset -0.08em -0.08em 0 #2a5ea8, 0.04em 0.04em 0 var(--ink); }
@media (prefers-reduced-motion: reduce){ #dlg-speak:active, #dlg-speak.press{ transform:none; } }
@media (pointer:coarse){ #dlg-text{ right:3em; bottom:3.4em; } #dlg-speak, #dlg-speak.candy-speak{ width:2.2em; height:2.2em; right:1.9em; bottom:.22em; } }
.tb-btn:disabled{ opacity:.5; cursor:not-allowed; }
.tb-btn[aria-pressed="true"]#btn-tts{ background:var(--green); }
.tlink{ color:#fff; }
.opt:focus-visible, .tb-btn:focus-visible{ outline:3px dashed var(--blue); outline-offset:2px; }
.jentry{ border-bottom:.15em dashed #d9c79b; padding:.2em 0 .5em; }
.jentry h3{ margin:.3em 0 .2em; font-size:1.05em; color:var(--green); }
.jentry p{ margin:.2em 0; } .jentry ol{ margin:.1em 0 .3em; padding-left:1.4em; }
.jentry li.good i{ color:#2f7a3a; font-style:normal; font-weight:bold; } .jentry li.meh i{ color:#8a6a2a; font-style:normal; }
@media (max-width:900px){ #btn-replay{ display:none; } }
#menu-list.row{ flex-direction:row; flex-wrap:wrap; } #menu-list.row .opt{ flex:1; text-align:center; white-space:nowrap; }

/* v3: level + XP bar */
.lvbadge{ background:var(--gold); color:var(--ink); font-weight:bold; padding:0 .35em; border:.12em solid #120e1f; white-space:nowrap; }
.hud-lvl{ display:flex; align-items:center; gap:.3em; padding:.05em .2em; }
.barwrap.xp{ width:4.5em; }
.bar.xpbar{ background:linear-gradient(90deg,#3d7fd9,#7fc4ff); transition:width .8s ease; }
.xpnum{ font-size:.75em; font-weight:bold; white-space:nowrap; }
#hud-world{ flex-wrap:wrap; max-width:97%; }
.bbox .barwrap.xp{ flex:1; height:.55em; }
#menu-level{ display:flex; align-items:center; gap:.4em; font-size:.8em; background:#eef4ff; border:.15em solid var(--ink); padding:.2em .4em; }
#menu-level .barwrap.xp{ flex:1; width:auto; height:.7em; }
#menu-xptext{ white-space:nowrap; font-weight:bold; }
.lvline{ background:#fff7d6; border:.12em dashed #d9b84b; padding:.3em .5em; }
#levelup{ position:absolute; left:50%; top:30%; transform:translate(-50%,-50%) scale(0); background:var(--gold); color:var(--ink); border:.3em solid var(--ink);
  box-shadow:.3em .3em 0 rgba(0,0,0,.4); padding:.3em 1em; text-align:center; pointer-events:none; z-index:5; opacity:0; }
#levelup b{ display:block; font-size:1.6em; letter-spacing:.06em; color:#c0392b; text-shadow:.06em .06em 0 #fff; } #levelup span{ font-weight:bold; }
#levelup.show{ animation:lvpop 1.9s ease forwards; }
@keyframes lvpop{ 0%{ transform:translate(-50%,-50%) scale(0); opacity:0; } 15%{ transform:translate(-50%,-50%) scale(1.15); opacity:1; } 25%{ transform:translate(-50%,-50%) scale(1); }
  80%{ transform:translate(-50%,-50%) scale(1); opacity:1; } 100%{ transform:translate(-50%,-80%) scale(.9); opacity:0; } }
.glow{ animation:glow 1.2s ease 2; }
@keyframes glow{ 50%{ box-shadow:0 0 0 .25em #ffe066, 0 0 1em .3em #ffe066; } }
@media (prefers-reduced-motion: reduce){ #levelup.show{ animation-duration:2.5s; } .glow{ animation:none; } }
/* v4: level cap, MAX, pins */
.barwrap.xp.max .bar.xpbar{ background:linear-gradient(90deg,#ffd23f,#ff9f1c,#ffd23f); background-size:200% 100%; animation:maxshine 2s linear infinite; }
@keyframes maxshine{ to{ background-position:-200% 0; } }
.pinrow{ display:inline-flex; gap:.15em; align-items:center; }
.pin-ico{ width:1.5em; height:1.5em; image-rendering:pixelated; }
.pin-ico.locked{ opacity:.55; }
#menu-pins{ margin-left:.4em; } #menu-pins .pin-ico{ width:1.7em; height:1.7em; }
#pinpop{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; opacity:0; visibility:hidden; z-index:30; }
#pinpop.show{ opacity:1; visibility:visible; }
#pinpop .pp-in{ background:#fffbe9; border:.3em solid var(--ink); border-radius:0; box-shadow:0 0 0 .2em var(--gold), .3em .3em 0 rgba(0,0,0,.4); padding:.5em 1em; text-align:center; display:flex; flex-direction:column; align-items:center; gap:.15em; max-width:70%; margin-bottom:22%; }
#pinpop.show .pp-in{ animation:pinpop .7s cubic-bezier(.2,1.6,.4,1) both; }
#pinpop b{ color:#c0392b; font-size:1.3em; letter-spacing:.06em; }
#pinpop .pp-art canvas{ width:4.5em; height:4.5em; image-rendering:pixelated; animation:pinspin 1.6s ease-in-out infinite alternate; }
#pinpop .pp-name{ font-weight:bold; } #pinpop .pp-desc{ font-size:.8em; }
@keyframes pinpop{ from{ transform:scale(0) rotate(-20deg); } to{ transform:scale(1) rotate(0); } }
@keyframes pinspin{ from{ transform:rotate(-8deg) scale(1); } to{ transform:rotate(8deg) scale(1.08); } }
.pin-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:.4em; }
.pin-card{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:.15em; background:#fff8e1; border:.12em solid var(--ink); padding:.35em; font-size:.85em; }
.pin-card img{ width:3.2em; height:3.2em; image-rendering:pixelated; }
.pin-card.locked{ background:#eeeaf2; color:#555; }
.cert-pins{ display:flex; gap:.3em; align-items:center; justify-content:center; flex-wrap:wrap; }
.cert-pins .pin-ico{ width:2em; height:2em; }
.cert-pinlbl{ font-size:.85em; }
@media (prefers-reduced-motion: reduce){ #pinpop .pp-art canvas, #pinpop.show .pp-in, .barwrap.xp.max .bar.xpbar{ animation:none; } }
#saved{ position:absolute; right:.5em; bottom:.5em; background:rgba(42,34,51,.88); color:#9df29a; border:.15em solid #120e1f; padding:.1em .45em; font-size:.65em; font-weight:bold; opacity:0; transition:opacity .3s; pointer-events:none; z-index:25; }
#saved.show{ opacity:1; } #saved.err{ color:#ff9a9a; }
.pin-card{ font-size:.72em; }
#pinpop .pp-in{ color:#2a2233; } #pinpop .pp-desc{ color:#4a4058; }
.cert-btns{ flex-wrap:wrap; gap:.4em; }
.cert-btns button{ font-size:.62em; white-space:nowrap; padding:.35em .8em !important; }
.cert-pins .pin-ico{ width:1.6em; height:1.6em; } .cert-pinlbl{ font-size:.62em; flex-basis:100%; }
.cert-inner{ padding:.4em 1em; }
#saved{ bottom:auto; top:.5em; }
.cert-ratep{ font-size:.62em !important; color:#5a5066; } @media print{ .cert-ratep{ display:none; } }

/* mini-games */
#hud-mini{ position:absolute; top:.4em; left:.4em; right:.4em; background:rgba(42,34,51,.85); border:.18em solid #120e1f; padding:.15em .5em; font-size:.62em; display:flex; gap:.6em; align-items:center; flex-wrap:wrap; pointer-events:none; z-index:5; }
#hud-mini b{ color:#ffe066; } #mg-score{ color:#9df29a; font-weight:bold; } #mg-help{ color:#d8d0e8; margin-left:auto; }
.rarity{ display:inline-block; color:#fff; font-weight:bold; font-size:.75em; padding:.05em .4em; border:.12em solid #120e1f; text-shadow:1px 1px 0 rgba(0,0,0,.4); }
.menu-legend{ font-size:.75em; color:#ffe066; margin:.2em 0 .3em; }
.pin-ico.trophy{ outline:.12em solid #f6c445; }
#hud-mini{ padding-right:8.5em; } /* leave room for the Saved indicator */
/* ---- round 3: status bar, backpack, friends, map, resilience ---- */
.barwrap.res{ display:inline-block; width:4em; height:.6em; background:#3a3050; border:.1em solid #120e1f; vertical-align:middle; position:relative; }
.barwrap.res.big{ width:60%; height:1em; }
.bar.resbar{ display:block; height:100%; background:linear-gradient(90deg,#ffb13b,#ff7fae); }
.resrow{ display:flex; align-items:center; gap:.5em; }
#menu-list.two{ display:grid; grid-template-columns:1fr 1fr; gap:.25em; }
.item-ico{ width:1.4em; height:1.4em; image-rendering:pixelated; vertical-align:middle; }
.bag-desc{ min-height:2.6em; background:#eef4ff; border:.12em solid var(--ink); padding:.25em .4em; }
.bag-desc:empty{ display:none; }
.hearts span{ color:#c9c2d6; } .hearts span.on{ color:#ff4f8b; }
.mapwrap{ text-align:center; } #school-map{ width:auto; height:auto; max-width:100%; max-height:11.5em; image-rendering:pixelated; border:.15em solid var(--ink); cursor:pointer; background:#2a2233; }
.map-info{ font-weight:bold; text-align:center; min-height:1.3em; color:var(--green); }
.map-key{ font-size:.85em; } .map-key .k{ display:inline-block; min-width:.9em; height:.9em; vertical-align:middle; border:.1em solid #2a2233; font-size:.8em; line-height:.9em; text-align:center; font-weight:bold; }
.k.you{ background:#e0303a; } .k.ex{ background:#ffd23f; } .k.ok{ background:#fff; color:#3fbf5a; } .k.sq{ background:#4fd2ff; } .k.lg{ background:#b06fd0; } .k.sc{ color:#2a9fc0; border:none; }
.cert-trophies:empty{ display:none; }
#menu-body h3{ margin:.4em 0 .2em; font-size:1em; color:var(--green); }
.tag{ font-size:.75em; background:#e6f0ff; border:.08em solid #8aa; padding:0 .3em; }
.menu-legend{ color:#6b4f00 !important; }
#menu.mapmode #menu-level, #menu.mapmode #menu-legend{ display:none; }
#menu.mapmode #school-map{ max-height:15em; }
/* ---- school-day clock ---- */
#bell{ position:absolute; top:auto; left:50%; right:auto; bottom:calc(32% + .55em); transform:translate(-50%,20%); width:auto; min-width:0; max-width:min(70%, calc(100% - 2em)); background:#fff8e1; color:var(--ink); border:.18em solid var(--ink); border-radius:0; box-shadow:.15em .15em 0 rgba(0,0,0,.35); padding:.2em .85em .25em; text-align:center; opacity:0; visibility:hidden; transition:opacity .2s, transform .2s, visibility .2s; z-index:30; pointer-events:none; }
#bell.show{ opacity:1; visibility:visible; transform:translate(-50%,0); }
#bell b{ display:block; font-size:.95em; color:#c0392b; letter-spacing:.01em; }
@media (prefers-reduced-motion: reduce){ #bell{ transition:none; } }
.st-time b{ color:#9df29a !important; }
.map-time{ background:#eef4ff; border:.12em solid var(--ink); padding:.2em .5em; margin:.3em 0; }
.timetable{ list-style:none; padding:0; margin:.2em 0; display:flex; flex-wrap:wrap; gap:.25em; font-size:.85em; }
.timetable li{ background:#fff; border:.1em solid #8a96a3; padding:0 .35em; } .timetable li.now{ background:#ffe066; border-color:var(--ink); font-weight:bold; }
/* ---- My Score ---- */
.st-score b{ color:#ffe066 !important; }
.score-total{ font-size:1.25em; margin:.2em 0; } .score-total b{ color:#b8860b; }
.muted{ color:#5a5a6a; font-size:.85em; }
.score-tbl{ width:100%; border-collapse:collapse; font-size:.85em; margin:.3em 0; }
.score-tbl td{ border-bottom:.08em solid #d8cfa8; padding:.1em .3em; } .score-tbl td:nth-child(n+2){ text-align:right; white-space:nowrap; }
.score-tbl tr.zero{ color:#8a8a96; }
.hs-form{ background:#fff8e1; border:.15em solid var(--ink); padding:.3em .6em; margin-top:.4em; }
.hs-form h3{ margin:.1em 0 .2em; } .hs-note{ font-size:.85em; margin:.2em 0; }
.hs-form input#hs-name{ font:inherit; padding:.15em .3em; border:.12em solid var(--ink); width:9em; }
.hs-form button{ font:inherit; margin-left:.3em; cursor:pointer; }
.hp{ position:absolute !important; left:-9999px !important; width:1px; height:1px; opacity:0; }
#hs-msg{ border-radius:0; margin-top:.35em; }
#hs-msg.bad, #hs-msg.good{ border:.12em solid var(--ink); border-radius:0; padding:.35em .5em; font-weight:bold; }
#hs-msg.bad{ color:#8a1515; background:#ffe8e8; }
#hs-msg.good{ color:#14532d; background:#e8f8ec; }
/* ---- skill icons ---- */
.sk-ico{ width:1.15em; height:1.15em; image-rendering:pixelated; vertical-align:-.2em; margin-right:.3em; flex:none; }
.sk-ico.sk-big{ width:1.6em; height:1.6em; vertical-align:middle; }
.sk-ico.huge{ width:56px; height:56px; margin:0; }
.sk-ico.locked{ filter:grayscale(1) brightness(.85); opacity:.45; }
.book li{ display:block; } .book li .sk-ico.sk-big{ float:left; margin:.15em .45em .2em 0; }
.cert-sk{ display:inline-block; white-space:nowrap; margin:0 .35em; }
#bdesc .sk-ico{ width:1.3em; height:1.3em; }

/* ---- clock chip + menu status panel ---- */
#hud-act{ position:absolute; left:50%; bottom:2.15em; transform:translateX(-50%); z-index:6; display:flex; align-items:center; gap:.35em; padding:.18em .7em .22em; border:.14em solid var(--ink); border-radius:0; background:linear-gradient(#fff6c8, #ffd36a); box-shadow:0 .14em 0 var(--ink); color:var(--ink); font-weight:900; font-size:.55em; pointer-events:none; white-space:nowrap; }
#hud-act[hidden]{ display:none; }
#hud-act .ha-key{ display:inline-flex; align-items:center; justify-content:center; min-width:1.3em; padding:0 .25em; border:.1em solid var(--ink); border-radius:0; background:#fff; font-size:.9em; }
@media (pointer:coarse){ #hud-act{ bottom:2.5em; font-size:.62em; } }
#hud-chip{ position:absolute; left:.35em; bottom:.3em; background:rgba(42,34,51,.55); color:#fffaf0; font-size:.5em; padding:0 .4em; border-radius:0; pointer-events:none; z-index:5; white-space:nowrap; }
#btn-play-menu{ position:absolute; right:.3em; bottom:.3em; z-index:25; min-width:4.6em; min-height:2.8em; padding:.2em .65em .28em; font:inherit; font-size:.8em; font-weight:900; letter-spacing:.04em; color:#fff; background:linear-gradient(#7d9cff, #3a5ad9); border:.16em solid var(--ink); border-radius:0; box-shadow:inset 0 -.18em 0 rgba(0,0,0,.2), 0 .16em 0 var(--ink); cursor:pointer; text-shadow:0 .08em 0 #1a2a7a; }
#btn-play-menu:hover, #btn-play-menu:focus-visible{ transform:translateY(-.06em); }
#btn-play-menu:active{ transform:translateY(.08em); box-shadow:inset 0 -.08em 0 rgba(0,0,0,.2), 0 .06em 0 var(--ink); }
@media (prefers-reduced-motion: reduce){ #btn-play-menu:hover, #btn-play-menu:focus-visible, #btn-play-menu:active{ transform:none; } }
@media (pointer:coarse){ #btn-play-menu{ min-width:5.4em; min-height:4em; font-size:.9em; } }

.ms-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(11.5em, 1fr)); gap:.2em .3em; margin:.15em 0 .2em; }
.ms-chip{ background:#fff3c4; border:.1em solid #c9a64a; color:#2a2233; padding:.05em .35em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:.95em; }
.ms-chip b{ color:#7a3b00; } .ms-time{ grid-column:1 / -1; background:#e3efff; border-color:#7d9cc9; }
.ms-chip .barwrap.res{ width:3em; display:inline-block; vertical-align:middle; }
.ms-legend{ margin:.1em 0 0; font-size:.95em; }

/* ---- Illustrated School Map overlay ---- */
#bigmap{position:fixed;inset:0;z-index:60;background:rgba(14,10,24,.82);display:flex;align-items:center;justify-content:center;padding:10px;font-family:inherit}
#bigmap[hidden]{display:none}
.bm-box{background:#fff8e7;color:#2a2233;border:4px solid #2a2233;border-radius:0;box-shadow:0 8px 0 rgba(0,0,0,.35);width:min(1320px,100%);max-height:100%;display:flex;flex-direction:column;overflow:hidden}
.bm-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;background:#2a2233;color:#fff}
.bm-head h2{margin:0;font-size:1.15rem;flex:0 0 auto}
.bm-chip{background:#4a3f5e;border-radius:0;padding:3px 10px;font-size:.9rem;white-space:nowrap}
.bm-btns{margin-left:auto;display:flex;gap:6px}
.bm-btns button{font:inherit;font-size:.9rem;padding:5px 10px;border-radius:0;border:2px solid #fff;background:#5b4a7a;color:#fff;cursor:pointer}
.bm-btns .bm-x{background:#e0574f}
.bm-btns button:focus-visible,.bm-lbl:focus-visible{outline:3px solid #ffe066;outline-offset:2px}
.bm-main{display:flex;gap:8px;padding:8px 10px 0;min-height:0;overflow:auto;justify-content:center}
.bm-mapcol{flex:1 1 auto;min-width:0;display:flex;justify-content:center;align-items:flex-start}
.bm-canvas{position:relative;width:min(100%,calc((100vh - 200px) * 1.6));aspect-ratio:320/200;border:3px solid #2a2233;border-radius:0;overflow:visible;background:#7cc457}
#bigmap #school-map{width:100%;height:100%;max-width:none;max-height:none;border:0;border-radius:0;background:none;display:block;image-rendering:pixelated;image-rendering:crisp-edges;cursor:pointer}
.bm-lbl{position:absolute;transform:translate(-50%,-50%);width:1.35em;height:1.35em;padding:0;border-radius:0;border:2px solid #2a2233;background:rgba(255,255,255,.95);color:#2a2233;cursor:pointer;box-shadow:0 2px 0 rgba(0,0,0,.25);font:inherit;font-size:clamp(9px,1.1vw,12px);font-weight:900;line-height:1;z-index:1}
.bm-lbl .bm-num{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
.bm-lbl .bm-tip{display:none;position:absolute;left:50%;bottom:calc(100% + 4px);transform:translateX(-50%);background:#2a2233;color:#fff;font-size:11px;font-weight:bold;padding:2px 7px;border-radius:0;white-space:nowrap;pointer-events:none;z-index:3}
.bm-lbl:hover .bm-tip, .bm-lbl:focus-visible .bm-tip, .bm-lbl.sel .bm-tip{display:block}
.bm-lbl.z-learn{border-color:#3d7fd9;background:#e8f1ff}.bm-lbl.z-care{border-color:#e0679a;background:#ffe8f2}.bm-lbl.z-play{border-color:#f0a04b;background:#fff0d6}.bm-lbl.z-green{border-color:#3f9b45;background:#e7f8e8}.bm-lbl.z-path{border-color:#a08a64;background:#f4ecdc}
.bm-lbl.sel{background:#ffe066;border-color:#2a2233;z-index:2;transform:translate(-50%,-50%) scale(1.15)}
.bm-you{position:absolute;transform:translate(-50%,120%);background:#e0303a;color:#fff;font-size:10px;font-weight:900;padding:2px 8px;border-radius:0;border:2px solid #fff;box-shadow:0 2px 0 #2a2233;white-space:nowrap;z-index:4;pointer-events:none;letter-spacing:.02em}
.bm-foot{padding:8px 10px 10px;display:flex;flex-direction:column;gap:6px;font-size:.9rem}
.bm-info{text-align:left;color:#2a2233;font-weight:normal;background:#fff;border:3px solid #2a2233;border-radius:0;padding:6px 10px}
.bm-info h3{margin:0 0 2px;font-size:1rem}
.bm-info p{margin:2px 0}.bm-info ul{margin:2px 0 0;padding-left:0;list-style:none;display:flex;flex-wrap:wrap;gap:2px 12px}.bm-info li{margin:0}
.bm-here{color:#c0303a;font-weight:bold}
.bm-open{color:#5b4a7a}
.bm-legend{background:#fff;border:3px solid #2a2233;border-radius:0;padding:5px 10px}
.bm-legend ul{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;gap:3px 10px;font-size:.78rem}
.mk{display:inline-flex;align-items:center;justify-content:center;width:13px;height:13px;border:2px solid #1d1726;font-size:9px;font-weight:bold;vertical-align:-2px;color:#1d1726}
.mk.you{background:#e0303a;border-radius:0;box-shadow:0 0 0 2px #fff inset}.mk.ex{background:#ffd23f}.mk.ok{background:#3fbf5a;color:#fff}.mk.sq{background:#4fd2ff}.mk.sc{background:#fff;color:#2aa0d0;border-color:#7fe0ff}.mk.lg{background:linear-gradient(90deg,#7a7488 33%,#b06fd0 33% 66%,#ffd23f 66%)}
.bm-zones{display:flex;flex-wrap:wrap;gap:4px;margin:6px 0 2px}
.zk{font-size:.75rem;padding:1px 7px;border-radius:0;border:2px solid var(--z);background:#fff}
.bm-stat{margin:4px 0 0;font-size:.82rem}
.bm-time{background:#fff;border:3px solid #2a2233;border-radius:0;padding:6px 10px;font-size:.85rem}
.bm-time p{margin:0 0 4px}
@media (max-width:700px){.bm-canvas{width:100%}.bm-head h2{font-size:1rem}.bm-info{font-size:.85rem}.bm-legend ul{font-size:.72rem}.bm-time{font-size:.78rem}.bm-x{min-width:2.2em;min-height:2.2em}}
#menu:has(#menu-body:not([hidden]):not(:empty)) #menu-legend #menu-status{ display:none; }
/* Ultra Rare badge, trophy cards and map key */
.rarity.r-ultra{ background:linear-gradient(90deg,#c2338f,#d9473f,#c97a00,#3f9b45,#2f7fc1,#7a4fc9,#c2338f) !important; background-size:200% 100% !important; text-shadow:1px 1px 0 #120e1f; animation:ultraShift 3s linear infinite; }
.pin-card.ultra.got{ background:linear-gradient(160deg,#fff0fa,#efe8ff 50%,#e6f7ff); border-color:#c2338f; }
.ultra-h{ margin-top:1em; display:flex; align-items:center; gap:.5em; }
.pp-in.ultra{ background:linear-gradient(160deg,#fff0fa,#efe8ff 50%,#e6f7ff); border-color:#c2338f; }
.mk.ul{ background:linear-gradient(90deg,#e0574f,#f6d04d,#5fc04a,#4fb3d9,#8e6fd1); }
@keyframes ultraShift{ from{ background-position:0 0; } to{ background-position:200% 0; } }
@media (prefers-reduced-motion: reduce){ .rarity.r-ultra{ animation:none; } }
/* Pixel-art logo on the title screen, top bar and certificate */
.brand-logo{ margin:0 0 .2em; line-height:0; }
.bl-wrap{ position:relative; display:inline-block; width:min(86%, 520px); }
.bl-wrap img{ display:block; width:100%; height:auto; image-rendering:pixelated; }
.bl-mud{ position:absolute; left:0; top:0; animation:mudBob 2.4s steps(1, end) infinite; }
@keyframes mudBob{ 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-2.6%); } }
@media (prefers-reduced-motion: reduce){ .bl-mud{ animation:none; } }
.tb-title{ line-height:0; } .tb-logo{ height:27px; width:auto; display:block; }
.cert-logo{ display:block; margin:0 auto .2em; width:min(70%, 372px); height:auto; image-rendering:pixelated; }
.jp-logo{ display:block; width:248px; max-width:60%; height:auto; image-rendering:pixelated; margin:0 0 .2em; }
/* music controls (title screen + Music page) */
.music-ctl{ display:flex; align-items:center; justify-content:center; gap:.6em; flex-wrap:wrap; margin:.4em 0; font-size:.85em; }
.music-ctl .mus-toggle{ font:inherit; font-weight:bold; padding:.25em .7em; border:.15em solid var(--ink); background:#fff8e1; cursor:pointer; }
.music-ctl .mus-toggle[aria-pressed="false"]{ background:#e6e1ec; color:#555; }
.music-ctl .mus-vol{ width:8em; vertical-align:middle; accent-color:#8e6fd1; }
.music-ctl .mus-num{ display:inline-block; min-width:1.4em; font-weight:bold; }
.bag-money{ background:#eaffea; border:.12em solid var(--ink); padding:.25em .5em; }
#pinpop .pp-paint canvas{ width:9em; height:6.75em; animation:none; border:.2em solid #8d5f31; }
.title-copy{ margin:.6em 0 0; font-size:.75em; font-weight:bold; display:flex; align-items:center; justify-content:center; gap:.4em; opacity:.9; }
/* phones: compact top bar that always fits, game screen centred above the controls */
@media (max-width:600px){
  #topbar{ padding:4px 6px; gap:4px; } .tb-right{ gap:4px; }
  .tb-btn{ font-size:12px; padding:4px 7px; min-height:40px; white-space:nowrap; }
}
@media (max-width:440px){ .tb-title{ display:none; } }
@media (max-height:440px) and (orientation:landscape){ #topbar{ padding:2px 6px; } .tb-btn{ min-height:34px; padding:2px 8px; } .tb-logo{ height:20px; } }
@media (pointer:coarse) and (orientation:portrait){ #frame-box{ align-items:center; } }
/* ---- Menu tiles (candy/pixel style) ---- */
#menu.home, #menu.submenu{ inset:3% 5%; background:linear-gradient(#fffdf6, #fff0f7); border-radius:0; }
#menu.home #menu-pins, #menu.submenu #menu-pins{ display:none; }
#menu.home #menu-title, #menu.submenu #menu-title{ color:#b8256a; text-shadow:.08em .08em 0 #ffd6ec; }
#menu-level{ border-radius:0; }
.mh-row{ display:flex; flex-wrap:wrap; gap:.3em; }
.mh-chip{ display:inline-flex; align-items:center; gap:.25em; background:#fff; border:.13em solid var(--ink); border-radius:0; padding:.1em .55em .1em .3em; font-size:.8em; white-space:nowrap; }
.mh-chip b{ color:#7a3b00; }
.mh-ico{ width:1.35em; height:1.35em; image-rendering:pixelated; vertical-align:middle; flex:none; }
.mh-note{ margin:.2em 0 0; font-size:.78em; font-weight:bold; color:#6c34b3; }
#menu-list.tiles{ display:grid; grid-template-columns:repeat(5, 1fr); grid-auto-rows:1fr; gap:.45em; padding:.15em .1em .35em; flex:1; overflow:auto; align-content:center; }
#menu-list.tiles.tiles-sub{ grid-auto-rows:auto; align-content:center; } #menu-list.tiles.tiles-sub .opt{ min-height:5.4em; }
#menu-list.tiles .opt{ --tc:#ff8fc0; position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.15em; text-align:center; font-weight:bold;
  min-height:4.6em; padding:.35em .2em .3em; border:.18em solid var(--ink); border-radius:0; background:linear-gradient(#ffffff 0%, #ffffff 45%, color-mix(in srgb, var(--tc) 30%, #fff) 100%);
  box-shadow:inset 0 -.28em 0 color-mix(in srgb, var(--tc) 55%, #fff), 0 .22em 0 var(--ink); transition:transform .15s cubic-bezier(.3,1.8,.5,1), background .15s; cursor:pointer; touch-action:manipulation; }
#menu-list.tiles .opt:nth-child(5n+1){ --tc:#ff5fa2; } #menu-list.tiles .opt:nth-child(5n+2){ --tc:#46b4ff; } #menu-list.tiles .opt:nth-child(5n+3){ --tc:#ffd23f; }
#menu-list.tiles .opt:nth-child(5n+4){ --tc:#8e4fd9; } #menu-list.tiles .opt:nth-child(5n){ --tc:#2fc79a; }
#menu-list.tiles .opt.hi{ background:linear-gradient(#fffbe0, #ffe680); box-shadow:inset 0 -.28em 0 #f2b705, 0 .22em 0 var(--ink), 0 0 0 .18em #fff, 0 0 0 .34em var(--tc); transform:translateY(-.12em); }
#menu-list.tiles .opt:hover{ transform:translateY(-.12em) scale(1.03); }
#menu-list.tiles .opt:active{ transform:translateY(.12em) scale(.96); box-shadow:inset 0 -.1em 0 rgba(0,0,0,.1), 0 .05em 0 var(--ink); }
.tile-ico{ width:2.5em; height:2.5em; image-rendering:pixelated; display:block; }
.tile-lbl{ font-size:.85em; line-height:1.1; color:var(--ink); }
.tile-st{ font-size:.62em; padding:0 .45em; border-radius:0; border:.1em solid var(--ink); background:#d8ffe9; color:#14532d; }
.tile-st.st-off{ background:#ffe0e6; color:#7a1028; }
.tile-key{ position:absolute; top:.25em; right:.35em; font-size:.55em; color:#6b5f7a; font-weight:bold; }
@media (pointer:coarse){ .tile-key{ display:none; } }
@media (prefers-reduced-motion: reduce){ #menu-list.tiles .opt{ transition:none; } #menu-list.tiles .opt:hover, #menu-list.tiles .opt.hi{ transform:none; } }
/* ===== Candy sub-screens (pages inside the menu) ===== */
#menu{ inset:3% 5%; border-radius:0; background:linear-gradient(#fffdf6, #fff0f7); }
#menu-title{ display:flex; align-items:center; gap:.35em; color:#b8256a; text-shadow:.08em .08em 0 #ffd6ec; font-size:1.3em; padding-right:2.6em; }
.title-ico{ width:1.5em; height:1.5em; image-rendering:pixelated; flex:none; }
#menu.pg #menu-level, #menu.pg #menu-legend:empty{ display:none; }
#menu.pg #menu-body{ font-size:.95em; line-height:1.45; padding:.15em .35em .4em .1em; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; scrollbar-width:auto; scrollbar-color:#ff8fc0 #ffe3f1; touch-action:pan-y; }
#menu.pg #menu-body::-webkit-scrollbar{ width:.7em; } #menu.pg #menu-body::-webkit-scrollbar-thumb{ background:#ff8fc0; border-radius:0; border:.15em solid #ffe3f1; } #menu.pg #menu-body::-webkit-scrollbar-track{ background:#ffe3f1; border-radius:0; }
#menu.pg #menu-body h3, .pg-h{ display:flex; align-items:center; gap:.35em; margin:.7em 0 .35em; font-size:1.05em; color:#6c34b3; }
.pg-ico{ width:1.4em; height:1.4em; image-rendering:pixelated; flex:none; } .pg-ico.big{ width:2.4em; height:2.4em; }
.pg-card{ background:#fff; border:.15em solid var(--ink); border-radius:0; padding:.45em .7em; margin:.35em 0; box-shadow:0 .18em 0 rgba(42,34,51,.35); }
.pg-card p{ margin:.25em 0; }
.pg-tip{ display:flex; align-items:center; gap:.5em; background:#fff8d6; }
.pg-stats{ display:grid; grid-template-columns:repeat(auto-fill, minmax(10em, 1fr)); gap:.35em; margin:.2em 0 .4em; }
.pg-stat{ display:flex; align-items:center; gap:.35em; background:#fff; border:.13em solid var(--ink); border-radius:0; padding:.2em .6em .2em .3em; font-size:.92em; }
.pg-stat b{ color:#7a3b00; }
/* quest cards */
.q-cards{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(12.5em, 1fr)); gap:.4em; }
.q-cards li, .q-card{ position:relative; display:flex; flex-wrap:wrap; align-items:flex-start; gap:.15em .4em; background:#fff; border:.15em solid var(--ink); border-radius:0; padding:.4em .5em .4em .45em; box-shadow:0 .18em 0 rgba(42,34,51,.3); line-height:1.25; }
.q-cards li.done, .q-card.done{ background:#e3fbe9; } .q-cards li.doing, .q-card.doing{ background:#fff6c9; } .q-cards li.boss, .q-card.boss{ background:#f1e6ff; }
.q-badge{ position:absolute; top:.35em; right:.35em; width:1.25em; height:1.25em; display:grid; place-items:center; border-radius:0; border:.12em solid var(--ink); background:#fff; font-size:.85em; }
.q-cards li.done .q-badge, .q-card.done .q-badge{ background:#2fc79a; color:#fff; } .q-cards li.doing .q-badge, .q-card.doing .q-badge{ background:#ffd23f; }
.q-ico, img.q-ico{ width:2.2em; height:2.2em; image-rendering:pixelated; flex:none; border-radius:0; }
.q-qst{ display:grid; place-items:center; width:2.2em; height:2.2em; background:linear-gradient(#5a4a78,#2a2233); color:#ffe066; font-weight:900; border:.12em solid var(--ink); border-radius:0; font-size:1.25em; line-height:1; }
.q-card b, .q-cards li > b{ flex:1 1 6em; padding-right:1.4em; font-size:.95em; }
.q-card small, .q-cards li > small{ flex:1 1 100%; font-size:.78em; line-height:1.25; }
.q-bar{ flex:1 1 100%; position:relative; height:.85em; background:#efe6f5; border:.1em solid var(--ink); border-radius:0; overflow:hidden; }
.q-bar i{ display:block; height:100%; width:0; background:linear-gradient(#ffd23f,#ff8a2b); }
.q-bar em{ position:absolute; inset:0; display:grid; place-items:center; font-size:.68em; font-style:normal; font-weight:900; color:var(--ink); }
.q-check{ display:inline-grid; place-items:center; width:1.3em; height:1.3em; border-radius:0; background:#2fc79a; color:#fff; border:.1em solid var(--ink); font-weight:900; margin-left:auto; }
.q-rewards{ display:flex; align-items:center; gap:.15em; margin-left:auto; }
.q-rew{ position:relative; display:grid; place-items:center; }
.q-rew em{ position:absolute; right:-.2em; bottom:-.15em; font-style:normal; font-size:.65em; font-weight:900; background:#fff; border:.08em solid var(--ink); border-radius:0; padding:0 .2em; line-height:1.1; }
.q-xp, .q-rew img, img.q-item{ width:1.35em; height:1.35em; image-rendering:pixelated; }
.q-card.mystery{ background:linear-gradient(#3d3558,#2a2233); color:#fff8e7; }
.q-card.mystery b, .q-card.mystery small{ color:#fff8e7; }
.q-card.mystery .q-badge{ background:#2a2233; color:#ffe066; }
.q-card .tag{ font-size:.7em; }
/* skill cards */
.sk-cards{ list-style:none; margin:0; padding:0; display:grid !important; grid-template-columns:repeat(auto-fill, minmax(15em, 1fr)); gap:.45em; }
.sk-cards li{ display:flex !important; gap:.55em; align-items:flex-start; background:#fff; border:.15em solid var(--ink); border-radius:0; padding:.5em .6em; box-shadow:0 .18em 0 rgba(42,34,51,.3); border-bottom-width:.15em !important; }
.sk-cards li .sk-ico.sk-card-ico{ width:2.8em; height:2.8em; float:none; margin:0; flex:none; }
.sk-cards li.locked{ background:#f2eef6; color:#6b5f7a; }
.type-chip{ display:inline-block; padding:0 .45em; border-radius:0; background:var(--tc); color:#fff; font-weight:bold; font-size:.9em; text-shadow:.06em .06em 0 rgba(0,0,0,.35); margin:.1em .05em; }
/* help */
.help-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(15em, 1fr)); gap:.45em; }
.help-card{ display:flex; gap:.55em; align-items:flex-start; margin:0; }
.help-card h3{ margin:.05em 0 .15em !important; }
/* pins and trophies */
#menu .pin-grid{ gap:.45em; }
#menu .pin-card{ border-radius:0; border:.15em solid var(--ink); background:#fff; box-shadow:0 .18em 0 rgba(42,34,51,.3); }
#menu .pin-card.got{ background:linear-gradient(#fffbe0, #fff); box-shadow:0 .18em 0 rgba(42,34,51,.3), 0 0 0 .15em #ffd23f inset; }
/* my stats */
#menu-body .ms-grid{ grid-template-columns:repeat(auto-fill, minmax(12em, 1fr)); gap:.4em; }
#menu-body .ms-chip{ background:#fff; border:.15em solid var(--ink); border-radius:0; padding:.4em .6em; font-size:1em; white-space:normal; box-shadow:0 .15em 0 rgba(42,34,51,.3); }
#menu-body .ms-time{ background:#e3efff; }
#menu-body .ms-legend{ background:#f1e6ff; border:.15em solid var(--ink); border-radius:0; padding:.4em .6em; margin-top:.5em; display:flex; gap:.4em; align-items:center; }
/* score */
#menu .score-total{ background:#fff8d6; border:.15em solid var(--ink); border-radius:0; padding:.4em .7em; font-size:1.15em; }
#menu .score-tbl{ border-collapse:separate; border-spacing:0; width:100%; background:#fff; border:.15em solid var(--ink); border-radius:0; overflow:hidden; }
#menu .score-tbl td{ padding:.25em .5em; border-bottom:.08em solid #f0e3ee; } #menu .score-tbl tr:nth-child(odd) td{ background:#fff7fb; }
#menu .hs-form{ background:#fff; border:.15em solid var(--ink); border-radius:0; padding:.5em .7em; margin-top:.6em; }
/* page buttons: candy pills, Back stands out */
#menu.pg #menu-list.row{ gap:.4em; flex-wrap:wrap; }
#menu.pg #menu-list.row .opt{ display:flex; align-items:center; justify-content:center; gap:.35em; min-height:2.6em; border-radius:0; border:.18em solid var(--ink); background:linear-gradient(#fff, #e9f4ff); box-shadow:inset 0 -.22em 0 #b9dcff, 0 .2em 0 var(--ink); font-weight:bold; }
#menu.pg #menu-list.row .opt:last-child{ background:linear-gradient(#b8f5d0, #2fc79a); box-shadow:inset 0 -.22em 0 #1f8f6a, 0 .2em 0 var(--ink); }
#menu.pg #menu-list.row .opt.hi{ box-shadow:inset 0 -.22em 0 #f2b705, 0 .2em 0 var(--ink), 0 0 0 .16em #fff, 0 0 0 .3em #ff5fa2; background:linear-gradient(#fffbe0, #ffe680); }
.btn-ico{ width:1.5em; height:1.5em; image-rendering:pixelated; flex:none; }
/* backpack and friends: tiles */
#menu.pg-bag #menu-list, #menu.pg-friends #menu-list{ display:grid; grid-template-columns:repeat(auto-fill, minmax(8.5em, 1fr)); gap:.4em; flex:none; max-height:55%; overflow:auto; padding:.15em .1em .3em; }
#menu.pg-bag #menu-list .opt, #menu.pg-friends #menu-list .opt{ display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:.15em; min-height:4.4em; border-radius:0; border:.16em solid var(--ink); background:linear-gradient(#fff 50%, #ffe8f3); box-shadow:0 .18em 0 var(--ink); font-weight:bold; line-height:1.15; }
#menu.pg-bag #menu-list .opt.hi, #menu.pg-friends #menu-list .opt.hi{ background:linear-gradient(#fffbe0, #ffe680); box-shadow:0 .18em 0 var(--ink), 0 0 0 .16em #fff, 0 0 0 .3em #ff5fa2; }
#menu.pg-bag #menu-list .opt .item-ico{ width:2.2em; height:2.2em; }
#menu.pg-bag #menu-list .opt small, #menu.pg-friends #menu-list .opt small{ font-weight:normal; font-size:.78em; background:#f1e6ff; border-radius:0; padding:0 .45em; }
#menu.pg-bag #menu-list .opt:last-child, #menu.pg-friends #menu-list .opt:last-child{ background:linear-gradient(#b8f5d0, #2fc79a); }
#menu.pg-bag .bag-money{ display:inline-flex; align-items:center; gap:.3em; background:#fff8d6; border:.15em solid var(--ink); border-radius:0; padding:.15em .7em; }
#menu.pg-bag .bag-desc, #menu.pg-friends .bag-desc, #bag-desc{ background:#fff; border:.13em dashed #c9a4ff; border-radius:0; padding:.3em .55em; min-height:2.2em; }
/* cafeteria shop tiles */
#choices.shop{ display:grid; grid-template-columns:repeat(4, 1fr); gap:.35em; }
#choices.shop .opt{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:.1em; border-radius:0; padding:.3em .2em; background:linear-gradient(#fff 50%, #fff3c4); box-shadow:0 .16em 0 rgba(0,0,0,.45); line-height:1.1; }
#choices.shop .opt.hi{ background:linear-gradient(#fffbe0, #ffe680); box-shadow:0 .16em 0 rgba(0,0,0,.45), 0 0 0 .14em #fff, 0 0 0 .28em #ff5fa2; }
#choices.shop .item-ico{ width:1.9em; height:1.9em; image-rendering:pixelated; }
#choices.shop .sh-name{ font-weight:bold; font-size:.85em; }
#choices.shop .sh-price{ background:#2fc79a; color:#fff; font-weight:bold; border-radius:0; padding:0 .5em; border:.1em solid var(--ink); font-size:.85em; }
#choices.shop .sh-hp{ display:none; } #choices.shop small{ font-size:.7em; }
#choices.shop .opt:last-child{ justify-content:center; background:linear-gradient(#b8f5d0, #2fc79a); }
.pg-ico.pgbig{ width:2.4em; height:2.4em; }
#menu.pg-bag .bag-money{ display:flex; flex-wrap:wrap; border-radius:0; } #menu.pg-bag .bag-money small{ flex-basis:100%; font-size:.8em; color:#6b5f7a; }
#menu.pg-bag #menu-body, #menu.pg-friends #menu-body{ min-height:4.5em; }
#menu.pg-bag #menu-list .opt:last-child, #menu.pg-friends #menu-list .opt:last-child{ flex-direction:row; }
#menu .tag{ display:inline-block; background:#e3efff; color:#1d4f8f; border:.08em solid #7d9cc9; border-radius:0; padding:0 .45em; font-size:.8em; font-weight:bold; }
#menu.pg #menu-body.more::after{ content:'\25BC  more'; position:sticky; bottom:0; float:right; margin-top:-1.4em; background:#ff5fa2; color:#fff; font-weight:bold; font-size:.75em; padding:.1em .6em; border-radius:0; border:.12em solid var(--ink); pointer-events:none; }
#menu-body .jentry{ background:#fff; border:.15em solid var(--ink); border-radius:0; padding:.45em .7em; margin:.4em 0; box-shadow:0 .18em 0 rgba(42,34,51,.3); }
/* random name dice */
.name-row{ display:inline-flex; gap:.4em; align-items:stretch; flex-wrap:wrap; justify-content:center; }
.dice-btn{ display:inline-flex; align-items:center; gap:.35em; font:inherit; font-weight:bold; font-size:1em; padding:.3em .8em; background:linear-gradient(#ffe36e,#ffb627); color:var(--ink); border:.2em solid var(--ink); border-radius:0; box-shadow:0 .2em 0 #a8701a; cursor:pointer; }
.dice-btn:hover,.dice-btn:focus-visible{ filter:brightness(1.08); outline:.15em solid #fff; }
.dice-btn.small{ font-size:.85em; padding:.2em .6em; }
.dice-btn .dice{ width:1.6em; height:1.6em; background:no-repeat center/contain; image-rendering:pixelated; display:inline-block; }
.dice-btn.roll .dice{ animation:diceroll .45s ease-out; }
@keyframes diceroll{ 0%{ transform:rotate(0) scale(1); } 50%{ transform:rotate(200deg) scale(1.3); } 100%{ transform:rotate(360deg) scale(1); } }
#name-input.locked, #hs-name.locked{ background:#efe6ff; }
/* save codes */
.soft{ font:inherit; font-weight:bold; background:#fff; color:var(--ink); border:.18em solid var(--ink); border-radius:0; padding:.3em .9em; box-shadow:0 .18em 0 rgba(42,34,51,.35); cursor:pointer; }
.soft:hover,.soft:focus-visible{ background:#fff3c4; }
#codebox{ background:rgba(29,24,48,.94); }
#codebox h2{ margin:0; color:var(--gold); font-size:1.3em; }
.cb-lead{ font-size:.85em; margin:.2em 0; max-width:30em; }
#code-input{ font:inherit; font-size:1.1em; font-weight:bold; letter-spacing:.05em; padding:.35em .5em; width:min(16em, 90%); text-align:center; text-transform:uppercase; border:.2em solid var(--ink); border-radius:0; background:var(--paper); color:var(--ink); -webkit-user-select:text; user-select:text; }
#code-err.note{ color:#ffe58a; }
.cb-btns{ display:flex; gap:.6em; justify-content:center; flex-wrap:wrap; }
#code-long{ font-size:.8em; max-width:30em; width:90%; }
#code-long summary{ cursor:pointer; color:#bfe3ff; }
#long-input, #sc-long{ width:100%; box-sizing:border-box; font-family:var(--mq-font), Verdana, sans-serif; font-size:.85em; border:.15em solid var(--ink); border-radius:0; padding:.3em; -webkit-user-select:text; user-select:text; word-break:break-all; }
.sc-wrap{ text-align:center; }
.sc-main{ background:linear-gradient(#fff,#fff6d6); border:.2em solid var(--ink); border-radius:0; padding:.6em 1em; box-shadow:0 .25em 0 rgba(42,34,51,.3); }
.sc-lead{ margin:0; font-size:1em; }
.sc-code{ margin:.1em 0 .15em; font-size:2.4em; font-weight:900; letter-spacing:.08em; color:#c2185b; word-break:break-word; -webkit-user-select:all; user-select:all; line-height:1.1; }
.sc-actions{ margin:.15em 0 .3em; } .sc-copy{ font:inherit; font-weight:bold; font-size:1.05em; padding:.25em 1em; border:.15em solid var(--ink); border-radius:0; background:#ffd23f; box-shadow:0 .15em 0 var(--ink); cursor:pointer; }
.sc-copy-msg{ font-weight:bold; color:#2e7d32; margin-left:.3em; }
.sc-say{ margin:.2em 0 0; font-size:1em; } .sc-note{ margin:.25em 0 0; }
.sc-more{ margin-top:.5em; padding-top:.4em; border-top:.12em dashed #f0c3d8; }
.sc-say{ margin:.2em 0; font-weight:bold; color:#2e7d32; }
.sc-note{ margin:.25em 0; font-size:.85em; color:#4b3d5e; }
.sc-small{ font-size:.75em; margin-top:.6em; }
.sc-tip{ display:flex; gap:.6em; align-items:flex-start; text-align:left; }
.sc-qr{ margin:.6em auto 0; } .sc-qr-svg{ width:min(12em, 60vw); height:auto; display:block; margin:0 auto; border:.2em solid var(--ink); border-radius:0; }
.sc-long{ text-align:left; margin-top:.5em; }
#menu-body .good{ color:#2e7d32; font-weight:bold; } #menu-body .bad{ color:#c62828; font-weight:bold; }
/* backpack/friends: compact row tiles so the description has room */
#menu.pg-bag #menu-list, #menu.pg-friends #menu-list{ grid-template-columns:repeat(auto-fill, minmax(10.5em, 1fr)); max-height:46%; }
#menu.pg-bag #menu-list .opt{ flex-direction:row; justify-content:flex-start; text-align:left; min-height:3em; gap:.45em; padding:.25em .5em; }
#menu.pg-bag #menu-list .opt:last-child{ justify-content:center; }
#menu.pg-bag #menu-list .opt .item-ico{ width:1.9em; height:1.9em; flex:none; }
#menu.pg-bag #menu-body, #menu.pg-friends #menu-body{ min-height:7.2em; flex:1 1 auto; }
#menu.pg-bag .bag-money{ display:inline-flex; border-radius:0; padding:.1em .7em; margin:0 0 .25em; font-size:.92em; } #menu.pg-bag .bag-money small{ flex-basis:auto; }
.music-ctl .mus-toggle{ border-radius:0; box-shadow:0 .15em 0 rgba(42,34,51,.35); padding:.3em .9em; }
#menu.pg .music-ctl{ background:#fff; border:.15em solid var(--ink); border-radius:0; padding:.4em .8em; width:max-content; max-width:100%; margin:.5em auto; }

/* game headings use the same candy lettering */
#menu-title, #select h2, #codebox h2, #bm-title, #mg-title, #ending h2, .cert-inner h2{
  font-weight:900; letter-spacing:.02em; color:#b8256a;
  background-image:linear-gradient(180deg, var(--mq-pink-1, #ffe0f0) 0 28%, var(--mq-pink-2, #ff5fa2) 52%, var(--mq-pink-3, #b8256a) 100%);
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
  -webkit-text-stroke:.05em var(--ink); paint-order:stroke fill;
  text-shadow:0 .06em 0 var(--ink), 0 .11em 0 rgba(42,34,51,.35);
}
#select h2, #codebox h2, #ending h2, .cert-inner h2{
  --mq-c1:var(--mq-gold-1, #fff6c8); --mq-c2:var(--mq-gold-2, #ffd23f); --mq-c3:var(--mq-gold-3, #c4860c);
  background-image:linear-gradient(180deg, var(--mq-c1) 0 28%, var(--mq-c2) 52%, var(--mq-c3) 100%);
  color:var(--mq-c3);
}
#bm-title{ --mq-c1:var(--mq-sky-1, #d6f3ff); --mq-c2:var(--mq-sky-2, #46b4ff); --mq-c3:var(--mq-sky-3, #1f6fb3);
  background-image:linear-gradient(180deg, var(--mq-c1) 0 28%, var(--mq-c2) 52%, var(--mq-c3) 100%); color:var(--mq-c3); }
#mg-title{ --mq-c1:var(--mq-mint-1, #d4ffe8); --mq-c2:var(--mq-mint-2, #2fc79a); --mq-c3:var(--mq-mint-3, #14895f);
  background-image:linear-gradient(180deg, var(--mq-c1) 0 28%, var(--mq-c2) 52%, var(--mq-c3) 100%); color:var(--mq-c3); }

/* sub-screens fit inside the play area */
#menu, #menu.home, #menu.submenu, .panel{
  inset:.7em .75em .95em .75em !important;
  box-sizing:border-box;
  overflow:hidden;
  max-width:none;
  max-height:none;
}
#menu-body, #menu.pg #menu-body, #menu-body:empty + #menu-list, #menu-list.tiles{ overflow:auto; overscroll-behavior:contain; }
#select, #codebox, #ending.screen{ box-sizing:border-box; overflow:auto; overscroll-behavior:contain; }
/* Reserved room so the square X never sits on a title or body text. */
#select h2, #codebox h2, #bm-title{ padding-right:2.6em; }
#choices, #bmenu, #bskills{ padding-top:2.3em; padding-right:.35em; box-sizing:border-box; }
@media (pointer:coarse){
  #menu-title, #select h2, #codebox h2, #bm-title{ padding-right:3.1em; }
  #choices, #bmenu, #bskills{ padding-top:2.8em; }
}

#dialog, #bskills, #bdesc, #bmenu{ box-sizing:border-box; }
#choices{ padding-top:2.3em; box-sizing:border-box; }
#choices .box-x, #bmenu .box-x, #bskills .box-x{ top:.12em; right:.12em; }
/* School Map: fills the overlay. Map art sits on grass (no cream margins); info is a slim side panel. */
#bigmap{ position:fixed !important; inset:0 !important; z-index:200; background:rgba(14,10,24,.86);
  display:flex; align-items:center; justify-content:center; padding:8px; box-sizing:border-box;
  font-family:var(--mq-font), Nunito, Verdana, sans-serif; }
#bigmap[hidden]{ display:none !important; }
#bigmap .bm-box{ position:relative; width:100%; height:100%;
  max-width:100%; max-height:100%; box-sizing:border-box; overflow:hidden; min-height:0;
  display:flex; flex-direction:column; background:#5fa83e; color:#2a2233;
  border:4px solid #2a2233; border-radius:0; box-shadow:8px 8px 0 #2a2233; }
#bigmap .bm-head{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:10px 3.4em 10px 14px;
  background:#2a2233; color:#fff; flex:0 0 auto; }
#bigmap .bm-head h2{ margin:0; font-size:1.25rem; font-weight:900; padding-right:0; color:#fff;
  text-shadow:.06em .06em 0 #120e1f; font-family:var(--mq-font), Nunito, Verdana, sans-serif; }
#bigmap .bm-chip{ background:#4a3f5e; border-radius:0; padding:4px 10px; font-size:.9rem; white-space:nowrap; border:2px solid #2a2233; }
#bigmap .bm-btns{ margin-left:auto; display:flex; gap:6px; }
#bigmap .bm-btns button{ font:inherit; font-size:.9rem; font-weight:800; padding:5px 10px; border-radius:0;
  border:2px solid #2a2233; background:#3d7fd9; color:#fff; cursor:pointer; box-shadow:2px 2px 0 #120e1f; }
#bigmap .bm-x, #bigmap #bm-close, #bigmap .box-x.bm-x{
  position:absolute; top:8px; right:8px; z-index:5; margin:0;
  width:2.1em; height:2.1em; min-width:2.1em; min-height:2.1em; padding:0;
  border:.15em solid var(--ink, #2a2233); border-radius:0; background:#ff5f7a; color:#fff;
  font:inherit; font-weight:900; font-size:1.1rem; line-height:1; cursor:pointer;
  box-shadow:inset 0 -.12em 0 rgba(0,0,0,.18), 0 .12em 0 var(--ink, #2a2233); }
#bigmap .bm-body{ flex:1 1 auto; min-height:0; min-width:0; display:flex; flex-direction:row; background:#5fa83e; }
#bigmap .bm-main{ flex:1 1 auto; min-height:0; min-width:0; padding:0; overflow:hidden;
  display:flex; justify-content:center; align-items:center; background:#5fa83e; }
#bigmap .bm-mapcol{ width:100%; height:100%; max-height:100%; min-height:0; min-width:0;
  display:flex; justify-content:center; align-items:center; overflow:hidden; background:#5fa83e; }
#bigmap .bm-canvas{ position:relative; flex:0 0 auto; width:auto; height:auto; max-width:100%; max-height:100%;
  border:0; border-radius:0; overflow:visible; background:#5fa83e; box-sizing:content-box; }
#bigmap #school-map{ width:auto; height:auto; max-width:none; max-height:none; display:block;
  image-rendering:pixelated; image-rendering:crisp-edges; cursor:pointer; border:0; background:none; }
#bigmap .bm-side, #bigmap .bm-foot{ flex:0 0 16.5rem; width:16.5rem; max-width:18rem; min-height:0; overflow:auto; overscroll-behavior:contain;
  padding:8px; display:flex; flex-direction:column; gap:8px; font-size:.82rem;
  background:#fff8e7; border-left:4px solid #2a2233; box-sizing:border-box; }
#bigmap .bm-info{ text-align:left; background:#fff; border:3px solid #2a2233; border-radius:0; padding:6px 10px; min-width:0; }
#bigmap .bm-info h3{ margin:0 0 2px; font-size:1rem; font-weight:900; }
#bigmap .bm-legend{ background:#fff; border:3px solid #2a2233; border-radius:0; padding:6px 10px; min-width:0; }
#bigmap .bm-legend ul{ margin:0; padding:0; list-style:none; display:flex; flex-wrap:wrap; gap:3px 10px; font-size:.78rem; }
#bigmap .bm-time{ background:#fff; border:3px solid #2a2233; border-radius:0; padding:6px 10px; font-size:.8rem; min-width:0; }
#bigmap .bm-time .timetable{ max-height:6.5em; overflow:auto; }
#bigmap .bm-note, #bigmap .bm-stat, #bigmap .bm-zones{ margin:4px 0 0; font-size:.78rem; }
/* Wooden-post labels in Nunito. .bm-full is visually hidden but kept for tests and read-aloud. */
#bigmap .bm-lbl{ position:absolute; transform:translate(-50%,-50%); width:auto; height:auto; min-width:0;
  padding:2px 6px 4px; border:2px solid #2a2233; border-radius:0; background:#e8c48a; color:#2a2233;
  font-family:var(--mq-font), Nunito, Verdana, sans-serif; font-size:11px; font-weight:800; line-height:1.15;
  cursor:pointer; box-shadow:2px 2px 0 #2a2233, inset 0 -3px 0 #8d5a35; z-index:1; white-space:nowrap; }
#bigmap .bm-lbl .bm-peg{ display:block; position:absolute; left:50%; bottom:-5px; width:4px; height:5px; margin-left:-2px; background:#6b4226; border:2px solid #2a2233; border-top:0; box-sizing:border-box; }
#bigmap .bm-lbl .bm-full{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
#bigmap .bm-lbl.sel{ background:#ffe066; z-index:3; }
#bigmap .bm-you{ display:block; position:absolute; transform:translate(-50%,140%); background:#e0303a; color:#fff;
  font-family:var(--mq-font), Nunito, Verdana, sans-serif; font-size:12px; font-weight:900; padding:3px 8px; border-radius:0; border:2px solid #fff;
  box-shadow:0 2px 0 #2a2233; white-space:nowrap; z-index:4; pointer-events:none; letter-spacing:.02em; }
#bigmap .bm-you[hidden]{ display:none !important; }
@media (max-width:700px), (max-height:500px){
  #bigmap{ padding:0; }
  #bigmap .bm-box{ width:100%; height:100%; max-width:100%; max-height:100%; border-width:0; box-shadow:none; }
  #bigmap .bm-head{ padding:8px 3.2em 8px 10px; gap:6px; }
  #bigmap .bm-head h2{ font-size:1.05rem; }
  #bigmap .bm-body{ flex-direction:column; }
  #bigmap .bm-side, #bigmap .bm-foot{ flex:0 1 auto; width:100%; max-width:none; max-height:32%;
    border-left:0; border-top:4px solid #2a2233; }
  #bigmap .bm-x, #bigmap #bm-close{ top:6px; right:6px; width:2.2em; height:2.2em; }
  /* Phone: compact posts; tap a post to read the name in the side panel. */
  #bigmap .bm-lbl{ padding:2px 4px 3px; font-size:10px; }
  #bigmap .bm-lbl .bm-name{ display:none; }
  #bigmap .bm-lbl.sel .bm-name, #bigmap .bm-lbl:focus-visible .bm-name{ display:inline; }
}

/* pixel UI icons (no emoji) */
img.ui-ico, .bm-chip img, .bm-head img, .bm-info img, .ms-panel img.ui-ico, p.bag-money img.ui-ico {
  width: 1.15em; height: 1.15em; image-rendering: pixelated; image-rendering: crisp-edges;
  vertical-align: -0.2em; display: inline-block;
}
#school-map { image-rendering: pixelated; image-rendering: crisp-edges; }



/* in-game title screen: teal ribbon tagline under the logo */
#title .title-slogan{ margin:0; }
#title .title-slogan span{ display:inline-block; position:relative; z-index:1; padding:.18em .9em .22em;
  color:#fff; font-weight:900; font-size:.95em; letter-spacing:.02em; line-height:1.15;
  text-shadow:0 .08em 0 #0a5c52; background:linear-gradient(180deg, #8ff3dc 0%, #2bb8a0 50%, #17887a 100%);
  border:.14em solid var(--ink); border-radius:0;
  box-shadow:inset 0 .08em 0 rgba(255,255,255,.4), 0 .12em 0 var(--ink); }
#title .title-slogan span::after{ content:''; position:absolute; left:-.45em; right:-.45em; top:.12em; bottom:.12em; z-index:-1;
  background:#0e6a60; clip-path:polygon(.45em 0, calc(100% - .45em) 0, 100% 50%, calc(100% - .45em) 100%, .45em 100%, 0 50%); }

/* Legendary quest unlock popup: square pixel box, Nunito, X in the corner. */
#lqpop{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:3.2em .8em 1.6em; z-index:36; pointer-events:auto; }
#lqpop[hidden]{ display:none; }
#lqpop .lq-box{ position:relative; background:#fffbe9; color:var(--ink); border:.3em solid var(--ink); box-shadow:0 0 0 .15em #c9a227, .25em .25em 0 rgba(0,0,0,.35); padding:.7em 2.4em .7em .75em; max-width:82%; width:16.5em; text-align:left; font-family:var(--mq-font), Nunito, sans-serif; border-radius:0; }
#lqpop .lq-box b{ display:block; color:#c0392b; font-size:1.15em; letter-spacing:.04em; line-height:1.2; padding-right:0; margin:0 0 .35em; }
#lqpop .lq-lead{ margin:0 0 .4em; font-weight:700; font-size:.78em; line-height:1.3; }
#lqpop .lq-list{ margin:0; padding:0 0 0 1.1em; font-size:.72em; line-height:1.35; }
#lqpop .lq-list li{ margin:0 0 .28em; }
#lqpop .box-x{ position:absolute; top:.12em; right:.12em; }
#toast{ z-index:20; }

/* ---- Muddle Book ---- */
.tile-new{ position:absolute; top:.12em; left:.12em; background:#ffd23f; color:#2a2233; border:.1em solid var(--ink); border-radius:0; padding:0 .28em; font-size:.65em; font-weight:900; line-height:1.3; z-index:2; }
.mb-wrap{ display:flex; flex-direction:column; gap:.35em; min-height:0; }
.mb-count{ margin:0; padding:.25em .5em; background:#fff8d6; border:.12em solid var(--ink); border-radius:0; font-weight:bold; }
.mb-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(4.6em, 1fr)); gap:.3em; }
.mb-cell{ position:relative; display:flex; flex-direction:column; align-items:center; gap:.1em; margin:0; padding:.3em .15em .25em; background:#fff; border:.12em solid var(--ink); border-radius:0; box-shadow:0 .12em 0 rgba(42,34,51,.25); color:var(--ink); font:inherit; font-weight:bold; cursor:pointer; }
.mb-cell.unknown{ background:#ece6f6; }
.mb-cell.on{ background:#fff6c8; box-shadow:0 .12em 0 var(--ink), 0 0 0 .12em #ffd23f; }
.mb-cell.calmed{ background:#eefbe8; }
.mb-cell.calmed.on{ background:#fff6c8; }
.mb-spr{ width:2.6em; height:2.6em; image-rendering:pixelated; image-rendering:crisp-edges; }
.mb-cell-name{ font-size:.72em; line-height:1.15; text-align:center; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mb-new{ position:absolute; top:.08em; left:.08em; background:#ffd23f; color:#2a2233; border:.08em solid var(--ink); border-radius:0; padding:0 .22em; font-size:.65em; font-weight:900; line-height:1.25; }
.mb-detail{ display:flex; gap:.6em; align-items:flex-start; background:#fff; border:.15em solid var(--ink); border-radius:0; padding:.45em .55em; }
.mb-hero{ width:4.2em; height:4.2em; flex:none; image-rendering:pixelated; image-rendering:crisp-edges; background:#f4eefc; border:.1em solid var(--ink); }
.mb-info{ min-width:0; flex:1; }
.mb-info h3{ margin:0 0 .15em; font-size:1.05em; padding-right:0; }
.mb-tags{ display:flex; flex-wrap:wrap; gap:.25em; align-items:center; margin:.1em 0 .25em; }
.mb-type, .mb-status{ display:inline-block; border:.08em solid var(--ink); border-radius:0; padding:0 .35em; font-size:.75em; font-weight:bold; background:#fff; }
.mb-status.met{ background:#e3efff; }
.mb-status.calmed{ background:#d9f5d0; }
.mb-blurb, .mb-skill, .mb-gold{ margin:.2em 0 0; }
.mb-skill{ background:#fff8d6; border:.08em solid var(--ink); border-radius:0; padding:.25em .4em; }
.mb-gold{ font-weight:bold; }
.mb-detail.unknown .mb-hero{ background:#2a2233; }
@media (max-width:700px){
  .mb-grid{ grid-template-columns:repeat(auto-fill, minmax(4em, 1fr)); }
  .mb-hero{ width:3.4em; height:3.4em; }
  .mb-detail{ gap:.4em; padding:.35em; }
}

.mb-story{ margin:.35em 0 0; padding:.3em .45em; background:#f4eefc; border:.08em solid var(--ink); border-radius:0; line-height:1.35; }
#pinpop .pp-in.founder{ background:#fff6c8; border-radius:0; }
#pinpop .pp-in.founder b{ color:#7a4a00; }
.founder-h{ margin:0.7em 0 .25em; font-size:.95em; }

.year-h{ margin:0.7em 0 .25em; font-size:.95em; }

/* Woodland campfire HUD and Campfire calm */
.hud-logs{ display:inline-flex; align-items:center; gap:.28em; padding:.08em .4em; margin-right:.15em; border:.12em solid #120e1f; border-radius:0; background:#3a2414; color:#fff6b0; font-family:var(--mq-font), Nunito, sans-serif; font-weight:800; font-size:.85em; letter-spacing:.02em; }
.hud-logs[hidden]{ display:none; }
.hud-logs img{ width:1em; height:1em; image-rendering:pixelated; image-rendering:crisp-edges; }
.hud-logs b{ color:#fffaf0; }
#campcalm{ position:absolute; inset:0; z-index:34; display:flex; align-items:center; justify-content:center; background:rgba(18,14,28,.55); pointer-events:auto; }
#campcalm[hidden]{ display:none; }
#campcalm .cc-box{ position:relative; width:15.6em; max-width:88%; background:#fffbe9; color:var(--ink); border:.3em solid var(--ink); border-radius:0; box-shadow:0 0 0 .15em #c0392b, .25em .25em 0 rgba(0,0,0,.35); padding:.7em 1.6em .75em .75em; text-align:center; font-family:var(--mq-font), Nunito, sans-serif; }
#campcalm h2{ margin:0 1.4em .4em 0; font-size:1.05em; letter-spacing:.03em; color:#8a2a12; text-align:left; }
#campcalm #cc-fire{ display:block; width:100%; height:auto; image-rendering:pixelated; image-rendering:crisp-edges; border:.18em solid var(--ink); border-radius:0; background:#12101c; margin:0 0 .45em; }
#campcalm .cc-breath{ margin:0 0 .2em; font-weight:900; font-size:1.05em; }
#campcalm .cc-hint{ margin:0 0 .5em; font-size:.72em; line-height:1.3; }
#campcalm .cc-go{ display:inline-block; padding:.28em .7em; border:.16em solid var(--ink); border-radius:0; background:#f0a04b; color:var(--ink); font:inherit; font-weight:800; cursor:pointer; box-shadow:.12em .12em 0 var(--ink); }
#campcalm .cc-go:hover, #campcalm .cc-go:focus-visible{ background:#ffe066; }

/* in-game title screen: full logo always fits, square Nunito buttons, starry sky behind */
#title{ background:transparent; padding:.4em .5em .35em; gap:.22em; justify-content:center; min-height:0; font-family:var(--mq-font), Nunito, sans-serif; box-sizing:border-box; }
#title .title-logo{ width:100%; max-width:100%; margin:0; flex:0 1 auto; display:flex; justify-content:center; align-items:center; min-height:0; max-height:36%; }
#title .bl-wrap{ position:relative; display:block; width:auto; max-width:100%; height:auto; max-height:100%; aspect-ratio:1488 / 304; flex:0 1 auto; }
#title .bl-wrap img{ display:block; width:100%; height:100%; max-width:100%; max-height:100%; object-fit:contain; object-position:center; image-rendering:pixelated; image-rendering:crisp-edges; }
#title .bl-mud{ position:absolute; left:0; top:0; }
#title-menu{ width:min(72%, 14.5em); min-width:0; gap:.22em; flex:0 0 auto; }
#title-menu .opt{ text-align:center; font-weight:900; font-size:.92em; border-radius:0; border:.16em solid var(--ink); box-shadow:.12em .12em 0 var(--ink); padding:.22em .55em; background:#fffaf0; }
#title-menu .opt.hi{ background:#ffe066; box-shadow:inset .25em 0 0 var(--red), .12em .12em 0 var(--ink); }
#title .hint{ margin:0; font-size:.62em; }
#title .music-ctl{ margin:.08em 0; }
#title .title-copy{ margin:.08em 0 0; font-size:.62em; }
#title .title-slogan{ flex:0 0 auto; }

/* Library book picker + page-flip reader */
#bookpick, #bookread{ position:absolute; inset:0; z-index:34; display:flex; align-items:center; justify-content:center; background:rgba(18,14,28,.55); pointer-events:auto; }
#bookpick[hidden], #bookread[hidden]{ display:none !important; }
.bpk-box, .br-box{ position:relative; width:20.4em; max-width:94%; max-height:94%; overflow:auto; background:#fffbe9; color:var(--ink); border:.3em solid var(--ink); border-radius:0; box-shadow:0 0 0 .15em #3d7fd9, .25em .25em 0 rgba(0,0,0,.35); padding:.55em 2.7em .65em .7em; text-align:left; font-family:var(--mq-font), Nunito, sans-serif; }
.br-box{ width:21.2em; }
.bpk-box h2, .br-box h2, .br-title{ margin:0 0 .3em; font-size:1.05em; letter-spacing:.02em; color:#2a2233; padding-right:0; line-height:1.2; }
.bpk-lead{ margin:0 0 .45em; font-size:.72em; line-height:1.3; font-weight:700; }
.bpk-list{ display:flex; flex-direction:column; gap:.3em; }
.bpk-item{ display:flex; align-items:center; gap:.45em; width:100%; text-align:left; background:#fff; color:var(--ink); border:.16em solid var(--ink); border-radius:0; padding:.28em .4em; font:inherit; cursor:pointer; box-shadow:.1em .1em 0 var(--ink); }
.bpk-item.on, .bpk-item:hover, .bpk-item:focus-visible{ background:#fff6c8; }
.bpk-item canvas{ width:2em; height:2.75em; image-rendering:pixelated; image-rendering:crisp-edges; flex:none; border:.08em solid var(--ink); border-radius:0; }
.bpk-meta{ display:flex; flex-direction:column; gap:.08em; min-width:0; }
.bpk-meta b{ font-size:.9em; }
.bpk-meta span{ font-size:.68em; line-height:1.25; }
.br-stage{ position:relative; overflow:hidden; border:.18em solid var(--ink); border-radius:0; background:#fff8e4; min-height:7.2em; max-height:10.5em; }
.br-page{ padding:.4em .5em .45em; min-height:7.2em; }
.br-page h3{ margin:0 0 .25em; font-size:.95em; }
.br-page p{ margin:0; font-size:.78em; line-height:1.35; font-weight:700; }
.br-page.flip{ animation:brFlip .28s steps(4, end); }
@keyframes brFlip{ 0%{ transform:translateX(8%) ; opacity:.4; } 100%{ transform:none; opacity:1; } }
@media (prefers-reduced-motion: reduce){ .br-page.flip{ animation:none; } }
.br-num{ margin:.3em 0 .2em; font-size:.7em; font-weight:800; }
.br-nav{ display:flex; gap:.4em; }
.br-btn{ flex:1; padding:.28em .5em; border:.16em solid var(--ink); border-radius:0; background:#f0a04b; color:var(--ink); font:inherit; font-weight:800; cursor:pointer; box-shadow:.1em .1em 0 var(--ink); }
.br-btn:hover, .br-btn:focus-visible{ background:#ffe066; }
.br-btn:disabled{ background:#ddd; color:#666; box-shadow:none; cursor:default; }

/* STEM robot builder */
#robotbuild{ position:absolute; inset:0; z-index:34; display:flex; align-items:center; justify-content:center; background:rgba(18,14,28,.55); pointer-events:auto; }
#robotbuild[hidden]{ display:none !important; }
.rb-box{ position:relative; width:22.5em; max-width:96%; max-height:96%; overflow:auto; background:#fffbe9; color:var(--ink); border:.3em solid var(--ink); border-radius:0; box-shadow:0 0 0 .15em #3d7fd9, .25em .25em 0 rgba(0,0,0,.35); padding:.5em 2.7em .55em .6em; text-align:left; font-family:var(--mq-font), Nunito, sans-serif; }
.rb-box h2{ margin:0 0 .2em; font-size:1.02em; line-height:1.2; }
.rb-lead{ margin:0 0 .35em; font-size:.68em; line-height:1.3; font-weight:700; }
.rb-main{ display:flex; gap:.35em; align-items:stretch; min-height:0; }
.rb-pal{ width:6.2em; flex:none; display:flex; flex-direction:column; gap:.18em; max-height:12.4em; overflow:auto; }
.rb-part{ display:flex; align-items:center; gap:.2em; border:.12em solid var(--ink); border-radius:0; background:#fff; padding:.12em .15em; font:inherit; font-size:.62em; font-weight:800; cursor:pointer; text-align:left; color:var(--ink); }
.rb-part.on{ background:#fff6c8; box-shadow:0 0 0 .1em #f6d04d; }
.rb-part canvas{ width:1.7em; height:1.1em; image-rendering:pixelated; flex:none; }
.rb-stage{ flex:1; min-width:0; border:.18em solid var(--ink); border-radius:0; background:#d9ece0; display:flex; align-items:center; justify-content:center; }
#rb-grid{ width:100%; height:auto; max-height:12.2em; image-rendering:pixelated; image-rendering:crisp-edges; display:block; touch-action:none; }
.rb-status{ margin:.28em 0 .2em; font-size:.68em; font-weight:800; min-height:1.2em; }
.rb-bar{ display:flex; gap:.35em; }
.rb-btn{ flex:1; padding:.26em .45em; border:.16em solid var(--ink); border-radius:0; background:#fff; color:var(--ink); font:inherit; font-weight:800; cursor:pointer; box-shadow:.1em .1em 0 var(--ink); }
.rb-go{ background:#3ee07a; }
.rb-btn:hover, .rb-btn:focus-visible{ background:#ffe066; }
.rb-go:disabled{ background:#c8c8c8; color:#555; box-shadow:none; cursor:default; }
@media (pointer:coarse){
  .bpk-box, .br-box, .rb-box{ padding-right:3em; }
}

/* Indi's gentle screen-time reminder: a small box that never locks play */
#balpop{ position:absolute; right:.45em; bottom:.45em; z-index:30; pointer-events:none; }
#balpop[hidden]{ display:none !important; }
#balpop .bal-box{ pointer-events:auto; position:relative; width:13.5em; max-width:70%; background:#fffbe9; color:var(--ink);
  border:.22em solid var(--ink); border-radius:0; box-shadow:.2em .2em 0 rgba(0,0,0,.3);
  padding:.45em 2.2em .5em .5em; font-family:var(--mq-font), Nunito, sans-serif; text-align:left; }
#balpop .bal-box b{ display:block; margin:0 0 .2em; font-size:.9em; color:#2f6a9a; }
#balpop .bal-text{ margin:0; font-size:.72em; line-height:1.3; font-weight:700; }
#balpop .box-x{ top:.16em; right:.16em; }

#title .title-ver{ margin:0; flex:0 0 auto; }
#title .title-ver a.mq-ver{ color:#fff6b0; font-size:.7em; font-weight:800; letter-spacing:.04em;
  text-decoration:none; text-shadow:.08em .08em 0 #2a1550; }
#title .title-ver a.mq-ver:hover, #title .title-ver a.mq-ver:focus-visible{ text-decoration:underline; text-underline-offset:.15em; }

/* ---- Battle layout: stat panels in a top-left stack; actions stay in a bottom dock. Never overlap. ---- */
#hud-battle{
  position:absolute; top:.4em; left:.4em; right:auto; width:48%; max-width:15.6em;
  display:flex; flex-direction:column; gap:.35em; max-height:46%; overflow:auto;
  z-index:26; pointer-events:none;
}
#hud-battle .bbox{
  position:static; width:100%; top:auto; left:auto; max-width:none;
  pointer-events:auto; flex:0 1 auto; min-width:0;
}
#hud-battle .enemy, #hud-battle .player{ top:auto; left:auto; width:100%; }
#hud-battle .bbox b{ overflow-wrap:anywhere; }
#hud-battle:not([hidden]) ~ #dialog{
  height:auto; min-height:22%; max-height:32%;
  bottom:.35em; left:.35em; right:.35em; z-index:28;
}
/* Keep the speaker name inside the box in battle so it cannot cover the stat panels. */
#hud-battle:not([hidden]) ~ #dialog #dlg-name{
  top:.2em; left:.5em;
}
#hud-battle:not([hidden]) ~ #dialog:not(:has(#dlg-name[hidden])){
  padding-top:1.7em;
}
#hud-battle:not([hidden]) ~ #dialog:not(:has(#dlg-name[hidden])) #dlg-text{
  top:1.85em;
}
#bskills{
  height:auto; min-height:22%; max-height:32%;
  bottom:.35em; left:.35em; right:.35em;
}
#bdesc{
  left:.35em; right:.35em; bottom:calc(32% + .35em);
  max-height:14%; overflow:auto;
}
#bmenu{
  right:.45em; bottom:.45em; width:30%; max-width:10em;
  height:auto; max-height:calc(32% - .2em); z-index:29;
  padding-top:1.6em; padding-bottom:.15em;
}
#bmenu .opt{ flex:1 1 auto; min-height:1.15em; }
/* Choice lists during a battle stay in the right-hand lower dock, clear of the stat stack. */
#hud-battle:not([hidden]) ~ #choices{
  left:52%; right:.4em; bottom:calc(32% + .55em); max-height:30%; overflow:auto;
}
/* When the command menu is open, keep "What will you do?" text to the left of it. */
#frame:has(#bmenu:not([hidden])) #dialog #dlg-text{ right:34%; }
#frame:has(#bmenu:not([hidden])) #dialog #dlg-speak{ right:calc(32% + .4em); }
#frame:has(#bmenu:not([hidden])) #dialog #dlg-next{ right:calc(32% + .45em); }
#frame:has(#bmenu:not([hidden])) #dialog .box-x{ right:calc(32% + .2em); }


/* Diary calendar, redeem box, dog pat, map floor toggle */
.diary-page{ margin:0 0 .7em; }
.diary-page p{ margin:.2em 0 .45em; }
.diary-cal{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(8,1fr); gap:3px; }
.diary-cal li{ aspect-ratio:1; display:flex; align-items:center; justify-content:center; border:2px solid #2a2233; background:#fff6d8; font-weight:800; font-size:.8em; }
.diary-cal li.dy-got{ background:#5ee0a0; }
.diary-cal li.dy-now{ background:#ffe066; }
#redeem.rd-box{ position:absolute; left:8%; right:8%; top:18%; z-index:40; padding:1.2em 1em 1em; background:#fffaf4; border:3px solid #2a2233; box-shadow:4px 4px 0 #2a2233; }
#redeem h2{ margin:0 1.2em .4em 0; font-size:1.1em; }
#redeem-form{ display:flex; gap:.4em; margin-top:.6em; }
#redeem-code{ flex:1; font:inherit; text-transform:uppercase; border:2px solid #2a2233; background:#fff; padding:.3em .4em; border-radius:0; }
#redeem-go{ font:inherit; font-weight:800; border:2px solid #2a2233; background:#ffe066; padding:.3em .7em; border-radius:0; cursor:pointer; }
.rd-msg{ margin:.2em 0; }
.rd-msg.err{ color:#9a1d3a; }
.rd-msg.ok{ color:#1a7a3a; }
#dog-pat{ position:absolute; right:.4em; bottom:36%; z-index:27; font:inherit; font-weight:800; font-size:.8em;
  border:2px solid #2a2233; background:#ffe066; color:#1d1726; padding:.25em .5em; border-radius:0; cursor:pointer; }
#bm-floor{ font:inherit; font-weight:800; border:2px solid #2a2233; background:#fff6d8; padding:.2em .5em; border-radius:0; cursor:pointer; }
.title-ver{ margin:.15em 0 0; }
.title-ver .mq-ver{ color:inherit; font-weight:800; text-decoration:none; }

/* Keep Pat Wattle off the battle screen so it cannot cover menus or stats. */
body:has(#hud-battle:not([hidden])) #dog-pat{ display:none !important; }

/* Keep the speaker button clear of battle message text, including when the command menu is open. */
#hud-battle:not([hidden]) ~ #dialog #dlg-text{ bottom:2.4em; right:3.2em; }
#frame:has(#bmenu:not([hidden])) #dialog #dlg-text{ right:calc(34% + 2.6em); bottom:2.4em; }

#exitgo.ex-box{ position:absolute; left:12%; right:12%; top:22%; z-index:45; padding:1.2em 1em 1em; background:#fffaf4; border:3px solid #2a2233; box-shadow:4px 4px 0 #2a2233; border-radius:0; }
#exitgo h2{ margin:0 1.6em .45em 0; font-size:1.15em; color:#2a2233; }
#exitgo .rd-msg{ margin:.2em 0 .15em; font-weight:700; line-height:1.35; }
#exitgo .ex-btns{ display:flex; gap:.55em; justify-content:center; margin-top:.85em; }
#exitgo .ex-btns button{ min-width:5em; min-height:3.6em; padding:.4em .9em; font:inherit; font-weight:900; color:#2a2233; border:3px solid #2a2233; border-radius:0; box-shadow:3px 3px 0 #2a2233; cursor:pointer; }
#exitgo .ex-yes{ background:#2fc79a; color:#fff; }
#exitgo .ex-no{ background:#fffaf4; }
#exitgo .ex-btns button.hi, #exitgo .ex-btns button:focus-visible{ outline:3px solid #f6d04d; outline-offset:2px; background:linear-gradient(#fffbe0, #ffe680); color:#2a2233; }
#exitgo .ex-btns button:active{ transform:translate(.08em, .08em); box-shadow:1px 1px 0 #2a2233; }
@media (pointer:coarse){ #exitgo .ex-btns button{ min-height:4em; min-width:5.6em; } #exitgo .box-x{ width:3.4em; height:3.4em; } }
@media (prefers-reduced-motion: reduce){ #exitgo .ex-btns button:active{ transform:none; } }

/* In-game menus sit on the top half of the homepage hero: purple-to-pink starry sky,
   pixel grass and a hill along the bottom, cream headings and readable square cards. */
.menu-sky{
  position:absolute; inset:0; z-index:0; pointer-events:none; overflow:hidden; border-radius:0;
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255,255,255,.35) 0, rgba(255,255,255,0) 42%),
    linear-gradient(180deg, #3b1d78 0%, #7a3dc4 36%, #e05aa8 68%, #f48cb8 86%, #f7b7d0 100%);
}
.menu-sky .panel-stars{
  position:absolute; inset:0; width:100%; height:100%; pointer-events:none; image-rendering:pixelated;
}
.menu-sky .panel-ground{
  position:absolute; left:0; right:0; bottom:0; width:100%;
  height:56px !important; min-height:56px !important; max-height:56px !important;
  pointer-events:none; image-rendering:pixelated; image-rendering:crisp-edges; display:block;
}
#menu, #menu.home, #menu.submenu, #menu.pg,
#redeem.rd-box, #exitgo.ex-box, #codebox,
.bpk-box, .br-box{
  background:transparent !important;
  color:#fffaf0;
  padding-bottom:64px;
}
#menu > *:not(.menu-sky):not(.box-x), #redeem > *:not(.menu-sky):not(.box-x), #exitgo > *:not(.menu-sky):not(.box-x),
#codebox > *:not(.menu-sky):not(.box-x), .bpk-box > *:not(.menu-sky):not(.box-x), .br-box > *:not(.menu-sky):not(.box-x){
  position:relative; z-index:1;
}
/* Keep close-X absolutely placed in the reserved gutter. The rule above would
   otherwise force it into document flow and overlap titles and body text. */
#menu > .box-x, #redeem > .box-x, #exitgo > .box-x, #codebox > .box-x,
.bpk-box > .box-x, .br-box > .box-x{
  position:absolute; z-index:40;
}
.bpk-box h2, .br-box h2, .br-title{ padding-right:2.6em; }
@media (pointer:coarse){
  .bpk-box h2, .br-box h2, .br-title{ padding-right:3.1em; }
}
/* Phone landscape and other short frames: shrink the grass strip and Settings
   tiles so options stay inside the panel and remain tappable (not covered by
   #menu's reserved bottom padding / grass). */
@media (max-height: 500px){
  .menu-sky .panel-ground{ height:22px !important; min-height:22px !important; max-height:22px !important; }
  #menu, #menu.home, #menu.submenu, #menu.pg,
  #redeem.rd-box, #exitgo.ex-box, #codebox,
  .bpk-box, .br-box{ padding-bottom:26px; }
  #menu-list.tiles.tiles-sub{ align-content:start; min-height:0; }
  #menu-list.tiles.tiles-sub .opt{ min-height:3.1em; }
}
#menu-title, #redeem h2, #exitgo h2, #codebox h2, .bpk-box h2, .br-box h2, .br-title{
  font-weight:900; letter-spacing:.03em;
  color:#fff6c8 !important; -webkit-text-fill-color:#fff6c8 !important;
  -webkit-text-stroke:.06em var(--ink); paint-order:stroke fill;
  background-image:none !important; background-clip:border-box !important; -webkit-background-clip:border-box !important;
  text-shadow:0 3px 0 var(--ink);
}
#menu-body, #menu.pg #menu-body, #redeem .rd-msg, #exitgo .rd-msg, #codebox .cb-lead,
.bpk-lead, .br-page, .br-num{ color:#fffaf0; }
#menu-body h3, .pg-h{ color:#fff6c8 !important; }
.menu-legend{ color:#fff6c8 !important; }
#menu-level{
  background:rgba(20,12,45,.78) !important; color:#fff6c8;
  border:.15em solid #fff6c8; border-radius:0;
}
.pin-card{
  background:#fffaf0 !important; color:var(--ink) !important;
  border:.15em solid var(--ink); border-radius:0;
  box-shadow:.15em .15em 0 var(--ink);
}
.pin-card.locked{ background:#e6dff0 !important; color:#3a3046 !important; }
.pin-card.ultra.got{ background:linear-gradient(160deg,#fff0fa,#efe8ff 50%,#e6f7ff) !important; }
#menu.pg #menu-body{ scrollbar-color:#ff8fc0 rgba(20,12,45,.6); }
#menu.pg #menu-body::-webkit-scrollbar-thumb{ background:#ff8fc0; border:.15em solid #3b1d78; }
#menu.pg #menu-body::-webkit-scrollbar-track{ background:rgba(20,12,45,.55); }
#menu.pg-bag .bag-desc, #menu.pg-friends .bag-desc, #bag-desc{
  background:rgba(20,12,45,.78) !important; color:#fffaf0; border:.13em dashed #fff6c8;
}
#menu.pg-bag .bag-money{ background:#fff8d6; color:var(--ink); }
#menu .music-ctl{ background:rgba(20,12,45,.78); color:#fffaf0; border:.15em solid #fff6c8; }
#redeem-code, #code-input{
  background:#fffaf0; color:var(--ink); border:2px solid var(--ink); border-radius:0;
}
#exitgo .rd-msg, #redeem .rd-msg{ color:#fffaf0; }


/* 1.2.2: cream headings and a no-scroll setup layout on common screens. */
#select, #codebox{
  background:transparent !important;
  color:#fffaf0;
  font-family:var(--mq-font), Nunito, Verdana, sans-serif;
  padding:.4em .55em 1.85em;
  gap:.28em;
  justify-content:flex-start;
  overflow:auto;
  overscroll-behavior:contain;
}
#select > *:not(.menu-sky):not(.box-x),
#codebox > *:not(.menu-sky):not(.box-x){ position:relative; z-index:1; }
#select > .box-x, #codebox > .box-x{ position:absolute; z-index:40; }
#select .menu-sky .panel-ground,
#codebox .menu-sky .panel-ground{
  height:1.55em !important; min-height:1.55em !important; max-height:1.55em !important;
}
#select h2, #codebox h2{
  font-weight:900; letter-spacing:.03em; font-size:1.05em; margin:0; flex:none;
  color:#fff6c8 !important; -webkit-text-fill-color:#fff6c8 !important;
  -webkit-text-stroke:.06em var(--ink); paint-order:stroke fill;
  background-image:none !important; background-clip:border-box !important; -webkit-background-clip:border-box !important;
  text-shadow:0 3px 0 var(--ink);
  padding-right:2.4em;
}
@media (pointer:coarse){
  #select h2, #codebox h2{ padding-right:3.1em; }
}
#select .select-grid{
  flex:1 1 auto; min-height:0; width:100%; max-width:36em;
  display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);
  gap:.3em .7em; align-items:center; justify-items:center;
}
#select .select-look, #select .select-go{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:.28em; width:100%; min-width:0;
}
#looks{ gap:.22em; }
#select .look{ padding:.12em; }
#select .look canvas{ width:2.15em; height:2.15em; }
#select .look-preview{ padding:.12em; }
#select .look-preview canvas{ width:3.35em; height:3.35em; }
#select .look-sliders{ width:100%; max-width:16em; gap:.16em; }
#select .look-sliders label{ font-size:.62em; gap:.06em; }
#select .look-sliders input[type=range]{ height:1.2em; }
#select .look-sliders input[type=range]::-webkit-slider-thumb,
#select .look-sliders input[type=range]::-moz-range-thumb{ width:1.45em; height:1.45em; }
#name-lbl{ margin:0; font-size:.72em; font-weight:800; color:#fffaf0; text-shadow:0 .08em 0 #000; }
#select .name-roll{ width:100%; max-width:16em; padding:.28em .45em .3em; }
#select .name-roll .name-shown, #select #name-shown{ font-size:1.15em; }
#select #start-btn, #select .big{ font-size:1em; padding:.28em 1.2em; min-height:2.15em; }
#select #name-hint{ max-width:16em; font-size:.58em; margin:0; }
#select #overwrite{ font-size:.68em; max-width:16em; }
#select .select-start{
  display:flex; flex-direction:column; align-items:center; gap:.2em; width:100%;
}
#select.is-tight .select-start{
  position:sticky; bottom:0; z-index:8;
  padding:.28em .15em .12em;
  background:linear-gradient(180deg, rgba(59,29,120,0) 0%, rgba(59,29,120,.94) 38%, rgba(90,40,160,.96) 100%);
}
#codebox{ gap:.28em; }
#codebox .cb-lead{ font-size:.78em; }
#codebox.is-tight .cb-btns{
  position:sticky; bottom:0; z-index:8;
  padding:.3em 0 .1em;
  background:linear-gradient(180deg, rgba(59,29,120,0) 0%, rgba(59,29,120,.94) 40%, rgba(90,40,160,.96) 100%);
}
#select, #codebox{ container-type:size; }
@container (max-width: 24em){
  #select .select-grid{ grid-template-columns:1fr; gap:.25em; }
  #select .look-preview canvas{ width:2.8em; height:2.8em; }
  #select .look canvas{ width:1.9em; height:1.9em; }
}
@media (pointer:coarse){
  #select .look-sliders input[type=range]{ height:1.45em; }
  #select .look-sliders input[type=range]::-webkit-slider-thumb,
  #select .look-sliders input[type=range]::-moz-range-thumb{ width:1.7em; height:1.7em; }
  #select #start-btn, #select .big{ min-height:2.4em; }
}
