.rotate-screen { display: none; }

@media (orientation: portrait) and (hover: none) and (pointer: coarse) and (max-width: 850px) {
  #game-root, #game-root dialog { display: none; }
  #game-root dialog::backdrop { display: none; }
  .rotate-screen {
    min-block-size: 100vh;
    min-block-size: 100dvh;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: 18px;
    background:
      repeating-linear-gradient(0deg, #171122 0 4px, transparent 4px 31px),
      radial-gradient(ellipse at 50% 43%, #503459 0, #26192f 48%, #110e1a 79%);
  }
  .rotate-card {
    width: 100%;
    max-width: 340px;
    padding: 18px 16px 24px;
    text-align: center;
    background: #21172e;
    border: 2px solid #9f6c79;
    outline: 2px solid #3b2949;
    box-shadow: 0 0 0 6px #171121, inset 0 0 0 3px #513555, 0 10px 0 6px #110d19;
  }
  .rotate-card h2 {
    margin: 8px 0 6px;
    color: #ffe3a1;
    font: 800 clamp(1.18rem, 5.8vw, 1.75rem)/1.2 var(--font-mono, monospace);
    text-shadow: 2px 2px #7b4a62;
  }
  .rotate-card p {
    margin: 0 auto;
    max-width: 26ch;
    color: #e6cde0;
    font-size: .96rem;
    line-height: 1.45;
  }
  .rotate-language { margin-top: 1rem; }
  .rotate-language button { min-width: 2.75rem; min-height: 2.75rem; touch-action: manipulation; }
  .rotate-illustration {
    position: relative;
    width: min(100%, 224px);
    height: 163px;
    margin: 0 auto;
    display: grid;
    place-items: center;
  }
  .rotate-runestone {
    position: absolute;
    inset: 19px 33px;
    border: 1px solid #795488;
    transform: rotate(45deg) scale(.75);
    background:
      repeating-linear-gradient(90deg, #352446 0 1px, transparent 1px 12px),
      repeating-linear-gradient(0deg, #352446 0 1px, #2b1e3a 1px 12px);
    box-shadow: inset 0 0 0 6px #2a1d38, inset 0 0 0 7px #62446e, 0 0 22px #9e648046;
  }
  .rotate-phone {
    position: relative;
    z-index: 2;
    width: 68px;
    height: 108px;
    padding: 6px;
    border: 2px solid #ffde96;
    background: #33223e;
    box-shadow: 0 0 0 3px #68435d, 4px 4px 0 2px #160e22, inset 0 0 0 1px #9f666b;
    transform: rotate(90deg);
    animation: turn-relic 3.2s ease-in-out infinite;
  }
  .rotate-phone::before, .rotate-phone::after {
    content: "";
    position: absolute;
    left: calc(50% - 4px);
    width: 8px;
    height: 2px;
    background: #e1a76a;
  }
  .rotate-phone::before { top: 2px; }
  .rotate-phone::after { bottom: 2px; }
  .rotate-phone-land {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(#3d2c62 0 20%, #65417a 20% 38%, #ad6f89 38% 55%, #e9a283 55% 72%, #315356 72% 83%, #243f4b 83%);
  }
  .rotate-phone-land::after {
    content: "";
    position: absolute;
    top: 23px;
    left: 34px;
    width: 12px;
    height: 12px;
    background: #ffeaa6;
    clip-path: polygon(25% 0,75% 0,75% 12%,88% 12%,88% 25%,100% 25%,100% 75%,88% 75%,88% 88%,75% 88%,75% 100%,25% 100%,25% 88%,12% 88%,12% 75%,0 75%,0 25%,12% 25%,12% 12%,25% 12%);
    box-shadow: 0 0 0 3px #eba888;
  }
  .rotate-landscape {
    position: absolute;
    width: 92px;
    height: 52px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    visibility: visible;
    animation: landscape-relic 3.2s step-end infinite;
  }
  .rotate-landscape .rotate-phone-land::after { top: 8px; left: 67px; }
  .rotate-landscape .rotate-phone-castle { bottom: 3px; left: 15px; height: 26px; }
  .rotate-phone-castle {
    position: absolute;
    bottom: 16px;
    left: 10px;
    width: 44px;
    height: 34px;
    background: linear-gradient(90deg, #3b304e 0 24%, #6e5065 24% 32%, #4c3b57 32% 67%, #765368 67% 74%, #352943 74%);
    clip-path: polygon(0 14%,12% 14%,12% 0,24% 0,24% 14%,33% 14%,33% 39%,42% 39%,42% 28%,52% 28%,52% 39%,62% 39%,62% 14%,74% 14%,74% 0,86% 0,86% 14%,100% 14%,100% 100%,0 100%);
  }
  .rotate-arc {
    position: absolute;
    z-index: 3;
    width: 139px;
    height: 139px;
    border: 2px dashed transparent;
    border-top-color: #eeb678;
    border-right-color: #eeb678;
    border-radius: 50%;
    transform: rotate(24deg);
  }
  .rotate-arc::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 14px;
    width: 14px;
    height: 16px;
    background: #ffe292;
    clip-path: polygon(0 35%,36% 35%,36% 0,65% 0,65% 35%,100% 35%,100% 57%,65% 100%,36% 100%,0 57%);
  }
  .rotate-spark {
    position: absolute;
    width: 11px;
    height: 11px;
    background: #ffe7aa;
    clip-path: polygon(36% 0,64% 0,64% 36%,100% 36%,100% 64%,64% 64%,64% 100%,36% 100%,36% 64%,0 64%,0 36%,36% 36%);
    animation: relic-spark 1.6s ease-in-out infinite alternate;
  }
  .rotate-spark-left { left: 21px; top: 52px; }
  .rotate-spark-right { right: 20px; bottom: 47px; animation-delay: -.8s; }
}
@keyframes turn-relic {
  0%, 18% { transform: rotate(0deg); }
  42%, 79% { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}
@keyframes landscape-relic {
  0%, 34% { visibility: hidden; }
  35%, 84% { visibility: visible; }
  85%, 100% { visibility: hidden; }
}
@keyframes relic-spark {
  from { opacity: .35; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .rotate-phone, .rotate-landscape, .rotate-spark { animation: none; }
}
