/* ═══════════════════════════════════════════════════════════════
   MAINTENANCE SYSTEM — Global Toast + Blocker Page + Admin Banner
   ═══════════════════════════════════════════════════════════════ */

/* ─── GLOBAL TOAST (center popup, works on any page) ─── */
.global-toast {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;  /* above EVERYTHING */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.global-toast.gt-visible {
  opacity: 1;
  pointer-events: auto;
}
.global-toast.gt-dismissing {
  opacity: 0;
  pointer-events: none;
}

.gt-panel {
  max-width: 560px;
  width: 92vw;
  padding: 32px 38px 30px;
  background:
    radial-gradient(ellipse at top, rgba(80, 42, 14, 0.95) 0%, rgba(22, 14, 6, 0.98) 80%),
    linear-gradient(180deg, #1c130a 0%, #0c0805 100%);
  border: 2px solid #d4a545;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 16px 52px rgba(0, 0, 0, 0.92),
    0 0 42px rgba(212, 165, 69, 0.35);
  text-align: center;
  font-family: 'Crimson Text', serif;
  cursor: pointer;
  transform: scale(0.9) translateY(-20px);
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.global-toast.gt-visible .gt-panel {
  transform: scale(1) translateY(0);
}

/* Corner ornaments */
.gt-panel::before,
.gt-panel::after {
  content: '';
  position: absolute;
  width: 38px;
  height: 38px;
  border: 2px solid #d4a545;
  opacity: 0.85;
}
.gt-panel::before {
  top: 10px; left: 10px;
  border-right: none; border-bottom: none;
}
.gt-panel::after {
  bottom: 10px; right: 10px;
  border-left: none; border-top: none;
}

.gt-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
  line-height: 1;
  color: #ffd84a;
  animation: gtIconPulse 1.4s ease-in-out infinite;
}
@keyframes gtIconPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255, 216, 74, 0.5)); }
  50%      { transform: scale(1.1); filter: drop-shadow(0 0 16px rgba(255, 216, 74, 0.9)); }
}

.gt-title {
  color: #ffd700;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95), 0 0 18px rgba(212, 165, 69, 0.55);
  margin-bottom: 12px;
  font-family: 'Cinzel', 'Crimson Text', serif;
}

.gt-message {
  color: #e8d5a3;
  font-size: 1.12rem;
  line-height: 1.55;
  letter-spacing: 0.5px;
}

/* Tone variants */
.global-toast--critical .gt-panel {
  border-color: #e06060;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 16px 52px rgba(0, 0, 0, 0.92),
    0 0 42px rgba(220, 60, 60, 0.5);
}
.global-toast--critical .gt-title { color: #ff8a6b; }
.global-toast--critical .gt-icon { color: #ff8a6b; }

.global-toast--info .gt-panel {
  border-color: #6b9ddb;
}
.global-toast--info .gt-title { color: #9fb6d8; }
.global-toast--info .gt-icon { color: #9fb6d8; }

@media (max-width: 768px) {
  .gt-panel { padding: 22px 20px; }
  .gt-title { font-size: 1.35rem; letter-spacing: 2px; }
  .gt-message { font-size: 0.95rem; }
}

/* ═══════════════════════════════════════════════════════════════
   MAINTENANCE PAGE (fullscreen blocker for non-admins)
   ═══════════════════════════════════════════════════════════════ */
.maintenance-page {
  position: fixed;
  inset: 0;
  z-index: 2000000;  /* absolutely on top */
  overflow: hidden;
  background: #050302;
  color: #e8d5a3;
  font-family: 'Crimson Text', serif;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: maintFadeIn 1.5s ease-out;
}
@keyframes maintFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.maint-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.35) saturate(0.85) blur(1px);
  transform: scale(1.05);
}

.maint-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 10%, rgba(0, 0, 0, 0.75) 80%),
    linear-gradient(180deg, rgba(10, 6, 2, 0.4) 0%, rgba(10, 6, 2, 0.7) 100%);
}

.maint-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
  width: 92vw;
  text-align: center;
  padding: 50px 30px;
}

.maint-title {
  font-family: 'Cinzel', 'Crimson Text', serif;
  font-size: 3.8rem;
  font-weight: 700;
  color: #ffd700;
  letter-spacing: 10px;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 1),
    0 0 32px rgba(212, 165, 69, 0.6),
    0 0 64px rgba(212, 165, 69, 0.35);
  margin-bottom: 30px;
  animation: maintTitleGlow 4s ease-in-out infinite;
}
@keyframes maintTitleGlow {
  0%, 100% { text-shadow: 0 2px 8px rgba(0,0,0,1), 0 0 32px rgba(212, 165, 69, 0.6), 0 0 64px rgba(212, 165, 69, 0.35); }
  50%      { text-shadow: 0 2px 8px rgba(0,0,0,1), 0 0 48px rgba(255, 210, 100, 0.85), 0 0 96px rgba(255, 210, 100, 0.5); }
}

.maint-message {
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1.6;
  color: #d8c8a8;
  margin-bottom: 42px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  letter-spacing: 0.5px;
  padding: 0 20px;
}

