/* Portal: the inverted world (black + red). Loaded only on /portal. */
html, body.mg-portal-page { background: #0a0a0c; }
body.mg-portal-page {
  --mg-white: #0a0a0c;
  --mg-off: #121317;
  --mg-ink: #f4f4f5;
  --mg-dim: #a1a1aa;
  --mg-line: #25262c;
  --mg-accent: #ff2d3d;
  --mg-accent-soft: rgba(255, 45, 61, 0.12);
  --mg-accent-tint: #ff7a84;
  --mg-accent-btn: #ea062e; /* buttons with white text: 4.6:1 (the brighter #ff2d3d stays for dots, badges and outlines) */
  color: var(--mg-ink);
}
.mg-portal-main { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; animation: mg-portal-in 1100ms cubic-bezier(0.7, 0, 0.2, 1) backwards; }
@keyframes mg-portal-in {
  0% { filter: invert(1) hue-rotate(180deg); }
  35% { filter: invert(1) hue-rotate(180deg) contrast(1.1); }
  100% { filter: invert(0) hue-rotate(0deg); }
}
.mg-portal-page .mg-nav { background: rgba(10, 10, 12, 0.78); }
.mg-portal-page .mg-nav__links a[aria-current="page"] { color: var(--mg-accent); }
.mg-portal-page .mg-nav__menu { background: #0a0a0c; }
.mg-portal-page .mg-orb-dot { background: radial-gradient(circle at 35% 30%, #ffc2c7 0%, var(--mg-accent) 55%, #a30d1a 100%); box-shadow: 0 2px 10px rgba(255, 45, 61, 0.5); }
.mg-portal-page .mg-cta-chat { background: var(--mg-accent-btn); }
.mg-portal-page .mg-cta-chat:hover { background: var(--mg-ink); color: #0a0a0c; box-shadow: 0 10px 28px rgba(255, 45, 61, 0.25); }

.mg-lock { position: relative; flex: 1; display: flex; align-items: center; min-height: 100vh; min-height: 100svh; padding: 108px 1.25rem 4rem; overflow: hidden; background: radial-gradient(ellipse 60% 50% at 72% 50%, rgba(255, 45, 61, 0.14), transparent 70%), #0a0a0c; }
.mg-lock[hidden] { display: none; }
.mg-lock__inner { position: relative; width: 100%; max-width: 1160px; margin: 0 auto; display: grid; gap: 2rem; align-items: center; }
@media (min-width: 900px) { .mg-lock__inner { grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 3rem; } }
.mg-lock__ticker { position: absolute; left: 0; right: 0; white-space: nowrap; overflow: hidden; font-family: var(--font-mg-mono); font-size: 1.1rem; letter-spacing: 0.04em; color: var(--mg-ink); filter: blur(2.5px); opacity: 0.14; pointer-events: none; }
.mg-lock__ticker--a { top: 14%; } .mg-lock__ticker--b { top: 84%; }
.mg-lock__track { display: inline-block; animation: mg-ticker 26s linear infinite; }
.mg-lock__ticker--b .mg-lock__track { animation-duration: 32s; animation-direction: reverse; }
.mg-lock__track span { display: inline-block; padding: 0 4px; }
@keyframes mg-ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.mg-lock__card { position: relative; order: 2; padding: 2.25rem 2rem 2rem; border: 1px solid var(--mg-line); border-radius: 22px; background: rgba(18, 19, 23, 0.72); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04); animation: mg-card-in 700ms cubic-bezier(0.2, 0.8, 0.2, 1) 350ms backwards; }
@media (min-width: 900px) { .mg-lock__card { order: 1; } }
.mg-lock__card.is-shaking { animation: mg-shake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes mg-card-in { from { transform: translateY(18px) scale(0.98); } to { transform: none; } }
@keyframes mg-shake { 15%, 85% { transform: translateX(-2px); } 30%, 70% { transform: translateX(5px); } 45%, 55% { transform: translateX(-7px); } }
.mg-lock__badge { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mg-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; color: var(--mg-accent); }
.mg-lock__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mg-accent); box-shadow: 0 0 10px var(--mg-accent); animation: mg-live 1.8s ease-in-out infinite; }
@keyframes mg-live { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.55); } }
.mg-lock h1 { margin: 1rem 0 0.75rem; color: var(--mg-ink); font-size: clamp(2.6rem, 5.4vw, 3.8rem); font-weight: 800; line-height: 0.98; letter-spacing: -0.045em; }
.mg-lock h1.mg-lock__welcome { font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.2; letter-spacing: -0.03em; text-wrap: balance; }
.mg-lock__lede { margin: 0 0 1.5rem; color: var(--mg-dim); font-size: 1.02rem; line-height: 1.6; max-width: 38ch; }
.mg-lock__label { display: block; margin-bottom: 0.6rem; color: var(--mg-ink); font-size: 0.92rem; font-weight: 600; }
.mg-lock__label--mono { font-family: var(--font-mg-mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--mg-dim); font-weight: 500; }
.mg-lock__row { display: flex; gap: 0.5rem; }
.mg-lock__row input { flex: 1; min-width: 0; padding: 0.85rem 1rem; border: 1px solid var(--mg-line); border-radius: 12px; background: #0a0a0c; color: var(--mg-ink); font-family: var(--font-mg-mono); font-size: 0.95rem; letter-spacing: 0.12em; outline: none; transition: border-color 150ms ease, box-shadow 150ms ease; }
.mg-lock__row input::placeholder { color: #5b5b63; letter-spacing: 0.04em; }
.mg-lock__row input:focus { border-color: var(--mg-accent); box-shadow: 0 0 0 3px rgba(255, 45, 61, 0.18); }
.mg-lock__row input[aria-invalid="true"] { border-color: var(--mg-accent); }
.mg-lock__enter { padding: 0.85rem 1.4rem; border: 0; border-radius: 12px; background: var(--mg-accent-btn); color: #ffffff; font-family: var(--font-mg-sans); font-weight: 700; font-size: 0.95rem; cursor: pointer; transition: transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1), background 150ms ease, color 150ms ease; }
.mg-lock__enter:hover:not(:disabled) { background: var(--mg-ink); color: #0a0a0c; transform: translateY(-1px); }
.mg-lock__enter:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.mg-lock__enter:disabled { opacity: 0.55; cursor: default; }
.mg-lock__enter--wide { width: 100%; margin-top: 1rem; }
.mg-lock__error { min-height: 1.3rem; margin: 0.6rem 0 0; color: #ff5c69; font-size: 0.86rem; font-weight: 500; }
.mg-lock__fine { margin: 0.75rem 0 0; color: #8a8a93; font-size: 0.78rem; line-height: 1.5; }
.mg-lock__outside { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--mg-line); color: var(--mg-dim); font-size: 0.92rem; }
.mg-lock__orb { position: relative; order: 1; justify-self: center; width: min(72vw, 360px); aspect-ratio: 1; pointer-events: none; }
@media (min-width: 900px) { .mg-lock__orb { order: 2; width: min(46vw, 560px); } }
.mg-lock__orb-video { position: relative; display: block; width: 100%; height: 100%; object-fit: cover; mix-blend-mode: screen; -webkit-mask-image: radial-gradient(circle at 50% 47%, #000 34%, transparent 62%); mask-image: radial-gradient(circle at 50% 47%, #000 34%, transparent 62%); animation: mg-orb-float 9s ease-in-out infinite; }
.mg-lock__orb-glow { position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 45, 61, 0.45), transparent 68%); filter: blur(40px); animation: mg-orb-breathe 5s ease-in-out infinite; }
@keyframes mg-orb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes mg-orb-breathe { 0%, 100% { transform: scale(0.92); } 50% { transform: scale(1.08); } }
.mg-portal-select { width: 100%; padding: 0.75rem 2.2rem 0.75rem 0.9rem; border: 1px solid var(--mg-line); border-radius: 12px; background: #0a0a0c; color: var(--mg-ink); font-family: var(--font-mg-sans); font-size: 0.92rem; }
.mg-portal-select:focus { outline: 2px solid var(--mg-accent); outline-offset: 1px; }
.mg-dash { flex: 1; padding-top: 68px; background: #0a0a0c; }
.mg-dash[hidden] { display: none; }
.mg-dash__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--mg-line); background: var(--mg-off); }
.mg-dash__selects { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-right: auto; }
.mg-dash__selects .mg-portal-select { width: auto; }
.mg-dash__lock { padding: 0.55rem 1.1rem; border: 1px solid var(--mg-line); border-radius: 999px; background: transparent; color: var(--mg-dim); font-family: var(--font-mg-sans); font-size: 0.85rem; cursor: pointer; }
.mg-dash__lock:hover { color: var(--mg-ink); border-color: var(--mg-accent); }
.mg-dash__frame { min-height: 480px; background: #0a0a0c; }
.mg-dash__frame iframe { display: block; width: 100%; height: 480px; border: 0; overflow: hidden; }
.mg-dash__loading { margin: 0; padding: 3rem 1.25rem; color: var(--mg-dim); font-family: var(--font-mg-mono); font-size: 0.85rem; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .mg-portal-main, .mg-lock__card, .mg-lock__card.is-shaking, .mg-lock__track, .mg-lock__dot, .mg-lock__orb-video, .mg-lock__orb-glow { animation: none !important; }
  .mg-lock__enter { transition: none; }
}

/* ---------- Mobile (Fix 1): tighter lock screen, code box clear of the cookie banner ---------- */
.mg-dash__lock { min-height: 44px; }
.mg-portal-select { min-height: 44px; }
html.mg-cookie-open .mg-lock { padding-bottom: calc(var(--mg-cookie-h, 0px) + 24px); }
@media (max-width: 899px) {
  .mg-lock { align-items: flex-start; padding: calc(68px + 24px) var(--mg-gutter) 48px; }
  .mg-lock__inner { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .mg-lock__orb { width: min(50vw, 210px); }
  .mg-lock__card { padding: 24px 20px; }
  .mg-lock h1 { margin: 12px 0 8px; font-size: clamp(2.25rem, 10vw, 2.6rem); }
  .mg-lock h1.mg-lock__welcome { font-size: clamp(1.5rem, 6.5vw, 1.9rem); }
  .mg-lock__lede { margin-bottom: 16px; }
  .mg-lock__outside { margin-top: 16px; padding-top: 16px; }
  .mg-dash__bar { padding: 12px var(--mg-gutter); }
}
@media (max-width: 899px) and (max-height: 720px) { .mg-lock__orb { width: min(32vw, 120px); } }
