/* ── Toast notifications ── */

.toast {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: min(92vw, 420px);
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  border: 2px solid rgba(201, 162, 39, 0.35);
  background:
    linear-gradient(155deg, rgba(38, 30, 58, 0.97) 0%, rgba(14, 11, 22, 0.98) 100%);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(88, 56, 160, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
  transform: translateX(-50%) translateY(calc(100% + 48px)) scale(0.94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 0.36s cubic-bezier(0.34, 1.4, 0.64, 1),
    opacity 0.28s ease,
    visibility 0.28s ease;
}

/* Build mode: keep the toast above the big launch button at the bottom. */
body.siege-mode .toast {
  bottom: max(132px, calc(env(safe-area-inset-bottom) + 112px));
}

.toast.visible {
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.toast-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-top: 1px;
  border-radius: 12px;
  font-size: 1.15rem;
  line-height: 1;
  background: rgba(255, 154, 46, 0.14);
  border: 1px solid rgba(255, 154, 46, 0.35);
  box-shadow: 0 0 16px rgba(255, 154, 46, 0.12);
}

.toast-icon[data-glyph='1'] {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--gold);
}

.toast-body {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.toast-title {
  display: block;
  margin: 0 0 3px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  line-height: 1.15;
  color: var(--gold);
  text-transform: uppercase;
}

.toast-message {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  color: rgba(245, 240, 255, 0.94);
}

.toast-dismiss {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -2px -4px 0 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.toast-dismiss:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.toast[data-variant='success'] {
  border-color: rgba(124, 252, 0, 0.4);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(124, 252, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.toast[data-variant='success'] .toast-icon {
  background: rgba(124, 252, 0, 0.12);
  border-color: rgba(124, 252, 0, 0.45);
  color: var(--success);
  box-shadow: 0 0 18px rgba(124, 252, 0, 0.2);
}

.toast[data-variant='warn'] {
  border-color: rgba(230, 57, 70, 0.42);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(230, 57, 70, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.toast[data-variant='warn'] .toast-icon {
  background: rgba(230, 57, 70, 0.14);
  border-color: rgba(230, 57, 70, 0.5);
  color: #ff8a94;
  box-shadow: 0 0 16px rgba(230, 57, 70, 0.18);
}

.toast[data-variant='shop'] {
  border-color: rgba(255, 213, 74, 0.42);
}

.toast[data-variant='shop'] .toast-icon {
  background: rgba(255, 213, 74, 0.12);
  border-color: rgba(255, 213, 74, 0.45);
  color: var(--gold);
}

/* ── Modal overlays (How to play, etc.) ── */

body.modal-open {
  overflow: hidden;
}

.gb-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.gb-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gb-modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 20%, rgba(88, 56, 160, 0.22) 0%, transparent 55%),
    rgba(8, 6, 14, 0.78);
  backdrop-filter: blur(10px);
}

.gb-modal-panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(92vh, 920px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px;
  border: 2px solid rgba(201, 162, 39, 0.48);
  background:
    linear-gradient(168deg, rgba(32, 26, 50, 0.99) 0%, rgba(12, 10, 20, 0.99) 100%);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.65),
    0 0 48px rgba(255, 140, 66, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(18px) scale(0.96);
  transition: transform 0.34s cubic-bezier(0.34, 1.35, 0.64, 1);
  outline: none;
}

.gb-modal.is-open .gb-modal-panel {
  transform: translateY(0) scale(1);
}

.gb-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--gold);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.gb-modal-close:hover {
  background: rgba(255, 213, 74, 0.12);
  border-color: rgba(255, 213, 74, 0.55);
}

.gb-modal-close:active {
  transform: scale(0.94);
}

.howto-modal-panel .howto-panel {
  margin: 0;
  padding: 12px 14px 18px;
}

.howto-modal-panel .howto-back {
  display: none;
}

@media (max-width: 640px) {
  .toast {
    width: min(94vw, 420px);
    padding: 12px 12px 12px 14px;
  }

  .toast-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .toast-title {
    font-size: 0.95rem;
  }

  .toast-message {
    font-size: 0.84rem;
  }

  .gb-modal-panel {
    max-height: min(94vh, 900px);
    border-radius: 16px;
  }
}
