:root {
  color-scheme: light;
  --paper: #fff7fb;
  --ink: #463238;
  --muted: #8b6f78;
  --line: #6a4651;
  --accent: #d85f8f;
  --accent-soft: #ffe7f1;
  --mint: #dff5ee;
  --gold: #c69a46;
  --panel: rgba(255, 252, 253, 0.9);
  --shadow: 0 24px 70px rgba(118, 65, 87, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Sans", "Meiryo", system-ui, sans-serif;
  background:
    linear-gradient(90deg, rgba(216, 95, 143, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(198, 154, 70, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, #fffaf2 0%, #fff0f7 46%, #eaf8f4 100%);
  background-size: 38px 38px, 38px 38px, auto;
}

button {
  font: inherit;
}

.game-shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.top-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 118px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-copy {
  min-width: 0;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  width: clamp(130px, 15vw, 188px);
  height: auto;
  filter: drop-shadow(0 8px 0 rgba(216, 95, 143, 0.14));
}

.brand-logo-link {
  display: block;
  flex: 0 0 auto;
}

.brand-home {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-home:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.brand-home:focus-visible,
.brand-logo-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

h1,
h2,
p {
  margin-top: 0;
}

.brand-title {
  margin-bottom: 0;
  font-size: clamp(1.38rem, 3.3vw, 2.55rem);
  font-weight: 900;
  line-height: 1.18;
}

.brand-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.86rem;
  font-style: italic;
  font-weight: 700;
}

.classic-link {
  position: absolute;
  right: 64px;
  bottom: 12px;
  z-index: 3;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.classic-link:hover {
  color: var(--accent);
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: var(--line);
  background: linear-gradient(#fff, #ffeaf3);
  box-shadow: 0 7px 0 rgba(106, 70, 81, 0.2);
  cursor: pointer;
}

.icon-button:hover {
  transform: translateY(2px);
  box-shadow: 0 5px 0 rgba(106, 70, 81, 0.2);
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 350px) minmax(0, 1fr);
  gap: 18px;
  min-height: 640px;
  padding: 22px;
  overflow: hidden;
  border: 2px solid rgba(106, 70, 81, 0.45);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.38)),
    linear-gradient(135deg, #fff8fb, #ffe3ef 52%, #e6f6f1);
  box-shadow: var(--shadow);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(198, 154, 70, 0.38);
  border-radius: 14px;
  pointer-events: none;
}

.stage::after {
  content: "";
  position: absolute;
  top: 19px;
  left: 22px;
  right: 22px;
  height: 12px;
  background:
    radial-gradient(circle at 6px 0, transparent 6px, rgba(255, 255, 255, 0.9) 6.5px) 0 0 / 18px 12px repeat-x;
  opacity: 0.82;
  pointer-events: none;
}

.background-sign {
  position: absolute;
  top: 40px;
  right: 36px;
  z-index: 1;
  display: grid;
  gap: 4px;
  width: min(320px, 36vw);
  padding: 16px 20px;
  border: 1px solid rgba(198, 154, 70, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 14px 30px rgba(118, 65, 87, 0.08);
  transform: rotate(1deg);
}

.background-sign span {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 700;
}

.background-sign strong {
  font-size: clamp(1.15rem, 3vw, 1.8rem);
}

.character-card {
  position: relative;
  z-index: 2;
  align-self: end;
  display: grid;
  gap: 15px;
  padding: 15px;
  border: 1px solid rgba(106, 70, 81, 0.46);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 32px rgba(118, 65, 87, 0.14);
}

.portrait {
  position: relative;
  display: grid;
  place-items: end center;
  min-height: 306px;
  border: 1px solid rgba(106, 70, 81, 0.42);
  border-radius: 18px;
  background:
    linear-gradient(transparent 64%, rgba(255, 255, 255, 0.68) 64%),
    linear-gradient(135deg, #fff2f8, #ffd8e8);
  overflow: hidden;
}

.portrait::before {
  content: "";
  position: absolute;
  bottom: 31px;
  width: 166px;
  height: 192px;
  border: 3px solid var(--line);
  border-bottom: 0;
  border-radius: 76px 76px 28px 28px;
  background: var(--accent);
}

.portrait::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 250px;
  height: 90px;
  border-top: 2px solid rgba(106, 70, 81, 0.62);
  background: rgba(255, 255, 255, 0.9);
}

.portrait.has-portrait-art {
  --portrait-art-left: -56.5674%;
  --portrait-art-top: 0%;
  place-items: center;
  width: 100%;
  aspect-ratio: 571 / 454;
}

.portrait.has-portrait-art::before,
.portrait.has-portrait-art::after,
.portrait.has-portrait-art .face {
  display: none;
}

.portrait-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.portrait-art[hidden] {
  display: none;
}

.portrait-teshigawara.has-portrait-art {
  --portrait-art-left: -58.6%;
  --portrait-art-top: -6.6%;
}

.portrait-ado.has-portrait-art {
  --portrait-art-left: -48%;
  --portrait-art-top: 4.4%;
}

/* Frame the face and shoulders while retaining the full 1240px-wide image. */
.portrait.has-portrait-art .portrait-art {
  position: absolute;
  top: var(--portrait-art-top);
  left: var(--portrait-art-left);
  width: 217.163%;
  height: auto;
}

.face {
  position: relative;
  z-index: 1;
  width: 138px;
  height: 138px;
  margin-bottom: 118px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: #fff5e8;
}

.eye {
  position: absolute;
  top: 54px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
}

.eye.left {
  left: 40px;
}

.eye.right {
  right: 40px;
}

.mouth {
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: 34px;
  height: 14px;
  border-bottom: 3px solid var(--line);
  border-radius: 0 0 30px 30px;
  transform: translateX(-50%);
}

.portrait-teshigawara {
  background:
    linear-gradient(transparent 64%, rgba(255, 255, 255, 0.68) 64%),
    linear-gradient(135deg, #f7fff8, #cdf1e5);
}

.portrait-teshigawara::before {
  width: 188px;
  background:
    linear-gradient(145deg, transparent 0 58%, rgba(255, 255, 255, 0.3) 58% 62%, transparent 62%),
    var(--accent);
}

.portrait-teshigawara .face {
  border-radius: 48% 52% 45% 55%;
}

.portrait-ado {
  background:
    linear-gradient(transparent 64%, rgba(255, 255, 255, 0.68) 64%),
    linear-gradient(135deg, #f6f1ff, #eadfff);
}

.portrait-ado::before {
  width: 196px;
  border-radius: 50px 50px 24px 24px;
  background: #2a2538;
}

.portrait-ado .face {
  background: #fff1eb;
}

.profile-label {
  display: inline-flex;
  margin-bottom: 5px;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  font-style: italic;
  font-weight: 800;
}

.profile h2 {
  margin-bottom: 6px;
  font-size: 1.55rem;
}

.profile p {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.6;
}

#statsList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

#statsList li {
  padding: 6px 10px;
  border: 1px solid rgba(216, 95, 143, 0.28);
  border-radius: 999px;
  background: rgba(255, 231, 241, 0.72);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.dialogue-panel {
  position: relative;
  z-index: 2;
  align-self: end;
  display: grid;
  gap: 14px;
  min-height: 396px;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.message-box {
  position: relative;
  min-height: 178px;
  padding: 24px;
  border: 1px solid rgba(106, 70, 81, 0.5);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 36px rgba(118, 65, 87, 0.12);
}

.message-box::before,
.message-box::after {
  content: "";
  position: absolute;
  width: 36px;
  height: 36px;
  border-color: rgba(198, 154, 70, 0.58);
  pointer-events: none;
}

.message-box::before {
  top: 11px;
  left: 11px;
  border-top: 2px solid;
  border-left: 2px solid;
  border-radius: 12px 0 0 0;
}

.message-box::after {
  right: 11px;
  bottom: 11px;
  border-right: 2px solid;
  border-bottom: 2px solid;
  border-radius: 0 0 12px 0;
}

.speaker {
  display: inline-flex;
  margin-bottom: 13px;
  padding: 6px 13px;
  border: 1px solid rgba(106, 70, 81, 0.46);
  border-radius: 999px;
  color: var(--line);
  background: linear-gradient(135deg, #fff, var(--accent-soft));
  font-weight: 900;
}

.message {
  margin-bottom: 0;
  font-size: clamp(1.02rem, 2.4vw, 1.24rem);
  line-height: 1.9;
  white-space: pre-line;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-button,
.primary-button {
  position: relative;
  min-height: 74px;
  padding: 14px 16px;
  border: 1px solid rgba(106, 70, 81, 0.55);
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(135deg, #fff, #fff2f8);
  box-shadow: 0 8px 0 rgba(106, 70, 81, 0.18);
  font-weight: 900;
  line-height: 1.5;
  cursor: pointer;
}

.choice-button:hover,
.primary-button:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #b94b83);
  transform: translateY(2px);
  box-shadow: 0 6px 0 rgba(106, 70, 81, 0.18);
}

.primary-button {
  justify-self: start;
  min-height: 54px;
}

.character-select {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.character-select .choice-button {
  min-height: 122px;
  text-align: left;
}

.choice-title {
  display: block;
  margin-bottom: 6px;
  font-size: 1.18rem;
}

.choice-meta {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.choice-button:hover .choice-meta {
  color: rgba(255, 255, 255, 0.84);
}

.customize-panel {
  margin-top: 16px;
  padding: 15px 18px;
  border: 1px dashed rgba(216, 95, 143, 0.45);
  border-radius: 18px;
  background: rgba(255, 252, 253, 0.76);
}

.customize-panel h2 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.customize-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(216, 95, 143, 0.12);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 920px) {
  .top-bar {
    align-items: center;
    gap: 10px;
  }

  .brand-lockup {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 4px 10px;
    flex: 1;
  }

  .brand-copy {
    display: contents;
  }

  .brand-logo-link {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .brand-logo {
    width: 72px;
  }

  .kicker {
    grid-column: 2;
    grid-row: 1;
    margin-bottom: 0;
  }

  .brand-home {
    grid-column: 2;
    grid-row: 2;
    font-size: 1.25rem;
    word-break: keep-all;
  }
}

@media (max-width: 820px) {
  .game-shell {
    width: min(100% - 18px, 640px);
    padding-top: 10px;
  }

  .top-bar {
    min-height: auto;
    padding: 6px 0 12px;
  }

  .classic-link {
    display: none;
  }

  .stage {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 14px;
  }

  .background-sign {
    position: relative;
    inset: auto;
    width: 100%;
    margin-top: 10px;
    transform: none;
  }

  .character-card {
    align-self: stretch;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }

  .portrait {
    min-height: 140px;
  }

  .portrait::before {
    bottom: 20px;
    width: 86px;
    height: 92px;
    border-width: 2px;
  }

  .portrait::after {
    width: 140px;
    height: 34px;
    border-top-width: 2px;
  }

  .face {
    width: 72px;
    height: 72px;
    margin-bottom: 52px;
    border-width: 2px;
  }

  .eye {
    top: 29px;
    width: 7px;
    height: 7px;
  }

  .eye.left {
    left: 21px;
  }

  .eye.right {
    right: 21px;
  }

  .mouth {
    bottom: 18px;
    width: 18px;
    height: 8px;
    border-bottom-width: 2px;
  }

  .dialogue-panel {
    min-height: auto;
  }

  .message-box {
    min-height: 168px;
    padding: 18px;
  }

  .choices,
  .character-select {
    grid-template-columns: 1fr;
  }

  .choice-button {
    min-height: 62px;
  }
}

@media (max-width: 440px) {
  .character-card {
    grid-template-columns: 1fr;
  }

  .portrait {
    min-height: 190px;
  }
}

.stage.is-route-active {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  min-height: 720px;
  padding: 24px 28px;
  overflow: clip;
  background:
    linear-gradient(rgba(52, 31, 58, 0.1), rgba(79, 36, 62, 0.24)),
    radial-gradient(circle at 50% 26%, rgba(255, 255, 255, 0.9), transparent 16rem),
    linear-gradient(135deg, #fff8fb, #eadcf6 44%, #dcefea);
}

.stage.is-route-active::after {
  content: none;
}

.stage.is-route-active .background-sign {
  top: 24px;
  left: 26px;
  right: auto;
  width: auto;
  min-width: 210px;
  padding: 8px 14px;
  border-color: rgba(255, 255, 255, 0.5);
  border-radius: 0 0 14px 0;
  color: #fff;
  background: linear-gradient(90deg, rgba(50, 31, 48, 0.8), rgba(80, 43, 70, 0.52));
  box-shadow: none;
  transform: none;
}

.stage.is-route-active .background-sign span {
  color: #ffd6e8;
}

.stage.is-route-active .background-sign strong {
  color: #fff;
  font-size: 1.12rem;
}

.stage.is-route-active .character-card {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 214px;
  width: min(440px, 46vw);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translateX(-50%);
  pointer-events: none;
}

.stage.is-route-active .character-card:has(.has-portrait-art) {
  width: min(680px, 72vw);
}

.stage.is-route-active .profile {
  display: none;
}

.stage.is-route-active .portrait {
  min-height: 444px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  filter: drop-shadow(0 18px 24px rgba(58, 34, 48, 0.24));
}

.stage.is-route-active .portrait.has-portrait-art {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  justify-self: center;
  width: min(660px, 100%);
  min-height: 0;
}

.stage.is-route-active .portrait.has-portrait-art .portrait-art {
  flex: none;
  width: 217.163%;
  max-height: none;
}

.stage.is-route-active .portrait::before {
  bottom: 0;
  width: 230px;
  height: 292px;
  border-width: 4px;
  border-radius: 106px 106px 28px 28px;
}

.stage.is-route-active .portrait::after {
  bottom: -14px;
  width: 340px;
  height: 92px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.72), transparent 70%);
}

.stage.is-route-active .face {
  width: 184px;
  height: 184px;
  margin-bottom: 222px;
  border-width: 4px;
}

.stage.is-route-active .eye {
  top: 72px;
  width: 15px;
  height: 15px;
}

.stage.is-route-active .eye.left {
  left: 54px;
}

.stage.is-route-active .eye.right {
  right: 54px;
}

.stage.is-route-active .mouth {
  bottom: 47px;
  width: 44px;
  height: 18px;
  border-bottom-width: 4px;
}

.stage.is-route-active .dialogue-panel {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 24px;
  z-index: 4;
  display: grid;
  gap: 10px;
  min-height: 0;
}

.stage.is-route-active .progress-row {
  display: none;
}

.stage.is-route-active .message-box {
  min-height: 152px;
  padding: 30px 30px 24px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 0;
  color: #fff;
  background:
    linear-gradient(rgba(54, 31, 45, 0.82), rgba(80, 42, 58, 0.78)),
    rgba(54, 31, 45, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(198, 154, 70, 0.45),
    0 18px 40px rgba(43, 28, 38, 0.32);
}

.stage.is-route-active .message-box::before,
.stage.is-route-active .message-box::after {
  border-color: rgba(255, 214, 232, 0.82);
}

.stage.is-route-active .speaker {
  position: absolute;
  top: -18px;
  left: 28px;
  min-width: 150px;
  justify-content: center;
  margin: 0;
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 0;
  color: #fff;
  background: linear-gradient(90deg, rgba(72, 37, 56, 0.95), rgba(150, 79, 115, 0.92));
  box-shadow: 0 8px 20px rgba(43, 28, 38, 0.28);
}

.stage.is-route-active .message {
  padding-top: 4px;
  font-size: clamp(1.05rem, 2.2vw, 1.32rem);
  line-height: 1.85;
  text-shadow: 0 1px 2px rgba(43, 28, 38, 0.4);
}

.stage.is-route-active .choices {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stage.is-route-active .choice-button,
.stage.is-route-active .primary-button {
  min-height: 54px;
  border-color: rgba(255, 255, 255, 0.5);
  border-radius: 0;
  color: #fff;
  background: linear-gradient(135deg, rgba(216, 95, 143, 0.94), rgba(106, 70, 81, 0.94));
  box-shadow: 0 7px 0 rgba(43, 28, 38, 0.28);
}

.stage.is-route-active .primary-button {
  justify-self: center;
  width: min(260px, 100%);
}

.stage.is-route-active .primary-button:only-child {
  grid-column: 1 / -1;
}

.stage.is-route-active .choice-button:hover,
.stage.is-route-active .primary-button:hover {
  background: linear-gradient(135deg, #fff, #ffdcec);
  color: var(--line);
}

@media (max-width: 920px) {
  body.route-active {
    min-height: 100svh;
  }

  body.route-active .game-shell {
    display: grid;
    grid-template-rows: minmax(64px, max-content) auto;
    gap: 10px;
    min-height: 100svh;
    padding: max(8px, env(safe-area-inset-top)) env(safe-area-inset-right) max(8px, env(safe-area-inset-bottom)) env(safe-area-inset-left);
  }

  body.route-active .top-bar {
    align-items: center;
    gap: 10px;
    min-height: auto;
    padding: 0;
  }

  body.route-active .brand-lockup {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 4px 8px;
  }

  body.route-active .brand-logo {
    width: 64px;
  }

  body.route-active .kicker {
    margin-bottom: 2px;
  }

  body.route-active .brand-title {
    font-size: 1.25rem;
  }

  body.route-active .brand-note,
  body.route-active .classic-link,
  body.route-active .customize-panel {
    display: none;
  }

  .stage.is-route-active {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(min-content, 1fr) auto;
    gap: 0;
    min-height: 0;
    padding: 14px;
    overflow: clip;
  }

  .stage.is-route-active .background-sign {
    position: absolute;
    top: 14px;
    left: 14px;
    width: min(240px, 70%);
    min-width: 0;
    margin: 0;
    padding: 6px 10px;
  }

  .stage.is-route-active .character-card {
    position: relative;
    top: auto;
    left: auto;
    bottom: auto;
    align-self: start;
    justify-self: center;
    width: min(360px, 90%);
    margin-top: 64px;
    grid-template-columns: 1fr;
    transform: none;
  }

  .stage.is-route-active .character-card:has(.has-portrait-art) {
    width: 100%;
    margin-top: 32px;
    margin-bottom: 0;
  }

  .stage.is-route-active .portrait {
    min-height: 200px;
  }

  .stage.is-route-active .portrait.has-portrait-art {
    aspect-ratio: 571 / 430;
    width: min(480px, 135%, max(220px, calc((100svh - 340px) * 1.15)));
  }

  .stage.is-route-active .portrait.has-portrait-art .portrait-art {
    width: 217.163%;
    max-height: none;
  }

  .stage.is-route-active .portrait::before {
    bottom: 0;
    width: 140px;
    height: 180px;
  }

  .stage.is-route-active .portrait::after {
    width: 250px;
    height: 70px;
  }

  .stage.is-route-active .face {
    width: 112px;
    height: 112px;
    margin-bottom: 80px;
  }

  .stage.is-route-active .eye {
    top: 44px;
    width: 9px;
    height: 9px;
  }

  .stage.is-route-active .eye.left {
    left: 33px;
  }

  .stage.is-route-active .eye.right {
    right: 33px;
  }

  .stage.is-route-active .mouth {
    bottom: 29px;
    width: 28px;
    height: 12px;
  }

  .stage.is-route-active .dialogue-panel {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    grid-template-rows: auto auto;
    width: 100%;
    min-height: 0;
    margin-top: 0;
  }

  .stage.is-route-active .message-box {
    min-height: 104px;
    padding: 26px 16px 12px;
  }

  .stage.is-route-active .message {
    font-size: 1rem;
    line-height: 1.7;
  }

  .stage.is-route-active .choices {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(54px, auto);
    gap: 8px;
    padding-bottom: 7px;
  }

  .stage.is-route-active .choice-button,
  .stage.is-route-active .primary-button {
    min-height: 54px;
    width: 100%;
    padding: 6px 12px;
    font-size: 0.95rem;
    line-height: 1.4;
  }

  .stage.is-route-active .primary-button {
    width: min(260px, 82%);
  }

  .stage.is-route-active .primary-button:only-child {
    grid-row: auto;
  }
}

@media (max-width: 920px) and (max-height: 650px) and (orientation: portrait) {
  body.route-active .game-shell {
    grid-template-rows: minmax(48px, max-content) auto;
  }

  .stage.is-route-active .portrait:not(.has-portrait-art) {
    min-height: 150px;
  }

  .stage.is-route-active .portrait:not(.has-portrait-art) .face {
    width: 96px;
    height: 96px;
    margin-bottom: 44px;
  }

  .stage.is-route-active .dialogue-panel {
    gap: 8px;
  }

  .stage.is-route-active .message-box {
    min-height: 96px;
  }

  .stage.is-route-active .message {
    line-height: 1.55;
  }

  .stage.is-route-active .choices {
    grid-auto-rows: minmax(50px, auto);
  }

  .stage.is-route-active .choice-button,
  .stage.is-route-active .primary-button {
    min-height: 50px;
  }
}

@media (max-width: 920px) and (orientation: landscape) {
  body.route-active .game-shell {
    grid-template-rows: minmax(48px, max-content) auto;
    gap: 6px;
  }

  .stage.is-route-active .background-sign {
    width: 34%;
    padding: 6px 10px;
  }

  .stage.is-route-active .background-sign strong {
    font-size: 0.92rem;
  }

  .stage.is-route-active {
    grid-template-columns: minmax(0, 44fr) minmax(0, 56fr);
    grid-template-rows: auto;
    gap: 10px;
  }

  .stage.is-route-active .character-card,
  .stage.is-route-active .character-card:has(.has-portrait-art) {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    margin-top: 56px;
  }

  .stage.is-route-active .portrait.has-portrait-art {
    width: min(360px, 140%, calc((100svh - 170px) * 1.6));
  }

  .stage.is-route-active .dialogue-panel {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }

  .stage.is-route-active .choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: minmax(76px, auto);
    gap: 8px;
  }

  .stage.is-route-active .primary-button {
    width: 100%;
  }

  .stage.is-route-active .choice-button,
  .stage.is-route-active .primary-button {
    font-size: 0.875rem;
    line-height: 1.3;
  }

  .stage.is-route-active .primary-button:only-child {
    min-height: 54px;
  }

  .stage.is-route-active .choices:has(.primary-button:only-child) {
    grid-auto-rows: minmax(54px, auto);
  }
}
