@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* Aligned with forum (forum.errl.wtf): default hide Design until Errl Phone enables it. */
html[data-errl-hide-design-nav] [data-errl-nav='design'] {
  display: none !important;
}

.errl-header {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 40;
  padding: 0.5rem 0.85rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--errl-panel, rgba(7, 27, 37, 0.82));
  box-shadow: var(--shadow, 0 24px 60px rgba(0, 0, 0, 0.45));
  border: 1px solid rgba(22, 58, 74, 0.6);
  border-bottom: 1px solid rgba(52, 225, 255, 0.12);
  isolation: isolate;
}

/* Normalize shared header sizing across static pages with legacy inline header styles. */
.errl-header,
header.errl-header {
  padding: 0.5rem 0.85rem !important;
}

.errl-header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.01em;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.errl-header-content {
  gap: 0.75rem !important;
}

.errl-header-content::-webkit-scrollbar {
  display: none;
}

.errl-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(52, 225, 255, 0.45);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  color: #ecf9ff;
  text-shadow: 0 0 8px rgba(52, 225, 255, 0.35);
  background: linear-gradient(
    135deg,
    rgba(52, 225, 255, 0.2) 0%,
    rgba(255, 52, 245, 0.15) 50%,
    rgba(0, 245, 160, 0.12) 100%
  );
  box-shadow:
    0 0 0 1px rgba(52, 225, 255, 0.15) inset,
    0 4px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.errl-home-btn {
  min-height: 2.1rem;
  padding: 0.45rem 0.75rem !important;
}

.errl-home-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(52, 225, 255, 0.3) inset,
    0 0 20px rgba(52, 225, 255, 0.25);
}

.errl-home-btn .chevron {
  font-size: 0.9rem;
  line-height: 1;
}

.errl-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.errl-nav::-webkit-scrollbar {
  display: none;
}

.errl-bubble-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.2rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: clamp(0.65rem, 0.8rem, 0.9rem);
  font-weight: 600;
  line-height: 1.05;
  text-align: center;
  text-decoration: none;
  color: var(--errl-text, rgba(236, 249, 255, 0.95));
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(52, 225, 255, 0.2);
  background: rgba(4, 16, 23, 0.65);
  border: 1px solid rgba(52, 225, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.errl-bubble-btn {
  min-width: 6.2rem !important;
  max-width: 8.2rem !important;
  min-height: 2.05rem;
  padding: 0.5rem 0.85rem !important;
  line-height: 1.05;
  aspect-ratio: auto !important;
}

.errl-bubble-btn::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  bottom: -1px;
  left: -1px;
  border-radius: 999px;
  padding: 1px;
  background: linear-gradient(
    90deg,
    rgba(52, 225, 255, 0.4) 0%,
    rgba(255, 52, 245, 0.35) 35%,
    rgba(245, 255, 183, 0.2) 70%,
    rgba(52, 225, 255, 0.4) 100%
  );
  background-size: 180% 100%;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: xor;
  -webkit-mask-composite: xor;
  animation: portal-header-led-flow 3s linear infinite;
  opacity: 0.55;
  pointer-events: none;
}

.errl-bubble-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(52, 225, 255, 0.45);
  box-shadow: 0 0 16px rgba(52, 225, 255, 0.15);
}

.errl-bubble-btn[aria-disabled='true'] {
  opacity: 0.7;
  cursor: not-allowed;
}

.errl-bubble-btn[aria-disabled='true']:hover {
  transform: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset;
}

.errl-bubble-btn.active {
  background: linear-gradient(
    135deg,
    rgba(52, 225, 255, 0.2) 0%,
    rgba(123, 92, 255, 0.2) 50%,
    rgba(255, 52, 245, 0.12) 100%
  );
  color: #fff;
  border-color: rgba(52, 225, 255, 0.55);
  font-weight: 700;
  text-shadow: 0 0 14px rgba(52, 225, 255, 0.5);
  box-shadow: 0 0 22px rgba(52, 225, 255, 0.15);
}

.errl-bubble-btn.active::before {
  opacity: 0.85;
  animation-duration: 1.2s;
}

@keyframes portal-header-led-flow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@supports not (font-size: clamp(1px, 2vw, 16px)) {
  .errl-bubble-btn {
    font-size: 0.8rem;
  }
}

@media (max-width: 900px) {
  @supports not (font-size: clamp(1px, 2vw, 16px)) {
    .errl-bubble-btn {
      font-size: 0.72rem;
    }
  }
}

