/* ============================================================
   Spy Profit Index — "Orokin trading terminal"
   Dark sci-fi HUD: clipped-corner panels, gold platinum,
   cyan/gold/ember energy accents per rotation.
   ============================================================ */

:root {
  --bg:        #080a0d;
  --bg-2:      #0c1014;
  --panel:     #111720;
  --panel-2:   #161e29;
  --line:      #233040;
  --line-soft: #1a232f;

  --gold:      #d8b46a;   /* platinum / primary value */
  --gold-hi:   #f3dca0;
  --cyan:      #4fd6e6;   /* energy / rotation A */
  --ember:     #e8865a;   /* rotation C */

  --rot-a: #4fd6e6;
  --rot-b: #d8b46a;
  --rot-c: #cf7bff;
  --rot-boss: #6ee7a8;
  --rot-final: #7aa2f7;
  --rot-arcane: #ff7eb6;

  --text:      #e7eef6;
  --muted:     #8a98a8;
  --faint:     #5a6675;
  --zero:      #3f4856;

  --mono: "JetBrains Mono", ui-monospace, monospace;
  --disp: "Chakra Petch", system-ui, sans-serif;

  --cut: 14px;            /* corner cut size */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--disp);
  color: var(--text);
  background:
    radial-gradient(120% 80% at 80% -10%, rgba(79,214,230,.07), transparent 60%),
    radial-gradient(90% 70% at 0% 110%, rgba(216,180,106,.06), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---- overlays ---- */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.scanlines {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .25;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
}

/* ============================================================ MASTHEAD */
.masthead {
  position: relative; z-index: 2;
  max-width: 1080px; margin: 0 auto; padding: 38px 24px 8px;
}
.masthead__bar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 28px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 18px; }
.brand__glyph {
  font-size: 44px; line-height: 1; color: var(--gold);
  text-shadow: 0 0 18px rgba(216,180,106,.55);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.brand__text h1 {
  margin: 0; font-weight: 700; font-size: clamp(28px, 5vw, 46px);
  letter-spacing: .06em; line-height: .95;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 70%, #9c7e3e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand__text p {
  margin: 6px 0 0; color: var(--muted); font-size: 13px;
  letter-spacing: .22em; text-transform: uppercase;
}

/* HUD readout panel */
.readout {
  font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--line); background: rgba(17,23,32,.7);
  backdrop-filter: blur(2px);
  padding: 12px 16px; min-width: 230px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}
.readout__row {
  display: flex; justify-content: space-between; gap: 18px;
  padding: 3px 0; border-bottom: 1px dashed var(--line-soft);
}
.readout__row:last-child { border-bottom: 0; }
.readout__row span { color: var(--faint); letter-spacing: .12em; }
.readout__row b { color: var(--cyan); font-weight: 500; }
.readout__live { color: var(--gold) !important; }
.readout__live.ok { color: #6ee7a8 !important; }

.method {
  position: relative; z-index: 2;
  max-width: 1080px; margin: 18px auto 0; padding: 0 24px;
  color: var(--faint); font-size: 12px; line-height: 1.6; letter-spacing: .02em;
}
.method b { color: var(--muted); font-weight: 500; }

/* ============================================================ TABS */
.tabs {
  position: relative; z-index: 2;
  max-width: 1080px; margin: 24px auto 0; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 7px;
}
.tab {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); background: rgba(17,23,32,.55);
  border: 1px solid var(--line-soft); padding: 8px 13px; cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
  transition: color .16s, border-color .16s, background .16s, box-shadow .16s;
}
.tab:hover { color: var(--text); border-color: var(--line); }
.tab.active {
  color: var(--bg); font-weight: 700;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border-color: var(--gold); box-shadow: 0 0 16px rgba(216,180,106,.35);
}
.tab__count { margin-left: 7px; font-size: 9.5px; opacity: .55; }
.tab.active .tab__count { opacity: .7; }
.tabs__group {
  flex-basis: 100%; margin: 10px 0 1px;
  font-family: var(--mono); font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--faint);
}
.tabs__group:first-child { margin-top: 0; }

