/* MrGym Unified Account UI | Gold Arena HIG v2.0 (Dual-Scheme Dark & Light) */

:root {
  color-scheme: dark;
  --mga-bg: #0e1116;
  --mga-bg-2: #11151c;
  --mga-surf: #151a23;
  --mga-surf-2: #1c222e;
  --mga-surf-3: #232b3a;
  --mga-input-bg: #11151c;
  --mga-glass: rgba(14, 17, 22, 0.86);
  --mga-bd: rgba(255, 255, 255, 0.085);
  --mga-bd-2: rgba(255, 255, 255, 0.16);
  --mga-ctrl-bd: rgba(255, 255, 255, 0.18);
  --mga-tx: #eef2f7;
  --mga-tx-2: #9aa6b6;
  --mga-tx-3: #6c7889;
  --mga-gold: #f0c14b;
  --mga-gold-2: #e3a52b;
  --mga-gold-3: #cf9416;
  --mga-gold-tx: #f0c14b;
  --mga-on-gold: #241900;
  --mga-grad: linear-gradient(135deg, #f6d36b 0%, #e3a52b 55%, #cf9416 100%);
  --mga-word-grad: linear-gradient(135deg, #ffe484 0%, #f0c14b 50%, #cf9416 100%);
  --mga-bevel: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --mga-shadow: 0 20px 48px -24px rgba(0, 0, 0, 0.7);
  --mga-shadow-gold: 0 12px 28px -10px rgba(227, 165, 43, 0.56);
  --mga-ok: #22c55e;
  --mga-warn: #f59e0b;
  --mga-err: #ef4444;
  --mga-sky: #38bdf8;
  --mga-violet: #a78bfa;
  --mga-font: "Dana", "MrGym", "RGBir Fallback", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mga-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-lqd-page-color-scheme="light"],
:root[data-theme="light"],
:root:has(body[data-lqd-page-color-scheme="light"]),
body[data-lqd-page-color-scheme="light"],
body[data-theme="light"] {
  color-scheme: light;
  --mga-bg: #f6f8fc;
  --mga-bg-2: #eef2f8;
  --mga-surf: #ffffff;
  --mga-surf-2: #f3f6fb;
  --mga-surf-3: #e8eef7;
  --mga-input-bg: #ffffff;
  --mga-glass: rgba(246, 248, 252, 0.9);
  --mga-bd: rgba(15, 23, 42, 0.1);
  --mga-bd-2: rgba(15, 23, 42, 0.18);
  --mga-ctrl-bd: rgba(15, 23, 42, 0.2);
  --mga-tx: #101722;
  --mga-tx-2: #4b5a72;
  --mga-tx-3: #526078;
  --mga-gold: #e3a52b;
  --mga-gold-2: #cf9416;
  --mga-gold-3: #b57b0c;
  --mga-gold-tx: #7c5303;
  --mga-word-grad: linear-gradient(135deg, #7c5303 0%, #664302 55%, #4f3301 100%);
  --mga-bevel: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --mga-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 14px 32px -18px rgba(15, 23, 42, 0.14);
  --mga-shadow-gold: 0 10px 24px -10px rgba(181, 123, 12, 0.44);
  --mga-ok: #15803d;
  --mga-warn: #b45309;
  --mga-err: #b91c1c;
  --mga-sky: #0369a1;
  --mga-violet: #6d28d9;
}

:root[data-lqd-page-color-scheme="dark"],
:root:has(body[data-lqd-page-color-scheme="dark"]) {
  color-scheme: dark;
}

.mga-sr-only,
.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.mga-hp {
  position: absolute;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Site Header Account Trigger, Menu & Drawer Card ---------- */
.mrhf-acc-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.mrhf-acc-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--mga-surf-2);
  border: 1px solid var(--mga-bd-2);
  color: var(--mga-tx);
  font-family: var(--mga-font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--mga-bevel);
  transition: border-color 0.2s var(--mga-ease), background 0.2s var(--mga-ease);
}

.mrhf-acc-btn:hover {
  border-color: rgba(240, 193, 75, 0.55);
  background: var(--mga-surf-3);
}

.mrhf-acc-btn:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
}

.mrhf-acc-btn.is-auth {
  padding-inline: 6px 12px;
  border-color: rgba(240, 193, 75, 0.42);
}

.mrhf-acc-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 30%, #2c2312 0%, #111622 54%, #06080d 100%);
  color: #ffe484;
  border: 1.5px solid #f0c14b;
  box-shadow: inset 0 1px 1px rgba(255, 252, 216, 0.36), 0 0 0 1px rgba(120, 70, 2, 0.7), 0 2px 6px rgba(0, 0, 0, 0.36);
  font-size: 12.5px;
  font-weight: 900;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.mrhf-acc-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mrhf-acc-lbl {
  max-width: none;
  white-space: nowrap;
}

.mrhf-acc-btn.is-auth .mrhf-acc-lbl {
  max-width: 124px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mrhf-acc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(240, 193, 75, 0.14);
  border: 1px solid rgba(240, 193, 75, 0.36);
  color: var(--mga-gold-tx);
  font-size: 11px;
  font-weight: 800;
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mrhf-acc-badge {
  background: rgba(181, 123, 12, 0.1);
  border-color: rgba(148, 102, 6, 0.32);
}

@media (max-width: 1380px) {
  .mrhf-acc-btn.is-auth {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 10px !important;
    flex: 0 0 44px !important;
  }
  .mrhf-acc-btn.is-auth .mrhf-acc-lbl,
  .mrhf-acc-btn.is-auth .mrhf-acc-badge {
    display: none !important;
  }
}

@media (max-width: 1180px) {
  .mrhf-acc-btn:not(.is-auth),
  .mrhf-acc-btn.is-auth {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 10px !important;
    flex: 0 0 44px !important;
  }
  .mrhf-acc-btn .mrhf-acc-lbl,
  .mrhf-acc-btn .mrhf-acc-badge {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .mrhf-acc-btn:not(.is-auth),
  .mrhf-acc-btn.is-auth {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    flex: 0 0 44px !important;
  }
}

.mrhf-acc-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: 248px;
  max-width: calc(100vw - 24px);
  background: var(--mga-surf);
  border: 1px solid var(--mga-bd-2);
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 24px 54px -16px rgba(0, 0, 0, 0.65), var(--mga-bevel);
  z-index: 9999;
  font-family: var(--mga-font);
  direction: rtl;
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mrhf-acc-menu {
  box-shadow: 0 22px 48px -18px rgba(15, 23, 42, 0.22), var(--mga-bevel);
}

.mrhf-acc-menu[hidden] {
  display: none;
}

.mrhf-acc-mhead {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--mga-bd);
  margin-bottom: 6px;
}

.mrhf-acc-mhead b {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--mga-tx);
}

.mrhf-acc-mhead em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--mga-tx-2);
  margin-top: 2px;
}

