/* First visit: a military composition around one central, real battle action. */
.welcome-mode > .topbar,
.welcome-mode > .game-nav {
  display: none;
}
.welcome-mode .view:not(#welcome-view) {
  display: none;
}
.welcome-mode .workspace {
  background: #07172f;
}
.welcome-mode .workspace main {
  padding: 0;
  max-width: none;
}
#welcome-view {
  position: relative;
  isolation: isolate;
  height: 100%;
  width: 100%;
  color: #fff4d6;
  background: #07172f;
  overflow: hidden;
}
.welcome-glow {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: radial-gradient(
    ellipse 42% 68% at 50% 49%,
    #367598 0%,
    #204863 39%,
    #102842 68%,
    #07172f 100%
  );
}
.welcome-battle-art {
  position: absolute;
  height: 94%;
  width: 100%;
  max-width: 860px;
  left: 50%;
  top: 5%;
  transform: translateX(-50%);
  object-fit: contain;
  pointer-events: none;
  z-index: -1;
  filter: drop-shadow(0 14px 14px #030b20aa);
  animation: welcome-art-enter 800ms ease-out both;
}
.welcome-logo {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: clamp(195px, 39vw, 320px);
  height: auto;
  filter: drop-shadow(0 5px 3px #030e22bd);
  z-index: 1;
}
.welcome-command {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(78%, 350px);
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
  z-index: 2;
}

#welcome-start {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  min-height: 80px;
  padding: 12px 15px;
  border-radius: 22px;
  border: 2px solid #ffedb7;
  background: linear-gradient(#fff0a9 0%, #ffdc72 45%, #efb63b 46%, #e8a92c 100%);
  box-shadow:
    inset 0 4px 0 #fff7ce,
    inset 0 -3px 0 #d48c20,
    0 7px 0 #956027,
    0 13px 28px #031128a8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #533314;
  text-shadow: 0 2px #ffe79a;
  transition:
    transform 120ms,
    box-shadow 120ms;
}
#welcome-start > img {
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  filter: drop-shadow(0 2px 0 #b77b28);
}
#welcome-start > span {
  font:
    27px/1.04 'Lilita One',
    sans-serif;
  text-align: left;
  position: relative;
  z-index: 1;
}
#welcome-start > i {
  position: absolute;
  inset: -50% auto -50% -60%;
  width: 30%;
  transform: rotate(20deg);
  background: linear-gradient(90deg, transparent, #ffffffa0, transparent);
  animation: welcome-shine 5s 1.2s ease-in-out infinite;
  pointer-events: none;
}
#welcome-start:hover {
  filter: brightness(1.06);
}
#welcome-start:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px #fff7ce,
    0 3px #956027,
    0 8px 18px #03112888;
}
#welcome-start:focus-visible,
#welcome-login:focus-visible {
  outline: 3px solid #a0efff;
  outline-offset: 6px;
}
#welcome-start:disabled {
  opacity: 0.86;
  cursor: wait;
}