.maint-return {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}
.maint-return-label {
  color: #b8a67a;
  font-size: 1.05rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.maint-return-time {
  color: #ffd700;
  font-size: 2.6rem;
  font-weight: 700;
  font-family: 'Cinzel', 'Crimson Text', serif;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 1), 0 0 20px rgba(212, 165, 69, 0.55);
  letter-spacing: 3px;
}

.maint-countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid rgba(212, 165, 69, 0.25);
  margin-inline: 100px;
}
.maint-countdown-label {
  color: #a89878;
  font-size: 0.95rem;
  letter-spacing: 2px;
}
.maint-countdown-time {
  color: #f3d484;
  font-size: 1.45rem;
  font-weight: 700;
  font-family: 'Cinzel', 'Crimson Text', monospace;
  letter-spacing: 3px;
}

.maint-return-static {
  color: #d4a545;
  font-size: 1.2rem;
  font-style: italic;
  margin-bottom: 30px;
}

.maint-footer {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  color: #6a5a3a;
  font-size: 0.85rem;
  letter-spacing: 6px;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .maint-title { font-size: 2.2rem; letter-spacing: 5px; }
  .maint-message { font-size: 1rem; padding: 0 10px; }
  .maint-return-time { font-size: 1.9rem; }
  .maint-countdown { margin-inline: 20px; }
  .maint-countdown-time { font-size: 1.2rem; }
}

/* ═══════════════════════════════════════════════════════════════
   ADMIN BANNER (top strip visible only to admins during maintenance)
   ═══════════════════════════════════════════════════════════════ */
/* Admin banner visible → shift ALL fixed-position game containers down by 44px.
   These elements use `position: fixed` and would otherwise cover the banner area.
   We shift each manually since they live at viewport coords, not inside #app. */
body.maint-banner-active .menu-sidebar {
  top: 44px !important;
  bottom: 0 !important;
  height: auto !important;
}
body.maint-banner-active .menu-toggle-btn {
  top: calc(50% + 22px) !important;
}
/* Kingdom wrapper — position:fixed; inset:0 */
body.maint-banner-active #kc-wrapper {
  top: 44px !important;
  height: calc(100% - 44px) !important;
}
/* Generic fullscreen menu pages (Campaign, Shop, Guild, etc.) — position:fixed; inset:0 */
body.maint-banner-active .menu-fullscreen {
  top: 44px !important;
  height: calc(100% - 44px) !important;
}
/* Game wrapper (during matches) */
body.maint-banner-active #gameWrapper {
  top: 44px !important;
  height: calc(100% - 44px) !important;
}
/* Normal menu screen (#app > .menu-screen) — body padding handles this */
body.maint-banner-active {
  padding-top: 44px !important;
  box-sizing: border-box !important;
  height: 100dvh !important;
}
body.maint-banner-active #app {
  height: 100% !important;
  width: 100% !important;
}

.maint-admin-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100000;
  height: 44px;
  padding: 10px 18px;
  box-sizing: border-box;
  background: linear-gradient(90deg, rgba(180, 60, 60, 0.95) 0%, rgba(140, 30, 30, 0.98) 50%, rgba(180, 60, 60, 0.95) 100%);
  border-bottom: 1px solid #ff8a6b;
  color: #ffd8c6;
  font-family: 'Crimson Text', serif;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
  animation: mabSlideDown 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes mabSlideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
.mab-label {
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 0.95rem;
}
.mab-time {
  color: #fff0a0;
  font-weight: 700;
}
.mab-note {
  color: #ffb8a5;
  font-style: italic;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .maint-admin-banner { flex-wrap: wrap; gap: 6px; font-size: 0.82rem; padding: 8px 10px; }
  .mab-label { font-size: 0.85rem; letter-spacing: 2px; }
  .mab-note { width: 100%; text-align: center; font-size: 0.78rem; }
}

/* ═══════════════════════════════════════════════════════════════
   SYSTEM MESSAGES IN GLOBAL CHAT (persistent maintenance reminders)
   ═══════════════════════════════════════════════════════════════ */
.gc-msg.gc-msg--system {
  padding: 6px 10px !important;
  margin: 6px 0;
  justify-content: center !important;
}
.gc-sys-bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 14px;
  border-radius: 8px;
  max-width: 92%;
  font-family: 'Crimson Text', serif;
}
.gc-msg--sys-warn .gc-sys-bubble {
  background: linear-gradient(135deg, rgba(120, 78, 18, 0.32), rgba(50, 32, 10, 0.55));
  border: 1px solid rgba(212, 165, 69, 0.65);
  box-shadow: 0 0 12px rgba(212, 165, 69, 0.18);
}
.gc-msg--sys-critical .gc-sys-bubble {
  background: linear-gradient(135deg, rgba(180, 60, 60, 0.3), rgba(80, 20, 20, 0.55));
  border: 1px solid rgba(220, 80, 80, 0.7);
  box-shadow: 0 0 14px rgba(220, 60, 60, 0.22);
}
.gc-sys-label {
  color: #ffd84a;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.gc-msg--sys-critical .gc-sys-label { color: #ff8a6b; }
.gc-msg--system .gc-text {
  color: #f3d484;
  font-size: 0.92rem;
  line-height: 1.4;
}
.gc-msg--sys-critical .gc-text { color: #ffb6a0; }
.gc-msg--system .gc-time {
  color: #8a7a5a;
  font-size: 0.65rem;
  align-self: flex-end;
}