.mrhf-acc-mitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--mga-tx);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  text-align: start;
  cursor: pointer;
  transition: background 0.16s var(--mga-ease), color 0.16s var(--mga-ease), border-color 0.16s var(--mga-ease);
}

.mrhf-acc-mitem:hover {
  background: var(--mga-surf-2);
  color: var(--mga-gold-tx);
}

.mrhf-acc-mitem:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: -2px;
}

.mrhf-acc-mitem.is-danger {
  color: #f87171;
  margin-top: 6px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.06);
  border-radius: 10px;
}

.mrhf-acc-mitem.is-danger:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.42);
  color: #fca5a5;
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mrhf-acc-mitem.is-danger {
  border-color: rgba(185, 28, 28, 0.22);
  background: rgba(185, 28, 28, 0.05);
  color: var(--mga-err);
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mrhf-acc-mitem.is-danger:hover {
  background: rgba(185, 28, 28, 0.11);
  border-color: rgba(185, 28, 28, 0.38);
  color: var(--mga-err);
}

.mrhf-drawer-acc {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 14px;
  background: var(--mga-surf-2);
  border: 1px solid var(--mga-bd-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mrhf-drawer-acc-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mrhf-drawer-acc-info b {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--mga-tx);
}

.mrhf-drawer-acc-info span {
  display: block;
  font-size: 12px;
  color: var(--mga-tx-2);
}

/* ---------- Auth Dialog (Native <dialog>, MWG Scoped) ---------- */
dialog.mga-dlg {
  width: min(460px, calc(100vw - 28px));
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 24px;
  background: var(--mga-surf);
  border: 1px solid var(--mga-bd-2);
  color: var(--mga-tx);
  font-family: var(--mga-font);
  direction: rtl;
  box-shadow: 0 32px 72px -18px rgba(0, 0, 0, 0.72), var(--mga-bevel);
  margin: auto;
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) dialog.mga-dlg {
  box-shadow: 0 28px 64px -20px rgba(15, 23, 42, 0.24), var(--mga-bevel);
}

html:has(dialog:modal) {
  overflow: hidden;
}

dialog.mga-dlg:modal {
  overscroll-behavior: contain;
}

dialog.mga-dlg [hidden],
.mga-field[hidden],
.mga-btn[hidden],
.mga-alert[hidden] {
  display: none !important;
}

dialog.mga-dlg::backdrop {
  background: rgba(5, 7, 12, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  overflow: hidden;
  overscroll-behavior: contain;
}

@media (prefers-reduced-motion: no-preference) {
  dialog.mga-dlg[open] {
    animation: mgaDlgIn 0.22s var(--mga-ease);
  }
}

@keyframes mgaDlgIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.mga-dlg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.mga-dlg-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mga-dlg-brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.mga-dlg-title {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.38;
  color: var(--mga-tx);
}

.mga-dlg-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--mga-tx-2);
  line-height: 1.5;
}

.mga-dlg-close {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  background: var(--mga-surf-2);
  border: 1px solid var(--mga-bd);
  color: var(--mga-tx-2);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 0.16s var(--mga-ease), color 0.16s var(--mga-ease), background 0.16s var(--mga-ease);
}

.mga-dlg-close:hover {
  color: var(--mga-tx);
  border-color: var(--mga-bd-2);
  background: var(--mga-surf-3);
}

.mga-dlg-close:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
}

