body.game-active {
  background: #b8deea;
}
body.game-active #title-screen {
  visibility: hidden;
}
.game {
  position: fixed;
  inset: 0;
  z-index: 20;
  color: var(--ink);
  pointer-events: none;
  outline: none;
  overflow: hidden;
  height: 100dvh;
}
.game button,
.game a,
.game dialog {
  pointer-events: auto;
}
.play-hud {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  right: max(24px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  z-index: 5;
  min-height: 44px;
}
.player-name {
  font-size: 23px;
  letter-spacing: -0.045em;
  line-height: 1.2;
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 22px;
}
.hud-counters {
  display: flex;
  align-items: center;
  gap: 19px;
}
.coin-counter,
.life-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-family: GamePixel, monospace;
}
.hud-counters b {
  font-weight: 400;
}
.coin-counter > i,
.deck-stats i {
  display: block;
  width: 14px;
  height: 19px;
  background: #ffcf4c;
  border: 2px solid #fff0a6;
  border-radius: 50%;
  box-shadow:
    2px 0 #bd7c2b,
    inset 2px 0 #eaa738;
}
.life-counter > span:first-child {
  color: #d94334;
  font-size: 23px;
  line-height: 1;
}
.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid #fff9e7;
  border-radius: 9px;
  background: #fffdf2ed;
  box-shadow: 0 3px #5c8a8855;
  font-size: 23px;
  line-height: 1;
  transition: transform 0.15s;
}
.icon-button:active {
  transform: translateY(2px);
}
.resume-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  min-height: 44px;
  padding: 0 4px;
}
.resume-link svg {
  width: 19px;
  height: 19px;
}
.resume-link:hover {
  color: #a43328;
}

/* A quiet reading placard leaves the world at full height on a laptop. */
.profile-panel,
.narrative-panel {
  position: absolute;
  top: max(86px, calc(env(safe-area-inset-top) + 70px));
  left: max(24px, env(safe-area-inset-left));
  right: auto;
  width: clamp(270px, 26vw, 350px);
  padding: 23px;
  background: linear-gradient(145deg, #fffdf5f7, #f7f4e9f7);
  color: #173e43;
  border: 1px solid #ffffffe6;
  border-radius: 13px;
  box-shadow:
    0 4px 0 #738b6d35,
    0 13px 36px #21454a20;
  z-index: 5;
  pointer-events: auto;
  max-height: calc(100dvh - 116px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #bdcbb3 transparent;
}
.profile-panel {
  display: block;
  cursor: pointer;
}
.profile-company {
  min-width: 0;
}
.profile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 35px;
  padding-right: 28px;
}
.profile-brand h2 {
  font-size: 21px;
  letter-spacing: -0.04em;
}
.profile-brand img {
  width: 160px;
  height: 35px;
  object-fit: contain;
  object-position: left center;
}
.profile-panel[data-kind="bits"] .profile-brand img {
  width: 34px;
  height: 34px;
}
.profile-panel[data-kind="qapita"] .profile-brand img {
  width: 108px;
  height: 37px;
  background: #1b1833;
  padding: 5px 9px;
  border-radius: 5px;
}
.profile-panel[data-kind="deutsche"] .profile-brand img {
  width: 159px;
  height: 24px;
}
.profile-panel[data-kind="damensch"] .profile-brand img {
  width: 145px;
  height: 25px;
}
#profile-backers {
  font-size: 11px;
  line-height: 1.55;
  color: #5c7468;
  margin-top: 10px;
}
#profile-description {
  font-size: 13px;
  line-height: 1.5;
  color: #4f6c60;
  margin-top: 6px;
}
#profile-backers:empty,
#profile-description:empty,
#profile-role:empty {
  display: none;
}
.profile-position {
  margin-top: 19px;
}
#profile-role {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
}
#profile-period {
  font-size: 12px;
  line-height: 1.5;
  color: #597568;
  margin-top: 5px;
}
.profile-panel[data-kind="bits"] .profile-position {
  margin-top: 11px;
}
.profile-result {
  margin-top: 19px;
  padding-top: 8px;
  border-top: 1px solid #dbe3d2;
}
.profile-work {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}
.profile-work li {
  min-width: 0;
}
.work-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 44px;
  padding: 10px 0;
  background: transparent;
  text-align: left;
  border-bottom: 1px solid #dfe7d5;
  color: #173e43;
}
.profile-work li:last-child .work-heading {
  border-bottom: 0;
}
.work-heading strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
}
.work-plus {
  display: block;
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  color: #5c7d63;
}
.work-heading:hover strong,
.work-heading:hover .work-plus {
  color: #27725e;
}
.work-heading:active {
  transform: translateY(1px);
}
.details-button {
  position: absolute;
  right: 16px;
  top: 22px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: #52705b;
}
.details-button > span:last-child {
  display: none;
}
.info-icon {
  font-family: Georgia, serif;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-style: italic;
  font-size: 13px;
  line-height: 1;
}
.details-button:hover {
  background: #e8efde;
  color: #214f42;
}

.narrative-panel {
  z-index: 7;
  padding: 25px;
  animation: story-arrive 0.28s var(--ease);
}
#narrative-copy {
  outline: none;
  min-width: 0;
}
#narrative-copy h2 {
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.04em;
}
#narrative-copy h2 span {
  display: block;
}
.narrative-aside {
  font-size: 14px;
  line-height: 1.6;
  color: #4f7564;
  margin-top: 15px;
}
.narrative-continue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 17px;
  width: 100%;
  min-height: 45px;
  padding: 0 14px;
  margin-top: 23px;
  border-radius: 7px;
  border: 1px solid #d7e2ca;
  background: #e8efde;
  font-size: 13px;
  font-weight: 600;
}
.narrative-continue > span {
  font-size: 21px;
}
.narrative-continue kbd {
  margin-left: auto;
  font-size: 9px;
  color: #5b7463;
}
.narrative-continue:hover {
  background: #dfead3;
}
.personal-origin {
  font-size: 13px;
  color: #4f7564;
  margin-bottom: 20px;
}
.personal-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 21px;
}
.personal-list h2 {
  font-size: 19px !important;
  line-height: 1.4 !important;
  letter-spacing: -0.025em !important;
}
.personal-list p {
  font-size: 14px;
  line-height: 1.55;
  color: #4f7564;
  margin-top: 5px;
}

