/* Level Up: Us — game page layout. JS sets --u (css px per game px) and --sx/--sy/--sw/--sh (stage rect). */
html, body.game-page { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.game-page { touch-action: manipulation; -webkit-user-select: none; user-select: none; }

.app {
  --u: 4px; --sx: 0px; --sy: 0px; --sw: 1280px; --sh: 720px;
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, #2b1747 0%, #170c28 55%, #0d0618 100%);
  font-size: clamp(14px, calc(var(--u) * 4.1), 24px);
  opacity: 0; transition: opacity .4s;
}
.app.ready { opacity: 1; }
.app::before { /* faint pixel grid pattern in the letterbox */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255, 143, 184, .16) 1px, transparent 1.4px);
  background-size: 22px 22px;
}

.stage-wrap { position: absolute; inset: 0; }
.stage {
  position: absolute; left: var(--sx); top: var(--sy); width: var(--sw); height: var(--sh);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px rgba(255, 143, 184, .22), 0 18px 60px rgba(0, 0, 0, .55);
}
#screen {
  width: 100%; height: 100%;
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #12081c; outline: none;
}

/* HUD (pause) */
.hud { position: absolute; top: calc(var(--u) * 2); right: calc(var(--u) * 2); display: flex; gap: 6px; }
.icon-btn {
  --b: 2px;
  appearance: none; border: 0; cursor: pointer;
  width: max(40px, calc(var(--u) * 11)); height: max(40px, calc(var(--u) * 11));
  display: grid; place-items: center;
  background: rgba(20, 10, 34, .7); color: #fff;
  font-family: var(--pixel); font-weight: 700; font-size: max(14px, calc(var(--u) * 3.6)); letter-spacing: -.08em;
  box-shadow: 0 -2px 0 0 #fff, 0 2px 0 0 #fff, -2px 0 0 0 #fff, 2px 0 0 0 #fff;
  opacity: .82;
}
.icon-btn:hover { opacity: 1; background: rgba(42, 24, 64, .9); }

/* chapter card */
.chapter-card {
  position: absolute; left: 50%; top: calc(var(--u) * 14);
  transform: translate(-50%, -10px); opacity: 0;
  display: flex; flex-direction: column; align-items: center; gap: .15em;
  padding: .55em 1.4em .6em; background: rgba(20, 10, 34, .82);
  --b: 3px; --bc: #fff;
  box-shadow: 0 -3px 0 0 #fff, 0 3px 0 0 #fff, -3px 0 0 0 #fff, 3px 0 0 0 #fff, 0 8px 0 3px rgba(0, 0, 0, .25);
  pointer-events: none; white-space: nowrap; max-width: 92%;
}
.chapter-card .cc-num { font-size: .72em; letter-spacing: .3em; color: var(--pink-2); }
.chapter-card .cc-title { font-size: 1.3em; font-weight: 400; text-shadow: 0 2px 0 var(--ink); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chapter-card.show { animation: cardIn 3.1s steps(28) forwards; }
@keyframes cardIn {
  0% { opacity: 0; transform: translate(-50%, -18px); }
  12%, 82% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -12px); }
}