.mga-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--mga-bg-2);
  border: 1px solid var(--mga-bd);
  margin-bottom: 18px;
}

.mga-tab {
  position: relative;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--mga-tx-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s var(--mga-ease), color 0.18s var(--mga-ease), border-color 0.18s var(--mga-ease);
}

.mga-tab:hover {
  color: var(--mga-tx);
}

.mga-tab:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
}

.mga-tab.is-active,
.mga-tab[aria-selected="true"] {
  background: var(--mga-surf-2);
  color: var(--mga-gold-tx);
  border-color: rgba(240, 193, 75, 0.48);
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-tab.is-active,
:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-tab[aria-selected="true"] {
  background: #ffffff;
  color: var(--mga-gold-tx);
  border-color: rgba(148, 102, 6, 0.42);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

@media (forced-colors: active) {
  .mga-tab.is-active,
  .mga-tab[aria-selected="true"] {
    background: Highlight;
    color: HighlightText;
    border: 2px solid Highlight;
  }
  .mga-tab:focus-visible,
  .mga-pw-toggle:focus-visible,
  .mga-toast-x:focus-visible,
  .mga-bm-btn:focus-visible,
  .mga-link-btn:focus-visible,
  .mga-dlg-close:focus-visible,
  .mrhf-acc-btn:focus-visible,
  .mrhf-acc-mitem:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}

/* ---------- Alerts & Form Controls ---------- */
.mga-alert {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  margin-bottom: 14px;
  background: rgba(239, 68, 68, 0.09);
  border: 1px solid rgba(239, 68, 68, 0.32);
  color: var(--mga-tx);
}

.mga-alert.is-ok {
  background: rgba(34, 197, 94, 0.09);
  border-color: rgba(34, 197, 94, 0.32);
}

.mga-alert.is-warn {
  background: rgba(245, 158, 11, 0.09);
  border-color: rgba(245, 158, 11, 0.32);
}

.mga-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.mga-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mga-field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--mga-tx);
  line-height: 1.45;
}

.mga-hint {
  margin: 0;
  font-size: 12px;
  color: var(--mga-tx-2);
  line-height: 1.5;
}