.game-prompt {
  position: absolute;
  left: 50%;
  top: calc(var(--play-top, 0px) + 20px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 30px);
  padding: 10px 15px;
  background: #fffdf2f5;
  color: #315b58;
  border: 1px solid #fff9e7;
  border-radius: 8px;
  box-shadow: 0 3px #477d7e33;
  z-index: 5;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.game-prompt > button {
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: #204f4c;
  padding: 6px 0;
}
.game[data-prompt="story"] .game-prompt {
  border-color: #ffd35e;
  background: #fff1bd;
  font-weight: 600;
  transform: translate(-50%, -100%);
}
.game[data-prompt="story"] .game-prompt[data-anchor="below"] {
  transform: translateX(-50%);
}
.coin-feedback {
  position: absolute;
  top: 70px;
  right: 91px;
  padding: 7px 11px;
  border-radius: 7px;
  background: #ffdf72;
  color: #5f4d1b;
  font-family: GamePixel, monospace;
  font-size: 12px;
  z-index: 6;
  pointer-events: none;
}
.coin-collected .coin-counter > i {
  box-shadow:
    0 0 0 5px #ffd35e44,
    2px 0 #bd7c2b;
}
.pipe-action {
  display: none !important;
}
#pipe-iris {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}
.controller-deck,
.pad-controls {
  display: none;
}

.game dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 30px;
  border: 1px solid #e5edda;
  background: #fffdf2;
  color: var(--ink);
  width: min(440px, calc(100% - 36px));
  max-height: 90dvh;
  border-radius: 16px;
  box-shadow:
    0 6px #b4c3a8,
    0 20px 80px #132e4555;
  overflow: auto;
  overscroll-behavior: contain;
  animation: dialog-arrive 0.2s var(--ease);
}
.game dialog::backdrop {
  background: #173e4366;
  backdrop-filter: blur(4px);
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}
.game-dialog h2 {
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -0.05em;
  font-weight: 700;
}
.close-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: #edf2e2;
  border-radius: 50%;
  font-size: 27px;
  font-weight: 400;
  color: #486c59;
}
.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  background: var(--red);
  color: #fff9e7;
  font-weight: 700;
  font-size: 14px;
  padding: 16px 19px;
  border: 1px solid #ff9275;
  border-radius: 8px;
  box-shadow:
    0 4px var(--red-dark),
    inset 0 1px #ffa58a;
  min-height: 52px;
  text-align: left;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.primary-button > span {
  display: flex;
  align-items: center;
  gap: 19px;
  font-weight: 400;
  font-size: 11px;
}
.primary-button > span > b {
  font-size: 22px;
  font-weight: 400;
}
.primary-button:hover {
  background: #ed513c;
}
.primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px var(--red-dark);
}
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.menu-grid > button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 12px;
  background: #edf2e2;
  border: 1px solid #dfe7d2;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  min-height: 49px;
}
.menu-grid > button > span {
  font-size: 18px;
  color: #51745b;
  line-height: 1;
}
.menu-grid > button:hover {
  background: #e1edd4;
}
.menu-bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 23px;
}
.menu-bottom button,
.text-button {
  font-size: 12px;
  padding: 12px 0;
  background: transparent;
  color: #506c5d;
}
.menu-help {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 19px;
  border-top: 1px solid #e0e8d5;
  font-size: 11px;
  color: #59715f;
}
.menu-help kbd {
  font-size: 10px;
  padding: 3px 4px;
}
.menu-help kbd:nth-of-type(3) {
  margin-left: 8px;
}
.map-stop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #e0e8d5;
  background: transparent;
  text-align: left;
  width: 100%;
  min-height: 65px;
}
.map-stop > img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #fff;
  padding: 5px;
  border-radius: 5px;
}
.map-stop > span {
  flex: 1;
}
.map-stop strong {
  font-size: 15px;
  display: block;
  line-height: 1.4;
}
.map-stop small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #59715f;
}
.map-stop > i {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 1px solid #b5c9aa;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-style: normal;
  color: #5e7d5c;
}
.map-stop.visited > i {
  background: #4d805d;
  border-color: #4d805d;
  color: #fff9e7;
}
.map-stop:hover strong {
  color: #427c55;
}
.game dialog.story-dialog {
  inset: max(24px, env(safe-area-inset-top)) auto auto 50%;
  margin: 0;
  transform: translateX(-50%);
  width: min(920px, calc(100% - 48px));
  max-height: calc(100dvh - 52px);
  padding: 0;
  overflow: hidden;
  animation: chapter-arrive 0.25s var(--ease);
}
.story-dialog[open] {
  display: flex;
  flex-direction: column;
}
#chapter-content {
  overflow-y: auto;
  min-height: 0;
  padding: 30px 35px 25px;
  scrollbar-width: thin;
  scrollbar-color: #bfceb2 transparent;
}
.company-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}
.company-brand img {
  width: 180px;
  height: 42px;
  object-fit: contain;
  object-position: left center;
}
.company-brand.brand-bits img {
  width: 42px;
  height: 42px;
}
.company-brand.brand-bits span {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.company-brand.brand-qapita img {
  width: 128px;
  height: 45px;
  padding: 6px 11px;
  background: #1b1833;
  border-radius: 6px;
}
.company-brand.brand-deutsche img {
  width: 180px;
  height: 30px;
}
.company-brand.brand-damensch img {
  width: 166px;
  height: 31px;
}
#chapter-title {
  font-size: 23px;
  letter-spacing: -0.025em;
  line-height: 1.35;
  font-weight: 600;
  outline: none;
  margin-top: 16px;
  max-width: 760px;
}
.chapter-period {
  font-size: 13px;
  line-height: 1.6;
  color: #59715f;
  margin-top: 5px;
}
.chapter-backers {
  font-size: 12px;
  color: #59715f;
  line-height: 1.6;
  margin-top: 16px;
}
.chapter-description {
  font-size: 14px;
  color: #4c6a5b;
  line-height: 1.6;
  margin-top: 5px;
  max-width: 690px;
}
.contributions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 35px;
  margin-top: 25px;
  padding-top: 24px;
  border-top: 1px solid #dbe4d0;
}
.contribution h3 {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.025em;
  color: #173e43;
}
.contribution p {
  font-size: 15px;
  line-height: 1.65;
  margin-top: 10px;
  color: #486457;
  max-width: 74ch;
}
.contribution.featured {
  grid-column: 1 / -1;
}
.contribution.featured h3 {
  font-size: 32px;
  letter-spacing: -0.04em;
  line-height: 1.2;
  color: #216354;
}
.contribution.featured p {
  font-size: 17px;
  line-height: 1.6;
}
.story-dialog[data-company="bits"] .contributions {
  grid-template-columns: 1fr 1fr;
}
.story-dialog[data-company="bits"] .contribution.featured {
  grid-column: auto;
}
.story-dialog[data-company="bits"] .contribution:last-child {
  grid-column: 1 / -1;
}
.story-dialog[data-company="bits"] .contribution.featured h3 {
  font-size: 45px;
}
.story-dialog[data-company="damensch"] .contributions,
.story-dialog[data-company="deutsche"] .contributions {
  grid-template-columns: 1fr;
  gap: 23px;
}
.story-dialog[data-company="damensch"] .contribution,
.story-dialog[data-company="deutsche"] .contribution {
  display: grid;
  grid-template-columns: 220px 1fr;
  column-gap: 26px;
}
.story-dialog[data-company="damensch"] .contribution h3,
.story-dialog[data-company="deutsche"] .contribution h3 {
  grid-column: 1;
  grid-row: 1 / 3;
}
.story-dialog[data-company="damensch"] .contribution p,
.story-dialog[data-company="deutsche"] .contribution p {
  grid-column: 2;
  margin-top: 0;
}
.story-dialog[data-company="damensch"] .contribution p + p {
  margin-top: 8px;
}
.chapter-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 19px 35px 23px;
  background: #f4f6e9;
  border-top: 1px solid #dfe7d4;
}
.chapter-footer > p {
  font-size: 12px;
  line-height: 1.5;
  color: #59715f;
}
.chapter-footer .primary-button {
  width: 250px;
  flex-shrink: 0;
}
.retry-dialog,
.victory-dialog {
  text-align: center;
}
.retry-symbol {
  display: block;
  font-size: 62px;
  color: #467c54;
  line-height: 1.2;
  margin: 0 0 17px;
}
.retry-dialog > p {
  margin-top: 15px;
  color: #59715f;
  font-size: 14px;
  line-height: 1.7;
}
.retry-dialog > .primary-button {
  margin-top: 27px;
}
.retry-dialog > .text-button {
  margin-top: 20px;
}
.game dialog.victory-dialog {
  width: min(500px, calc(100% - 36px));
  padding: 30px 35px;
}
.victory-star {
  font-size: 43px;
  line-height: 1.2;
  color: #e8a523;
  text-shadow: 0 3px #bb7c19;
  margin-bottom: 20px;
}
.pixel-label {
  font-family: GamePixel, monospace;
  color: #557748;
  font-size: 9px;
  line-height: 1.8;
}
.victory-dialog h2 {
  text-wrap: balance;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.055em;
  margin-top: 17px;
  outline: none;
}
.victory-invite {
  font-size: 15px;
  color: #486d53;
  line-height: 1.7;
  margin-top: 15px;
}
.victory-stats {
  display: flex;
  justify-content: space-around;
  gap: 15px;
  margin: 25px 0;
  padding: 20px 0;
  border-top: 1px solid #dbe4d0;
  border-bottom: 1px solid #dbe4d0;
}
.victory-stats span {
  display: block;
  font-size: 12px;
  color: #59715f;
  margin-bottom: 11px;
}
.victory-stats b {
  font-family: GamePixel, monospace;
  font-size: 13px;
  font-weight: 400;
  color: #356444;
}
.victory-bottom {
  display: flex;
  justify-content: space-between;
  margin-top: 17px;
  font-size: 13px;
  color: #4c6b55;
}
.victory-bottom button {
  background: transparent;
  padding: 10px 0;
  font-size: 13px;
  color: #4c6b55;
}
.victory-bottom a {
  padding: 10px 0;
}
.contact-dialog > p {
  font-size: 15px;
  color: #59715f;
  margin-bottom: 23px;
}
.contact-link {
  font-size: 14px;
  display: block;
  padding: 23px 0 0;
  text-align: center;
  color: #486d53;
}
.download-resume {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  font-size: 13px;
  margin-top: 17px;
  color: #486d53;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.game-fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(430px, calc(100% - 40px));
  background: #fff9e7;
  padding: 30px;
  border-radius: 14px;
  pointer-events: auto;
  z-index: 10;
}
.game-fallback h2 {
  font-size: 27px;
  letter-spacing: -0.04em;
}
.game-fallback p {
  font-size: 14px;
  line-height: 1.7;
  margin-top: 15px;
}
.game-fallback a,
.game-fallback button {
  display: block;
  padding: 14px 0;
  background: none;
  text-decoration: underline;
  font-size: 14px;
}

