/* Orientation guidance is driven by physical screen state, never a keyboard-
   resized CSS orientation query. Load after the older mobile layout rules. */
#mobileRotateHint,
#mobileRotateHint .mobileRotateActions [hidden],
body.touchDevice.mobileMatchMode #mobileRotateHint[hidden],
body.touchDevice.mobileMatchMode #mobileRotateHint.hidden,
#mobileFullscreenButton[hidden] {
  display: none !important;
}
#mobileScreenNotice { display: none; }
body.touchDevice.mobileMatchMode #mobileScreenNotice:not([hidden]):not(.hidden) {
  position: fixed;
  z-index: 240;
  top: calc(var(--mobile-visual-top, 0px) + env(safe-area-inset-top, 0px) + 64px);
  left: 50%;
  transform: translateX(-50%);
  display: block;
  box-sizing: border-box;
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 14px;
  border: 1px solid rgba(217,199,162,.52);
  border-radius: 10px;
  background: rgba(22,22,32,.97);
  box-shadow: 0 6px 22px rgba(0,0,0,.28);
  color: #f1e9d8;
  text-align: center;
  font: 500 13px/1.4 system-ui, sans-serif;
  pointer-events: none;
}
body.touchDevice.mobileMatchMode.mobileRotateBlocked #mobileRotateHint:not([hidden]):not(.hidden) {
  position: fixed;
  z-index: 220;
  inset: auto 0;
  top: var(--mobile-visual-top, 0px);
  width: 100%;
  height: var(--mobile-visual-height, 100dvh);
  max-width: none;
  margin: 0;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
  pointer-events: auto;
  border: 0;
  border-radius: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(38, 31, 71, .94), rgba(8, 10, 20, .97) 72%);
  color: #f4f0ff;
  text-align: center;
  font: 400 15px/1.55 system-ui, sans-serif;
}
#mobileRotateHint .mobileRotateCard {
  width: min(100%, 360px);
  max-height: 100%;
  padding: 8px 0;
  box-sizing: border-box;
}
#mobileRotateHint h2 {
  margin: 20px 0 10px;
  font: 750 clamp(22px, 6vw, 28px)/1.2 system-ui, sans-serif;
  letter-spacing: -.025em;
  color: #f4f0ff;
}
#mobileRotateHint p { margin: 0; color: #cec9df; }
#mobileRotateHint [data-mobile-screen-status] {
  min-height: 3em;
  margin: 16px auto 0;
  color: #aea9c3;
  font-size: 13px;
}
#mobileRotateHint .mobileRotateActions { display: grid; gap: 10px; margin-top: 22px; }
#mobileRotateHint .mobileRotateActions button {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid #8ca6d3;
  border-radius: 12px;
  box-sizing: border-box;
  background: #d2e5ff;
  color: #18243d;
  font: 700 15px/1.35 system-ui, sans-serif;
  touch-action: manipulation;
  cursor: pointer;
}
#mobileRotateHint .mobileRotateActions [data-mobile-screen-portrait] {
  background: rgba(255,255,255,.035);
  border-color: rgba(196,204,236,.32);
  color: #e3e4f1;
}
#mobileRotateHint button:disabled { opacity: .6; cursor: wait; }
#mobileRotateHint button:focus-visible,
body.touchDevice.mobileMatchMode #mobileFullscreenButton:focus-visible {
  outline: 3px solid #eac985;
  outline-offset: 3px;
}
#mobileRotateHint .mobileRotateIllustration {
  position: relative;
  width: 142px;
  height: 104px;
  margin: 4px auto 0;
  color: #bdd7fb;
}
/* A quiet landscape phone and curved directional arrow; readable without motion. */
#mobileRotateHint .mobileRotateIllustration span {
  position: absolute;
  top: 36px;
  left: 14px;
  width: 112px;
  height: 60px;
  box-sizing: border-box;
  border: 3px solid currentColor;
  border-radius: 11px;
  background: linear-gradient(130deg, rgba(153,192,250,.13), rgba(91,95,157,.03));
  box-shadow: inset 0 0 0 5px #14172d, 0 12px 36px rgba(102,147,231,.09);
}
#mobileRotateHint .mobileRotateIllustration span::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 20px;
  width: 3px;
  height: 13px;
  border-radius: 3px;
  background: currentColor;
}
#mobileRotateHint .mobileRotateIllustration::before {
  content: '';
  position: absolute;
  width: 77px;
  height: 46px;
  left: 35px;
  top: 2px;
  border: 2px solid #b6a6e3;
  border-bottom: 0;
  border-right-color: transparent;
  border-radius: 70px 70px 0 0;
  transform: rotate(14deg);
}
#mobileRotateHint .mobileRotateIllustration::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  top: 10px;
  left: 105px;
  border-right: 2px solid #b6a6e3;
  border-bottom: 2px solid #b6a6e3;
  transform: rotate(12deg);
}
#mobileFullscreenButton { display: none; }
body.touchDevice.mobileMatchMode #mobileFullscreenButton:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  box-sizing: border-box;
  border: 1px solid rgba(200,211,240,.3);
  border-radius: 10px;
  background: rgba(12,16,28,.94);
  color: #e5edff;
  touch-action: manipulation;
  cursor: pointer;
}
#mobileFullscreenButton [aria-hidden="true"] { font: 400 23px/1 system-ui, sans-serif; }
#mobileFullscreenButton .mobileScreenSrOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
body.touchDevice.mobileMatchMode #mobileFullscreenButton:disabled { opacity: .6; cursor: wait; }
#mobileScreenHelp:not([open]) { display: none !important; }
#mobileScreenHelp[open] {
  position: fixed;
  inset: auto 0;
  top: calc(var(--mobile-visual-top, 0px) + max(12px, env(safe-area-inset-top, 0px)));
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100vw - max(12px, env(safe-area-inset-left, 0px)) - max(12px, env(safe-area-inset-right, 0px))));
  max-width: none;
  max-height: calc(var(--mobile-visual-height, 100dvh) - max(12px, env(safe-area-inset-top, 0px)) - max(12px, env(safe-area-inset-bottom, 0px)));
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #525c7c;
  border-radius: 16px;
  background: #121827;
  color: #e9effb;
  box-shadow: 0 20px 80px rgba(0,0,0,.5);
  font: 400 15px/1.5 system-ui, sans-serif;
  touch-action: pan-y pinch-zoom;
}
#mobileScreenHelp::backdrop { background: rgba(4,7,15,.78); }
#mobileScreenHelp header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 12px;
  padding: 10px 12px 10px 20px;
  border-bottom: 1px solid #303b54;
}
#mobileScreenHelp h2 { margin: 0; color: #edf2fc; font: 750 19px/1.3 system-ui, sans-serif; }
#mobileScreenHelp .mobileScreenHelpBody { min-height: 0; padding: 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
#mobileScreenHelp .mobileScreenHelpBody p { margin: 0; }
#mobileScreenHelp ol { display: grid; gap: 12px; margin: 18px 0; padding-left: 24px; }
#mobileScreenHelp li { padding-left: 4px; }
#mobileScreenHelp li::marker { color: #bbd2f9; font-weight: 750; }
#mobileScreenHelp .mobileScreenHelpNote { color: #b4bfd4; font-size: 13px; }
#mobileScreenHelp footer { flex: 0 0 auto; padding: 12px 16px; border-top: 1px solid #303b54; }
#mobileScreenHelp button {
  min-width: 44px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #718ebd;
  border-radius: 10px;
  background: #d2e5ff;
  color: #18243d;
  font: 700 14px/1.4 system-ui, sans-serif;
  touch-action: manipulation;
  cursor: pointer;
}
#mobileScreenHelp header button { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; background: #1e2940; color: #edf2fc; font-size: 25px; }
#mobileScreenHelp footer button { width: 100%; }
#mobileScreenHelp button:focus-visible { outline: 3px solid #eac985; outline-offset: 2px; }
@media (max-height: 520px) {
  #mobileRotateHint .mobileRotateIllustration { transform: scale(.75); height: 76px; margin-top: 0; }
  #mobileRotateHint h2 { margin-top: 10px; }
  #mobileRotateHint .mobileRotateActions { margin-top: 14px; }
  #mobileRotateHint [data-mobile-screen-status] { margin-top: 10px; }
}