@media (max-width: 640px) {
  @supports not (font-size: clamp(1px, 2vw, 16px)) {
    .errl-bubble-btn {
      font-size: 0.65rem;
    }
  }
}

@media (max-width: 480px) {
  @supports not (font-size: clamp(1px, 2vw, 16px)) {
    .errl-bubble-btn {
      font-size: 0.58rem;
    }
  }
}

@supports not (aspect-ratio: 1 / 1) {
  @media (max-width: 640px) {
    .errl-bubble-btn {
      min-height: 2.75rem;
    }
  }

  @media (max-width: 480px) {
    .errl-bubble-btn {
      min-height: 2.5rem;
    }
  }
}

@media (max-width: 900px) {
  .errl-header-content {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .errl-nav {
    gap: 0.4rem;
    max-width: 100%;
  }

  .errl-nav::-webkit-scrollbar {
    display: none;
  }

  .errl-bubble-btn {
    min-width: 5.5rem;
    max-width: 8rem;
    padding: 0.5rem 0.75rem 0.6rem;
    font-size: clamp(0.6rem, 0.75rem, 0.85rem);
    border-radius: 999px;
  }
}

@media (max-width: 640px) {
  .errl-header {
    padding: 0.45rem 0.65rem;
  }

  .errl-header-content {
    gap: 0.4rem;
    flex-wrap: nowrap;
  }

  .errl-home-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 0;
    flex-shrink: 0;
  }

  .errl-home-btn .chevron {
    font-size: 16px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
  }

  .errl-nav {
    gap: 0.3rem;
    padding: 0.1rem 0;
  }

  .errl-bubble-btn {
    min-width: 4rem;
    max-width: 6.5rem;
    padding: 0.4rem 0.55rem 0.5rem;
    font-size: clamp(0.55rem, 0.65rem, 0.75rem);
    border-radius: 999px;
    aspect-ratio: 1.2;
  }
}

@media (max-width: 480px) {
  .errl-header {
    padding: 0.4rem 0.5rem;
  }

  .errl-bubble-btn {
    min-width: 3.5rem;
    max-width: 6rem;
    padding: 0.35rem 0.5rem 0.45rem;
    font-size: clamp(0.5rem, 0.6rem, 0.7rem);
    border-radius: 999px;
    aspect-ratio: 1.1;
  }
}

@media (max-width: 640px) {
  .errl-header,
  header.errl-header {
    padding: 0.45rem 0.65rem !important;
  }

  .errl-home-btn {
    min-height: 38px;
  }

  .errl-bubble-btn {
    min-width: 4rem !important;
    max-width: 6.5rem !important;
    min-height: 2rem;
    padding: 0.4rem 0.55rem 0.5rem !important;
    aspect-ratio: auto !important;
  }
}

@media (max-width: 480px) {
  .errl-header,
  header.errl-header {
    padding: 0.4rem 0.5rem !important;
  }

  .errl-bubble-btn {
    min-width: 3.5rem !important;
    max-width: 6rem !important;
    min-height: 1.85rem;
    padding: 0.35rem 0.5rem 0.45rem !important;
    aspect-ratio: auto !important;
  }
}

.errl-external-modal[hidden] {
  display: none !important;
}

.errl-external-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 16px;
}

.errl-external-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 14, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.errl-external-modal__dialog {
  position: relative;
  width: min(100%, 420px);
  border-radius: 14px;
  border: 1px solid rgba(52, 225, 255, 0.26);
  background: linear-gradient(165deg, rgba(8, 18, 30, 0.96), rgba(4, 10, 20, 0.96));
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  padding: 16px;
  color: rgba(236, 249, 255, 0.95);
}

.errl-external-modal__title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.errl-external-modal__copy {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: rgba(229, 240, 255, 0.86);
}

.errl-external-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.errl-external-modal__btn {
  border-radius: 999px;
  border: 1px solid rgba(52, 225, 255, 0.3);
  background: rgba(7, 21, 35, 0.86);
  color: rgba(236, 249, 255, 0.95);
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.errl-external-modal__btn:hover,
.errl-external-modal__btn:focus-visible {
  outline: none;
  border-color: rgba(52, 225, 255, 0.62);
}

.errl-external-modal__btn--confirm {
  background: linear-gradient(135deg, rgba(52, 225, 255, 0.18), rgba(123, 92, 255, 0.2));
}