/* Details remain one focused reading surface, with a fixed return action. */
.chapter-footer {
  justify-content: flex-end;
}
.chapter-footer > p {
  margin-right: auto;
}
.game dialog.story-dialog[data-single="true"] {
  width: min(720px, calc(100% - 48px));
}
.story-dialog[data-single="true"] .contributions {
  grid-template-columns: 1fr !important;
}
.story-dialog[data-single="true"] .contribution {
  display: block !important;
  grid-column: 1 !important;
}
.story-dialog[data-single="true"] .contribution p {
  margin-top: 10px !important;
}
.story-dialog[data-single="true"] .contribution.featured h3 {
  font-size: 30px;
}
@keyframes dialog-arrive {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes chapter-arrive {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
@keyframes story-arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Touch portrait keeps a dedicated reading area, play screen and controller. */
@media (max-width: 760px) and (orientation: portrait),
  (pointer: coarse) and (orientation: portrait) {
  .play-hud {
    top: max(13px, env(safe-area-inset-top));
    left: max(17px, env(safe-area-inset-left));
    right: max(17px, env(safe-area-inset-right));
    gap: 12px;
  }
  .player-name {
    font-size: 21px;
  }
  .hud-right {
    gap: 12px;
  }
  .hud-counters {
    display: none;
  }
  .resume-link span {
    display: none;
  }
  .resume-link {
    width: 34px;
    justify-content: center;
  }
  .icon-button {
    width: 42px;
    height: 42px;
  }
  .profile-panel,
  .narrative-panel {
    left: max(15px, env(safe-area-inset-left));
    right: max(15px, env(safe-area-inset-right));
    width: auto;
    top: calc(max(13px, env(safe-area-inset-top)) + 55px);
    padding: 14px 16px;
    border-radius: 10px;
    max-height: calc(100dvh - 210px);
    overflow-y: auto;
  }
  .profile-brand {
    min-height: 29px;
  }
  .profile-brand h2 {
    font-size: 19px;
  }
  .profile-brand img {
    width: 136px;
    height: 29px;
  }
  .profile-panel[data-kind="bits"] .profile-brand img {
    width: 29px;
    height: 29px;
  }
  .profile-panel[data-kind="qapita"] .profile-brand img {
    width: 94px;
    height: 32px;
    padding: 4px 8px;
  }
  .profile-panel[data-kind="deutsche"] .profile-brand img {
    width: 140px;
    height: 21px;
  }
  .profile-panel[data-kind="damensch"] .profile-brand img {
    width: 128px;
    height: 22px;
  }
  .details-button {
    top: 12px;
    right: 11px;
  }
  #profile-backers {
    font-size: 10px;
    line-height: 1.4;
    margin-top: 7px;
  }
  #profile-description {
    font-size: 11px;
    line-height: 1.4;
    margin-top: 4px;
  }
  .profile-position {
    margin-top: 10px;
  }
  #profile-role {
    font-size: 13px;
    line-height: 1.4;
  }
  #profile-period {
    font-size: 10px;
    line-height: 1.4;
    margin-top: 3px;
  }
  .profile-panel[data-kind="bits"] .profile-position {
    display: none;
  }
  .profile-result {
    margin-top: 11px;
    padding-top: 4px;
  }
  .work-heading {
    min-height: 32px;
    padding: 6px 0;
    gap: 12px;
  }
  .work-heading strong {
    font-size: 13.5px;
    line-height: 1.35;
  }
  .work-plus {
    font-size: 17px;
  }
  .narrative-panel {
    padding: 19px;
    max-height: calc(100dvh - 180px);
  }
  #narrative-copy h2 {
    font-size: 25px;
  }
  .narrative-aside {
    font-size: 13px;
    margin-top: 12px;
  }
  .narrative-continue {
    margin-top: 18px;
    min-height: 42px;
    font-size: 12px;
  }
  .narrative-continue kbd {
    display: none;
  }
  .personal-origin {
    font-size: 12px;
    margin-bottom: 14px;
  }
  .personal-list {
    gap: 15px;
  }
  .personal-list h2 {
    font-size: 17px !important;
  }
  .personal-list p {
    font-size: 13px;
    line-height: 1.5;
    margin-top: 3px;
  }
  .world-stage.game-world {
    bottom: 137px;
    border-bottom: 4px solid #718a77;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
  }
  .controller-deck {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 140px;
    background: #e7eadb;
    border-radius: 13px 13px 0 0;
    box-shadow:
      inset 0 3px #bccdb6,
      inset 0 5px #fafbeb;
    pointer-events: none;
    z-index: 1;
  }
  .deck-stats {
    display: flex;
    position: absolute;
    top: 15px;
    left: 24px;
    gap: 18px;
    color: #4e7055;
    font-family: GamePixel, monospace;
    font-size: 7px;
  }
  .deck-stats > span {
    display: flex;
    align-items: center;
    gap: 7px;
  }
  .deck-stats b {
    font-weight: 400;
  }
  .deck-stats i {
    width: 9px;
    height: 12px;
    border-width: 1px;
    box-shadow: 1px 0 #b68c40;
  }
  .speaker-grille {
    position: absolute;
    top: 17px;
    right: 25px;
    width: 38px;
    height: 12px;
    background: repeating-linear-gradient(
      110deg,
      transparent 0,
      transparent 5px,
      #b5c1aa 6px,
      #b5c1aa 8px,
      transparent 9px
    );
    border-radius: 3px;
  }
  .pad-controls {
    position: absolute;
    bottom: max(21px, env(safe-area-inset-bottom));
    left: max(23px, env(safe-area-inset-left));
    right: max(23px, env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 6;
    gap: 20px;
  }
  .direction-pad {
    display: flex;
    gap: 13px;
  }
  .pad-controls button {
    pointer-events: auto;
    width: 57px;
    height: 57px;
    min-width: 57px;
    border-radius: 50%;
    color: #edf6df;
    background: #588b70;
    border: 1px solid #8fb89a;
    box-shadow:
      0 5px #345a4c,
      inset 0 2px #9cc29e;
    font-size: 20px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .pad-controls button:active {
    transform: translateY(3px);
    background: #417b5e;
    box-shadow: 0 2px #345a4c;
  }
  .pad-controls #touch-jump {
    width: 70px;
    height: 70px;
    min-width: 70px;
    background: #e84531;
    border-color: #ff9170;
    box-shadow:
      0 5px #a32c24,
      inset 0 2px #ffac87;
    font-family: GamePixel, monospace;
    font-size: 21px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
  }
  #touch-jump small {
    font-family: Manrope, Arial, sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #ffe1c3;
  }
  #touch-jump:active {
    box-shadow: 0 2px #a32c24;
  }
  .game-prompt {
    font-size: 11px;
    padding: 8px 12px;
  }
  .coin-feedback {
    top: calc(var(--play-top, 210px) + 13px);
    right: 14px;
    font-size: 9px;
    padding: 6px 8px;
  }
}
@media (min-width: 761px) and (pointer: coarse) and (orientation: portrait) {
  .profile-panel {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0 24px;
    padding: 18px 22px;
  }
  .profile-company {
    grid-column: 1;
    grid-row: 1;
  }
  .profile-position {
    grid-column: 1;
    grid-row: 2;
  }
  .profile-result {
    grid-column: 2;
    grid-row: 1 / 3;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .work-heading strong {
    font-size: 15px;
  }
  .work-heading {
    min-height: 42px;
  }
  .details-button {
    display: none;
  }
}
@media (max-width: 370px) and (orientation: portrait) {
  .play-hud {
    left: 13px;
    right: 13px;
  }
  .player-name {
    font-size: 19px;
  }
  .hud-right {
    gap: 7px;
  }
  .profile-panel,
  .narrative-panel {
    left: 12px;
    right: 12px;
    padding: 12px 14px;
  }
  #profile-backers {
    display: none;
  }
  .work-heading strong {
    font-size: 13px;
  }
  .pad-controls {
    left: 19px;
    right: 19px;
  }
  .direction-pad {
    gap: 12px;
  }
  .pad-controls button {
    width: 53px;
    height: 53px;
    min-width: 53px;
  }
  .pad-controls #touch-jump {
    width: 66px;
    height: 66px;
    min-width: 66px;
  }
  #narrative-copy h2 {
    font-size: 23px;
  }
  .personal-list h2 {
    font-size: 16px !important;
  }
  .personal-list p {
    font-size: 12px;
  }
}
@media (max-width: 760px) and (max-height: 760px) and (orientation: portrait) {
  #profile-backers,
  #profile-description {
    display: none;
  }
  .world-stage.game-world {
    bottom: 111px;
  }
  .controller-deck {
    height: 114px;
  }
  .pad-controls {
    bottom: max(16px, env(safe-area-inset-bottom));
  }
  .deck-stats {
    top: 12px;
  }
  .speaker-grille {
    top: 13px;
  }
  .pad-controls button {
    width: 51px;
    height: 51px;
    min-width: 51px;
  }
  .pad-controls #touch-jump {
    width: 62px;
    height: 62px;
    min-width: 62px;
  }
  .profile-panel {
    max-height: calc(100dvh - 190px);
  }
}

