/* Natural modal frame integration: use a single proportional canvas for the
   literal Relic frame and portrait. The legacy 13px inset and portrait border
   exposed a rectangular image above the frame and created a second rim. */
body[data-relic-literal-frame="full-frame-v006"] #cardDialog[open]
  .collectible-card.holo-card[data-rarity="Relic"] > .collectible-art {
  padding: 0 !important;
  aspect-ratio: 382 / 457 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body[data-relic-literal-frame="full-frame-v006"] #cardDialog[open]
  .collectible-card.holo-card[data-rarity="Relic"] > .collectible-art > img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  clip-path: inset(4.4% 4% 5% 4% round 3px) !important;
}
/*
 * PRANATARA modal card polish v002 — chat-201.
 *
 * Scope: the clicked-card dialog for every canonical C001-C333 card.
 * - Keeps both artwork labels clear of the existing portrait rails and makes
 *   their panels fully transparent.
 * - Normalises the five vector rarity emblems to a shared optical centre while
 *   preserving the already accepted Relic raster-glyph correction.
 * - Introduces the original, static "Segel Jejak Niskala" memory frame.  It is
 *   drawn only with CSS geometry and project palette variables; no external or
 *   copied frame artwork is used.
 *
 * v002 also resolves both pre-activation v176 findings: narrow Relic faction
 * labels may wrap at <=360px, and the two eyebrow rails are non-interactive.
 */

/* Frame-safe artwork-label geometry.  The percentage rails are inherited from
 * the accepted portrait and Relic source-canvas measurements; the extra 8px is
 * the visible-content clearance requested by the user. */
body[data-modal-art-overlays="transparent-safe-inset-v002"]
  #cardDialog[open]
  .collectible-card.holo-card:not([data-rarity="Relic"])
  > .collectible-art.protected-media {
  --modal-overlay-left: calc(20.4% + 8px);
  --modal-overlay-right: calc(20.4% + 8px);
  --modal-overlay-top: calc(4.98% + 8px);
  --modal-overlay-bottom: calc(4.48% + 8px);
}

body[data-modal-art-overlays="transparent-safe-inset-v002"]
  #cardDialog[open]
  .collectible-card.holo-card[data-rarity="Relic"]
  > .collectible-art.protected-media {
  --modal-overlay-left: calc(26.4397906% + 8px);
  --modal-overlay-right: calc(23.8219895% + 8px);
  --modal-overlay-top: calc(3.7199125% + 8px);
  --modal-overlay-bottom: calc(5.4704595% + 8px);
}