#welcome-status {
  position: absolute;
  top: 100%;
  width: 100%;
  margin: 17px 0 0;
  min-height: 18px;
  font:
    800 12px/1.25 Nunito,
    sans-serif;
  color: #ffe5a1;
}
.welcome-footer {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0 10px;
  background: linear-gradient(transparent, #07172ff5 40%);
  color: #c5d6e5;
  font:
    700 12px/1.3 Nunito,
    sans-serif;
  text-align: center;
}
#welcome-login {
  min-height: 44px;
  background: none;
  border: none;
  box-shadow: none;
  font:
    800 14px Nunito,
    sans-serif;
  padding: 9px 14px;
  color: #cfdee8;
}
#welcome-login b {
  color: #ffe197;
  margin-left: 4px;
}
@keyframes welcome-art-enter {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(1.035);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}
@keyframes welcome-shine {
  0%,
  72% {
    left: -60%;
  }
  100% {
    left: 150%;
  }
}
@media (min-width: 700px) and (min-height: 501px) {
  .welcome-battle-art {
    max-width: min(900px, 92vh);
    object-fit: contain;
  }
  .welcome-command {
    width: 320px;
  }
}
@media (max-height: 650px) and (orientation: portrait) {
  .welcome-logo {
    width: 190px;
    top: 6px;
  }

  #welcome-start {
    min-height: 66px;
    border-radius: 18px;
    padding: 8px 12px;
  }
  #welcome-start > span {
    font-size: 23px;
  }
  #welcome-start > img {
    width: 37px;
    height: 37px;
    flex-basis: 37px;
  }

  #welcome-status {
    font-size: 11px;
    margin-top: 5px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .welcome-battle-art {
    height: 170%;
    width: min(850px, 100%);
    max-width: none;
    top: -29%;
    object-fit: contain;
  }
  .welcome-logo {
    width: 184px;
    left: 13px;
    top: 8px;
    transform: none;
  }
  .welcome-command {
    width: 275px;
    top: 51%;
  }

  #welcome-start {
    min-height: 66px;
    padding: 8px 12px;
  }
  #welcome-start > span {
    font-size: 23px;
  }

  .welcome-footer {
    padding-top: 8px;
    bottom: 4px;
    flex-direction: row;
    justify-content: center;
    gap: 12px;
  }

  #welcome-login {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-battle-art,
  #welcome-start > i {
    animation: none;
  }
  #welcome-start {
    transition: none;
  }
}