/* Landscape is a full diorama with a compact left placard. */
@media (max-height: 500px) and (orientation: landscape) {
  .play-hud {
    top: max(10px, env(safe-area-inset-top));
    left: max(19px, env(safe-area-inset-left));
    right: max(19px, env(safe-area-inset-right));
    min-height: 38px;
  }
  .player-name {
    font-size: 19px;
  }
  .icon-button {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }
  .resume-link {
    min-height: 38px;
  }
  .resume-link span {
    display: none;
  }
  .resume-link {
    width: 30px;
    justify-content: center;
  }
  .hud-counters {
    font-size: 8px;
    gap: 14px;
  }
  .coin-counter,
  .life-counter {
    font-size: 8px;
  }
  .profile-panel,
  .narrative-panel {
    left: max(19px, env(safe-area-inset-left));
    top: 59px;
    width: clamp(210px, 30vw, 270px);
    padding: 14px;
    max-height: calc(100dvh - 139px);
    border-radius: 10px;
  }
  .profile-brand {
    min-height: 26px;
  }
  .profile-brand img {
    height: 25px;
    width: 130px;
  }
  .profile-brand h2 {
    font-size: 17px;
  }
  .profile-panel[data-kind="bits"] .profile-brand img {
    width: 27px;
    height: 27px;
  }
  .profile-panel[data-kind="qapita"] .profile-brand img {
    width: 85px;
    height: 29px;
  }
  .profile-panel[data-kind="deutsche"] .profile-brand img {
    width: 135px;
    height: 20px;
  }
  .profile-panel[data-kind="damensch"] .profile-brand img {
    width: 125px;
    height: 21px;
  }
  .details-button {
    top: 11px;
    right: 9px;
    width: 26px;
    height: 26px;
    min-height: 26px;
  }
  .info-icon {
    width: 16px;
    height: 16px;
    font-size: 11px;
  }
  #profile-backers,
  #profile-description {
    display: none;
  }
  .profile-position {
    margin-top: 10px;
  }
  #profile-role {
    font-size: 12px;
    line-height: 1.35;
  }
  #profile-period {
    font-size: 10px;
    line-height: 1.35;
    margin-top: 3px;
  }
  .profile-panel[data-kind="bits"] .profile-position {
    display: none;
  }
  .profile-result {
    margin-top: 10px;
    padding-top: 3px;
  }
  .work-heading {
    min-height: 28px;
    padding: 5px 0;
    gap: 10px;
  }
  .work-heading strong {
    font-size: 12px;
    line-height: 1.3;
  }
  .work-plus {
    font-size: 16px;
  }
  #narrative-copy h2 {
    font-size: 21px;
  }
  .narrative-aside {
    font-size: 12px;
    margin-top: 10px;
  }
  .narrative-continue {
    margin-top: 15px;
    min-height: 38px;
    font-size: 11px;
    padding: 0 10px;
    gap: 10px;
  }
  .narrative-continue kbd {
    display: none;
  }
  .personal-origin {
    font-size: 10px;
    margin-bottom: 10px;
  }
  .personal-list {
    gap: 12px;
  }
  .personal-list h2 {
    font-size: 14px !important;
  }
  .personal-list p {
    font-size: 11px;
    line-height: 1.4;
  }
  .coin-feedback {
    top: 58px;
    right: 79px;
    font-size: 9px;
  }
}
@media (max-width: 620px) and (max-height: 350px) and (orientation: landscape) {
  .hud-counters {
    display: none;
  }
  .profile-panel,
  .narrative-panel {
    padding: 11px 12px;
  }
  .profile-position {
    margin-top: 8px;
  }
  #profile-role {
    font-size: 11px;
  }
  #profile-period {
    font-size: 9px;
  }
  .profile-result {
    margin-top: 7px;
  }
  .work-heading {
    min-height: 25px;
    padding: 4px 0;
  }
  .work-heading strong {
    font-size: 11px;
  }
  .work-plus {
    font-size: 14px;
  }
  .narrative-panel {
    max-height: calc(100dvh - 80px);
  }
}
@media (pointer: coarse) and (orientation: landscape) {
  .pad-controls {
    position: absolute;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: max(22px, env(safe-area-inset-left));
    right: max(22px, env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    z-index: 6;
    pointer-events: none;
  }
  .direction-pad {
    display: flex;
    gap: 13px;
  }
  .pad-controls button {
    pointer-events: auto;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    color: #173e43;
    background: #fff9e7e6;
    border: 1px solid #fff9e7;
    box-shadow: 0 3px #477d7e70;
    font-size: 19px;
    touch-action: none;
    user-select: none;
  }
  .pad-controls #touch-jump {
    width: 64px;
    height: 64px;
    background: #e84531;
    color: #fff9e7;
    border-color: #ff9170;
    box-shadow: 0 4px #a32c24;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    font-family: GamePixel, monospace;
  }
  #touch-jump small {
    font-family: Manrope, Arial, sans-serif;
    font-size: 9px;
  }
}