/* ============================================================ CONTROLS */
.controls {
  /* gutter container — matches .masthead / .method / .board so the panel
     lines up with the mission cards below it */
  position: relative; z-index: 2;
  max-width: 1080px; margin: 26px auto 0; padding: 0 24px;
}
.controls__panel {
  padding: 16px 22px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(17,23,32,.7), rgba(12,16,20,.5));
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.ctrl { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ctrl__label {
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
}
.ctrl input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 180px; max-width: 460px; height: 4px;
  border-radius: 2px; background: var(--line); outline: none; cursor: pointer;
}
.ctrl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--bg);
  box-shadow: 0 0 12px rgba(216,180,106,.6); cursor: pointer;
  transition: transform .12s;
}
.ctrl input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.ctrl input[type="range"]::-moz-range-thumb {
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--bg);
  box-shadow: 0 0 12px rgba(216,180,106,.6); cursor: pointer;
}
.ctrl output {
  font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--gold-hi);
  min-width: 52px; text-align: right; text-shadow: 0 0 12px rgba(216,180,106,.4);
}
.ctrl__hint { margin: 11px 0 0; color: var(--faint); font-size: 11.5px; line-height: 1.5; }
.ctrl-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.toggle {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); background: rgba(17,23,32,.5);
  border: 1px solid var(--line-soft); padding: 7px 13px; cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  transition: color .16s, border-color .16s, background .16s, box-shadow .16s;
}
.toggle::before { content: "○ "; opacity: .7; }
.toggle:hover { color: var(--text); border-color: var(--line); }
.toggle.active {
  color: var(--rot-c); border-color: color-mix(in srgb, var(--rot-c) 55%, transparent);
  background: color-mix(in srgb, var(--rot-c) 12%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--rot-c) 25%, transparent);
}
.toggle.active::before { content: "✕ "; opacity: 1; }

/* ============================================================ BOARD */
.board {
  position: relative; z-index: 2;
  max-width: 1080px; margin: 26px auto 0; padding: 0 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.loading {
  font-family: var(--mono); color: var(--muted); padding: 60px 0;
  text-align: center; letter-spacing: .2em; animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .4; } }

/* ---- mission row ---- */
.mission {
  --accent: var(--gold);
  position: relative;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  opacity: 0; transform: translateY(12px);
  animation: rise .5s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* left energy spine */
.mission::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  background: var(--accent); box-shadow: 0 0 12px var(--accent); opacity: .55;
  transition: opacity .25s, width .25s;
}
.mission:hover::before { opacity: 1; width: 4px; }

.mission__head {
  display: grid;
  grid-template-columns: 58px 1fr minmax(180px, 320px) 172px;
  align-items: center; gap: 20px;
  padding: 16px 22px 16px 24px; cursor: pointer; user-select: none;
}
.rank {
  font-family: var(--mono); font-weight: 700; font-size: 26px;
  color: var(--faint); text-align: center; letter-spacing: -.04em;
}
.mission.is-first .rank { color: var(--accent); text-shadow: 0 0 14px var(--accent); }

.info .node {
  font-size: 19px; font-weight: 600; letter-spacing: .02em;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.info .planet { color: var(--muted); font-weight: 400; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; margin-top: 3px; }
.tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: .15em;
  color: var(--ember); border: 1px solid rgba(232,134,90,.5);
  padding: 2px 7px; border-radius: 2px; text-transform: uppercase;
}
.boss-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em; white-space: nowrap;
  color: var(--rot-boss); border: 1px solid color-mix(in srgb, var(--rot-boss) 35%, transparent);
  background: color-mix(in srgb, var(--rot-boss) 10%, transparent);
  padding: 2px 8px; border-radius: 2px;
}