body[data-modal-art-overlays="transparent-safe-inset-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  > .collectible-art.protected-media
  > .collectible-faction {
  inset: var(--modal-overlay-top) var(--modal-overlay-right) auto var(--modal-overlay-left) !important;
  box-sizing: border-box !important;
  width: auto !important;
  max-width: none !important;
}

body[data-modal-art-overlays="transparent-safe-inset-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  > .collectible-art.protected-media
  > .preview-mark {
  inset: auto var(--modal-overlay-right) var(--modal-overlay-bottom) var(--modal-overlay-left) !important;
  box-sizing: border-box !important;
  width: auto !important;
  max-width: none !important;
}

body[data-modal-art-overlays="transparent-safe-inset-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  > .collectible-art.protected-media
  > :is(.collectible-faction, .preview-mark) {
  background: transparent !important;
  background-image: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  text-shadow: 0 1px 2px #000, 0 0 4px #000 !important;
}

/* Clicked-card pennants remain upright.  The five SVG motifs are proportioned
 * against the live pennant instead of retaining their old fixed pixel size.
 * Their per-motif offsets place the visible-ink centroid at the same optical
 * target.  Relic is excluded because its accepted 1.4deg glyph-only correction
 * already cancels the asymmetry of its literal source mask. */
body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  > .reference-rarity-pennant,
body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  > .reference-rarity-pennant
  > .reference-rarity-pennant-shell {
  transform: none !important;
  transform-origin: 50% 50% !important;
  rotate: none !important;
  translate: none !important;
  scale: none !important;
}

body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  > .reference-rarity-pennant:not([data-rarity="Relic"])
  > .reference-rarity-emblem {
  right: auto !important;
  bottom: auto !important;
  width: 66% !important;
  height: 49.5% !important;
  transform: none !important;
  transform-origin: 50% 50% !important;
  rotate: none !important;
  translate: none !important;
  scale: none !important;
}

body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
  #cardDialog[open]
  .reference-rarity-pennant[data-rarity="Core"]
  > .reference-rarity-emblem {
  left: 17% !important;
  top: 11.775% !important;
}

body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
  #cardDialog[open]
  .reference-rarity-pennant[data-rarity="Uncommon"]
  > .reference-rarity-emblem {
  left: 17% !important;
  top: 10.91% !important;
}

body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
  #cardDialog[open]
  .reference-rarity-pennant[data-rarity="Rare"]
  > .reference-rarity-emblem {
  left: 16.069% !important;
  top: 15.635% !important;
}

body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
  #cardDialog[open]
  .reference-rarity-pennant[data-rarity="Epic"]
  > .reference-rarity-emblem {
  left: 17% !important;
  top: 15.317% !important;
}

body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
  #cardDialog[open]
  .reference-rarity-pennant[data-rarity="Mythic"]
  > .reference-rarity-emblem {
  left: 17% !important;
  top: 17.17% !important;
}

/* Original PRANATARA-only frame: Segel Jejak Niskala.  Its asymmetric seal
 * silhouette, split crown notch, and dotted memory spine are authored here and
 * do not trace or embed any existing reference frame. */
body[data-card-scar-frame="segel-jejak-niskala-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  .collectible-scar {
  --memory-frame-metal: color-mix(in srgb, var(--frame-light, #d7c28d) 62%, var(--frame-metal, #8f7346));
  --memory-frame-accent: color-mix(in srgb, var(--frame-accent, #6e536f) 70%, var(--frame-light, #d7c28d));
  --memory-frame-ink: color-mix(in srgb, var(--frame-dark, #17120f) 88%, #080b0d);
  position: relative !important;
  isolation: isolate !important;
  box-sizing: border-box !important;
  margin: 16px 0 0 !important;
  padding: 19px 18px 17px 24px !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  clip-path: polygon(
    11px 0,
    calc(50% - 16px) 0,
    50% 7px,
    calc(50% + 16px) 0,
    calc(100% - 20px) 0,
    100% 13px,
    100% calc(100% - 11px),
    calc(100% - 12px) 100%,
    24px 100%,
    14px calc(100% - 7px),
    0 calc(100% - 7px),
    0 11px
  ) !important;
  background:
    radial-gradient(circle at 50% 3px, var(--memory-frame-metal) 0 1.4px, transparent 1.8px),
    linear-gradient(90deg, color-mix(in srgb, var(--memory-frame-accent) 78%, transparent) 0 3px, transparent 3px),
    radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--memory-frame-accent) 20%, transparent), transparent 58%),
    linear-gradient(145deg, color-mix(in srgb, var(--memory-frame-ink) 96%, var(--memory-frame-accent)), var(--memory-frame-ink) 62%, #080b0df7) !important;
  box-shadow:
    inset 0 0 0 3px #050708c7,
    inset 0 0 0 4px color-mix(in srgb, var(--memory-frame-metal) 34%, transparent),
    0 8px 18px #0000004f !important;
  overflow-wrap: anywhere !important;
}

body[data-card-scar-frame="segel-jejak-niskala-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  .collectible-scar::before {
  content: "" !important;
  position: absolute !important;
  z-index: 0 !important;
  inset: 0 !important;
  padding: 1px !important;
  pointer-events: none !important;
  clip-path: inherit !important;
  background: linear-gradient(118deg, var(--memory-frame-metal), var(--memory-frame-accent) 42%, var(--memory-frame-metal) 72%, transparent 94%) !important;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0) !important;
  -webkit-mask-composite: xor !important;
  mask-composite: exclude !important;
}

body[data-card-scar-frame="segel-jejak-niskala-v002"]
  #cardDialog[open]
  .collectible-card.holo-card
  .collectible-scar::after {
  content: "" !important;
  position: absolute !important;
  z-index: 0 !important;
  top: 20px !important;
  bottom: 15px !important;
  left: 8px !important;
  width: 6px !important;
  pointer-events: none !important;
  opacity: .88 !important;
  background: radial-gradient(circle, var(--memory-frame-accent) 0 1.15px, transparent 1.55px) 50% 0 / 6px 13px repeat-y !important;
}

body[data-card-scar-frame="segel-jejak-niskala-v002"]
  #cardDialog[open]
  .collectible-scar
  > .collectible-eyebrow {
  position: relative !important;
  z-index: 1 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: var(--memory-frame-metal) !important;
  text-align: center !important;
}

body[data-card-scar-frame="segel-jejak-niskala-v002"]
  #cardDialog[open]
  .collectible-scar
  > .collectible-eyebrow::before,
body[data-card-scar-frame="segel-jejak-niskala-v002"]
  #cardDialog[open]
  .collectible-scar
  > .collectible-eyebrow::after {
  content: "" !important;
  flex: 1 1 auto !important;
  height: 1px !important;
  pointer-events: none !important;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--memory-frame-metal) 78%, transparent)) !important;
}

body[data-card-scar-frame="segel-jejak-niskala-v002"]
  #cardDialog[open]
  .collectible-scar
  > .collectible-eyebrow::after {
  transform: scaleX(-1) !important;
}

body[data-card-scar-frame="segel-jejak-niskala-v002"]
  #cardDialog[open]
  .collectible-scar
  > p {
  position: relative !important;
  z-index: 1 !important;
  margin: 8px 0 0 !important;
  color: #d6cdbb !important;
  font-size: 11px !important;
  line-height: 1.58 !important;
}


@media (max-width: 360px) {
  body[data-modal-art-overlays="transparent-safe-inset-v002"]
    #cardDialog[open]
    .collectible-card.holo-card[data-rarity="Relic"]
    > .collectible-art.protected-media
    > .collectible-faction {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.2 !important;
    text-align: center !important;
  }
}

@media (max-width: 430px) {
  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-card.holo-card
    .collectible-scar {
    margin-top: 13px !important;
    padding: 17px 13px 14px 20px !important;
  }

  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar
    > .collectible-eyebrow {
    gap: 6px !important;
    letter-spacing: .1em !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
    #cardDialog[open]
    .reference-rarity-pennant,
  body[data-modal-rarity-emblem-alignment="upright-optical-v002"]
    #cardDialog[open]
    .reference-rarity-emblem,
  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar,
  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar * {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  body[data-modal-art-overlays="transparent-safe-inset-v002"]
    #cardDialog[open]
    .collectible-card.holo-card
    > .collectible-art.protected-media
    > :is(.collectible-faction, .preview-mark) {
    forced-color-adjust: none !important;
    background: transparent !important;
    background-image: none !important;
    border-color: transparent !important;
    color: CanvasText !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-card.holo-card
    .collectible-scar {
    forced-color-adjust: auto !important;
    padding: 16px !important;
    border: 2px solid CanvasText !important;
    border-left-width: 4px !important;
    border-radius: 0 !important;
    clip-path: none !important;
    background: Canvas !important;
    color: CanvasText !important;
    box-shadow: none !important;
  }

  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar::before,
  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar::after {
    display: none !important;
  }

  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar
    > .collectible-eyebrow,
  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar
    > p {
    color: CanvasText !important;
  }

  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar
    > .collectible-eyebrow::before,
  body[data-card-scar-frame="segel-jejak-niskala-v002"]
    #cardDialog[open]
    .collectible-scar
    > .collectible-eyebrow::after {
    background: CanvasText !important;
  }
}

