/* The display faces, cut down to the characters the game draws (npm run fonts). Labels name them in their font stacks. */
@font-face { font-family: "Anome Serif"; src: url("fonts/serif-700.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "Anome Serif Heavy"; src: url("fonts/serif-900.woff2") format("woff2"); font-weight: 900; font-display: block; }
@font-face { font-family: "Anome Roman"; src: url("fonts/roman-700.woff2") format("woff2"); font-weight: 700; font-display: block; }
:root { color-scheme: dark; --safe-top: env(safe-area-inset-top); --safe-right: env(safe-area-inset-right); --safe-bottom: env(safe-area-inset-bottom); --safe-left: env(safe-area-inset-left); }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #0a0f24; }
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
#GameDiv { position: fixed; inset: 0; width: 100%; height: 100%; margin: 0; border: 0; }
#Cocos3dGameContainer, #GameCanvas { display: block; width: 100%; height: 100%; }
#GameCanvas { touch-action: none; outline: none; }
#GameDiv { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
noscript { position: fixed; top: 45%; width: 100%; text-align: center; color: #9aa2c4; }

/* Loading screen: the night-blue hall with the card back's gold compass, shown from first paint until the deck builder is ready. */
#boot {
  position: fixed; inset: 0; z-index: 10; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(20px + var(--safe-right)) calc(72px + var(--safe-bottom)) calc(20px + var(--safe-left));
  color: #eef0fa; user-select: none; -webkit-user-select: none;
  background:
    radial-gradient(ellipse 55% 32% at 50% 36%, rgba(120, 140, 255, .2), rgba(243, 200, 110, .05) 60%, transparent 75%),
    radial-gradient(ellipse 130% 70% at 50% 0%, #18224e 0%, #0a0f24 62%, #070a1a 100%);
  transition: opacity .2s ease;
}
/* The compass from the card back, faint behind the fan. */
#boot::before {
  content: ""; position: absolute; left: 50%; top: 36%; width: 420px; height: 420px; margin: -210px 0 0 -210px; pointer-events: none; opacity: .2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-100 -100 200 200'%3E%3Cg fill='none' stroke='%23d6b46a'%3E%3Ccircle r='70' stroke-width='.8'/%3E%3Ccircle r='84' stroke-width='.4'/%3E%3Cpath d='M0-98L8-8L98 0L8 8L0 98L-8 8L-98 0L-8-8Z' stroke-width='.8'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
#boot::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 95% 80% at 50% 42%, transparent 55%, rgba(3, 5, 14, .7) 100%); }
#boot.is-away { opacity: 0; pointer-events: none; }
#boot.is-done { opacity: 0; pointer-events: none; transition: opacity .5s ease .08s; }
#boot.is-done .boot-stage { transform: scale(1.04); }

.boot-motes { position: absolute; inset: 0; pointer-events: none; }
.boot-motes i {
  position: absolute; bottom: -8px; width: 2px; height: 2px; border-radius: 50%;
  background: #f3e1a8; box-shadow: 0 0 6px 1px rgba(243, 225, 168, .6); opacity: 0;
  animation: boot-mote 12s linear infinite;
}
.boot-motes i:nth-child(1) { left: 12%; animation-delay: -1s; }
.boot-motes i:nth-child(2) { left: 24%; animation-delay: -7s; animation-duration: 14s; transform: scale(.7); }
.boot-motes i:nth-child(3) { left: 37%; animation-delay: -4s; }
.boot-motes i:nth-child(4) { left: 49%; animation-delay: -9.5s; animation-duration: 15s; }
.boot-motes i:nth-child(5) { left: 61%; animation-delay: -2.5s; animation-duration: 13s; transform: scale(.6); }
.boot-motes i:nth-child(6) { left: 72%; animation-delay: -6s; }
.boot-motes i:nth-child(7) { left: 83%; animation-delay: -10.5s; animation-duration: 14s; transform: scale(.8); }
.boot-motes i:nth-child(8) { left: 92%; animation-delay: -3.5s; animation-duration: 16s; }
@keyframes boot-mote {
  0% { opacity: 0; translate: 0 0; }
  15% { opacity: .7; }
  70% { opacity: .45; }
  100% { opacity: 0; translate: 18px -86vh; }
}

/* Free space splits evenly above the emblem and above the bar, so the emblem sits a little above centre and the bar near the bottom. */
.boot-stage { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; margin-top: auto; transition: transform .6s ease; }

/* Five compass backs fanned like a hand; a lift ripples across them while loading. */
.boot-fan { position: relative; width: 250px; height: 150px; margin-bottom: 26px; }
.boot-fan::before {
  content: ""; position: absolute; left: 50%; bottom: -26px; width: 300px; height: 120px; margin-left: -150px;
  background: radial-gradient(ellipse at center, rgba(214, 180, 106, .22), transparent 68%);
}
.boot-fan i {
  position: absolute; left: 50%; bottom: 0; width: 76px; height: 96px; margin-left: -38px;
  transform-origin: 50% 230%; transform: rotate(var(--angle));
  animation: boot-spread .7s cubic-bezier(.2, .8, .25, 1.15) both; animation-delay: var(--deal);
}
.boot-fan b {
  display: block; width: 100%; height: 100%; border-radius: 6px;
  background: #1d2a44 url("boot-card.jpg") center / cover;
  box-shadow: 0 0 0 1px #05070f, 0 0 0 2px rgba(214, 180, 106, .7), 0 12px 20px rgba(0, 0, 0, .6);
  animation: boot-lift 2.6s ease-in-out infinite; animation-delay: calc(var(--deal) + .8s);
}
@keyframes boot-spread { from { transform: rotate(0deg) translateY(36px); opacity: 0; } to { transform: rotate(var(--angle)); opacity: 1; } }
@keyframes boot-lift {
  0%, 34%, 100% { translate: 0 0; }
  14% { translate: 0 -14px; box-shadow: 0 0 0 1px #05070f, 0 0 0 2px #f3e1a8, 0 0 22px rgba(243, 200, 110, .45), 0 18px 22px rgba(0, 0, 0, .55); }
}

.boot-title {
  margin: 0; padding-left: .18em; letter-spacing: .18em;
  font: 700 46px/1.05 "Anome Roman", Cinzel, Georgia, serif;
  color: #f3e1a8;
  background: linear-gradient(180deg, #fff6d6 15%, #e6c77e 55%, #a67c32 95%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .7));
}
.boot-subtitle { display: flex; align-items: center; gap: 12px; margin: 10px 0 0; font: 900 15px/1.2 "Anome Serif Heavy", "Noto Serif SC", "Songti SC", STSong, serif; color: #f3e1a8; }
.boot-subtitle span { padding-left: .5em; letter-spacing: .5em; }
.boot-rule { width: 44px; height: 1px; background: linear-gradient(90deg, transparent, #d6b46a); }
.boot-rule:last-child { background: linear-gradient(270deg, transparent, #d6b46a); }
.boot-gem { display: none; }

.boot-progress { position: relative; z-index: 1; width: min(260px, 72vw); margin-top: auto; padding-top: 40px; margin-bottom: 18px; }
.boot-status { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 2px 10px; font: 700 13px/1.2 "Anome Serif", "Noto Serif SC", "Songti SC", STSong, serif; letter-spacing: .08em; color: #9aa2c4; }
.boot-status b { color: #f3e1a8; font: 700 13px/1 "Anome Roman", Georgia, serif; font-variant-numeric: tabular-nums; }
.boot-bar { position: relative; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); box-shadow: 0 0 0 1px rgba(214, 180, 106, .22); }
.boot-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; overflow: hidden; border-radius: 2px;
  background: linear-gradient(90deg, #9c7832, #e6c77e 70%, #fff3cc);
  box-shadow: 0 0 10px rgba(243, 200, 110, .6);
}
.boot-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .7) 50%, transparent 70%);
  animation: boot-sheen 1.8s ease-in-out infinite;
}
@keyframes boot-sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.boot-retry {
  display: block; margin: 22px auto 0; min-width: 156px; height: 46px; padding: 0 26px; border: 0; border-radius: 23px; cursor: pointer;
  font: 700 15px/1 "Anome Serif", "Noto Serif SC", "Songti SC", serif; letter-spacing: .2em; color: #1d1608;
  background: linear-gradient(180deg, #fbeec2 0%, #e5c27a 40%, #c69844 75%, #a87a2e 100%);
  box-shadow: 0 0 0 1px #5e4314, inset 0 2px 0 rgba(255, 255, 255, .7), 0 10px 18px -8px rgba(0, 0, 0, .9);
}
.boot-retry[hidden] { display: none; }
#boot.is-failed .boot-status { justify-content: center; }
#boot.is-failed .boot-status span { color: #f0a395; }
#boot.is-failed .boot-status b { display: none; }
#boot.is-failed .boot-fill { background: linear-gradient(90deg, #7a1d2a, #e0796b); }
#boot.is-failed .boot-fill::after, #boot.is-failed .boot-fan b { animation: none; }

.boot-tip {
  position: absolute; z-index: 1; left: calc(28px + var(--safe-left)); right: calc(28px + var(--safe-right)); bottom: calc(24px + var(--safe-bottom));
  margin: 0 auto; max-width: 420px; text-align: center; font-size: 12px; line-height: 1.65; color: rgba(154, 162, 196, .9);
  text-wrap: balance; transition: opacity .35s ease;
}
.boot-tip b { margin-right: .6em; color: #d6b46a; font-weight: 600; letter-spacing: .1em; }
.boot-tip.is-fading { opacity: 0; }

@media (min-height: 760px) and (min-width: 360px) {
  .boot-fan { height: 170px; margin-bottom: 30px; }
  .boot-fan i { width: 86px; height: 109px; margin-left: -43px; }
  .boot-title { font-size: 52px; }
}
@media (max-height: 480px) {
  #boot { padding-bottom: calc(16px + var(--safe-bottom)); }
  .boot-fan { height: 104px; margin-bottom: 12px; }
  .boot-fan i { width: 56px; height: 71px; margin-left: -28px; }
  .boot-title { font-size: 34px; }
  .boot-progress { padding-top: 22px; margin-bottom: 0; }
  .boot-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #boot *, #boot *::before, #boot *::after { animation: none !important; transition: none !important; }
  .boot-motes { display: none; }
}