.mga-field input:not([type="checkbox"]):not([type="radio"]),
.mga-field select,
.mga-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--mga-input-bg);
  border: 1px solid var(--mga-ctrl-bd);
  color: var(--mga-tx);
  font: inherit;
  font-size: max(1rem, 15px);
  box-sizing: border-box;
  transition: border-color 0.18s var(--mga-ease), box-shadow 0.18s var(--mga-ease), background 0.18s var(--mga-ease);
}

.mga-field input:not([type="checkbox"]):not([type="radio"]):hover,
.mga-field select:hover,
.mga-field textarea:hover {
  border-color: rgba(240, 193, 75, 0.44);
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-field input:not([type="checkbox"]):not([type="radio"]),
:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-field select,
:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-field textarea {
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mga-field input:focus-visible,
.mga-field select:focus-visible,
.mga-field textarea:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
  border-color: var(--mga-gold-2);
  box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.16);
}

.mga-field input::placeholder,
.mga-field textarea::placeholder {
  color: var(--mga-tx-3);
}

.mga-field input:user-invalid,
.mga-field select:user-invalid,
.mga-field textarea:user-invalid,
.mga-field input[aria-invalid="true"] {
  border-color: var(--mga-err);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.mga-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.mga-pw-wrap input {
  padding-inline-end: 74px;
}

.mga-pw-toggle {
  position: absolute;
  inset-inline-end: 6px;
  min-height: 40px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--mga-bd);
  background: var(--mga-surf-2);
  color: var(--mga-tx-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.mga-pw-toggle::before {
  content: "";
  position: absolute;
  inset: -4px;
}

.mga-pw-toggle:hover {
  color: var(--mga-tx);
  border-color: var(--mga-bd-2);
}

.mga-pw-toggle:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
}

.mga-otp-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: 1.35rem !important;
  letter-spacing: 0.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.mga-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13px;
  color: var(--mga-tx-2);
  margin-bottom: 16px;
  cursor: pointer;
}

.mga-check input {
  width: 18px;
  height: 18px;
  accent-color: #e3a52b;
}

/* ---------- Buttons & Tactile States ---------- */
.mga-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 14px;
  font-family: var(--mga-font);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.16s var(--mga-ease), filter 0.16s var(--mga-ease), border-color 0.16s var(--mga-ease), background 0.16s var(--mga-ease), color 0.16s var(--mga-ease), box-shadow 0.16s var(--mga-ease);
}

.mga-btn:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .mga-btn:active:not(:disabled) {
    transform: scale(0.97);
  }
}

.mga-btn:disabled {
  background: var(--mga-surf-2);
  border-color: var(--mga-bd);
  color: var(--mga-tx-3);
  box-shadow: none;
  opacity: 0.88;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.mga-btn[aria-busy="true"]:disabled {
  cursor: wait;
}

.mga-btn-gold {
  background: var(--mga-grad);
  border-color: rgba(255, 232, 148, 0.35);
  color: var(--mga-on-gold);
  box-shadow: var(--mga-shadow-gold), inset 0 1px 0 rgba(255, 250, 224, 0.45);
}

.mga-btn-gold:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 14px 32px -10px rgba(227, 165, 43, 0.68), inset 0 1px 0 rgba(255, 250, 224, 0.55);
}

@media (prefers-reduced-motion: no-preference) {
  .mga-btn-gold:hover:not(:disabled) {
    transform: translateY(-1px);
  }
  .mga-btn-gold:active:not(:disabled) {
    transform: scale(0.97);
  }
}

.mga-btn-ghost {
  background: var(--mga-surf-2);
  border-color: var(--mga-ctrl-bd);
  color: var(--mga-tx);
  box-shadow: var(--mga-bevel);
}

.mga-btn-ghost:hover:not(:disabled) {
  border-color: rgba(240, 193, 75, 0.52);
  background: var(--mga-surf-3);
  color: var(--mga-gold-tx);
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-btn-ghost {
  background: #ffffff;
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-btn-ghost:hover:not(:disabled) {
  background: var(--mga-surf-2);
  border-color: rgba(148, 102, 6, 0.48);
}

.mga-btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.34);
  color: #f87171;
}

