.mk4-header {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
}

.mk4-header__inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 5px;
  border-radius: 999px;
  background: rgba(20, 20, 22, 1);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
  position: relative;
  overflow: visible;
  height: 52px;
  min-height: 52px;
}

.mk4-header__inner::before {
  content: "";
  position: absolute;
  inset: -20px;
  pointer-events: none;
  opacity: 0.8;
  clip-path: inset(0 round 999px);
}

.mk4-header__brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.96);
  position: relative;
  z-index: 1;
}

.mk4-header__brandMark svg {
  width: 18px;
  height: 18px;
  display: block;
  position: relative;
  z-index: 1;
}

.mk4-header__brandMark svg path {
  fill: currentColor;
}

.mk4-header__brandText {
  font-weight: 780;
  letter-spacing: -0.3px;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.mk4-header__cta {
  position: relative;
  z-index: 1;
  justify-self: end;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: -0.1px;
  color: rgba(2, 4, 8, 0.92);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.65));
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.mk4-header__cta:hover {
  filter: brightness(1.04) saturate(1.05);
}

.mk4-header__actions {
  position: static;
  z-index: 2;
  display: inline-flex;
  align-items: center;
}

.mk4-header__iconBtn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(calc(var(--glass-blur) * 0.9)) saturate(1.2);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.9)) saturate(1.2);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
  margin-left: 5px;
}

.mk4-header__iconBtn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
}

.mk4-header__iconBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 106, 43, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 18px 60px rgba(0, 0, 0, 0.55);
}

.mk4-header__iconBtn svg {
  width: 18px;
  height: 18px;
}

.mk4-dd {
  position: static;
  z-index: 2;
}

.mk4-dd__button {
  height: 40px;
  padding: 8px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.96);
  position: relative;
  z-index: 1;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
  font-family: inherit;
  cursor: pointer;
}

.mk4-dd__button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.mk4-dd__button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 106, 43, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 18px 60px rgba(0, 0, 0, 0.55);
}

.mk4-dd__brandMark svg {
  width: 18px;
  height: 18px;
  display: block;
  position: relative;
}

.mk4-dd__brandMark svg path {
  fill: currentColor;
}

.mk4-dd__buttonLabel {
  font-weight: 780;
  letter-spacing: -0.3px;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.mk4-dd__chev {
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255, 255, 255, 0.8);
  border-bottom: 2px solid rgba(255, 255, 255, 0.8);
  transform: rotate(45deg);
  margin-top: -2px;
  transition: transform 180ms ease;
}

.mk4-dd.is-open .mk4-dd__chev {
  transform: rotate(225deg);
  margin-top: 2px;
}

.mk4-dd__menu {
  position: absolute;
  top: calc(100% + 17px);
  left: 0;
  width: 100%;
  padding: 23px 10px;
  border-radius: 22px;
  background: rgba(20, 20, 22, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  display: grid;
  gap: 6px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 200;
}

.mk4-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  background: rgba(2, 4, 8, 0.22);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  transition: opacity 160ms ease;
}

.mk4-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.mk4-dd.is-open .mk4-dd__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mk4-header.is-bottom .mk4-dd__menu {
  top: auto;
  bottom: calc(100% + 17px);
  transform: translateY(6px);
}

.mk4-header.is-bottom .mk4-dd.is-open .mk4-dd__menu {
  transform: translateY(0);
}

.mk4-dd__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 15px;
  border-radius: 8px;
  color: rgb(255 255 255 / 78%);
  border: 1px solid rgb(255 255 255 / 5%);
  background: rgba(255, 255, 255, 0.04);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, color 180ms ease;
  text-decoration: none;
}

.mk4-dd__link svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
  transition: opacity 180ms ease;
}

.mk4-dd__link:hover svg,
.mk4-dd__link.is-active svg,
.mk4-dd__link[aria-current="page"] svg {
  opacity: 1;
}

.mk4-dd__itemLabel {
  font-weight: 650;
  letter-spacing: -0.1px;
  font-size: 14px;
}

.mk4-dd__link:hover {
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.mk4-dd__link.is-active,
.mk4-dd__link[aria-current="page"] {
  color: rgb(255 255 255);
  border-color: rgb(255 255 255 / 54%);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border-style: inset;
  border-width: 1px;
}

.mk4-dd__groupHead {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mk4-dd__groupLink {
  flex: 1;
  min-width: 0;
}

.mk4-dd__groupToggle {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.mk4-dd__groupToggle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255, 255, 255, 0.8);
  border-bottom: 2px solid rgba(255, 255, 255, 0.8);
  transform: translate(-50%, -55%) rotate(45deg);
  transition: transform 180ms ease;
}

.mk4-dd__groupToggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.mk4-dd__groupToggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 106, 43, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 18px 60px rgba(0, 0, 0, 0.55);
}

.mk4-dd__group.is-collapsed .mk4-dd__groupToggle::before {
  transform: translate(-50%, -45%) rotate(-45deg);
}

.mk4-dd__children {
  display: grid;
  gap: 6px;
  padding-left: 18px;
  margin-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.mk4-dd__group.is-collapsed .mk4-dd__children {
  display: none;
}

/* Login Panel */
.mk4-dd__login {
  position: absolute;
  top: 100%; /* Will be overridden by JS */
  left: 0;
  width: 100%; /* Match the menu/container width */
  padding: 16px;
  border-radius: 22px;
  background: rgba(20, 20, 22, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden; /* For height animation */
}

.mk4-dd__login.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mk4-login-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  margin-bottom: 4px;
}

.mk4-login-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  padding: 6px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mk4-login-tab:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.05);
}

.mk4-login-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mk4-login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mk4-login-form.hidden {
  display: none;
}

.mk4-login-form.fade-out {
  opacity: 0;
  transform: translateX(-10px);
}

.mk4-login-form.fade-in {
  opacity: 0;
  transform: translateX(10px);
}

.mk4-login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mk4-login-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  margin-left: 4px;
}

.mk4-login-field input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  color: white;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.mk4-login-field input:focus {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.mk4-login-btn {
  margin-top: 4px;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: white;
  color: black;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s;
}

.mk4-login-btn:hover {
  filter: brightness(0.92);
}

.mk4-login-btn:active {
  transform: scale(0.98);
}

.mk4-login-btn svg {
  width: 16px;
  height: 16px;
}

.mk4-login-error {
  font-size: 12px;
  color: #ff8080;
  padding: 10px;
  background: rgba(255, 80, 80, 0.1);
  border: 1px solid rgba(255, 80, 80, 0.2);
  border-radius: 8px;
  display: none;
}

.mk4-login-error:not(.hidden) {
  display: block;
}

@media (max-width: 720px) {
  .mk4-dd__buttonLabel {
    max-width: 9ch;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .mk4-dd__login {
    position: fixed !important; /* Override JS inline styles */
    top: auto !important;
    bottom: 20px;
    left: 12px;
    right: 12px;
    width: auto;
    z-index: 210;
  }
}
