/* 維護頁: the login key art「雲海玉闕」(palace in the clouds, the calligraphy logo) with the
   game's painted panel and jade button (styles.css .ornate-panel, .jade-btn--primary). Static:
   no build step, no web fonts, nothing from the server. */

:root {
  --night: #0b1823;
  --deep-2: #163747;
  --jade: #7fd6c8;
  --moon: #e6f2f4;
  --mist: #a8c4d4;
  --gold: #e2c482;
  --gold-text: #f1d98f;
  --gold-deep: #9c7a3c;
  --sky: #b8d9e6;
  --title: 'LXGW WenKai TC', 'Kaiti TC', 'STKaiti', 'BiauKai', serif;
  --sans: 'Noto Sans TC', system-ui, -apple-system, 'PingFang TC', sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gilt: linear-gradient(
    90deg,
    transparent,
    var(--gold-deep) 12%,
    var(--gold) 35%,
    #fff3cf 50%,
    var(--gold) 65%,
    var(--gold-deep) 88%,
    transparent
  );
  color-scheme: light;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: var(--sky);
}

body {
  margin: 0;
  font: 400 16px/1.6 var(--sans);
  color: var(--moon);
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  min-height: 100svh;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px
    calc(24px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky) 0%, #d6eaf0 48%, #eaf4f6 72%, #c9e1ea 100%);
}

/* The sky: far clouds, the palace, near clouds (the login screen's layer order). */
.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sky img {
  position: absolute;
  display: block;
  height: auto;
}

.palace {
  left: 50%;
  top: clamp(150px, 25svh, 250px);
  width: min(88vw, 560px);
  transform: translateX(-50%);
}

.cloud {
  width: min(130vw, 760px);
}

.cloud--far-left {
  left: -34vw;
  top: 7svh;
  opacity: 0.45;
  animation: drift 40s ease-in-out infinite alternate;
}

.cloud--far-right {
  right: -40vw;
  top: 17svh;
  opacity: 0.55;
  animation: drift 48s ease-in-out infinite alternate-reverse;
}

.cloud--near-left {
  left: -44vw;
  top: calc(25svh + min(42vw, 270px));
  opacity: 0.85;
  animation: drift 32s ease-in-out infinite alternate-reverse;
}

.cloud--near-right {
  right: -48vw;
  top: calc(28svh + min(44vw, 290px));
  opacity: 0.8;
  animation: drift 36s ease-in-out infinite alternate;
}

/* The one motion on the page: the clouds drift past the closed palace. */
@keyframes drift {
  from {
    transform: translateX(-3vw);
  }

  to {
    transform: translateX(3vw);
  }
}

.logo {
  position: relative;
  z-index: 1;
  width: min(350px, 88vw);
  height: auto;
  filter: drop-shadow(0 4px 10px rgb(11 24 35 / 0.25));
}

/* The game's painted panel (styles.css .ornate-panel). */
.plaque {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: min(420px, 100%);
  margin-top: auto;
  padding: 20px 14px 10px;
  border: 14px solid transparent;
  border-image: url('/art/ui/panel-frame@2x.webp') 10% 6.67% / 14px;
  background: linear-gradient(180deg, rgb(22 55 71 / 0.94), rgb(11 24 35 / 0.96));
  background-clip: border-box;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
  text-align: center;
}

h1 {
  margin: 0 0 14px;
  /* Letter-spaced and re-centred: the trailing space would push it off centre. */
  padding: 0 0 14px 0.4em;
  font: 700 clamp(36px, 10vw, 46px) / 1.1 var(--title);
  letter-spacing: 0.4em;
  color: var(--gold-text);
  text-shadow: 0 2px 2px rgb(0 0 0 / 0.6);
  background: var(--gilt) center bottom / 64% 1px no-repeat;
}

.lead {
  margin: 0;
  font-size: 16px;
}

.when {
  margin: 8px 0 0;
  font: 700 clamp(17px, 4.8vw, 19px) / 1.4 var(--title);
  letter-spacing: 0.04em;
  color: var(--gold-text);
  text-wrap: balance;
}

.when time {
  white-space: nowrap;
}

.note {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--mist);
}

[hidden] {
  display: none;
}

/* The game's primary jade button (styles.css .jade-btn--primary). */
.jade {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 52px;
  max-width: 100%;
  margin-top: 20px;
  border: 0 solid transparent;
  border-width: 16px 26px;
  border-image: url('/art/ui/button-primary-normal@2x.webp') 31.25% 13.34% fill / 16px 26px;
  font: 700 18px/1.15 var(--title);
  letter-spacing: 0.1em;
  color: #08222a;
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.45);
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 120ms var(--ease-out);
}

.jade:active {
  transform: scale(0.97);
  border-image-source: url('/art/ui/button-primary-pressed@2x.webp');
}

.retry {
  display: block;
  min-height: 44px;
  margin: 6px auto 0;
  padding: 0 16px;
  border: 0;
  background: none;
  font: 600 15px/1 var(--sans);
  color: var(--jade);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms var(--ease-out);
}

.retry:active {
  transform: scale(0.97);
}

.status {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--mist);
}

:focus-visible {
  outline: 2px solid var(--gold-text);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .jade:hover {
    filter: brightness(1.06);
  }

  .retry:hover {
    color: var(--moon);
  }
}

/* Phone landscape: the logo over the palace on the left, the panel on the right. */
@media (orientation: landscape) and (max-height: 540px) {
  .stage {
    flex-direction: row;
    justify-content: center;
    gap: 28px;
    padding-left: calc(24px + env(safe-area-inset-left, 0px));
    padding-right: calc(24px + env(safe-area-inset-right, 0px));
  }

  .logo {
    align-self: flex-start;
    width: min(320px, 40vw);
  }

  .palace {
    left: 28%;
    top: 34svh;
    width: min(40vw, 400px);
  }

  .cloud--near-left,
  .cloud--near-right {
    top: 62svh;
  }

  .plaque {
    margin-top: 0;
    width: min(400px, 52vw);
    padding-top: 12px;
  }

  h1 {
    margin-bottom: 10px;
    padding-bottom: 10px;
    font-size: 34px;
  }

  .jade {
    margin-top: 14px;
  }
}

/* Desktop: the key art at its login scale. */
@media (min-width: 1024px) and (min-height: 600px) {
  .logo {
    width: min(540px, 60vw);
  }

  .palace {
    top: 24svh;
    width: min(46vw, 640px);
  }

  .cloud {
    width: min(60vw, 900px);
  }

  .cloud--far-left {
    left: -6vw;
  }

  .cloud--far-right {
    right: -8vw;
  }

  .cloud--near-left {
    left: -10vw;
    top: 52svh;
  }

  .cloud--near-right {
    right: -12vw;
    top: 56svh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cloud {
    animation: none;
  }

  .jade,
  .retry {
    transition: none;
  }
}
