/* ============================================================
   TOAST NOTIFICATIONS - Compact bottom-right toasts
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height, 56px) + var(--ticker-height, 22px) + 12px);
  right: 12px;
  z-index: 10001;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  pointer-events: none;
  width: auto;
  max-width: min(340px, calc(100vw - 24px));
}

/* Anchored inside the Living World band (top/right set inline from its rect) */
.toast-container--vp {
  flex-direction: column;
  max-width: min(300px, calc(100vw - 24px));
}

.toast {
  --toast-rgb: 0, 210, 211;
  position: relative;
  border-radius: 6px;
  padding: 8px 14px 8px 12px;
  font-size: 0.78rem;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.25s ease-out;
  background: rgba(13, 13, 31, 0.95);
  border: 1px solid rgba(var(--toast-rgb), 0.25);
  border-left: 3px solid rgba(var(--toast-rgb), 0.8);
  box-shadow: 0 4px 16px var(--scrim-40),
              0 0 8px rgba(var(--toast-rgb), 0.1);
  pointer-events: auto;
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
}

/* Type color overrides */
.toast.info    { --toast-rgb: 0, 210, 211; }
.toast.success { --toast-rgb: 16, 185, 129; }
.toast.warning { --toast-rgb: 245, 158, 11; }
.toast.error   { --toast-rgb: 239, 68, 68; }

/* Severity glyph: shape carries the state (✓ / ! / ✕ / i), colour only reinforces */
.toast-glyph {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1;
  color: #0d0d1f;
  background: rgba(var(--toast-rgb), 0.9);
}
.toast.warning .toast-glyph,
.toast.error .toast-glyph {
  border-radius: 3px; /* squared chip: severity readable by shape, not hue */
}

.toast-body {
  min-width: 0;
}

.toast--tappable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.toast--tappable:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--scrim-50),
              0 0 12px rgba(var(--toast-rgb), 0.25);
}

/* Subtle top shimmer */
.toast::after {
  content: '';
  position: absolute;
  top: 0; left: 3px; right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--toast-rgb), 0.6), transparent 70%);
  pointer-events: none;
}

.toast.fade-out {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}

.toast .cost-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 2px;
}

/* Duplicate counter badge */
.toast-count {
  margin-left: auto;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  background: rgba(var(--toast-rgb), 0.4);
  border: 1px solid rgba(var(--toast-rgb), 0.6);
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   ALLIANCE CHAT FLOATING INDICATOR
   Persistent pill shown bottom-centered, above the bottom nav,
   when the player has unread alliance chat messages and is not
   currently on the Alliance view. Clicking it navigates there.
   ============================================================ */

.alliance-unread-floater {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-height, 56px) + var(--ticker-height, 22px) + 14px);
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 10px;
  max-width: min(320px, calc(100vw - 24px));
  border-radius: 999px;
  background: linear-gradient(180deg, #00e5e7, #00b3b5);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55),
              0 0 18px rgba(0, 229, 231, 0.55);
  color: #04121a;
  font-size: 0.78rem;
  line-height: 1.2;
  cursor: pointer;
  animation: alliance-floater-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.alliance-unread-floater:hover {
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6),
              0 0 22px rgba(0, 229, 231, 0.75);
}
.alliance-unread-floater.hidden { display: none; }

.alliance-unread-floater .alliance-floater-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #04121a;
}

.alliance-unread-floater .alliance-floater-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.alliance-unread-floater .alliance-floater-title {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(4, 18, 26, 0.75);
  font-weight: 700;
}
.alliance-unread-floater .alliance-floater-name {
  font-weight: 700;
  color: #04121a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alliance-unread-floater .alliance-floater-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #04121a;
  color: #00e5e7;
  font-weight: 700;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px rgba(4, 18, 26, 0.35);
  flex-shrink: 0;
}

