/* Shared OP (subscription) gate + boot overlay for mini-apps */

/* Critical boot: covers UI until OP check finishes */
#appBoot {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #141414;
  color: #fff;
  opacity: 1;
  transition: opacity 0.2s ease;
  transform: none;
}

#appBoot.is-done {
  opacity: 0;
  pointer-events: none;
  transform: none;
}

#appBootIcon {
  width: 88px;
  height: 88px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  margin: 0 auto;
  opacity: 0;
  transition: opacity 0.45s ease;
}

#appBootIcon canvas,
#appBootIcon svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
  margin: 0 auto;
}

#appBootLabel {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #a0a0a0;
  letter-spacing: -0.01em;
  opacity: 1;
}

/* Sticker fades in after loading.tgs is ready; label stays visible from the start */
#appBoot.is-content-ready #appBootIcon {
  opacity: 1;
}

body.app-booting #mainApp,
body.app-booting #battlesApp,
body.app-booting .battles-wrap {
  visibility: hidden !important;
}

.sub-gate {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  flex-direction: column;
  background: #141414;
  color: #fff;
  overflow: hidden;
}

.sub-gate.is-open {
  display: flex;
}

.sub-gate-inner {
  flex: 1;
  min-height: 0;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 18px 110px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sub-gate-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
  text-align: center;
}

.sub-gate-prompt {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #a0a0a0;
  text-align: center;
}

.sub-channels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sub-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 8px 8px 10px;
  border: none;
  border-radius: 999px;
  background: #2a2a2a;
  color: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.sub-channel:active {
  background: #333;
}

.sub-channel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #444;
  flex-shrink: 0;
}

.sub-channel-title {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sub-channel-go {
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  min-height: 40px;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  pointer-events: none;
}

.sub-gate-fab {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  z-index: 9010;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0 0 10px;
}

.sub-check-btn {
  pointer-events: auto;
  width: 100%;
  max-width: 420px;
  padding: 18px 18px;
  border: none;
  border-radius: 14px;
  background: #2dcf6e;
  color: #0b1a10;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.28),
    0 8px 14px rgba(0, 0, 0, 0.55);
}

.sub-check-btn:active {
  background: #26b85f;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.28),
    0 4px 8px rgba(0, 0, 0, 0.45);
}

.sub-check-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

/* In-app alert (blur + card), same idea as battles */
.sub-alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: subAlertFadeIn 0.25s ease;
}

@keyframes subAlertFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sub-alert-card {
  background: #1a1a1a;
  border-radius: 24px;
  padding: 28px 22px 22px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  animation: subAlertSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes subAlertSlideUp {
  from { transform: translateY(28px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.sub-alert-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #ffffff;
  white-space: pre-wrap;
}

.sub-alert-close {
  margin-top: 22px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.sub-alert-close:active {
  background: rgba(255, 255, 255, 0.16);
}
