/* Wallet widget — StonkFun theme + iOS Safari safe-area */

:root {
  --widget-safe-b: env(safe-area-inset-bottom, 0px);
  --widget-safe-t: env(safe-area-inset-top, 0px);
  --widget-overlay: rgba(7, 11, 18, 0.88);
  --widget-panel: #0e1520;
  --widget-border: #223247;
  --widget-accent: #6fb3e0;
}

/* Overlay backdrop */
body > div[data-widget-overlay],
body > div.widget-overlay,
#kiwi-widget-overlay,
div[class*="overlay" i][style*="position: fixed"],
div[class*="backdrop" i][style*="position: fixed"] {
  background: var(--widget-overlay) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Modal / sheet container */
#kiwi-widget,
#kiwi-widget.show,
body > div[data-widget-modal],
body > div.widget-modal,
div[class*="modal" i][style*="position: fixed"],
div[class*="sheet" i][style*="position: fixed"],
div[class*="drawer" i][style*="position: fixed"] {
  z-index: 99999 !important;
  border-radius: 14px 14px 0 0 !important;
  border: 1px solid var(--widget-border) !important;
  border-bottom: none !important;
  background: linear-gradient(180deg, #101a26, #0c141e) !important;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45) !important;
  color: #eef2f7 !important;
  box-sizing: border-box !important;
}

/* Fullscreen widget iframe (mobile) */
body > iframe[style*="position: fixed"],
body > iframe[style*="position:fixed"],
iframe[data-widget-frame],
#kiwi-widget iframe {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  padding-bottom: var(--widget-safe-b) !important;
  border: none !important;
  z-index: 99999 !important;
  box-sizing: border-box !important;
}

@media (max-width: 720px) {
  /* Bottom sheet — lift above Safari toolbar */
  #kiwi-widget,
  body > div[data-widget-modal],
  body > div.widget-modal,
  div[class*="modal" i][style*="position: fixed"],
  div[class*="sheet" i][style*="position: fixed"],
  div[class*="drawer" i][style*="position: fixed"] {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    bottom: var(--widget-safe-b) !important;
    padding-bottom: max(12px, var(--widget-safe-b)) !important;
    max-height: calc(100dvh - var(--widget-safe-t) - var(--widget-safe-b)) !important;
  }

  body > iframe[style*="position: fixed"],
  body > iframe[style*="position:fixed"],
  iframe[data-widget-frame] {
    top: var(--widget-safe-t) !important;
    height: calc(100dvh - var(--widget-safe-t)) !important;
    padding-bottom: var(--widget-safe-b) !important;
  }
}

@supports (-webkit-touch-callout: none) {
  body > iframe[style*="position: fixed"],
  body > iframe[style*="position:fixed"],
  iframe[data-widget-frame] {
    height: -webkit-fill-available !important;
    min-height: -webkit-fill-available !important;
    padding-bottom: max(20px, var(--widget-safe-b)) !important;
  }
}