/* The reading sheet reflows, with its action always within reach. */
@media (max-width: 760px) {
  .game dialog {
    width: calc(100% - 30px);
    padding: 25px;
    max-height: 90dvh;
  }
  .game-dialog h2 {
    font-size: 31px;
  }
  .game dialog.story-dialog,
  .game dialog.story-dialog[data-single="true"] {
    inset: max(14px, env(safe-area-inset-top)) auto auto 50%;
    width: calc(100% - 24px);
    max-height: calc(
      100dvh - max(14px, env(safe-area-inset-top)) -
        max(20px, env(safe-area-inset-bottom))
    );
    border-radius: 12px;
  }
  #chapter-content {
    padding: 23px;
  }
  .company-brand {
    min-height: 33px;
  }
  .company-brand img {
    width: 157px;
    height: 35px;
  }
  .company-brand.brand-bits img {
    width: 36px;
    height: 36px;
  }
  .company-brand.brand-bits span {
    font-size: 24px;
  }
  .company-brand.brand-qapita img {
    width: 112px;
    height: 39px;
  }
  .company-brand.brand-deutsche img {
    width: 160px;
    height: 25px;
  }
  .company-brand.brand-damensch img {
    width: 144px;
    height: 26px;
  }
  #chapter-title {
    font-size: 19px;
    line-height: 1.35;
    margin-top: 15px;
  }
  .chapter-period {
    font-size: 12px;
    margin-top: 6px;
  }
  .chapter-backers {
    font-size: 11px;
    line-height: 1.5;
    margin-top: 14px;
  }
  .chapter-description {
    font-size: 13px;
    line-height: 1.5;
    margin-top: 5px;
  }
  .contributions,
  .story-dialog[data-company="bits"] .contributions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 23px;
    margin-top: 21px;
    padding-top: 21px;
  }
  .contribution.featured,
  .story-dialog[data-company="bits"] .contribution.featured,
  .story-dialog[data-company="bits"] .contribution:last-child {
    grid-column: auto;
  }
  .contribution h3 {
    font-size: 19px;
    line-height: 1.3;
  }
  .contribution p {
    font-size: 15px;
    line-height: 1.6;
    margin-top: 8px;
  }
  .contribution.featured h3 {
    font-size: 27px;
  }
  .contribution.featured p {
    font-size: 15px;
    line-height: 1.6;
  }
  .story-dialog[data-company="bits"] .contributions {
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
  }
  .story-dialog[data-company="bits"] .contribution:last-child {
    grid-column: 1 / -1;
  }
  .story-dialog[data-company="bits"] .contribution.featured h3 {
    font-size: 31px;
    white-space: nowrap;
  }
  .story-dialog[data-company="bits"] .contribution h3 {
    font-size: 18px;
  }
  .story-dialog[data-company="bits"] .contribution p {
    font-size: 13px;
    line-height: 1.5;
  }
  .story-dialog[data-company="damensch"] .contribution,
  .story-dialog[data-company="deutsche"] .contribution {
    display: block;
  }
  .story-dialog[data-company="damensch"] .contribution p,
  .story-dialog[data-company="deutsche"] .contribution p {
    margin-top: 8px;
  }
  .chapter-footer {
    padding: 14px 20px 19px;
    gap: 10px;
    flex-direction: column;
  }
  .chapter-footer > p {
    font-size: 10px;
    margin-right: 0;
    align-self: center;
  }
  .chapter-footer .primary-button {
    width: 100%;
    font-size: 14px;
    min-height: 49px;
    padding: 13px 16px;
  }
  .chapter-footer kbd {
    display: none;
  }
  .chapter-footer .primary-button > span > b {
    font-size: 21px;
  }
  .game dialog.victory-dialog {
    padding: 26px;
  }
  .victory-dialog h2 {
    font-size: 37px;
  }
  .victory-star {
    font-size: 35px;
    margin-bottom: 17px;
  }
  .victory-stats {
    margin: 21px 0;
    padding: 18px 0;
  }
  .victory-stats span {
    font-size: 11px;
  }
  .victory-stats b {
    font-size: 11px;
  }
  .menu-grid > button {
    font-size: 11px;
  }
  .menu-help {
    font-size: 10px;
  }
}
@media (max-width: 370px) {
  #chapter-content {
    padding: 21px 19px;
  }
  .chapter-footer {
    padding-left: 17px;
    padding-right: 17px;
  }
  .contribution h3 {
    font-size: 18px;
  }
  .contribution.featured h3 {
    font-size: 25px;
  }
  .contribution p,
  .contribution.featured p {
    font-size: 14px;
  }
  #chapter-title {
    font-size: 18px;
  }
  .victory-dialog h2 {
    font-size: 33px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .game dialog {
    max-height: calc(100dvh - 24px);
    padding: 22px 26px;
  }
  .game dialog.story-dialog,
  .game dialog.story-dialog[data-single="true"] {
    inset: 12px auto auto 50%;
    width: min(830px, calc(100% - 38px));
    max-height: calc(100dvh - 28px);
  }
  #chapter-content {
    padding: 22px 28px;
  }
  .chapter-footer {
    flex-direction: row;
    padding: 13px 28px 17px;
  }
  .chapter-footer .primary-button {
    width: 220px;
  }
  .chapter-footer > p {
    font-size: 11px;
  }
  .contributions {
    grid-template-columns: 1fr 1fr;
  }
  .contribution h3 {
    font-size: 18px;
  }
  .contribution.featured h3 {
    font-size: 26px;
  }
  .contribution p,
  .contribution.featured p {
    font-size: 14px;
  }
  #chapter-title {
    font-size: 19px;
  }
  .menu-help {
    display: none;
  }
  .dialog-heading {
    margin-bottom: 18px;
  }
  .menu-grid {
    margin-top: 17px;
  }
  .menu-grid > button {
    min-height: 42px;
    padding: 11px;
  }
  .menu-bottom {
    margin-top: 13px;
  }
  .game dialog.victory-dialog {
    width: 490px;
    padding: 22px 28px;
  }
  .victory-star {
    display: none;
  }
  .victory-dialog h2 {
    font-size: 34px;
    margin-top: 10px;
  }
  .victory-invite {
    margin-top: 9px;
  }
  .victory-stats {
    margin: 14px 0;
    padding: 13px 0;
  }
  .download-resume {
    margin-top: 12px;
  }
  .victory-bottom {
    margin-top: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 760px) and (max-height: 760px) and (orientation: portrait) {
  .profile-panel[data-kind="bits"] #profile-description {
    display: block;
    font-size: 10px;
    line-height: 1.35;
  }
  .profile-panel[data-kind="bits"] {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .profile-panel[data-kind="bits"] .profile-result {
    margin-top: 7px;
  }
  .profile-panel[data-kind="bits"] .work-heading {
    min-height: 30px;
    padding: 5px 0;
  }
}

