/* skin-terminal: a scientific instrument readout, phosphor on black like a telescope control console.
   Idea: monospace everything with hairline rules and tiny labels, where tier is carried by phosphor colour, bloom and a signal-strength ladder. */

/* ================= PAGE ================= */
body.skin-terminal {
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", "SF Mono", Consolas, Menlo, "Liberation Mono", "Courier New", monospace;
  background:
    repeating-linear-gradient(0deg, rgba(120, 255, 160, .03) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 0%, #0a1a10 0%, #030704 55%, #010201 100%);
  background-attachment: fixed;
  color: #9dffb8;
  font-family: var(--mono);
}

/* ================= CARD BASE (acts as the Common default) ================= */
body.skin-terminal .card {
  --rgb: 36, 135, 72;
  --core: rgb(var(--rgb));
  --bloom: 0px;
  --edge: .28;
  --kb: .5;
  --sig: 16%;

  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
  height: auto;
  min-height: 352px;
  padding: 12px 12px 10px;
  border: 1px solid rgba(var(--rgb), var(--edge));
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(var(--rgb), .05), rgba(var(--rgb), 0) 38%),
    #020503;
  box-shadow: 0 0 calc(var(--bloom) * 1.8) rgba(var(--rgb), .26), inset 0 0 24px rgba(var(--rgb), .05);
  color: rgb(var(--rgb));
  text-align: left;
}

body.skin-terminal .card,
body.skin-terminal .card * {
  font-family: ui-monospace, "Cascadia Mono", "Cascadia Code", "SF Mono", Consolas, Menlo, "Liberation Mono", "Courier New", monospace;
}

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

/* ---- corner brackets, like a viewfinder ---- */
body.skin-terminal .card::before {
  --k: rgba(var(--rgb), var(--kb));
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(var(--k), var(--k)) 0 0 / 9px 1px no-repeat,
    linear-gradient(var(--k), var(--k)) 0 0 / 1px 9px no-repeat,
    linear-gradient(var(--k), var(--k)) 100% 0 / 9px 1px no-repeat,
    linear-gradient(var(--k), var(--k)) 100% 0 / 1px 9px no-repeat,
    linear-gradient(var(--k), var(--k)) 0 100% / 9px 1px no-repeat,
    linear-gradient(var(--k), var(--k)) 0 100% / 1px 9px no-repeat,
    linear-gradient(var(--k), var(--k)) 100% 100% / 9px 1px no-repeat,
    linear-gradient(var(--k), var(--k)) 100% 100% / 1px 9px no-repeat;
}

/* ---- CRT layer: rolling bar + scanlines + vignette ---- */
body.skin-terminal .card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent, rgba(var(--rgb), .0) 20%, rgba(var(--rgb), 0) 80%, transparent),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(0, 0, 0, .38) 100%);
  background-size: 100% 30%, auto, auto;
  background-repeat: no-repeat, repeat, no-repeat;
  background-position: 0 -40%, 0 0, 0 0;
}

/* ================= CARD PARTS ================= */

/* ruler scale along the top */
body.skin-terminal .card .rule {
  flex: none;
  height: 8px;
  opacity: .85;
  background:
    linear-gradient(rgb(var(--rgb)), rgb(var(--rgb))) 0 100% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, rgb(var(--rgb)) 0 1px, transparent 1px 8px) 0 100% / 100% 4px no-repeat,
    repeating-linear-gradient(90deg, rgb(var(--rgb)) 0 1px, transparent 1px 40px) 0 100% / 100% 7px no-repeat;
}

body.skin-terminal .card header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 9.5px;
  line-height: 1.2;
  text-transform: uppercase;
}

body.skin-terminal .card .tier {
  font-weight: 700;
  letter-spacing: .22em;
  color: rgb(var(--rgb));
  text-shadow: 0 0 calc(var(--bloom) * .6) rgba(var(--rgb), .8);
}

/* signal-strength ladder: lit bars = rarity */
body.skin-terminal .card .tier::after {
  content: "";
  display: inline-block;
  width: 30px;
  height: 10px;
  margin-left: 8px;
  vertical-align: -1px;
  background: linear-gradient(90deg, rgb(var(--rgb)) var(--sig), rgba(var(--rgb), .16) var(--sig));
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px);
          mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px);
  clip-path: polygon(0 70%, 100% 0, 100% 100%, 0 100%);
}

body.skin-terminal .card .idx {
  letter-spacing: .12em;
  color: rgba(var(--rgb), .62);
}
body.skin-terminal .card .idx::before {
  content: "CH ";
  opacity: .6;
}

