/*
 * The welcome gate (gate.js): the card the page opens on. Behind it, once you
 * are signed in, the square is drawn and blurred (body.gate-prep); until then
 * a plain sea-blue fill (no image to download first).
 */

/* The old menu page and its account chips stay out of sight while the gate is up. */
body.gate-on .game-page,
body.gate-on .account-bar {
  display: none;
}
body.gate-on {
  overflow: hidden;
}

.wg {
  position: fixed;
  inset: 0;
  z-index: 80;                 /* over the square (55) and the account layer (60), under the sign-in dialog (90) */
  display: grid;
  place-items: center;
  padding: 16px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fffaf0;
  transition: opacity 0.4s ease;
}
.wg[hidden] { display: none; }
.wg.leaving { opacity: 0; pointer-events: none; }

.wg-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, #1c88c4 0%, #0a5a8c 45%, #052a42 100%);
  transition: opacity 0.6s ease, background-color 0.6s ease;
}
/* The square is ready behind: show it, tinted and blurred. */
body.gate-prep .wg-bg {
  background: rgba(5, 42, 66, 0.42);
}

/* The square under the card: blurred, no HUD. */
body.gate-prep .hub-layer .hub-canvas {
  filter: blur(9px) saturate(1.1);
  transform: scale(1.04);          /* hides the soft edge the blur leaves */
}
body.gate-prep .hub-layer .hub-hud {
  display: none;
}
.hub-layer .hub-canvas {
  transition: filter 0.45s ease, transform 0.45s ease;
}

.wg-card {
  position: relative;
  width: min(400px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-sizing: border-box;
  padding: 26px 24px 22px;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.97);
  color: #10232d;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.wg-brand h1 {
  max-width: none;            /* styles.css caps every h1 at 11ch */
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.7rem;
  line-height: 1.1;
  color: #064a73;
}
.wg-brand p {
  margin: 4px 0 14px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5b7482;
}

.wg-title {
  max-width: none;
  line-height: 1.15;
  margin: 6px 0 4px;
  font-size: 1.25rem;
  color: #10232d;
  overflow-wrap: anywhere;
}
.wg-sub {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #3d5563;
}
.wg-status {
  margin: 8px 0 14px;
  font-size: 0.82rem;
  color: #5b7482;
  min-height: 1.2em;
}

.wg-bar {
  height: 6px;
  margin: 12px 0 0;
  border-radius: 999px;
  background: #d9e6ee;
  overflow: hidden;
}
.wg-bar i {
  display: block;
  height: 100%;
  width: 4%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1c88c4, #f3c744);
  transition: width 0.35s ease;
}

.wg-spin {
  width: 26px;
  height: 26px;
  margin: 6px auto 4px;
  border-radius: 50%;
  border: 3px solid #d9e6ee;
  border-top-color: #064a73;
  animation: wg-spin 0.9s linear infinite;
}
@keyframes wg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .wg-spin { animation-duration: 3s; }
  .wg, .wg-bg, .wg-bar i, .hub-layer .hub-canvas { transition: none; }
}

.wg-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f6d256, #e0b02b);
  color: #10232d;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #a67f12;
}
.wg-btn:hover:not(:disabled) { filter: brightness(1.05); }
.wg-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #a67f12; }
.wg-btn:disabled {
  cursor: default;
  background: #cfdbe3;
  color: #5b7482;
  box-shadow: none;
}
.wg-btn:focus-visible,
.wg-link:focus-visible,
.wg-tab:focus-visible,
.wg-form input:focus-visible {
  outline: 3px solid #1c88c4;
  outline-offset: 2px;
}

.wg-link {
  margin: 14px auto 0;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: #4a6676;
  font: inherit;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
}
.wg-link:disabled { cursor: default; text-decoration: none; }

.wg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  border-radius: 12px;
  background: #e5eef4;
}
.wg-tab {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: #4a6676;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.wg-tab.on {
  background: #064a73;
  color: #fffaf0;
}

.wg-form { text-align: left; }
.wg-form label {
  display: block;
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #3d5563;
}
.wg-form input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 9px 12px;
  border: 2px solid #c3d4de;
  border-radius: 10px;
  background: #fff;
  color: #10232d;
  font: inherit;
  font-size: 1rem;            /* 16px: no zoom on iOS */
  font-weight: 500;
}
.wg-error {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fde8e6;
  color: #9b1c12;
  font-size: 0.85rem;
  font-weight: 600;
}
.wg-error[hidden] { display: none; }

.wg-code {
  display: block;
  margin: 4px 0 14px;
  padding: 12px 10px;
  border-radius: 10px;
  background: #10232d;
  color: #f3c744;
  font: 700 1.05rem/1.3 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
  user-select: all;
}

@media (max-width: 420px) {
  .wg-card { padding: 22px 18px 18px; }
  .wg-brand h1 { font-size: 1.5rem; }
}