/* notice toast */
.notice {
  position: absolute; left: 50%; bottom: calc(var(--u) * 4); transform: translate(-50%, 8px);
  max-width: 90%; padding: .5em 1em; font-size: .8em; text-align: center;
  background: var(--paper); color: var(--text);
  box-shadow: 0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.notice.show { opacity: 1; transform: translate(-50%, 0); }

/* title panel */
.title-panel {
  position: absolute; z-index: 5;
  left: var(--sx); width: var(--sw);
  top: calc(var(--sy) + var(--sh) * .6); height: calc(var(--sh) * .4);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: calc(var(--u) * 1.6);
  text-align: center; padding: 0 12px;
}
.for-line { margin: 0; font-size: 1.25em; color: #fff; text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }
.for-line b { color: var(--gold); font-weight: 400; }
.for-line .from { opacity: .9; }
.btn-start { font-size: 1.4em; font-weight: 700; padding: .55em 1.5em .5em; background: var(--pink); min-height: 48px; }
.btn-start .blink { display: inline-block; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.title-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; margin-top: calc(var(--u) * 1); }
.title-row .chip { font-size: .86em; }
.hint { margin: 0; font-size: .8em; color: rgba(255, 255, 255, .82); text-shadow: 0 2px 0 var(--ink); }
.hint kbd { font-family: var(--pixel); font-size: .95em; padding: 0 .35em; margin: 0 1px; background: rgba(20, 10, 34, .75); border: 1px solid rgba(255, 255, 255, .45); }
.demo-ribbon { margin: 0; font-size: .8em; color: #fff; text-shadow: 0 2px 0 var(--ink); }
.demo-ribbon a { color: var(--gold); }

/* portrait: canvas on top, panel/controls below */
.app[data-layout="portrait"] { font-size: 16px; }
@media (min-width: 1100px) and (min-height: 700px) {
  .app[data-layout="landscape"] .for-line { font-size: 1.4em; }
  .app[data-layout="landscape"] .btn-start { font-size: 1.55em; }
  .app[data-layout="landscape"] .title-row .chip { font-size: .95em; }
}
.app[data-layout="portrait"] .title-panel {
  left: 0; width: 100%; top: calc(var(--sy) + var(--sh) + 18px); height: auto; bottom: max(16px, env(safe-area-inset-bottom));
  justify-content: center; gap: 14px;
}
.app[data-layout="portrait"] .for-line { font-size: 1.25rem; }
.app[data-layout="portrait"] .btn-start { font-size: 1.4rem; padding: .7em 1.6em; }
.app[data-layout="portrait"] .title-row { flex-direction: column; align-items: center; }
.app[data-layout="portrait"] .title-row .chip { font-size: .78rem; }
.app[data-layout="portrait"] .title-panel { justify-content: center; padding-top: 0; padding-bottom: 10px; }

/* touch controls */
.touch { position: absolute; z-index: 6; pointer-events: none; touch-action: none; -webkit-touch-callout: none; }
.touch .pad { position: absolute; display: flex; gap: 14px; pointer-events: auto; touch-action: none; }
.touch button {
  appearance: none; border: 0; padding: 0; cursor: pointer; touch-action: none;
  width: 76px; height: 76px; display: grid; place-items: center;
  font-family: var(--pixel); font-size: 30px; color: #fff;
  background: rgba(255, 255, 255, .16);
  box-shadow: 0 -3px 0 0 rgba(255, 255, 255, .6), 0 3px 0 0 rgba(255, 255, 255, .6), -3px 0 0 0 rgba(255, 255, 255, .6), 3px 0 0 0 rgba(255, 255, 255, .6), 0 7px 0 3px rgba(0, 0, 0, .25);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.touch button.jump { width: 96px; height: 96px; font-size: 40px; background: rgba(255, 77, 138, .55); color: #fff; }
.touch button.is-down { transform: translateY(3px); background: rgba(255, 255, 255, .34); }
.touch button.jump.is-down { background: rgba(255, 77, 138, .85); }
.app[data-layout="landscape"] .touch { inset: 0; }
.app[data-layout="landscape"] .touch .pad-move { left: max(14px, env(safe-area-inset-left)); bottom: 16px; }
.app[data-layout="landscape"] .touch .pad-jump { right: max(18px, env(safe-area-inset-right)); bottom: 16px; }
.app[data-layout="landscape"] .touch button { opacity: .78; }

/* ---------------------------------------------------------------- modals */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: safe center; padding: 18px;
  background: rgba(12, 6, 22, .62);
  overflow-y: auto;
}
.modal.is-open .card, .modal.is-open .q-wrap { animation: pop .32s steps(5) both; }
@keyframes pop { 0% { transform: scale(.6) translateY(16px); opacity: 0; } 60% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
.card {
  --b: 4px;
  width: min(calc(100% - 16px), 520px); margin: 8px;
  background: var(--paper); color: var(--text);
  padding: 22px 22px 18px; text-align: center;
  box-shadow:
    0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink),
    0 12px 0 4px rgba(0, 0, 0, .28);
}

/* memory */
.card-memory { background: linear-gradient(#fff9f3, #ffeef4); position: relative; }
.card-memory::before { /* pink header band */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 8px;
  background: repeating-linear-gradient(90deg, var(--pink) 0 12px, var(--gold) 12px 24px);
}
.mem-count { margin: 6px 0 0; font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.mem-emoji { font-family: var(--emoji); font-size: 58px; line-height: 1.15; margin: 6px 0 2px; animation: floaty 2.4s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-5px) rotate(-4deg); } }
.mem-date {
  display: inline-block; margin: 0 0 6px; padding: .2em .7em; font-size: .78rem; letter-spacing: .08em;
  background: var(--ink); color: var(--gold);
}
.mem-title { margin: 6px 0 12px; font-size: clamp(1.15rem, 4.2vw, 1.5rem); line-height: 1.25; font-weight: 400; color: var(--pink-deep); overflow-wrap: anywhere; }
.mem-text { margin: 0 auto 18px; max-width: 34em; font-family: var(--read); font-size: 1.06rem; line-height: 1.55; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }

/* pause menu */
.card-menu { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: min(calc(100% - 16px), 360px); }
.menu-title { margin: 0 0 8px; font-size: 1.7rem; letter-spacing: .1em; font-weight: 700; color: var(--pink-deep); }
.menu-keys { margin: 8px 0 0; font-size: .74rem; color: var(--muted); }

/* letter */
.card-letter {
  width: min(calc(100% - 16px), 640px); min-height: min(62vh, 440px); display: flex; flex-direction: column; text-align: left; padding: 26px 26px 18px;
  background: linear-gradient(#fffaf2, #fff1f2);
}
.letter-to { margin: 0 0 12px; font-size: 1.15rem; color: var(--pink-deep); font-weight: 400; }
.letter-body { flex: 1; font-family: var(--read); font-size: 1.2rem; line-height: 31px; background: repeating-linear-gradient(transparent 0 30px, rgba(255, 77, 138, .16) 30px 31px); background-attachment: local; color: var(--text); max-height: min(52vh, 420px); overflow-y: auto; padding-right: 6px; }
.letter-body p { margin: 0 0 31px; min-height: 31px; overflow-wrap: anywhere; white-space: pre-line; }
.letter-body p:not(.on) { display: none; }
.letter-body p:last-child { margin-bottom: 4px; }
.letter-from { margin: 10px 0 12px; text-align: right; font-size: 1.1rem; font-weight: 400; color: var(--pink-deep); }
.letter-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.letter-actions .btn:only-child, .letter-actions #letter-next { margin-left: auto; }

/* the question */
.modal-question { background: linear-gradient(rgba(12, 6, 22, .55), rgba(12, 6, 22, .15) 70%); align-content: start; }
.app[data-layout="landscape"] .modal-question { padding-top: calc(var(--sy) + var(--sh) * .07); }
.q-wrap { text-align: center; max-width: 760px; padding: 10px; }
.q-text {
  margin: 0 0 26px; font-size: clamp(1.5rem, 4.6vw, 2.7rem); line-height: 1.2; font-weight: 400; color: #fff; overflow-wrap: anywhere;
  text-shadow: 0 4px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 0 10px 0 rgba(0, 0, 0, .25);
}
.q-buttons { display: flex; justify-content: center; align-items: center; gap: 28px; flex-wrap: wrap; min-height: 90px; }
.btn-yes {
  font-size: clamp(1.2rem, 3.6vw, 1.6rem); padding: .6em 1.6em; background: var(--pink);
  transform: scale(var(--grow, 1)); transition: transform .25s cubic-bezier(.3, 1.7, .5, 1);
  animation: heartbeat 1.1s ease-in-out infinite;
}
@keyframes heartbeat { 0%, 100% { filter: brightness(1); } 15% { filter: brightness(1.18); } }
.btn-no { font-size: 1rem; background: var(--paper-2); color: var(--text); text-shadow: none; white-space: nowrap; }
.btn-no.is-fleeing {
  position: fixed; z-index: 60; margin: 0;
  transform: scale(var(--shrink, 1)); transform-origin: center;
  transition: left .2s cubic-bezier(.2, .9, .3, 1), top .2s cubic-bezier(.2, .9, .3, 1), transform .25s cubic-bezier(.3, 1.6, .5, 1); /* no positional overshoot: it must never leave the screen */
}
.reduce-motion .btn-no.is-fleeing { transition: none; }

/* ending */
.modal-ending { background: rgba(12, 6, 22, .12); }
.app[data-layout="landscape"] .modal-ending { justify-items: end; align-items: center; padding-right: max(18px, calc(var(--sx) + var(--sw) * .03)); }
.card-ending {
  width: min(calc(100% - 16px), 470px);
  background: rgba(24, 12, 40, .93); color: #fff;
  box-shadow: 0 -4px 0 0 var(--pink), 0 4px 0 0 var(--pink), -4px 0 0 0 var(--pink), 4px 0 0 0 var(--pink), 0 12px 0 4px rgba(0, 0, 0, .3);
}
.app[data-layout="landscape"] .card-ending { width: min(44vw, 470px); }
.end-title {
  margin: 0 0 10px; font-size: clamp(1.1rem, 2.6vw, 1.45rem); line-height: 1.3; letter-spacing: .02em; font-weight: 400;
  color: var(--gold); text-shadow: 0 3px 0 #000;
}
.end-title span { color: var(--pink); display: inline-block; animation: blink 1s steps(2) infinite; }
.end-msg { margin: 0 auto 14px; max-width: 32em; font-family: var(--read); font-size: 1.05rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.stats { margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.stats div { background: rgba(255, 255, 255, .07); padding: 8px 6px 7px; display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; }
.stats dt { font-size: .62rem; letter-spacing: .04em; color: var(--lilac); text-transform: uppercase; }
.stats dd { margin: 0; font-size: 1.15rem; color: #fff; }
.end-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 18px; }
.end-link { color: var(--pink-2); font-size: .95rem; }
.end-link:hover { color: #fff; }

.noscript { position: fixed; inset: auto 0 20px; text-align: center; }

@media (max-height: 520px) and (orientation: landscape) {
  .title-panel { gap: 6px; }
  .title-panel .hint { display: none; }
  .btn-start { min-height: 40px; padding: .4em 1.3em; }
  .title-row { margin-top: 0; }
  .title-row .chip { min-height: 30px; padding: .25em .7em; }
  .chapter-card { font-size: 13px; top: 10px; }
  .modal { padding: 8px; }
  .card-ending { padding: 10px 12px 10px; }
  .end-title { font-size: 1rem; margin-bottom: 6px; }
  .end-msg { font-size: .9rem; line-height: 1.35; margin-bottom: 8px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 8px; }
  .stats dd { font-size: .9rem; }
  .stats dt { font-size: .5rem; }
  .end-actions .btn { min-height: 38px; }
  .card { padding: 14px 16px 12px; }
  .mem-emoji { font-size: 40px; }
  .mem-text { font-size: .98rem; margin-bottom: 10px; }
  .letter-body { max-height: 46vh; }
  .stats div { padding: 5px 4px; }
  .end-msg { margin-bottom: 8px; }
}
@media (max-width: 420px) {
  .card { padding: 18px 16px 14px; }
  .q-buttons { gap: 18px; }
}

/* ================================================================ PORTRAIT — made for phones
   The canvas is a narrower slice of the level (see ui.layout) that fills the phone's width.
   Below it: a slim chapter/progress strip, then a handheld-style control deck. */
.app[data-layout="portrait"] .stage {
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 7px #3b2458, 0 0 0 9px var(--ink), 0 14px 40px rgba(0, 0, 0, .55);
}
.app[data-layout="portrait"] .hud { display: none; }
.app[data-layout="portrait"] .chapter-card { display: none; } /* the deck strip carries the chapter title in portrait */
.deck-title.flash { animation: deckFlash 2.4s steps(12) both; }
@keyframes deckFlash { 0% { opacity: 0; transform: translateX(-10px); color: var(--gold); } 20% { opacity: 1; transform: none; color: var(--gold); } 70% { color: var(--gold); } 100% { color: #fff; } }
.app[data-layout="portrait"] .notice { font-size: 13px; }

/* chapter + progress strip */
.deck { display: none; }
.app[data-layout="portrait"] .deck {
  display: block; position: absolute; z-index: 7;
  left: 14px; right: 14px; top: calc(var(--sy) + var(--sh) + 16px);
  --p: 0;
}
.app[data-layout="portrait"] .deck[hidden] { display: none; }
.deck-row { display: flex; align-items: center; gap: 10px; }
.deck-ch {
  flex: none; font-size: 11px; letter-spacing: .08em; color: var(--ink); background: var(--pink-2);
  padding: 4px 6px 3px; box-shadow: 0 2px 0 var(--pink-deep);
}
.deck-title { flex: 1; min-width: 0; font-size: 15px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 var(--ink); }
.deck-pause {
  flex: none; appearance: none; border: 0; cursor: pointer; width: 46px; height: 36px;
  font-family: var(--pixel); font-size: 14px; letter-spacing: -.1em; color: #fff; background: rgba(255, 255, 255, .1);
  box-shadow: 0 -2px 0 0 rgba(255, 255, 255, .55), 0 2px 0 0 rgba(255, 255, 255, .55), -2px 0 0 0 rgba(255, 255, 255, .55), 2px 0 0 0 rgba(255, 255, 255, .55);
}
.deck-pause:active { transform: translateY(2px); }
.deck-track {
  position: relative; height: 10px; margin: 12px 8px 0 4px; background: rgba(255, 255, 255, .08);
  box-shadow: 0 -2px 0 0 #120a20, 0 2px 0 0 #120a20, -2px 0 0 0 #120a20, 2px 0 0 0 #120a20;
  background-image: repeating-linear-gradient(90deg, transparent 0 14px, rgba(255, 255, 255, .07) 14px 16px);
}
.deck-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p) * 100%); background: linear-gradient(90deg, #c7246a, var(--pink)); }
.deck-me, .deck-goal { position: absolute; top: 50%; font-size: 17px; line-height: 1; transform: translate(-50%, -55%); text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }
.deck-me { left: calc(var(--p) * 100%); color: #fff; }
.deck-goal { left: 100%; color: var(--gold); }

/* turn-sideways hint */
.rotate-hint { display: none; }
.app[data-layout="portrait"] .rotate-hint {
  display: flex; align-items: center; gap: 8px; position: absolute; z-index: 8;
  left: 50%; transform: translateX(-50%); top: calc(var(--sy) + var(--sh) + 96px);
  margin: 0; padding: 6px 6px 6px 12px; white-space: nowrap;
  font-size: 12px; color: #fff; background: rgba(20, 10, 34, .88);
  box-shadow: 0 -2px 0 0 var(--lilac), 0 2px 0 0 var(--lilac), -2px 0 0 0 var(--lilac), 2px 0 0 0 var(--lilac);
  animation: hintIn .5s steps(5) both;
}
.app[data-layout="portrait"] .rotate-hint[hidden] { display: none; }
.rotate-hint span { color: var(--lilac); font-size: 16px; }
.rotate-hint button { appearance: none; border: 0; cursor: pointer; width: 30px; height: 30px; font: inherit; font-size: 16px; color: #fff; background: rgba(255, 255, 255, .1); }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* handheld-style control deck */
.app[data-layout="portrait"] .touch {
  left: 10px; right: 10px; top: calc(var(--sy) + var(--sh) + 78px); bottom: max(10px, env(safe-area-inset-bottom));
  background:
    radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1.5px) 0 0 / 10px 10px,
    linear-gradient(#2a1844, #1f1234);
  box-shadow: 0 -3px 0 0 #3b2458, 0 3px 0 0 #120a20, -3px 0 0 0 #33204d, 3px 0 0 0 #33204d;
}
.app[data-layout="portrait"] .touch .pad { top: 50%; transform: translateY(-46%); }
.app[data-layout="portrait"] .touch .pad-move { left: 16px; gap: 12px; }
.app[data-layout="portrait"] .touch .pad-jump { right: 18px; }
.app[data-layout="portrait"] .touch button { width: min(24vw, 96px); height: min(24vw, 96px); font-size: 32px; }
.app[data-layout="portrait"] .touch button.jump { width: min(31vw, 124px); height: min(31vw, 124px); font-size: 44px; }
.touch-badge { display: none; }
.app[data-layout="portrait"] .touch-badge {
  display: block; position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center;
  font-size: 10px; letter-spacing: .3em; color: rgba(255, 255, 255, .22); pointer-events: none;
}

/* dialogs in portrait */
.app[data-layout="portrait"] #m-memory { align-items: end; padding: 10px 8px max(12px, env(safe-area-inset-bottom)); }
.app[data-layout="portrait"] #m-memory .card { width: 100%; margin: 0; }
.app[data-layout="portrait"] .modal-question {
  align-content: center; padding-top: calc(var(--sy) + var(--sh) + 12px); padding-bottom: 24px;
  background: linear-gradient(rgba(12, 6, 22, .15), rgba(12, 6, 22, .15) calc(var(--sy) + var(--sh)), rgba(20, 10, 34, .9) calc(var(--sy) + var(--sh)));
}
.app[data-layout="portrait"] .q-text { font-size: clamp(1.35rem, 6.4vw, 2rem); margin-bottom: 22px; }
.app[data-layout="portrait"] .q-buttons { gap: 18px; }
.app[data-layout="portrait"] .modal-ending { align-items: end; padding: calc(var(--sy) + var(--sh) * .66) 8px max(10px, env(safe-area-inset-bottom)); }
.app[data-layout="portrait"] .card-ending { width: 100%; margin: 0; padding: 16px 14px 12px; }
.app[data-layout="portrait"] .end-title { font-size: 1.05rem; }
.app[data-layout="portrait"] .end-msg { font-size: .98rem; line-height: 1.45; margin-bottom: 10px; }
.app[data-layout="portrait"] .stats { grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; }
.app[data-layout="portrait"] .stats div { padding: 6px 2px 5px; }
.app[data-layout="portrait"] .stats dd { font-size: .95rem; }
.app[data-layout="portrait"] .stats dt { font-size: .5rem; }
.app[data-layout="portrait"] .letter-body { max-height: 48vh; }