.mga-btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.56);
  color: #fca5a5;
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-btn-danger {
  background: rgba(185, 28, 28, 0.06);
  border-color: rgba(185, 28, 28, 0.28);
  color: var(--mga-err);
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-btn-danger:hover:not(:disabled) {
  background: rgba(185, 28, 28, 0.12);
  border-color: rgba(185, 28, 28, 0.46);
  color: var(--mga-err);
}

.mga-btn-block {
  width: 100%;
}

.mga-link-btn {
  position: relative;
  background: none;
  border: 0;
  padding: 0;
  border-radius: 6px;
  color: var(--mga-gold-tx);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.mga-link-btn::before {
  content: "";
  position: absolute;
  inset: -10px -4px;
}

.mga-link-btn:hover {
  text-decoration: underline;
}

.mga-link-btn:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
}

.mga-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  color: var(--mga-tx-3);
  font-size: 12px;
}

.mga-divider::before,
.mga-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--mga-bd);
}

.mga-alt-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.mga-legal {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--mga-tx-2);
  text-align: center;
  line-height: 1.6;
}

.mga-turnstile {
  margin-bottom: 12px;
  min-height: 0;
}

/* ---------- Persistent Stackable Toasts (Safe Bottom Anchor) ---------- */
.mga-toast-region {
  position: fixed;
  inset-block-end: max(20px, env(safe-area-inset-bottom));
  inset-inline-start: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.mga-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--mga-surf) 94%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(240, 193, 75, 0.36);
  color: var(--mga-tx);
  font-family: var(--mga-font);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  box-shadow: 0 18px 42px -12px rgba(0, 0, 0, 0.6), var(--mga-bevel);
  direction: rtl;
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-toast {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 36px -14px rgba(15, 23, 42, 0.22), var(--mga-bevel);
}

.mga-toast.is-ok {
  border-color: rgba(34, 197, 94, 0.44);
}

.mga-toast.is-warn {
  border-color: rgba(245, 158, 11, 0.46);
}

.mga-toast.is-err {
  border-color: rgba(239, 68, 68, 0.48);
}

.mga-toast-x {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--mga-bd);
  background: var(--mga-surf-2);
  color: var(--mga-tx-2);
  cursor: pointer;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
}

.mga-toast-x::before {
  content: "";
  position: absolute;
  inset: -5px;
}

.mga-toast-x:hover {
  border-color: var(--mga-bd-2);
  color: var(--mga-tx);
}

.mga-toast-x:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
}

/* ---------- Site-Wide Bookmark Button ---------- */
.mga-bm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--mga-surf-2);
  border: 1px solid var(--mga-ctrl-bd);
  color: var(--mga-tx-2);
  font-family: var(--mga-font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s var(--mga-ease), color 0.18s var(--mga-ease), background 0.18s var(--mga-ease);
}

.mga-bm-btn:hover {
  border-color: rgba(240, 193, 75, 0.5);
  color: var(--mga-gold-tx);
}

.mga-bm-btn:focus-visible {
  outline: 2px solid var(--mga-gold-tx);
  outline-offset: 2px;
}

.mga-bm-btn.is-saved {
  background: rgba(240, 193, 75, 0.14);
  border-color: rgba(240, 193, 75, 0.48);
  color: var(--mga-gold-tx);
}

@media (max-width: 768px) {
  .mga-toast-region {
    inset-block-end: max(16px, env(safe-area-inset-bottom));
    inset-inline: 12px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mga-btn,
  .mga-tab,
  .mrhf-acc-btn,
  .mga-bm-btn,
  .mrhf-acc-mitem,
  .mga-dlg-close {
    transition: none !important;
  }
}

.mga-ico {
  display: block;
  flex: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

:is(html, body):is([data-lqd-page-color-scheme="light"], [data-theme="light"]) .mga-ico {
  filter: drop-shadow(0 1px 3px rgba(15, 23, 42, 0.18));
}

.mga-bm-btn:not(.is-saved) .mga-bm-star {
  opacity: 0.42;
  filter: saturate(0.25);
  transition: opacity 0.2s, filter 0.2s;
}

.mga-bm-btn.is-saved .mga-bm-star {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(240, 193, 75, 0.45));
}