@media (max-width: 760px) and (max-height: 760px) and (orientation: portrait) {
  .profile-panel {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .profile-brand {
    min-height: 26px;
  }
  .profile-panel[data-kind="qapita"] .profile-brand img {
    height: 27px;
    width: 87px;
    padding: 3px 7px;
  }
  .profile-brand img {
    height: 26px;
  }
  .profile-position {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
  }
  #profile-role {
    font-size: 11px;
    line-height: 1.35;
    letter-spacing: -0.025em;
  }
  #profile-period {
    font-size: 9px;
    line-height: 1.35;
    margin-top: 0;
    flex-shrink: 0;
  }
  .profile-location {
    display: none;
  }
  .profile-result {
    margin-top: 8px;
  }
  .work-heading {
    min-height: 30px;
    padding: 5px 0;
  }
}

/* A clicked achievement shows its evidence first; company context lives in the full view. */
.story-dialog[data-focused="true"] #chapter-title {
  font-size: 17px;
  line-height: 1.4;
  margin-top: 14px;
}
.story-dialog[data-focused="true"] .chapter-period {
  font-size: 12px;
}
.story-dialog[data-focused="true"] .contributions {
  margin-top: 21px;
  padding-top: 21px;
}
.story-dialog[data-focused="true"] .contribution.featured h3 {
  font-size: 29px;
}
@media (max-width: 760px) {
  .story-dialog[data-focused="true"] #chapter-title {
    font-size: 14px;
    margin-top: 13px;
  }
  .story-dialog[data-focused="true"] .chapter-period {
    font-size: 11px;
  }
  .story-dialog[data-focused="true"] .contribution.featured h3 {
    font-size: 26px;
  }
  .story-dialog[data-focused="true"] .contributions {
    margin-top: 18px;
    padding-top: 18px;
  }
  .story-dialog[data-focused="true"] .contribution p {
    font-size: 14px;
    line-height: 1.6;
  }
  .story-dialog[data-focused="true"] .chapter-footer {
    padding-top: 12px;
    padding-bottom: 16px;
  }
  .story-dialog[data-focused="true"] .chapter-footer .primary-button {
    min-height: 46px;
  }
}

