/* NEBULA skin - a deep-space foil skin where every tier owns one loud jewel hue,
   so rarity reads from across a room and Mythic looks like a holographic prize. */

body.skin-nebula {
  background:
    radial-gradient(1.3px 1.3px at 40px 60px, #fff, transparent 100%) 0 0 / 211px 173px,
    radial-gradient(1px 1px at 120px 130px, rgba(255, 255, 255, .8), transparent 100%) 0 0 / 211px 173px,
    radial-gradient(1px 1px at 80px 40px, rgba(255, 255, 255, .7), transparent 100%) 0 0 / 137px 251px,
    radial-gradient(1.4px 1.4px at 100px 190px, rgba(190, 210, 255, .9), transparent 100%) 0 0 / 137px 251px,
    radial-gradient(55% 45% at 12% 8%, rgba(255, 79, 216, .20), transparent 62%),
    radial-gradient(50% 42% at 88% 18%, rgba(47, 160, 255, .20), transparent 62%),
    radial-gradient(65% 50% at 50% 105%, rgba(164, 92, 255, .26), transparent 66%),
    #05020d;
  background-attachment: fixed;
  color: #ece8ff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

/* ---------- card shell (defaults = Common, tiers override the variables) ---------- */

body.skin-nebula .card {
  --bw: 3px;
  --ink: #0a0414;
  --c: #9fb0c8;
  --c2: #d3dbe6;
  --hi: #e6ecf4;
  --deep: #232c3a;
  --deep2: #0f141c;
  --glow: rgba(159, 176, 200, .30);
  --foil: linear-gradient(135deg, #e6ecf4 0%, #9fb0c8 50%, #6b7a92 100%);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, Menlo, monospace;

  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 392px;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
  padding: 12px 10px 8px;
  overflow: hidden;
  border-radius: 14px;
  border: var(--bw) solid transparent;
  color: #fff;
  background:
    radial-gradient(120% 50% at 50% 0%, var(--deep) 0%, transparent 72%) padding-box,
    radial-gradient(80% 40% at 100% 100%, var(--deep) 0%, transparent 70%) padding-box,
    linear-gradient(180deg, var(--deep2) 0%, #06030e 100%) padding-box,
    var(--foil) border-box;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .55),
    0 0 14px var(--glow),
    0 8px 18px rgba(0, 0, 0, .5);
  transition: transform .2s ease, box-shadow .2s ease;
}

body.skin-nebula .card:hover {
  transform: translateY(-3px);
}

/* star dust on the card face */
body.skin-nebula .card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: .55;
  background:
    radial-gradient(1.2px 1.2px at 22px 30px, #fff, transparent 100%) 0 0 / 173px 131px,
    radial-gradient(1px 1px at 120px 88px, #fff, transparent 100%) 0 0 / 173px 131px,
    radial-gradient(1px 1px at 52px 61px, #fff, transparent 100%) 0 0 / 97px 211px,
    radial-gradient(1.3px 1.3px at 75px 160px, var(--hi), transparent 100%) 0 0 / 97px 211px;
}

/* foil sheen, only the top three tiers switch it on */
body.skin-nebula .card::after {
  content: "";
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .10) 46%, rgba(255, 255, 255, .02) 54%, transparent 66%);
}

body.skin-nebula .card > * {
  position: relative;
  z-index: 1;
  flex: none;
  margin: 0;
}

/* ---------- rule: glowing tab hanging from the top edge ---------- */

body.skin-nebula .card .rule {
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  z-index: 2;
  height: 4px;
  border-radius: 0 0 5px 5px;
  background: linear-gradient(90deg, transparent, var(--c2) 18%, var(--c) 50%, var(--c2) 82%, transparent);
  box-shadow: 0 0 10px var(--glow);
}

/* ---------- header ---------- */

body.skin-nebula .card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 22px;
}

body.skin-nebula .card .tier {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 14px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(90deg, var(--c2), var(--c));
  box-shadow: 0 0 10px var(--glow);
}

body.skin-nebula .card .idx {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--hi);
  text-shadow: 0 0 8px var(--glow);
}

/* ---------- orbit plot ---------- */

body.skin-nebula .card .plot {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  background:
    radial-gradient(1px 1px at 18px 22px, rgba(255, 255, 255, .9), transparent 100%) 0 0 / 83px 71px,
    radial-gradient(1.2px 1.2px at 51px 49px, rgba(255, 255, 255, .7), transparent 100%) 0 0 / 61px 93px,
    radial-gradient(circle at 50% 50%, var(--deep) 0%, #04020c 80%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, .6), inset 0 0 22px -6px var(--glow);
}

body.skin-nebula .card .orb {
  position: absolute;
  inset: 4px;
  display: block;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  overflow: visible;
}

body.skin-nebula .card .ring {
  fill: none;
  stroke: rgba(255, 255, 255, .16);
  stroke-width: 1;
}

body.skin-nebula .card .shadow {
  fill: none;
  stroke: rgba(255, 255, 255, .45);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: .1 5;
}

body.skin-nebula .card .ghost {
  fill: none;
  stroke: var(--c);
  stroke-opacity: .26;
  stroke-width: 1.2;
}

body.skin-nebula .card .orbit {
  fill: none;
  stroke: var(--c);
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px var(--c)) drop-shadow(0 0 9px var(--glow));
}

body.skin-nebula .card .qline {
  stroke: var(--hi);
  stroke-opacity: .6;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

body.skin-nebula .card .sun {
  fill: #ffe27a;
  stroke: #fff6c8;
  stroke-width: 1;
  filter: drop-shadow(0 0 5px #ffb800);
}

body.skin-nebula .card .body {
  fill: #fff;
  stroke: var(--c);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 4px var(--c)) drop-shadow(0 0 9px var(--glow));
}

/* ---------- name ---------- */

body.skin-nebula .card h2 {
  height: 20px;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 800;
  line-height: 20px;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: 0 0 10px var(--glow);
}

/* ---------- the product: the observation count ---------- */

body.skin-nebula .card .count {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

body.skin-nebula .card .count b {
  display: block;
  font-family: "Segoe UI Black", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-size: 52px;
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--c);
  background: linear-gradient(180deg, #fff 5%, var(--hi) 35%, var(--c) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px var(--glow));
}

body.skin-nebula .card .count span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
  line-height: 13px;
  text-align: center;
  color: rgba(255, 255, 255, .72);
}

/* ---------- elements ---------- */

body.skin-nebula .card .els {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 6px;
  padding: 0;
}

body.skin-nebula .card .els > div {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  padding: 3px 7px 3px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 3px 0 0 var(--c);
}

body.skin-nebula .card .els dt {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  color: var(--c);
}

body.skin-nebula .card .els dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

/* ---------- footer ---------- */

body.skin-nebula .card footer {
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 8.5px;
  font-weight: 500;
  line-height: 11px;
  color: rgba(255, 255, 255, .45);
}

/* =====================================================================
   TIERS - one hue each. Rarest first.
   ===================================================================== */

/* MYTHIC - magenta + gold, animated rainbow hologram border, sweeping sheen */
body.skin-nebula .card.t-mythic {
  --bw: 4px;
  --c: #ff4fd8;
  --c2: #ffd34d;
  --hi: #ffc2f4;
  --deep: #4a0d52;
  --deep2: #1d0626;
  --glow: rgba(255, 79, 216, .70);
  --foil: linear-gradient(120deg, #ff2bd6, #ffd34d 20%, #5dffb4 40%, #36c6ff 60%, #9b5cff 80%, #ff2bd6);
  background-size: 100% 100%, 100% 100%, 100% 100%, 300% 300%;
  background-position: 0 0, 0 0, 0 0, 0% 50%;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .6),
    0 0 22px rgba(255, 79, 216, .75),
    0 0 46px rgba(255, 211, 77, .35),
    0 12px 26px rgba(0, 0, 0, .6);
  animation: nebula-foil 7s ease-in-out infinite alternate;
}

body.skin-nebula .card.t-mythic::before {
  opacity: .9;
}

body.skin-nebula .card.t-mythic::after {
  display: block;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .24) 50%, transparent 62%);
  background-size: 260% 100%;
  animation: nebula-sheen 5s linear infinite;
}

