/* Keep language controls in their own row, including on narrow screens. */
html { scroll-padding-top: 76px; }
.languageBar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 60px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 8px 12px;
  background: #100e19;
}
.languageBar label { margin-inline-end: 6px; cursor: pointer; }
.languageBar .languagePicker {
  position: static;
  margin: 0;
  max-width: 100%;
  min-height: 44px;
  font-size: 14px;
}
h1, h2, #premiumOffer { scroll-margin-top: 76px; }
html[lang="ja"] #premiumOffer h2 { font-size: clamp(22px, 5.6vw, 25px); line-height: 1.5; text-wrap: balance; }
html[lang="ja"] #premiumOffer h2 span,
html[lang="ja"] #intro h1 span { display: inline-block; white-space: nowrap; }
html[lang="ja"] #intro h1 { font-size: clamp(20px, 5vw, 36px); line-height: 1.5; text-wrap: balance; }
.restorePurchase { min-height: 44px; padding: 12px 16px; line-height: 1.5; }
html[lang="ja"] .worldBadge,
html[lang="ja"] .heroHeading .mirrorTitle,
html[lang="ja"] .heroStats { display: none; }
html[lang="ja"] .heroHome { min-height: auto; }
html[lang="ja"] .worldStart { margin-top: 16px; }
html[lang="ja"] .freeText {
  color: #d6c9d8;
  font-size: 13px;
  letter-spacing: .035em;
}
.homeResultExample {
  position: relative;
  max-width: 430px;
  margin: 28px auto 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  text-align: left;
}
.homeResultExample h2 {
  margin: 0 0 12px;
  color: var(--sub);
  font-size: 14px;
}
.homeExampleBody {
  display: grid;
  grid-template-columns: clamp(64px, 19vw, 96px) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}
.homeExampleBody img { display: block; width: 100%; height: auto; border-radius: 9px; }
.homeExampleBody h3 { margin: 0; font-size: 17px; line-height: 1.5; }
.homeExampleBody p { margin: 5px 0 0; color: #d7cfd9; font-size: 14px; line-height: 1.65; }
.homeExampleBody a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: #ff9bce;
  font-size: 14px;
  text-underline-offset: 3px;
}
@media (max-width: 480px) {
  .heroHome { padding-top: 14px; }
  .heroCatch { margin-top: 16px; }
  .heroStats { margin: 16px auto 14px; padding-block: 12px; }
  html[lang="ja"] main:has(#home:not(.hidden)) { padding-top: 12px; }
  html[lang="ja"] .heroHome { padding: 0 0 28px; }
  html[lang="ja"] .mirrorVisual { width: 96px; height: 96px; margin: 24px auto 0; }
  html[lang="ja"] .brandMini { margin-top: 18px; }
  html[lang="ja"] .heroCatch { margin: 6px auto 10px; }
  html[lang="ja"] .heroDescription { line-height: 1.7; }
}
@media (max-width: 360px) and (max-height: 700px) {
  html[lang="ja"] .mirrorVisual { width: 76px; height: 76px; }
  html[lang="ja"] .mirrorVisual::before { width: 96px; height: 96px; }
  html[lang="ja"] .mirrorVisual::after { width: 110px; height: 110px; }
}
@media print { .languageBar { display: none; } }

#mirrorMatchShare {
  margin: 20px auto 26px;
  padding: clamp(17px, 4.6vw, 28px);
  color: #fff5fa;
  background: radial-gradient(ellipse at 100% 0, #482039 0, transparent 60%), #19131f;
  border: 1px solid #76435e;
  border-radius: 24px;
}
.matchInviteHeader { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.matchInviteBrand { color: #ffaad3; font-size: 11px; font-weight: 800; letter-spacing: .17em; }
#matchShareHeading {
  margin: 8px 0 0; font-size: clamp(22px, 5.8vw, 31px);
  line-height: 1.28; text-wrap: balance; overflow-wrap: anywhere;
}
html[lang="ja"] #matchShareHeading { word-break: auto-phrase; }
.matchPair { display: inline-flex; align-items: center; flex: none; padding: 5px 3px 5px 0; }
.matchPair img, .matchPair span {
  width: clamp(34px, 9vw, 48px); height: auto; aspect-ratio: 4 / 5;
  border: 1px solid #e1a3c6; border-radius: 6px;
}
.matchPair img { transform: rotate(-9deg); object-fit: cover; background: #342034; }
.matchPair span {
  position: relative; margin-left: -6px; transform: rotate(8deg);
  display: grid; place-items: center; background: #331b32; color: #ffd4ea;
  font: bold 22px/1 Georgia, serif;
}
#matchShareDesc { margin: 14px 0 18px; color: #e3d5df; font-size: 14px; line-height: 1.65; }
#mirrorGuessChoices { min-width: 0; margin: 0; padding: 0; border: 0; }
#matchGuessLabel { padding: 0; margin: 0 0 7px; color: #e6ccda; font-size: 13px; font-weight: 650; }
.matchGuessButtons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.matchGuessButtons button {
  min-height: 44px; margin: 0; padding: 8px 4px; border: 1px solid #77536c;
  border-radius: 12px; background: #211927; color: #fff4fb; font-size: 16px;
}
.matchGuessButtons [aria-pressed="true"] { border: 2px solid #ff91c6; background: #50263e; }
.matchGuessButtons [aria-pressed="true"]::before { content: "✓"; margin-right: 4px; }
#matchShareButton {
  min-height: 50px; margin: 16px 0 2px; padding: 13px 15px;
  background: #ff78bd; color: #230a18; border-radius: 999px;
}
#resultShareButton {
  min-height: 44px; margin: 0; padding: 10px 5px 5px; width: auto; display: block;
  margin-inline: auto; color: #eec1d8; background: transparent; font-size: 14px;
  text-decoration: underline; text-underline-offset: 3px;
}
#mirrorMatchShare button:focus-visible { outline: 3px solid #ffd597; outline-offset: 3px; }

@media screen {
  main {
    width: 100%;
    max-width: 48rem;
    padding-inline: clamp(12px, 3vw, 24px);
    padding-top: clamp(16px, 4vw, 38px);
  }
  .worldStart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6em;
    line-height: 1.45;
  }
  .worldStart span { position: static; flex: none; }
  #quiz { padding: clamp(18px, 4vw, 32px); }
  #question { font-size: clamp(1.3rem, 4.4vw, 1.75rem); }
  #answers .answer { min-height: 48px; line-height: 1.5; }
  #home, #quiz, #result { overflow-wrap: anywhere; }
  /* Reserve the full 864 × 1080 portrait before the file loads. */
  #result #character {
    width: 100% !important;
    max-width: 30rem !important;
    height: auto !important;
    aspect-ratio: 4 / 5;
    border-radius: 0 !important;
  }
  #result .section p { font-size: 1rem; line-height: 1.8; }
  .matchInviteHeader > div:first-child { min-width: 0; }
}