.game.is-reading .pad-controls {
  opacity: 0.4;
  transition: opacity 0.2s;
}
.pad-controls button:disabled {
  pointer-events: none;
}

.narrative-context {
  font-size: 12px;
  font-weight: 600;
  color: #57745f;
  margin-bottom: 12px;
  line-height: 1.4;
}
@media (max-width: 760px) {
  .narrative-context {
    font-size: 11px;
    margin-bottom: 10px;
  }
}

.personal-origin {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #173e43;
  line-height: 1.4;
}
@media (max-width: 760px) {
  .personal-origin {
    font-size: 18px;
    margin-bottom: 17px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .personal-origin {
    font-size: 16px;
    margin-bottom: 12px;
  }
}

.game.is-reading .profile-panel {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 760px) and (max-height: 700px) and (orientation: portrait) {
  .game dialog.victory-dialog {
    max-height: calc(100dvh - 28px);
    padding: 22px;
  }
  .victory-star {
    display: none;
  }
  .victory-dialog .pixel-label {
    font-size: 8px;
  }
  .victory-dialog h2 {
    font-size: 28px;
    line-height: 1.1;
    margin-top: 12px;
  }
  .victory-invite {
    font-size: 13px;
    line-height: 1.5;
    margin-top: 10px;
  }
  .victory-stats {
    margin: 17px 0;
    padding: 14px 0;
  }
  .victory-stats span {
    font-size: 10px;
    margin-bottom: 9px;
  }
  .victory-stats b {
    font-size: 10px;
  }
  .victory-dialog > .primary-button {
    min-height: 46px;
    padding: 12px 15px;
    font-size: 13px;
  }
  .victory-dialog .download-resume {
    min-height: 37px;
    font-size: 12px;
    margin-top: 8px;
  }
  .victory-bottom {
    margin-top: 5px;
    font-size: 12px;
  }
  .victory-bottom button,
  .victory-bottom a {
    font-size: 12px;
    padding: 9px 0;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .profile-location {
    display: none;
  }
  .profile-panel[data-kind="bits"] #profile-description {
    display: block;
    font-size: 10px;
    line-height: 1.35;
    margin-top: 5px;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .details-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
    right: 6px;
    top: 6px;
  }
}
@media (min-width: 761px) and (pointer: coarse) and (orientation: portrait) {
  .details-button {
    display: grid;
    position: static;
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    width: 40px;
    height: 40px;
    min-height: 40px;
    margin: -4px -4px 0 0;
  }
}

/* Reading can grow over the paused world without squeezing the camera. */
.narrative-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.narrative-continue {
  flex-shrink: 0;
}
#narrative-copy {
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #a9bf9c transparent;
}
@media (max-height: 500px) and (orientation: landscape) {
  .narrative-panel {
    width: min(830px, calc(100% - 38px));
    max-height: calc(100dvh - 78px);
    left: 19px;
    right: 19px;
    padding: 17px 20px;
  }
  .narrative-continue {
    align-self: flex-end;
    width: 210px;
    margin-top: 16px;
  }
  .narrative-panel[data-kind="personal"] .personal-list {
    grid-template-columns: 1fr 1.15fr 1fr;
    gap: 22px;
  }
  .narrative-panel[data-kind="personal"] .personal-origin {
    font-size: 16px;
    margin-bottom: 13px;
  }
  .narrative-panel[data-kind="personal"] .personal-list h2 {
    font-size: 14px !important;
  }
  .narrative-panel[data-kind="personal"] .personal-list p {
    font-size: 11px;
    line-height: 1.5;
  }
  .narrative-context {
    font-size: 11px;
    margin-bottom: 10px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .profile-panel {
    max-height: calc(100dvh - 132px);
  }
  .game.is-reading .pad-controls {
    opacity: 0;
  }
}
.game.is-reading #pause-game {
  opacity: 0.45;
}

.route-map[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.route-map .dialog-heading {
  flex-shrink: 0;
}
#map-stops {
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #a9bf9c transparent;
}
@media (max-height: 500px) and (orientation: landscape) {
  .retry-symbol {
    display: none;
  }
  .game dialog.retry-dialog {
    width: min(440px, calc(100% - 38px));
  }
  .retry-dialog h2 {
    font-size: 28px;
  }
  .retry-dialog > p {
    font-size: 12px;
    line-height: 1.5;
    margin-top: 12px;
  }
  .retry-dialog > .primary-button {
    margin-top: 20px;
    min-height: 46px;
    padding: 12px 16px;
  }
  .retry-dialog > .text-button {
    margin-top: 10px;
  }
  .game dialog.pause-dialog {
    width: min(620px, calc(100% - 38px));
  }
  .pause-dialog[open] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
  }
  .pause-dialog .dialog-heading {
    grid-column: 1 / -1;
  }
  .pause-dialog > .primary-button {
    grid-column: 1;
    grid-row: 2;
  }
  .pause-dialog .menu-grid {
    grid-column: 2;
    grid-row: 2 / 4;
    margin: 0;
  }
  .pause-dialog .menu-bottom {
    grid-column: 1;
    grid-row: 3;
    align-self: start;
    gap: 15px;
  }
  .pause-dialog .menu-bottom button {
    font-size: 11px;
  }
  .game dialog.victory-dialog {
    width: min(680px, calc(100% - 38px));
    padding: 22px 26px;
  }
  .victory-dialog[open] {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    gap: 0 24px;
    text-align: left;
  }
  .victory-dialog .pixel-label {
    grid-column: 1;
    grid-row: 1;
    font-size: 8px;
  }
  .victory-dialog h2 {
    grid-column: 1;
    grid-row: 2;
    font-size: 28px;
    line-height: 1.08;
    margin-top: 8px;
  }
  .victory-invite {
    grid-column: 1;
    grid-row: 3;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 4px;
  }
  .victory-stats {
    grid-column: 1;
    grid-row: 4;
    margin: 12px 0 0;
    padding: 10px 0;
    gap: 8px;
    text-align: center;
  }
  .victory-stats span {
    font-size: 9px;
    margin-bottom: 8px;
  }
  .victory-stats b {
    font-size: 9px;
  }
  .victory-dialog > .primary-button {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    font-size: 13px;
    min-height: 46px;
    padding: 12px 16px;
  }
  .victory-dialog .download-resume {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
    font-size: 11px;
    min-height: 37px;
    margin: 0;
  }
  .victory-bottom {
    grid-column: 2;
    grid-row: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: 8px;
  }
  .victory-bottom a,
  .victory-bottom button {
    font-size: 12px;
    padding: 8px 0;
  }
}