body.skin-nebula .card.t-mythic .rule {
  height: 5px;
  background: linear-gradient(90deg, transparent, #ff2bd6 12%, #ffd34d 32%, #5dffb4 52%, #36c6ff 72%, #9b5cff 88%, transparent);
  box-shadow: 0 0 14px rgba(255, 79, 216, .8);
}

body.skin-nebula .card.t-mythic .tier {
  background: linear-gradient(90deg, #ff9bea, #ffd34d, #7dffc2, #6ad4ff, #c79bff);
  box-shadow: 0 0 14px rgba(255, 79, 216, .8);
}

body.skin-nebula .card.t-mythic .tier::before {
  content: "\2726\2726\2726\00a0";
}

body.skin-nebula .card.t-mythic .count b {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .65) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(100deg, #ff7be9 0%, #ffd34d 30%, #7dffc2 55%, #6ad4ff 78%, #c79bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 14px rgba(255, 79, 216, .85));
}

body.skin-nebula .card.t-mythic .orbit {
  stroke-width: 3.1;
  filter: drop-shadow(0 0 4px #ff4fd8) drop-shadow(0 0 12px rgba(255, 211, 77, .7));
}

/* LEGENDARY - molten gold and orange */
body.skin-nebula .card.t-legendary {
  --bw: 4px;
  --c: #ffb21a;
  --c2: #ff6a1a;
  --hi: #ffe08a;
  --deep: #4d2a05;
  --deep2: #1f1004;
  --glow: rgba(255, 168, 26, .60);
  --foil: linear-gradient(135deg, #fff3b0, #ffb21a 30%, #ff6a1a 55%, #ffd34d 80%, #fff3b0);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .6),
    0 0 20px rgba(255, 168, 26, .6),
    0 10px 22px rgba(0, 0, 0, .55);
}

body.skin-nebula .card.t-legendary::after {
  display: block;
}

body.skin-nebula .card.t-legendary .tier::before {
  content: "\2726\2726\00a0";
}

/* EPIC - royal violet */
body.skin-nebula .card.t-epic {
  --c: #a45cff;
  --c2: #6a3cff;
  --hi: #d4b3ff;
  --deep: #2e1161;
  --deep2: #130829;
  --glow: rgba(164, 92, 255, .55);
  --foil: linear-gradient(135deg, #d4b3ff, #a45cff 35%, #5b2fe0 65%, #c58bff);
}

body.skin-nebula .card.t-epic::after {
  display: block;
}

body.skin-nebula .card.t-epic .tier::before {
  content: "\2726\00a0";
}

/* RARE - electric blue */
body.skin-nebula .card.t-rare {
  --c: #2fa0ff;
  --c2: #14d4ff;
  --hi: #a8dcff;
  --deep: #0a2a5c;
  --deep2: #06122b;
  --glow: rgba(47, 160, 255, .50);
  --foil: linear-gradient(135deg, #bfe6ff, #2fa0ff 35%, #0f6bd6 65%, #14d4ff);
}

/* UNCOMMON - emerald and lime */
body.skin-nebula .card.t-uncommon {
  --bw: 2px;
  --c: #25d68a;
  --c2: #b6f23a;
  --hi: #aef5d0;
  --deep: #0a3d2b;
  --deep2: #051b14;
  --glow: rgba(37, 214, 138, .45);
  --foil: linear-gradient(135deg, #d9ffb0, #25d68a 40%, #0d9a63 70%, #b6f23a);
}

/* COMMON - cool silver, quiet glow */
body.skin-nebula .card.t-common {
  --bw: 2px;
  --glow: rgba(159, 176, 200, .22);
}

body.skin-nebula .card.t-common::before {
  opacity: .35;
}

/* CONTROL - graphite proof card, dashed edge, no glow */
body.skin-nebula .card.t-control {
  --bw: 2px;
  --c: #8b93a5;
  --c2: #8b93a5;
  --hi: #c3c9d6;
  --deep: #1b1f29;
  --deep2: #0f1218;
  --glow: rgba(0, 0, 0, 0);
  border-style: dashed;
  border-color: #6e778a;
  background: linear-gradient(180deg, #151922, #0b0d12);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .45);
}

body.skin-nebula .card.t-control::before {
  opacity: .2;
}

body.skin-nebula .card.t-control .rule {
  height: 3px;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, #7d8596 0 6px, transparent 6px 10px);
  box-shadow: none;
}

body.skin-nebula .card.t-control .tier {
  color: #aab2c2;
  background: transparent;
  box-shadow: inset 0 0 0 1px #6e778a;
}

body.skin-nebula .card.t-control .orbit,
body.skin-nebula .card.t-control .body {
  filter: none;
}

body.skin-nebula .card.t-control .orbit {
  stroke-width: 2.2;
  stroke-opacity: .85;
}

body.skin-nebula .card.t-control .count b {
  background: linear-gradient(180deg, #f2f4f8, #8b93a5);
  -webkit-background-clip: text;
  background-clip: text;
  filter: none;
}

/* ---------- motion ---------- */

@keyframes nebula-foil {
  from { background-position: 0 0, 0 0, 0 0, 0% 50%; }
  to   { background-position: 0 0, 0 0, 0 0, 100% 50%; }
}

@keyframes nebula-sheen {
  0%   { background-position: 0% 0; }
  60%, 100% { background-position: 100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  body.skin-nebula .card.t-mythic,
  body.skin-nebula .card.t-mythic::after {
    animation: none;
  }
  body.skin-nebula .card {
    transition: none;
  }
}
