/* The cat's story box: house dialogue module, in the game's vermilion, paper and jade. Square, pixel, no rounded cards. */
.dlg {
  --dlg-ink: #2a0904; --dlg-paper: #fff1dc; --dlg-edge: #4f0f07;
  --dlg-portrait: min(56vh, 520px); --dlg-box-w: 860px;
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding: 0 12px calc(14px + env(safe-area-inset-bottom)) calc(var(--dlg-portrait) * .92 + 20px); user-select: none; -webkit-user-select: none;
  background: linear-gradient(to top, rgba(79,15,7,.88), rgba(79,15,7,.35) 55%, rgba(79,15,7,0));
}
.dlg[hidden] { display: none; }
.dlg-stage { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dlg-portrait { position: absolute; bottom: 0; height: var(--dlg-portrait); transition: transform .4s cubic-bezier(.2,.9,.3,1.2), opacity .3s; z-index: 1; }
.dlg-portrait img { height: 100%; width: auto; display: block; image-rendering: pixelated; transform-origin: 50% 100%; animation: dlg-breathe 3.2s ease-in-out infinite; filter: drop-shadow(10px 0 0 #4f0f07); }
@keyframes dlg-breathe { 50% { transform: scale(1.012, .988) } }
.dlg-left { left: 0; transform: translateX(-110%); }
.dlg-portrait.dlg-in.dlg-left { transform: none; }
.dlg-portrait.dlg-hop img { animation: dlg-hop .3s ease-out, dlg-breathe 3.2s ease-in-out .3s infinite; }
@keyframes dlg-hop { 35% { transform: translateY(-3%) } }
.dlg-portrait.dlg-out { opacity: 0; transform: translateX(-30%); }
.dlg-box { position: relative; z-index: 3; width: 100%; max-width: var(--dlg-box-w); min-height: 128px; background: var(--dlg-paper); color: var(--dlg-ink);
  border: 4px solid var(--dlg-edge); box-shadow: 8px 8px 0 #4f0f07; padding: 22px 22px 46px;
  font: 400 clamp(17px, 2.3vw, 22px)/1.4 'Mini', ui-monospace, monospace; animation: dlg-up .25s ease-out; cursor: pointer; }
.dlg-box.dlg-out { animation: dlg-down .3s ease-in forwards; }
@keyframes dlg-up { from { transform: translateY(16px); opacity: 0 } }
@keyframes dlg-down { to { transform: translateY(16px); opacity: 0 } }
.dlg-plate { position: absolute; top: -20px; left: 16px; padding: 6px 12px 5px; border: 4px solid var(--dlg-edge); color: #fff1dc; font: 400 16px/1 'Future', sans-serif; letter-spacing: .04em; }
.dlg-text { min-height: 2.8em; white-space: pre-wrap; }
.dlg-more { position: absolute; right: 16px; bottom: 12px; font-size: 16px; animation: dlg-bob .8s infinite; color: #d8402a; }
@keyframes dlg-bob { 50% { transform: translateY(3px) } }
.dlg-skip { all: unset; position: absolute; left: 18px; bottom: 10px; font: 400 13px/1 'Future', sans-serif; color: #8e2112; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; padding: 6px 4px; }
.dlg-skip kbd { font-size: 11px; }
.dlg-menu { display: none; }
@media (prefers-reduced-motion: reduce) { .dlg-portrait, .dlg-box, .dlg-portrait img { transition: none; animation: none } }
/* phones: the cat stands above the box, the box takes the full width */
@media (max-width: 700px), (max-height: 520px) {
  .dlg { --dlg-portrait: min(40vh, 74vw); padding-left: 12px; }
  .dlg-left { left: 50%; transform: translateX(-160%); }
  .dlg-portrait.dlg-in.dlg-left { transform: translateX(-50%); }
  .dlg-portrait { bottom: calc(206px + env(safe-area-inset-bottom)); }
  .dlg-box { min-height: 176px; }
}
@media (max-height: 520px) and (min-width: 701px) {
  .dlg { --dlg-portrait: 80vh; padding-left: calc(var(--dlg-portrait) * .92 + 16px); }
  .dlg-portrait { top: auto; bottom: 0; }
  .dlg-left { left: 0; transform: translateX(-110%); }
  .dlg-portrait.dlg-in.dlg-left { transform: none; }
  .dlg-box { min-height: 0; padding: 18px 18px 40px; }
}
