:root {
  --sg-ink: #f5f5f7;
  --sg-muted: rgba(245, 245, 247, .64);
  --sg-blue: #0a84ff;
  --sg-glass: rgba(29, 30, 34, .68);
  --sg-line: rgba(255, 255, 255, .18);
}

html.safari-gate-required,
html.safari-gate-required body { min-height: 100%; background: #090a0c; }
html.safari-gate-required body { min-height: 100dvh; overflow: hidden !important; }
html.safari-gate-required body > :not(#safari-gate) { display: none !important; }

#safari-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  overflow: hidden;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  color: var(--sg-ink);
  background: radial-gradient(circle at 50% 78%, rgba(71, 110, 150, .25), transparent 33%), linear-gradient(180deg, #1a1d23 0%, #111318 48%, #08090b 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#safari-gate::before {
  content: "";
  position: absolute;
  width: min(112vw, 760px);
  aspect-ratio: 1;
  left: 50%;
  top: min(-56vw, -310px);
  transform: translateX(-50%);
  pointer-events: none;
  border: 1px solid rgba(85, 145, 214, .22);
  border-radius: 50%;
  box-shadow: 0 0 42px rgba(30, 101, 180, .06);
}

.safari-shell {
  position: relative;
  width: min(100%, 760px);
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(132px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
}

.safari-prompt { width: min(100%, 540px); margin-top: -10px; text-align: center; }
.safari-compass {
  width: 102px;
  height: 102px;
  margin: 0 auto 30px;
  border: 1px solid rgba(255,255,255,.19);
  border-radius: 29px;
  display: grid;
  place-items: center;
  background: rgba(35,38,44,.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 0 30px rgba(91,151,220,.08);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
}
.safari-compass svg { width: 60px; height: 60px; }
.safari-prompt h1 { margin: 0; color: #fff; font-size: clamp(38px, 8vw, 56px); font-weight: 720; line-height: 1.04; letter-spacing: -1.8px; }
.safari-prompt > p { max-width: 460px; margin: 22px auto 0; color: var(--sg-muted); font-size: 15px; line-height: 1.6; }

.safari-action-panel {
  width: 100%;
  margin-top: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: saturate(160%) blur(26px);
  backdrop-filter: saturate(160%) blur(26px);
}

.safari-primary-address {
  min-height: 66px;
  padding: 7px 8px 7px 18px;
  border: 1px solid rgba(255, 255, 255, .19);
  border-radius: 23px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 10px;
  background: rgba(30, 31, 35, .74);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 0 24px rgba(93,156,228,.08);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  color: rgba(255, 255, 255, .92);
}

.safari-primary-url {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 520;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.safari-lock-icon { width: 22px; height: 22px; color: rgba(255,255,255,.58); }
.safari-lock-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.safari-primary-copy {
  width: 60px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.safari-primary-copy:active { background: rgba(255, 255, 255, .15); }
.safari-primary-copy svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.safari-open-button {
  width: 100%;
  min-height: 66px;
  margin-top: 18px;
  padding: 0 24px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 23px;
  background: var(--sg-blue);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(10,132,255,.25), 0 0 24px rgba(10,132,255,.22);
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  font-weight: 680;
  -webkit-tap-highlight-color: transparent;
}

.safari-open-button:active { background: #0077ed; transform: scale(.985); }
.safari-open-button:focus-visible,
.safari-tool-button:focus-visible,
.safari-copy-button:focus-visible,
.safari-primary-copy:focus-visible { outline: 3px solid rgba(10,132,255,.46); outline-offset: 3px; }
.safari-status { min-height: 18px; margin: 14px auto 0 !important; color: rgba(245,245,247,.5) !important; font-size: 11px !important; line-height: 1.45 !important; }
.safari-status.is-success { color: #7ee2aa !important; }

.safari-toolbar {
  position: fixed;
  z-index: 3;
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: min(calc(100% - 36px), 724px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 10px;
}

.safari-tool-button,
.safari-address-bar {
  min-height: 58px;
  border: 1px solid var(--sg-line);
  background: var(--sg-glass);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px rgba(0,0,0,.32), 0 0 20px rgba(166,205,255,.1);
  -webkit-backdrop-filter: saturate(160%) blur(24px);
  backdrop-filter: saturate(160%) blur(24px);
}

.safari-tool-button {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.92);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.safari-tool-button svg,
.safari-tabs-icon svg,
.safari-copy-button svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.safari-tool-button svg { width: 24px; height: 24px; stroke-width: 1.85; }

.safari-address-bar {
  min-width: 0;
  border-radius: 29px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  padding: 0 7px;
}

.safari-tabs-icon { width: 42px; height: 42px; display: grid; place-items: center; color: rgba(255,255,255,.78); }
.safari-tabs-icon svg { width: 21px; height: 21px; stroke-width: 1.65; }
.safari-url-text { min-width: 0; overflow: hidden; color: rgba(255,255,255,.92); font-size: 13px; font-weight: 520; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

.safari-copy-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: rgba(255,255,255,.88);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.safari-copy-button:active { background: rgba(255,255,255,.1); }
.safari-copy-button svg { width: 21px; height: 21px; stroke-width: 1.75; }

@media (max-width: 430px) {
  .safari-shell { padding-left: 18px; padding-right: 18px; }
  .safari-prompt { margin-top: -28px; }
  .safari-compass { width: 82px; height: 82px; margin-bottom: 25px; border-radius: 24px; }
  .safari-compass svg { width: 50px; height: 50px; }
  .safari-prompt h1 { font-size: 39px; letter-spacing: -1.35px; }
  .safari-prompt > p { max-width: 310px; font-size: 13px; }
  .safari-action-panel { margin-top: 27px; }
  .safari-primary-address { min-height: 62px; padding-left: 14px; grid-template-columns: 28px minmax(0, 1fr) 54px; border-radius: 19px; }
  .safari-primary-copy { width: 54px; height: 48px; border-radius: 14px; }
  .safari-primary-url { font-size: 14px; }
  .safari-open-button { min-height: 58px; border-radius: 19px; }
  .safari-toolbar { left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); width: auto; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 7px; }
  .safari-tool-button, .safari-address-bar { min-height: 52px; }
  .safari-tool-button { width: 52px; height: 52px; }
  .safari-address-bar { grid-template-columns: 36px minmax(0,1fr) 36px; border-radius: 26px; padding: 0 4px; }
  .safari-tabs-icon { width: 36px; height: 36px; }
  .safari-url-text { font-size: 12px; }
  .safari-copy-button { width: 36px; height: 36px; }
}

@media (max-height: 620px) {
  .safari-shell { align-items: flex-start; padding-top: calc(50px + env(safe-area-inset-top)); }
  .safari-prompt { margin-top: 0; }
  .safari-prompt h1 { font-size: 32px; }
  .safari-compass { width: 64px; height: 64px; margin-bottom: 14px; }
  .safari-compass svg { width: 40px; height: 40px; }
  .safari-action-panel { margin-top: 22px; }
  .safari-toolbar { bottom: calc(10px + env(safe-area-inset-bottom)); }
}

@media (max-height: 500px) and (orientation: landscape) {
  .safari-shell { padding: calc(18px + env(safe-area-inset-top)) 92px calc(80px + env(safe-area-inset-bottom)); }
  .safari-prompt { max-width: 620px; }
  .safari-prompt h1 { font-size: 27px; }
  .safari-prompt > p { margin-top: 8px; font-size: 11px; }
  .safari-action-panel { margin-top: 12px; padding: 7px; }
  .safari-primary-address { min-height: 44px; grid-template-columns: 26px minmax(0, 1fr) 42px; }
  .safari-primary-copy { width: 42px; height: 38px; }
  .safari-open-button { min-height: 42px; margin-top: 7px; }
  .safari-toolbar { grid-template-columns: 46px minmax(0, 1fr) 46px; }
  .safari-tool-button, .safari-address-bar { min-height: 46px; }
  .safari-tool-button { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) { .safari-open-button { transition: none; } }

/* Keep the reference UI consistent inside each Goldify page. */
#safari-gate,
#safari-gate * { box-sizing: border-box; }
#safari-gate svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#safari-gate button { font-family: inherit; }
#safari-gate .safari-prompt h1 { font-family: inherit; }