.world-stage.game-world {
  transition: filter 0.22s;
}
body.reading-story .world-stage.game-world {
  filter: brightness(0.82) saturate(0.82);
}
@media (max-height: 500px) and (orientation: landscape) {
  .narrative-panel[data-kind="personal"] .personal-list h2 {
    font-size: 15px !important;
  }
  .narrative-panel[data-kind="personal"] .personal-list p {
    font-size: 12px;
    line-height: 1.5;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .narrative-panel {
    width: auto;
    max-width: 830px;
    left: max(19px, env(safe-area-inset-left));
    right: max(19px, env(safe-area-inset-right));
  }
}

.work-subtitle {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #4e6d60;
}
@media (max-width: 760px) and (orientation: portrait),
  (pointer: coarse) and (orientation: portrait) {
  .work-subtitle {
    font-size: 11.5px;
    line-height: 1.35;
    margin-top: 2px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .work-subtitle {
    font-size: 10px;
    line-height: 1.35;
    margin-top: 2px;
  }
}

#career-inline-period,
.degree-compact {
  display: none;
}
@media (max-width: 760px) and (orientation: portrait),
  (pointer: coarse) and (orientation: portrait) {
  .work-heading,
  .profile-panel[data-kind="bits"] .work-heading {
    min-height: 44px;
  }
  .profile-panel[data-kind="bits"] #career-inline-period {
    display: block;
    margin-left: auto;
    font-size: 10px;
    font-weight: 400;
    line-height: 1.4;
    color: #597568;
    white-space: nowrap;
  }
  .profile-panel[data-kind="bits"] .profile-brand {
    gap: 8px;
  }
}
@media (max-width: 760px) and (max-height: 760px) and (orientation: portrait) {
  #profile-description {
    display: block;
    font-size: 10px;
    line-height: 1.35;
    margin-top: 4px;
  }
  #profile-role {
    font-size: 12px;
  }
  #profile-period {
    font-size: 10px;
  }
}
@media (max-width: 760px) and (max-height: 620px) and (orientation: portrait) {
  #profile-description {
    display: none;
  }
  #profile-role {
    font-size: 11px;
  }
  #profile-period {
    font-size: 9px;
  }
  .work-heading,
  .profile-panel[data-kind="bits"] .work-heading {
    min-height: 36px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .profile-panel[data-kind="bits"] #profile-description {
    font-size: 9.5px;
  }
  .profile-panel[data-kind="bits"] .degree-full {
    display: none;
  }
  .degree-compact {
    display: block;
  }
}

@media (max-width: 760px) and (max-height: 620px) and (orientation: portrait) {
  .play-hud {
    top: max(8px, env(safe-area-inset-top));
    min-height: 38px;
  }
  .icon-button {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }
  .resume-link {
    min-height: 38px;
  }
  .profile-panel,
  .narrative-panel {
    top: calc(max(8px, env(safe-area-inset-top)) + 46px);
  }
  .profile-panel,
  .profile-panel[data-kind="bits"] {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .profile-position {
    margin-top: 6px;
  }
  .profile-result,
  .profile-panel[data-kind="bits"] .profile-result {
    margin-top: 6px;
    padding-top: 2px;
  }
}

#narrative-copy h2 span {
  text-wrap: balance;
}
#narrative-copy h2 span + span {
  margin-top: 4px;
}

@media (max-width: 760px) and (orientation: portrait) {
  .victory-dialog h2 {
    font-size: clamp(26px, 7.7vw, 36px);
    line-height: 1.12;
  }
}

@media (max-width: 620px) and (max-height: 350px) and (orientation: landscape) {
  .profile-panel[data-kind="carbon"] .profile-position,
  .profile-panel[data-kind="damensch"] .profile-position {
    display: flex;
    align-items: baseline;
    gap: 7px;
  }
  .profile-panel[data-kind="carbon"] #profile-period,
  .profile-panel[data-kind="damensch"] #profile-period {
    margin-top: 0;
    white-space: nowrap;
  }
  .profile-position {
    margin-top: 4px;
  }
}


/* The whole row is the target; numbers work as keyboard shortcuts too. */
.work-heading {
  position: relative;
  gap: 12px;
  cursor: pointer;
  transition: background-color 140ms ease;
}
.work-heading:hover,
.work-heading:focus-visible {
  background-color: #e7eede;
}
.work-shortcut {
  display: grid;
  place-items: center;
  flex: 0 0 23px;
  width: 23px;
  height: 23px;
  border: 1px solid #b9cbb4;
  border-radius: 6px;
  color: #52705b;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.work-help {
  margin: 2px 0 5px;
  font-size: 10px;
  line-height: 1.4;
  color: #597568;
  cursor: default;
}
.work-help-touch { display: none; }
@media (pointer: coarse) {
  .work-help-keyboard { display: none; }
  .work-help-touch { display: inline; }
}
@media (max-width: 760px) and (orientation: portrait),
       (pointer: coarse) and (orientation: portrait) {
  .profile-panel {
    max-height: min(46dvh, calc(100dvh - 365px));
    overscroll-behavior: contain;
  }
  .work-help { font-size: 9px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .work-shortcut {
    width: 19px;
    height: 19px;
    flex-basis: 19px;
    font-size: 10px;
  }
  .work-help { font-size: 9px; margin-bottom: 3px; }
}


/* Keep the company and role visible when a longer work list needs scrolling. */
.profile-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.profile-company,
.profile-position,
.work-help,
.work-scroll-hint { flex-shrink: 0; }
.profile-result {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.profile-work {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #9db396 transparent;
}
.work-scroll-hint {
  padding-top: 4px;
  font-size: 10px;
  line-height: 1.4;
  color: #52705b;
}