.alliance-unread-floater .alliance-floater-close {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(4, 18, 26, 0.35);
  color: rgba(4, 18, 26, 0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.alliance-unread-floater .alliance-floater-close:hover {
  color: #04121a;
  border-color: rgba(4, 18, 26, 0.7);
}

@keyframes alliance-floater-in {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.96); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@media (max-width: 480px) {
  .alliance-unread-floater {
    max-width: calc(100vw - 24px);
    font-size: 0.74rem;
    padding: 7px 10px 7px 8px;
  }
  .alliance-unread-floater .alliance-floater-icon { width: 18px; height: 18px; }
}

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

/* ============================================================
   PUSH NOTIFICATION PROMPT BANNER
   ============================================================ */

.push-prompt-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-height, 56px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  width: calc(100% - 24px);
  max-width: 420px;
  background: rgba(13, 13, 31, 0.96);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px var(--scrim-50), 0 0 20px rgba(0, 200, 255, 0.1);
  animation: slide-up-banner 0.4s ease-out;
  flex-wrap: wrap;
}
.push-prompt-banner.hidden { display: none; }
.push-prompt-banner span { flex: 1; font-size: 0.82rem; min-width: 150px; }
.push-prompt-banner .icon { color: var(--cyan); }
.push-prompt-actions { display: flex; gap: 8px; flex-shrink: 0; }

@keyframes slide-up-banner {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================================
   OBJECTIVE TOAST - Global progress notification
   Slides in from the top, sits above all routed screens.
   Two variants: PROGRESS (compact cyan) and FESTIVE (golden).
   ============================================================ */

.obj-toast-layer {
  position: fixed;
  top: calc(var(--banner-offset, 0px) + var(--topbar-height, 52px) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(380px, calc(100vw - 24px));
}

.obj-toast {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg, rgba(10, 14, 28, 0.97), rgba(7, 10, 22, 0.97));
  border: 1px solid rgba(0, 210, 211, 0.35);
  border-radius: 10px;
  padding: 10px 14px 12px;
  color: var(--text, #e6f4f5);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.55),
    0 0 14px rgba(0, 210, 211, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
  cursor: pointer;
  animation: obj-toast-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.obj-toast::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 210, 211, 0.75), transparent);
  pointer-events: none;
}

.obj-toast.fade-out {
  animation: obj-toast-out 0.35s ease-in forwards;
}

.obj-toast-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.obj-toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #00d2d3;
  filter: drop-shadow(0 0 4px rgba(0, 210, 211, 0.6));
}

.obj-toast-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(0, 210, 211, 0.85);
  font-weight: 600;
  line-height: 1;
}

.obj-toast-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text, #e6f4f5);
  line-height: 1.25;
  margin-top: 2px;
  /* clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.obj-toast-text { flex: 1; min-width: 0; }

.obj-toast-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: rgba(230, 244, 245, 0.85);
}

.obj-toast-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #00d2d3;
  white-space: nowrap;
  font-size: 0.78rem;
}

.obj-toast-bar {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.obj-toast-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #0891a1, #00d2d3 60%, #7df9ff);
  box-shadow: 0 0 6px rgba(0, 210, 211, 0.55);
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── FESTIVE VARIANT ─────────────────────────────────────── */

.obj-toast.festive {
  border: 1px solid rgba(255, 206, 84, 0.55);
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(255, 206, 84, 0.15), transparent 55%),
    linear-gradient(180deg, rgba(22, 16, 8, 0.97), rgba(14, 10, 6, 0.97));
  box-shadow:
    0 14px 44px rgba(0, 0, 0, 0.65),
    0 0 32px rgba(255, 206, 84, 0.32),
    0 0 60px rgba(255, 140, 50, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 14px 16px 16px;
  animation: obj-toast-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3), festive-glow 2.4s ease-in-out infinite 0.4s;
}

.obj-toast.festive::before {
  background: linear-gradient(90deg, transparent, rgba(255, 220, 120, 0.9), rgba(255, 140, 50, 0.5), rgba(255, 220, 120, 0.9), transparent);
  height: 2px;
}

.obj-toast.festive .obj-toast-icon {
  width: 30px;
  height: 30px;
  color: #ffd24a;
  filter: drop-shadow(0 0 6px rgba(255, 206, 84, 0.9));
  animation: festive-trophy 1.6s ease-in-out infinite;
}

.obj-toast.festive .obj-toast-label {
  color: #ffd24a;
  font-size: 0.66rem;
}