/* stacked rotation bar */
.bar { height: 12px; display: flex; gap: 2px; background: rgba(255,255,255,.03); }
.bar__seg { height: 100%; transition: filter .2s; min-width: 1px; }
.bar__seg--a { background: linear-gradient(90deg, var(--rot-a), color-mix(in srgb, var(--rot-a) 60%, #000)); }
.bar__seg--b { background: linear-gradient(90deg, var(--rot-b), color-mix(in srgb, var(--rot-b) 60%, #000)); }
.bar__seg--c { background: linear-gradient(90deg, var(--rot-c), color-mix(in srgb, var(--rot-c) 60%, #000)); }
.bar__seg--boss { background: linear-gradient(90deg, var(--rot-boss), color-mix(in srgb, var(--rot-boss) 60%, #000)); }
.bar__seg--final { background: linear-gradient(90deg, var(--rot-final), color-mix(in srgb, var(--rot-final) 60%, #000)); }
.bar__seg--arcane { background: linear-gradient(90deg, var(--rot-arcane), color-mix(in srgb, var(--rot-arcane) 60%, #000)); }
.bar__seg--d, .bar__seg--e { background: var(--muted); }
.barwrap { display: flex; flex-direction: column; gap: 6px; }
.barwrap small { font-family: var(--mono); font-size: 10px; color: var(--faint); letter-spacing: .08em; }

.value-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.value { text-align: right; font-family: var(--mono); white-space: nowrap; }
.value__num { font-size: 28px; font-weight: 700; color: var(--gold); letter-spacing: -.02em; }
.value__num .plat { color: var(--gold-hi); font-size: 16px; margin-left: 3px; }
.value__label { font-size: 10px; color: var(--faint); letter-spacing: .12em; }
.chev { color: var(--faint); transition: transform .3s; font-size: 13px; }
.mission.open .chev { transform: rotate(90deg); color: var(--accent); }

/* ---- expanded detail ---- */
.detail {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  padding: 4px 22px 22px; overflow: hidden;
  max-height: 0; opacity: 0;
  transition: max-height .4s ease, opacity .3s, padding .3s;
}
.mission.open .detail { max-height: 1600px; opacity: 1; }

.rot {
  border: 1px solid var(--line-soft); background: rgba(0,0,0,.25);
  clip-path: polygon(0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}
.rot__head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
}
.rot__name { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.rot__weight {
  font-family: var(--mono); font-size: 9px; letter-spacing: .06em; color: var(--faint);
  border: 1px solid var(--line-soft); border-radius: 2px; padding: 1px 5px; margin-left: 8px;
}
.rot--a .rot__name { color: var(--rot-a); }
.rot--b .rot__name { color: var(--rot-b); }
.rot--c .rot__name { color: var(--rot-c); }
.rot--boss .rot__name { color: var(--rot-boss); }
.rot--final .rot__name { color: var(--rot-final); }
.rot--arcane .rot__name { color: var(--rot-arcane); }
.rot__ev { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--gold); }
.rot__ev small { color: var(--faint); font-weight: 400; font-size: 10px; }

.rot__rows { max-height: 320px; overflow-y: auto; }

.drop {
  display: grid; grid-template-columns: 1fr 3.4em 3.4em 3.4em; gap: 4px 10px;
  align-items: baseline; font-family: var(--mono); font-size: 11.5px;
  padding: 6px 12px; border-bottom: 1px dashed var(--line-soft);
}
.drop:last-child { border-bottom: 0; }
.drop__name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop--zero .drop__name { color: var(--zero); }
.demand-icon { font-size: 9px; margin-right: 4px; letter-spacing: -2px; }
.demand-icon--1 { opacity: .45; }
.demand-icon--2 { opacity: .75; }
.demand-icon--3 { opacity: 1; filter: saturate(1.4); }
.drop__price { color: var(--text); text-align: right; }
.drop__price--na { color: var(--zero); }
.drop__price--cut { color: var(--zero); text-decoration: line-through; } /* below the live filter */
.drop__chance { color: var(--faint); text-align: right; }
.drop__contrib { color: var(--gold); font-weight: 500; text-align: right; }
.drop--zero .drop__contrib { color: var(--zero); }

/* column header inside each rotation panel */
.drop--head {
  border-bottom: 1px solid var(--line-soft); padding-top: 8px; padding-bottom: 8px;
  cursor: help;
}
.drop--head span {
  color: var(--faint); font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
}
.drop--head span:not(:first-child) { text-align: right; }

/* ============================================================ FOOT */
.foot {
  position: relative; z-index: 2;
  max-width: 1080px; margin: 50px auto 40px; padding: 22px 24px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--faint); font-size: 11.5px; line-height: 1.7;
}
.foot a { color: var(--cyan); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot__links { margin: 0 0 14px; }
.ghlink {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  color: var(--muted) !important; text-decoration: none !important;
  border: 1px solid var(--line); background: rgba(17,23,32,.6);
  padding: 7px 13px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  transition: color .2s, border-color .2s, box-shadow .2s;
}
.ghlink svg { display: block; }
.ghlink:hover {
  color: var(--gold-hi) !important; border-color: var(--gold);
  box-shadow: 0 0 14px rgba(216,180,106,.25);
}
.foot__legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-family: var(--mono); letter-spacing: .06em; }
.foot__sep { color: var(--line); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 10px; }
.dot--a { background: var(--rot-a); } .dot--b { background: var(--rot-b); } .dot--c { background: var(--rot-c); }

/* ============================================================ RESPONSIVE */
@media (max-width: 760px) {
  .mission__head { grid-template-columns: 40px 1fr auto; gap: 12px; padding: 14px 16px; }
  .barwrap { display: none; }          /* hide bar on narrow screens */
  .detail { grid-template-columns: 1fr; }
  .value__num { font-size: 22px; }
  .rank { font-size: 20px; }
  .readout { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
  .mission { opacity: 1; transform: none; }
}