/* scope display */
body.skin-terminal .card .plot {
  flex: none;
  position: relative;
  height: 150px;
  border: 1px solid rgba(var(--rgb), .34);
  background:
    radial-gradient(circle at 50% 50%, rgba(var(--rgb), .1), transparent 68%),
    linear-gradient(rgba(var(--rgb), .07) 1px, transparent 1px) 0 0 / 19px 19px,
    linear-gradient(90deg, rgba(var(--rgb), .07) 1px, transparent 1px) 0 0 / 19px 19px,
    #010302;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .8);
}
body.skin-terminal .card .plot::before,
body.skin-terminal .card .plot::after {
  position: absolute;
  z-index: 2;
  font-size: 7px;
  line-height: 1;
  letter-spacing: .18em;
  color: rgba(var(--rgb), .6);
  pointer-events: none;
}
body.skin-terminal .card .plot::before { content: "ORB-PLOT"; top: 4px; left: 5px; }
body.skin-terminal .card .plot::after { content: "ECL / AU"; bottom: 4px; right: 5px; }

body.skin-terminal .card .plot .orb {
  display: block;
  width: 100%;
  height: 100%;
}

body.skin-terminal .card h2 {
  flex: none;
  font-size: 12.5px;
  font-weight: 700;
  font-style: normal;
  line-height: 1.25;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgb(var(--rgb));
  overflow-wrap: anywhere;
  text-shadow: 0 0 calc(var(--bloom) * .7) rgba(var(--rgb), .7);
}
body.skin-terminal .card h2::before { content: "> "; opacity: .5; }
body.skin-terminal .card h2::after { content: "_"; margin-left: 2px; opacity: .9; }

/* ---- the product: the observation number, on its own display panel ---- */
body.skin-terminal .card .count {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  padding: 6px 8px;
  border: 1px solid rgba(var(--rgb), .3);
  background: rgba(var(--rgb), .05);
  box-shadow: inset 0 0 14px rgba(var(--rgb), .08);
}

body.skin-terminal .card .count b {
  flex: none;
  font-size: 56px;
  font-weight: 700;
  line-height: .9;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  color: var(--core);
  text-shadow:
    0 0 var(--bloom) rgba(var(--rgb), .9),
    0 0 calc(var(--bloom) * 2.4) rgba(var(--rgb), .45);
}

body.skin-terminal .card .count span {
  flex: 1 1 80px;
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(var(--rgb), .72);
}
body.skin-terminal .card .count span::before {
  content: "N_OBS";
  display: block;
  margin-bottom: 2px;
  letter-spacing: .24em;
  opacity: .6;
}

/* ---- elements: hairline readout rows with dotted leaders ---- */
body.skin-terminal .card .els {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}

body.skin-terminal .card .els div {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(var(--rgb), .16);
}

body.skin-terminal .card .els dt {
  flex: 1;
  display: flex;
  align-items: baseline;
  margin: 0;
  font-size: 10px;
  font-style: normal;
  letter-spacing: .1em;
  color: rgba(var(--rgb), .6);
}
body.skin-terminal .card .els dt::after {
  content: "";
  flex: 1;
  margin-left: 4px;
  border-bottom: 1px dotted rgba(var(--rgb), .3);
  transform: translateY(-2px);
}

body.skin-terminal .card .els dd {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: rgb(var(--rgb));
}

body.skin-terminal .card footer {
  flex: none;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid rgba(var(--rgb), .18);
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: .02em;
  color: rgba(var(--rgb), .5);
}

/* ================= ORBIT DRAWING ================= */
body.skin-terminal .card .orb .ring {
  fill: none;
  stroke: rgba(var(--rgb), .22);
  stroke-width: .9;
}

body.skin-terminal .card .orb .shadow {
  fill: none;
  stroke: rgba(var(--rgb), .55);
  stroke-width: 1.1;
  stroke-dasharray: 1 3.5;
}

body.skin-terminal .card .orb .ghost {
  fill: none;
  stroke: rgba(var(--rgb), .28);
  stroke-width: 1;
}

body.skin-terminal .card .orb .orbit {
  fill: none;
  stroke: rgb(var(--rgb));
  stroke-width: 1.9;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 calc(var(--bloom) * .4) rgba(var(--rgb), .9));
}

body.skin-terminal .card .orb .qline {
  stroke: rgba(var(--rgb), .55);
  stroke-width: .8;
  stroke-dasharray: 4 3;
}

body.skin-terminal .card .orb .sun {
  fill: #f2fff6;
  filter: drop-shadow(0 0 4px rgba(240, 255, 245, .8));
}

body.skin-terminal .card .orb .body {
  fill: rgb(var(--rgb));
  stroke: rgba(255, 255, 255, .9);
  stroke-width: 1.1;
  filter: drop-shadow(0 0 calc(var(--bloom) * .5) rgba(var(--rgb), 1));
}

/* ================= TIERS (rarest first) ================= */

