.application.mgne,
.mgne-chat-card {
  --mgne-bg: @bg-char;
  --mgne-panel: @bg-panel;
  --mgne-panel-soft: @bg-panel-soft;
  --mgne-border: fade(@bone, 35%);
  --mgne-border-strong: fade(@gold-acid, 42%);
  --mgne-accent: @ember-bright;
  --mgne-accent-alt: @verdigris;
  --mgne-text: @parchment;
  --mgne-text-soft: @dust;
  --mgne-title: @bone;
  --mgne-shadow: @shadow-heavy;
}

.application.mgne {
  .body-copy();
  color: @parchment;

  .window-header {
    background:
      linear-gradient(
        90deg,
        fade(@blood, 40%),
        fade(@ember, 18%) 25%,
        transparent 70%
      ),
      linear-gradient(180deg, color-mix(in srgb, @bg-char 80%, black), @bg-void);
    border-bottom: 1px solid fade(@gold-acid, 35%);
    color: @bone;

    .window-title {
      .caps-heading();
      font-size: 1rem;
      text-shadow: 0 0 16px fade(@ember-bright, 25%);
    }

    .header-control {
      font-family: var(--font-awesome, "Font Awesome 6 Pro");
      font-style: normal;
      font-variant: normal;
      text-rendering: auto;
    }

    .header-control::before,
    i[class^="fa"],
    i[class*=" fa"] {
      font-family: inherit;
      font-style: normal;
      font-variant: normal;
      text-rendering: auto;
    }

    .header-control.fa-solid,
    .header-control.fas,
    .fa-solid,
    .fas {
      font-weight: 900;
    }

    .header-control.fa-regular,
    .header-control.far,
    .fa-regular,
    .far {
      font-weight: 400;
    }
  }

  .window-content {
    background:
      radial-gradient(circle at top left, fade(@ember, 12%), transparent 28%),
      radial-gradient(
        circle at top right,
        fade(@verdigris, 10%),
        transparent 24%
      ),
      linear-gradient(180deg, fade(@bg-char, 30%), fade(@bg-void, 28%)),
      url("@{page-bg-url}") center top / cover no-repeat,
      linear-gradient(180deg, @bg-char, @bg-void 120%);
    color: @parchment;
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }
}

.application.mgne.character {
  .window-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
}

.application.mgne *,
.mgne-chat-card * {
  box-sizing: border-box;
}

.application.mgne input,
.application.mgne select,
.application.mgne textarea,
.application.mgne button,
.application.mgne label,
.application.mgne p,
.application.mgne span,
.application.mgne small,
.mgne-chat-card {
  .body-copy();
}

.application.mgne input,
.application.mgne select,
.application.mgne textarea {
  width: 100%;
  border: 1px solid fade(@bone, 22%);
  border-radius: @radius-sm;
  background:
    linear-gradient(180deg, fade(@bone, 4%), transparent 60%), @bg-input;
  color: @parchment;
  padding: 0.4rem 0.52rem;
  box-shadow: inset 0 1px 0 fade(white, 4%);

  &:focus {
    outline: none;
    border-color: fade(@ember-bright, 70%);
    box-shadow:
      0 0 0 1px fade(@ember-bright, 25%),
      inset 0 1px 0 fade(white, 6%);
  }
}

.application.mgne select {
  appearance: none;
  padding-right: 1.3rem;
  background-image:
    linear-gradient(45deg, transparent 50%, fade(@gold-acid, 78%) 50%),
    linear-gradient(135deg, fade(@gold-acid, 78%) 50%, transparent 50%),
    linear-gradient(180deg, fade(@bone, 4%), transparent 60%);
  background-position:
    calc(100% - 11px) calc(50% - 2px),
    calc(100% - 7px) calc(50% - 2px),
    0 0;
  background-size:
    4px 4px,
    4px 4px,
    auto;
  background-repeat: no-repeat;
}

.application.mgne textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.application.mgne button {
  .metal-button();
  padding: 0.34rem 0.72rem;
}

.application.mgne label {
  .caps-heading();
  color: @bone;
  font-size: 0.74rem;
}

// Item sheets: dark labels for parchment backgrounds
.application.mgne.item-sheet label,
.application.mgne.item-sheet .item-form-row > label {
  color: @bg-char;
}

.application.mgne fieldset {
  .panel-shell();
  .ornate-frame();
  margin: 0;
}

// Character sheet: Rules Snapshot fieldset text - dark color for parchment bg
.application.mgne.character fieldset p {
  color: @bg-char;
}

// ProseMirror / toggled editor inside fieldset — enforce contrast on dark bg
.application.mgne fieldset {
  .editor,
  .editor-content,
  .ProseMirror,
  .document-editor {
    color: lighten(@parchment, 8%);
    background: transparent;
  }
  .editor-content,
  .ProseMirror {
    p,
    li {
      color: lighten(@parchment, 8%);
    }
    h1,
    h2,
    h3 {
      color: @gold-acid;
    }
    .is-empty::before {
      color: fade(@gold-acid, 40%);
    }
  }
  .editor-menu button {
    color: @bone;
    background: fade(@bg-void, 55%);
    &:hover {
      color: lighten(@parchment, 8%);
      background: fade(@gold-acid, 20%);
    }
  }
}

.application.mgne legend {
  .caps-heading();
  color: @gold-acid;
  display: inline-block;
  position: relative;
  top: 0.12rem;
  font-size: 0.82rem;
  line-height: 1.1;
  padding: 0.04rem 0.32rem;
}

.application.mgne code,
.mgne-chat-card code {
  font-family: "Courier New", monospace;
  background: fade(@bg-void, 75%);
  color: @bone;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
}

.application.mgne .empty-state {
  color: @bg-char;
  font-style: italic;
  letter-spacing: 0.03em;
}

.application.mgne .rollable {
  color: lighten(@parchment, 8%);
  text-shadow: 0 0 12px fade(@gold-acid, 18%);

  &:hover {
    color: lighten(@parchment, 12%);
  }
}

#combat .combat-controls .mgne-flee-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 2rem;
  margin-top: 0.35rem;
  border: 1px solid fade(@gold-acid, 28%);
  border-radius: @radius-sm;
  background:
    linear-gradient(180deg, fade(@blood, 26%), fade(@ember, 14%)),
    fade(@bg-input, 92%);
  color: @bone;
  font-family: @font-body;
  font-weight: 700;

  &:hover:not(:disabled) {
    border-color: fade(@ember-bright, 52%);
    color: lighten(@bone, 6%);
  }

  &:disabled {
    opacity: 0.5;
  }
}

// ============================================================
// PAUSE OVERLAY — replace default Foundry spinner with system logo
// ============================================================
#pause {
  & > img {
    content: url("../assets/ui/machine_god_skull.png");
    animation: none;
    width: 260px;
    height: auto;
    filter: drop-shadow(0 0 18px rgba(0, 0, 0, 0.8));
  }

  figcaption {
    font-family: @font-display;
    font-size: 2rem;
    font-weight: bold;
    color: @label-ink;
    text-shadow:
      0 0 10px rgba(0, 0, 0, 0.9),
      1px 1px 2px #000;
    letter-spacing: 2px;
  }
}