.obj-toast.festive .obj-toast-title {
  font-size: 0.98rem;
  color: #fff4d6;
  text-shadow: 0 0 12px rgba(255, 206, 84, 0.35);
}

.obj-toast.festive .obj-toast-count {
  color: #ffd24a;
}

.obj-toast.festive .obj-toast-bar-fill {
  background: linear-gradient(90deg, #ff8c32, #ffd24a 50%, #fff0a8);
  box-shadow: 0 0 10px rgba(255, 206, 84, 0.75);
}

@keyframes festive-glow {
  0%, 100% {
    box-shadow:
      0 14px 44px rgba(0, 0, 0, 0.65),
      0 0 28px rgba(255, 206, 84, 0.28),
      0 0 55px rgba(255, 140, 50, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  50% {
    box-shadow:
      0 14px 48px var(--scrim-70),
      0 0 38px rgba(255, 206, 84, 0.42),
      0 0 80px rgba(255, 140, 50, 0.26),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }
}

@keyframes festive-trophy {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-4deg); }
  50% { transform: scale(1.15) rotate(0deg); }
  75% { transform: scale(1.1) rotate(4deg); }
}

/* ── Confetti (CSS only, 12 pieces) ──────────────────────── */

.obj-toast-confetti {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 10px;
}

.obj-toast-confetti i {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 11px;
  opacity: 0;
  border-radius: 1px;
  animation: confetti-fall 2.2s cubic-bezier(0.3, 0.6, 0.5, 1) forwards;
}

.obj-toast-confetti i:nth-child(1)  { left:  6%; background: #ffd24a; animation-delay: 0.00s; transform: rotate(15deg); }
.obj-toast-confetti i:nth-child(2)  { left: 14%; background: #ff8c32; animation-delay: 0.14s; transform: rotate(-10deg); width: 5px; height: 9px; }
.obj-toast-confetti i:nth-child(3)  { left: 22%; background: #7df9ff; animation-delay: 0.05s; transform: rotate(25deg); }
.obj-toast-confetti i:nth-child(4)  { left: 30%; background: #fff0a8; animation-delay: 0.22s; transform: rotate(-20deg); width: 6px; height: 6px; border-radius: 50%; }
.obj-toast-confetti i:nth-child(5)  { left: 39%; background: #ffd24a; animation-delay: 0.10s; transform: rotate(8deg); }
.obj-toast-confetti i:nth-child(6)  { left: 48%; background: #ff6a9a; animation-delay: 0.28s; transform: rotate(-15deg); width: 5px; height: 10px; }
.obj-toast-confetti i:nth-child(7)  { left: 57%; background: #7df9ff; animation-delay: 0.06s; transform: rotate(30deg); width: 6px; height: 6px; border-radius: 50%; }
.obj-toast-confetti i:nth-child(8)  { left: 66%; background: #ffd24a; animation-delay: 0.18s; transform: rotate(-5deg); }
.obj-toast-confetti i:nth-child(9)  { left: 74%; background: #ff8c32; animation-delay: 0.02s; transform: rotate(20deg); width: 5px; height: 9px; }
.obj-toast-confetti i:nth-child(10) { left: 82%; background: #fff0a8; animation-delay: 0.24s; transform: rotate(-12deg); }
.obj-toast-confetti i:nth-child(11) { left: 90%; background: #7df9ff; animation-delay: 0.09s; transform: rotate(18deg); width: 6px; height: 6px; border-radius: 50%; }
.obj-toast-confetti i:nth-child(12) { left: 96%; background: #ffd24a; animation-delay: 0.16s; transform: rotate(-25deg); }

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translateY(-20px) rotate(0deg);
  }
  10% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translateY(130px) rotate(420deg);
  }
}

@keyframes obj-toast-in {
  0% { opacity: 0; transform: translateY(-24px) scale(0.96); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes obj-toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-16px) scale(0.98); }
}

@media (prefers-reduced-motion: reduce) {
  .obj-toast, .obj-toast.festive, .obj-toast-confetti i, .obj-toast.festive .obj-toast-icon {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
