:root {
  color-scheme: dark;
  --realm-ink: #102423;
  --realm-paper: #ecdfbd;
  --realm-gold: #bda475;
  --realm-muted: #88a29a;
  --arena-width: min(100vw, 56.25vh);
  --arena-height: min(100vh, 177.777778vw);
}

html, body { overflow: hidden; overscroll-behavior: none; background: var(--realm-ink); }
body { font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif; }
#GameCanvas { touch-action: none; }
[hidden] { display: none !important; }

.realm-wing {
  position: fixed;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: max(0px, calc((100vw - var(--arena-width)) / 2));
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 25% 40%, #27474066, transparent 62%), linear-gradient(160deg, #142d2b, #0b1b1c 80%);
}
.realm-wing::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .2;
  background: repeating-linear-gradient(100deg, transparent 0, transparent 92px, #9cb5a517 94px, transparent 96px), radial-gradient(circle at 24% 20%, #ebdbae 0, #ebdbae 1px, transparent 2px), radial-gradient(circle at 71% 71%, #ebdbae 0, #ebdbae 1px, transparent 2px);
}
.realm-wing-left { left: 0; box-shadow: inset -30px 0 50px -20px #0008; }
.realm-wing-right { right: 0; box-shadow: inset 30px 0 50px -20px #0008; }
.wing-ridge { position: absolute; left: -10%; right: -10%; bottom: 0; height: 44%; background: #0c1d1ce6; clip-path: polygon(0 60%, 13% 41%, 25% 51%, 38% 15%, 52% 45%, 63% 27%, 77% 46%, 89% 10%, 100% 38%, 100% 100%, 0 100%); }
.wing-ridge-far { bottom: 10%; height: 43%; background: #30504832; transform: scaleX(-1); }
.realm-wing-right .wing-ridge { transform: scaleX(-1); }
.realm-wing-right .wing-ridge-far { transform: none; }
.wing-brand, .wing-footer, .wing-guide { display: none; }
.realm-frame { position: fixed; z-index: 3; pointer-events: none; top: 50%; left: 50%; width: var(--arena-width); height: var(--arena-height); transform: translate(-50%, -50%); box-sizing: border-box; box-shadow: 0 0 0 1px #b8a27229, 0 0 50px #0006; }

.launch-screen {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--realm-paper);
  text-align: center;
  background: radial-gradient(ellipse at 50% 38%, #294a4199 0, #102423 68%);
  opacity: 1;
  transition: opacity .42s ease, visibility .42s ease;
}
.launch-haze { position: absolute; pointer-events: none; width: min(90vw, 720px); height: min(90vw, 720px); border: 1px solid #81967d0d; border-radius: 50%; box-shadow: 0 0 0 64px #81967d05, 0 0 0 128px #81967d04; }
.launch-content { position: relative; width: min(78vw, 360px); margin-top: -28px; }
.launch-emblem { position: relative; width: 55px; height: 55px; margin: 0 auto 36px; transform: rotate(45deg); border: 1px solid #bda47580; box-shadow: 0 0 35px #d8bd7610; }
.launch-emblem::before, .launch-emblem::after { content: ""; position: absolute; inset: 5px; border: 1px solid #bda47526; }
.launch-emblem::after { inset: 12px; border-color: #bda47515; }
.launch-emblem span { position: absolute; width: 6px; height: 47px; top: 3px; left: 24px; background: linear-gradient(#ebdbb1, #a98b5b); transform: rotate(-45deg); clip-path: polygon(50% 0, 100% 18%, 71% 68%, 100% 77%, 100% 83%, 64% 81%, 64% 100%, 36% 100%, 36% 81%, 0 83%, 0 77%, 29% 68%, 0 18%); }
.launch-eyebrow { margin: 0 0 15px; color: #a7b7a4; font-size: 11px; letter-spacing: 4px; }
.launch-content h1 { margin: 0; padding-left: 8px; font-family: "STKaiti", "KaiTi", "Songti SC", "SimSun", serif; font-size: clamp(42px, 9vw, 62px); font-weight: 500; letter-spacing: 8px; line-height: 1.5; text-shadow: 0 3px 18px #0005; }
.launch-divider { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 21px auto 39px; }
.launch-divider i { height: 1px; width: 48px; background: linear-gradient(90deg, transparent, #bda47580); }
.launch-divider i:last-child { transform: rotate(180deg); }
.launch-divider b { color: #bda475; font-size: 7px; font-weight: 400; }
.launch-status { margin: 0 0 14px; color: #d0d5bd; font-size: 13px; letter-spacing: 2px; }
.launch-progress { position: relative; width: 190px; height: 3px; overflow: hidden; margin: auto; background: #c6c7a81c; border-radius: 3px; }
.launch-progress span { display: block; width: 35%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #698e78, #d4bc82); animation: awaken 1.8s ease-in-out infinite; }
.launch-measured .launch-progress span { animation: none; transition: width .2s ease; }
.launch-hint { min-height: 32px; margin: 18px -15px 0; color: #839b8e; font-size: 11px; line-height: 1.8; letter-spacing: 1px; }
.launch-footer { position: absolute; bottom: max(32px, env(safe-area-inset-bottom)); color: #647f73; font-size: 10px; letter-spacing: 5px; }
.launch-retry { display: inline-block; min-width: 136px; min-height: 44px; margin: 15px 0 0; padding: 10px 22px; border: 1px solid #bda47570; border-radius: 5px; color: #e5d7b5; background: #bda4750c; font: inherit; font-size: 13px; letter-spacing: 2px; cursor: pointer; touch-action: manipulation; }
.launch-retry:hover { background: #bda47520; border-color: #bda475; }
.launch-retry:focus-visible { outline: 2px solid #dfce9f; outline-offset: 4px; }
.launch-ready { opacity: 0; visibility: hidden; pointer-events: none; }
.launch-failed .launch-status { color: #e6c596; }
.no-script { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; color: #ecdfbd; background: #102423; font-size: 15px; }
@keyframes awaken { from { transform: translateX(-110%); } to { transform: translateX(390%); } }

@media (min-width: 1080px) and (min-aspect-ratio: 4/3) and (hover: hover) and (pointer: fine) {
  .wing-brand { display: flex; position: absolute; top: 25%; width: 100%; align-items: center; flex-direction: column; gap: 24px; opacity: .8; }
  .wing-seal { display: flex; align-items: center; justify-content: center; border: 1px solid #b69a685c; width: 34px; height: 34px; color: #bfa673; font-size: 11px; letter-spacing: 2px; }
  .wing-title { color: #d9d1b3; font-family: "STKaiti", "KaiTi", "Songti SC", "SimSun", serif; writing-mode: vertical-rl; font-size: 32px; letter-spacing: 13px; }
  .wing-caption { color: #718f7e; font-size: 10px; letter-spacing: 2px; }
  .wing-footer { display: block; position: absolute; bottom: 46px; width: 100%; color: #5e7a6c; font-size: 10px; letter-spacing: 1px; }
  .wing-guide { display: block; position: absolute; top: 50%; left: 50%; width: 190px; transform: translate(-50%, -35%); text-align: left; }
  .guide-eyebrow { display: block; color: #a5b29a; font-size: 11px; letter-spacing: 3px; padding-bottom: 20px; margin-bottom: 21px; border-bottom: 1px solid #97b19c1a; }
  .guide-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; color: #809789; font-size: 11px; }
  .key-cluster { display: flex; gap: 3px; }
  kbd { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 23px; box-sizing: border-box; border: 1px solid #87998244; border-bottom-width: 2px; border-radius: 3px; color: #b4bea5; background: #adc1a506; font: 9px "Segoe UI", sans-serif; }
  kbd.key-wide { width: 54px; letter-spacing: 1px; }
  .guide-note { display: block; color: #607f6e; font-size: 10px; margin-top: 29px; letter-spacing: .5px; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .launch-screen, .launch-progress span { transition: none; }
  .launch-progress span { animation: none; width: 100%; opacity: .5; }
}
@media (max-height: 520px) {
  .launch-emblem { margin-bottom: 20px; width: 38px; height: 38px; }
  .launch-emblem span { left: 17px; top: -4px; }
  .launch-content { margin-top: 0; }
  .launch-content h1 { font-size: 38px; }
  .launch-divider { margin: 12px auto 20px; }
  .launch-footer { display: none; }
}
