:root {
  color-scheme: dark;
  --bg: #051222;
  --surface: #0b2946;
  --ink: #f0faff;
  --muted: #c1ddeb;
  --accent: #adeaff;
  --font-body: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --text-small: 12px;
  --text-body: 16px;
  --text-title: 22px;
  --radius: 4px;
  --duration: 180ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; font-family: var(--font-body); color: var(--ink); background: var(--bg); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.sr-only, .site-title, .version-title { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* The complete image and the controls share the same full-screen coordinates. */
.portal { width: 100%; }
.scene { position: relative; isolation: isolate; width: 100%; height: 100vh; height: 100svh; min-height: 420px; }
.scene-art { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: fill; }
.portal-actions { position: absolute; inset: 0; z-index: 1; }
.downloads { position: absolute; bottom: 14%; display: grid; gap: 12px; width: clamp(168px, 18%, 250px); transform: translateX(-50%); }
.downloads-honor { left: 19%; }
.downloads-retro { left: 79%; }
.download-link { position: relative; display: flex; justify-content: center; align-items: center; gap: 14px; min-height: 54px; padding: 12px 16px; border: 1px solid #bbdef2; border-radius: var(--radius); font-size: var(--text-body); font-weight: 700; letter-spacing: .04em; text-decoration: none; color: #f0faff; background: linear-gradient(#16466ded, #08243eeb); box-shadow: inset 0 1px 0 #ffffff24, 0 3px 12px #02101c70; transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease); }
.download-link:hover { border-color: #fff; background: linear-gradient(#27688ded, #113b5deb); }
.download-link:active { background: #082b49; }

.contact { position: absolute; left: 50%; bottom: 13%; width: 224px; transform: translateX(-50%); text-align: center; }
.qr-preview { display: block; position: relative; width: clamp(138px, 11vw, 176px); height: clamp(138px, 11vw, 176px); margin: 0 auto; padding: 6px; border: 1px solid #d9f7ff; border-radius: var(--radius); background: #fff; box-shadow: 0 3px 20px #0007; }
.qr-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.qr-zoom { position: absolute; top: -25px; left: -15px; right: -15px; padding: 4px; background: #08203be6; color: var(--ink); font-size: 11px; border-radius: 3px; opacity: 0; transition: opacity var(--duration) var(--ease); }
.qr-preview:hover .qr-zoom, .qr-preview:focus-visible .qr-zoom { opacity: 1; }
.contact-caption { margin: 8px 0 0; color: #fff; font-size: var(--text-small); line-height: 1.5; text-shadow: 0 1px 4px #000, 0 0 8px #071629; }
.qr-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 6px; }
.qr-selectors { display: flex; }
.qr-dot { display: grid; place-items: center; width: 44px; height: 44px; border: 0; padding: 0; background: transparent; }
.qr-dot span { width: 7px; height: 7px; border: 1px solid #fff; border-radius: 50%; background: #123754d9; box-shadow: 0 1px 5px #0009; }
.qr-dot[aria-current="true"] span { background: #fff; border-color: #fff; box-shadow: 0 0 7px #aeedff; }
.rotation-toggle { min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: #fff; font-size: 11px; white-space: nowrap; text-shadow: 0 1px 4px #000, 0 0 8px #071629; }
.rotation-toggle:hover { color: var(--accent); }
.noscript-note { margin: 0; font-size: var(--text-small); text-shadow: 0 1px 4px #000; }

.qr-dialog { width: min(430px, calc(100% - 32px)); max-height: calc(100svh - 32px); padding: 34px 28px 24px; border: 1px solid #9ad5f2; border-radius: 4px; color: var(--ink); text-align: center; background: linear-gradient(150deg, #173d58, #071b31); box-shadow: 0 20px 70px #0009; overflow: auto; }
.qr-dialog::backdrop { background: #020d1de6; }
.dialog-close { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius); color: var(--ink); background: transparent; }
.dialog-close:hover { background: #ffffff14; }
.dialog-eyebrow { margin: 0 0 8px; font-size: var(--text-small); letter-spacing: .2em; color: var(--muted); }
.qr-dialog h2 { margin: 0 0 22px; font-size: var(--text-title); }
.qr-dialog > img { display: block; width: 100%; aspect-ratio: 1; height: auto; padding: 12px; object-fit: contain; background: #fff; border-radius: var(--radius); }
.dialog-tip { margin: 18px 0 0; color: var(--muted); font-size: var(--text-small); line-height: 1.8; }
body.dialog-open { overflow: hidden; }

/* Mobile and portrait tablets use normal flow, so short screens can scroll. */
@media (max-width: 900px), (max-width: 1100px) and (orientation: portrait) {
  .scene { --mobile-hero-height: 46vw; height: auto; min-height: 100vh; min-height: 100svh; padding: var(--mobile-hero-height) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: #06192c; }
  .scene::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 50% 0, #164564, #06192c 65%); }
  .scene-art { inset: 0 0 auto; height: auto; object-fit: contain; clip-path: inset(0 0 14%); }
  .scene::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: calc(var(--mobile-hero-height) + 1px); z-index: 0; pointer-events: none; background: linear-gradient(transparent 65%, #06192c 100%); }
  .portal-actions { position: relative; inset: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 12px; width: 100%; max-width: 580px; margin: 18px auto 0; }
  .downloads { position: static; width: 100%; min-width: 0; gap: 10px; transform: none; }
  .version-title { position: static; width: auto; height: auto; padding: 0 0 8px; margin: 0 0 2px; overflow: visible; clip-path: none; white-space: normal; border-bottom: 1px solid #85b7d347; font-size: 19px; line-height: 1.5; color: #e2f5ff; text-align: center; letter-spacing: .03em; }
  .download-link { min-height: 52px; gap: 10px; padding: 12px 8px; font-size: 15px; line-height: 1.4; letter-spacing: 0; }
  .download-link .icon { width: 22px; height: 22px; }
  .contact { position: static; grid-column: 1 / -1; display: grid; grid-template-columns: clamp(120px, 36vw, 160px) minmax(0, 1fr); grid-template-areas: "qr title" "qr caption" "qr controls"; gap: 0 16px; align-items: center; width: 100%; min-width: 0; padding: 20px 0; border-top: 1px solid #85b7d347; transform: none; }
  .contact .version-title { grid-area: title; align-self: end; margin: 0; padding: 0; border: 0; text-align: left; font-size: 19px; }
  .qr-preview { grid-area: qr; width: 100%; height: auto; aspect-ratio: 1; padding: 6px; }
  .qr-preview img { height: 100%; aspect-ratio: 1; }
  .qr-zoom { top: auto; bottom: -22px; left: 0; right: 0; padding: 0; background: transparent; font-size: 11px; color: var(--muted); opacity: 1; }
  .contact-caption { grid-area: caption; margin: 6px 0 0; font-size: 13px; line-height: 1.6; text-align: left; }
  .qr-controls { grid-area: controls; justify-content: flex-start; align-self: start; gap: 0 4px; }
  .rotation-toggle { font-size: 12px; }
  .noscript-note { grid-column: 1 / -1; margin-top: 22px; }
}
@media (max-width: 370px) {
  .version-title, .contact .version-title { font-size: 17px; }
  .download-link { gap: 8px; font-size: 14px; }
  .contact { column-gap: 12px; }
  .contact-caption { font-size: 12px; }
}
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .scene { --mobile-hero-height: min(46vw, 40svh); }
  .scene-art { clip-path: inset(0 0 calc(100% - var(--mobile-hero-height))); }
  .portal-actions { margin-top: 12px; gap: 20px 12px; }
}
@media (max-height: 550px) and (min-width: 901px) {
  .downloads { gap: 8px; }
  .download-link { min-height: 44px; padding-block: 8px; }
  .qr-preview { width: 112px; height: 112px; padding: 4px; }
  .contact-caption { margin-top: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