/* ---- MYTHIC: off-scale magenta, full ladder, flicker + colour-split digits ---- */
body.skin-terminal .card.t-mythic {
  --rgb: 255, 105, 235;
  --core: #ffe6fa;
  --bloom: 16px;
  --edge: .95;
  --kb: 1;
  --sig: 100%;
}
body.skin-terminal .card.t-mythic .count b {
  text-shadow:
    -1.5px 0 rgba(255, 0, 90, .7),
    1.5px 0 rgba(0, 225, 255, .7),
    0 0 16px rgba(var(--rgb), .9),
    0 0 38px rgba(var(--rgb), .45);
  animation: term-flicker 3.2s steps(1) infinite;
}
body.skin-terminal .card.t-mythic::after {
  background-position: 0 -40%, 0 0, 0 0;
  background-image:
    linear-gradient(180deg, transparent, rgba(var(--rgb), .13) 50%, transparent),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(0, 0, 0, .38) 100%);
  animation: term-roll 4s linear infinite;
}

/* ---- LEGENDARY: amber phosphor ---- */
body.skin-terminal .card.t-legendary {
  --rgb: 255, 176, 0;
  --core: #ffe9b0;
  --bloom: 12px;
  --edge: .85;
  --kb: .95;
  --sig: 82%;
}
body.skin-terminal .card.t-legendary::after {
  background-image:
    linear-gradient(180deg, transparent, rgba(var(--rgb), .1) 50%, transparent),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(0, 0, 0, .38) 100%);
  animation: term-roll 6s linear infinite;
}

/* ---- EPIC: cyan phosphor ---- */
body.skin-terminal .card.t-epic {
  --rgb: 56, 240, 255;
  --core: #d4fcff;
  --bloom: 9px;
  --edge: .7;
  --kb: .85;
  --sig: 66%;
}
body.skin-terminal .card.t-epic::after {
  background-image:
    linear-gradient(180deg, transparent, rgba(var(--rgb), .08) 50%, transparent),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(0, 0, 0, .38) 100%);
  animation: term-roll 9s linear infinite;
}

/* ---- RARE: bright green phosphor ---- */
body.skin-terminal .card.t-rare {
  --rgb: 57, 255, 122;
  --core: #c9ffdc;
  --bloom: 7px;
  --edge: .55;
  --kb: .75;
  --sig: 50%;
}

/* ---- UNCOMMON: mid green, faint bloom ---- */
body.skin-terminal .card.t-uncommon {
  --rgb: 52, 196, 100;
  --core: rgb(52, 196, 100);
  --bloom: 3px;
  --edge: .4;
  --kb: .6;
  --sig: 33%;
}

/* ---- COMMON: dim green, no bloom, one bar ---- */
body.skin-terminal .card.t-common {
  --rgb: 36, 135, 72;
  --core: rgb(36, 135, 72);
  --bloom: 0px;
  --edge: .28;
  --kb: .5;
  --sig: 16%;
}

/* ---- CONTROL: grey, dotted frame, no signal ---- */
body.skin-terminal .card.t-control {
  --rgb: 118, 134, 124;
  --core: rgb(118, 134, 124);
  --bloom: 0px;
  --edge: .2;
  --kb: .3;
  --sig: 0%;
  border-style: dotted;
  box-shadow: none;
}
body.skin-terminal .card.t-control::after {
  background-image:
    linear-gradient(180deg, transparent, transparent),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 4px);
}
body.skin-terminal .card.t-control .rule { opacity: .35; }
body.skin-terminal .card.t-control .count b { opacity: .75; }
body.skin-terminal .card.t-control .orb .sun { fill: #9aa89f; filter: none; }

/* ---- cursor blinks on the upper tiers only ---- */
body.skin-terminal .card.t-mythic h2::after,
body.skin-terminal .card.t-legendary h2::after,
body.skin-terminal .card.t-epic h2::after,
body.skin-terminal .card.t-rare h2::after {
  animation: term-blink 1.1s steps(1) infinite;
}
body.skin-terminal .card.t-control h2::after { content: ""; }

/* ================= KEYFRAMES ================= */
@keyframes term-blink {
  0%, 55% { opacity: .9; }
  56%, 100% { opacity: 0; }
}
@keyframes term-roll {
  from { background-position: 0 -40%, 0 0, 0 0; }
  to   { background-position: 0 140%, 0 0, 0 0; }
}
@keyframes term-flicker {
  0%, 46%, 50%, 91%, 95%, 100% { opacity: 1; }
  47% { opacity: .78; }
  48% { opacity: 1; }
  49% { opacity: .88; }
  92% { opacity: .84; }
  93% { opacity: 1; }
}

/* ================= REDUCED MOTION ================= */
@media (prefers-reduced-motion: reduce) {
  body.skin-terminal .card::after,
  body.skin-terminal .card h2::after,
  body.skin-terminal .card .count b {
    animation: none !important;
  }
}