@media (orientation: portrait) {
  .welcome-battle-art {
    width: 100%;
    height: auto;
    top: 7%;
    -webkit-mask-image: linear-gradient(#000 30%, transparent 44%);
    mask-image: linear-gradient(#000 30%, transparent 44%);
  }
  .welcome-battle-art-allies {
    top: auto;
    bottom: 3%;
    -webkit-mask-image: linear-gradient(transparent 41%, #000 53%);
    mask-image: linear-gradient(transparent 41%, #000 53%);
  }
}
@media (orientation: landscape) {
  .welcome-battle-art-allies {
    display: none;
  }
}

#welcome-title {
  margin: 0;
  position: absolute;
  bottom: calc(100% + 24px);
  width: 115%;
  color: #fff0b4;
  font:
    44px/1.04 'Lilita One',
    sans-serif;
  text-shadow:
    0 3px 0 #132b43,
    0 7px 20px #030d24;
}
/* Cards deal out of the left stack, lift through the centre and settle at right. */
.welcome-deck {
  --card-height: clamp(104px, 18vh, 160px);
  --card-width: calc(var(--card-height) * 0.73);
  --travel: calc(100vw - var(--card-width) - 40px);
  position: absolute;
  inset: auto 0 max(44px, env(safe-area-inset-bottom));
  height: calc(var(--card-height) + 44px);
  z-index: 1;
  pointer-events: none;
  perspective: 850px;
}
.welcome-deck-track {
  position: absolute;
  inset: 0;
  perspective: 850px;
}
.welcome-deck-card {
  position: absolute;
  height: var(--card-height);
  width: var(--card-width);
  padding: 4px;
  border: 2px solid #fff0b3;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff2b1, #d79622 45%, #fff0a8 75%, #b67a1d);
  box-shadow:
    0 5px 0 #88571d,
    0 9px 14px #020c2299;
}
.welcome-deck-card {
  left: 20px;
  top: 22px;
  animation: welcome-deck-shuffle 7s linear infinite;
  animation-delay: calc(var(--order) * -7s / 18);
  will-change: transform, opacity;
}
.welcome-deck-card svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: #173854;
  border: 1px solid #714411;
}
/* Each element queues at the left, becomes the top card, travels, then joins
   the top of the right stack. Older arrivals move deeper as newer cards land.
   Only a fully covered bottom card is recycled; there are no separate piles. */
@keyframes welcome-deck-shuffle {
  0% {
    opacity: 0;
    z-index: 1;
    transform: translate3d(-22px, 13px, -28px) rotateY(66deg) rotateZ(-7deg);
  }
  2% {
    opacity: 1;
    z-index: 1;
    transform: translate3d(-22px, 13px, -28px) rotateY(66deg) rotateZ(-7deg);
  }
  12% {
    opacity: 1;
    z-index: 2;
    transform: translate3d(-11px, 7px, -14px) rotateY(66deg) rotateZ(-7deg);
  }
  24% {
    opacity: 1;
    z-index: 4;
    transform: translate3d(0, 0, 0) rotateY(66deg) rotateZ(-7deg);
  }
  25% {
    opacity: 1;
    z-index: 20;
    transform: translate3d(0, 0, 0) rotateY(66deg) rotateZ(-7deg);
  }
  32% {
    opacity: 1;
    z-index: 20;
    transform: translate3d(calc(var(--travel) * 0.12), -15px, 35px) rotateY(28deg) rotateZ(-7deg);
  }
  43% {
    opacity: 1;
    z-index: 20;
    transform: translate3d(calc(var(--travel) * 0.4), 2px, 45px) rotateY(8deg) rotateZ(-4deg);
  }
  54% {
    opacity: 1;
    z-index: 20;
    transform: translate3d(calc(var(--travel) * 0.75), -13px, 40px) rotateY(-24deg) rotateZ(4deg);
  }
  62% {
    opacity: 1;
    z-index: 20;
    transform: translate3d(calc(var(--travel) * 0.98), -5px, 15px) rotateY(-62deg) rotateZ(7deg);
  }
  65% {
    opacity: 1;
    z-index: 20;
    transform: translate3d(var(--travel), 0, 0) rotateY(-66deg) rotateZ(7deg);
  }
  66% {
    opacity: 1;
    z-index: 5;
    transform: translate3d(var(--travel), 0, 0) rotateY(-66deg) rotateZ(7deg);
  }
  76% {
    opacity: 1;
    z-index: 4;
    transform: translate3d(calc(var(--travel) + 7px), 4px, -9px) rotateY(-66deg) rotateZ(7deg);
  }
  86% {
    opacity: 1;
    z-index: 3;
    transform: translate3d(calc(var(--travel) + 15px), 9px, -18px) rotateY(-66deg) rotateZ(7deg);
  }
  96% {
    opacity: 1;
    z-index: 1;
    transform: translate3d(calc(var(--travel) + 22px), 13px, -28px) rotateY(-66deg) rotateZ(7deg);
  }
  98% {
    opacity: 0;
    z-index: 1;
    transform: translate3d(calc(var(--travel) + 22px), 13px, -28px) rotateY(-66deg) rotateZ(7deg);
  }
  99%,
  100% {
    opacity: 0;
    z-index: 1;
    transform: translate3d(-22px, 13px, -28px) rotateY(66deg) rotateZ(-7deg);
  }
}
@media (max-width: 400px) {
  #welcome-title {
    font-size: 35px;
    bottom: calc(100% + 21px);
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .welcome-deck {
    --card-height: 88px;
    bottom: 35px;
  }
  .welcome-command {
    top: 43%;
  }
  #welcome-title {
    font-size: 31px;
    bottom: calc(100% + 15px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-deck-card {
    animation: none;
    will-change: auto;
    left: calc(20px + var(--travel) * var(--order) / 5);
    transform: rotate(-4deg);
  }
  .welcome-deck-card:nth-child(n + 7) {
    display: none;
  }
  .welcome-deck-card:nth-child(even) {
    transform: rotate(4deg) translateY(-8px);
  }
}

.welcome-card-name {
  position: absolute;
  bottom: 5px;
  left: 5px;
  right: 5px;
  min-height: 28%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 3px 4px;
  border-radius: 0 0 9px 9px;
  background: linear-gradient(transparent, #091b36ed 25%, #091b36 100%);
  color: #fff1bb;
  font:
    clamp(11px, 1.7vh, 15px) / 1.02 'Lilita One',
    sans-serif;
  text-align: center;
  text-shadow: 0 2px 1px #020919;
}
