:root {
  --bg: #05070d;
  --bg-card: rgba(10, 16, 32, 0.88);
  --glass: rgba(10, 16, 30, 0.88);
  --panel: var(--glass);
  --edge: rgba(127, 216, 255, 0.22);
  --line: var(--edge);
  --glow-accent: 0 0 12px rgba(127, 216, 255, 0.35);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --text: #d8e2f4;
  --dim: #7d8aa6;
  --accent: #7fd8ff;
  --gold: #ffd84a;
  --r0: #d8dde6; --r1: #6f9cff; --r2: #ffd84a; --r3: #d9a55a; --r4: #3be07a; --r5: #c070ff;
  --hull: #e0413a; --shield: #6fe6ff; --energy: #3f7dff;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Rajdhani", "Orbitron", "Eurostile", ui-sans-serif, system-ui;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 160, 255, 0.25) transparent;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: rgba(120, 160, 255, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.35 var(--font-body);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  background: linear-gradient(180deg, rgba(32, 48, 84, 0.85), rgba(16, 24, 46, 0.95));
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.08s;
}
button:hover {
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), var(--glow-accent);
}
button:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(0.88);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled {
  opacity: .35;
  cursor: default;
  filter: grayscale(0.5);
  box-shadow: none;
}
button.primary {
  background: linear-gradient(180deg, #2b4a8f, #152448);
  border-color: rgba(127, 216, 255, 0.6);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 12px rgba(80, 160, 255, 0.35);
}
button.primary:hover {
  border-color: #7fd8ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 18px rgba(127, 216, 255, 0.6);
}
button.danger {
  background: linear-gradient(180deg, #8a2020, #421010);
  border-color: rgba(255, 100, 90, 0.6);
  color: #ffd0d0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 10px rgba(255, 70, 60, 0.3);
}
button.danger:hover {
  border-color: #ff7a6a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 16px rgba(255, 70, 60, 0.55);
}
input, select {
  font-family: var(--font-body);
  color: var(--text);
  background: rgba(8, 14, 28, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(127, 216, 255, 0.25), var(--glow-accent);
}
.hidden { display: none !important; }

/* ---------- login */
#login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 35, 75, 0.25), rgba(5, 7, 13, 0.8) 75%);
  z-index: 50;
  padding: 16px;
}
.lbox { width: min(520px, 100%); text-align: center; }
.lbox h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 10vw, 58px);
  letter-spacing: .25em;
  margin: 0 0 6px;
  font-weight: 900;
  padding-left: .25em;
  white-space: nowrap;
  background: linear-gradient(110deg, #fff 0%, #7fd8ff 35%, #ffffff 50%, #7fd8ff 65%, #3f5fff 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: logo-sweep 7s ease-in-out infinite;
  filter: drop-shadow(0 0 22px rgba(127, 216, 255, .45));
}
@keyframes logo-sweep {
  0% { background-position: 100% 0; }
  50%, 100% { background-position: 0% 0; }
}
.tag { color: var(--dim); margin: 0 0 10px; font-style: italic; font-size: 13.5px; }
.tag-div {
  height: 1px;
  width: 80%;
  margin: 0 auto 20px;
  background: linear-gradient(90deg, transparent, rgba(127, 216, 255, 0.8), transparent);
  box-shadow: 0 0 8px rgba(127, 216, 255, 0.6);
}
#lform { display: grid; gap: 12px; }
#lform button {
  padding: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .25em;
  text-transform: uppercase;
}
#lerr { color: #ff7a6a; min-height: 1.2em; font-weight: 600; }
.hint { color: var(--dim); font-size: 12px; }
#classlist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}
.cls {
  text-align: left;
  padding: 12px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  background: rgba(10, 16, 32, 0.85);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  transition: all 0.18s ease;
}
.cls:hover {
  border-color: var(--cls-col, var(--accent));
  box-shadow: 0 0 16px var(--cls-col, var(--accent)), inset 0 0 12px rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}
.cls canvas {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: rgba(4, 7, 15, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.cls-info { display: flex; flex-direction: column; gap: 2px; }
.cls b {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}
.cls-role {
  font-size: 11px;
  font-weight: 700;
  color: var(--cls-col, var(--accent));
  letter-spacing: 0.04em;
}
.cls small {
  color: var(--dim);
  font-size: 11px;
  line-height: 1.25;
  margin: 3px 0 6px;
}
.cls-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 5px;
}
.cs-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cs-row span { font-size: 9.5px; color: var(--dim); text-transform: uppercase; font-family: var(--font-display); }
.cs-bar {
  flex: 1;
  height: 4px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  overflow: hidden;
  max-width: 38px;
}
.cs-bar i {
  display: block;
  height: 100%;
  background: var(--cls-col, var(--accent));
  border-radius: 2px;
}
@media (max-width: 560px) {
  #classlist { grid-template-columns: 1fr; }
}

/* ---------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#topbar {
  position: absolute;
  top: calc(6px + env(safe-area-inset-top));
  left: 8px;
  right: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
#xpwrap {
  position: relative;
  height: 14px;
  background: rgba(6, 10, 20, 0.85);
  border: 1px solid var(--edge);
  border-radius: 7px;
  overflow: hidden;
  max-width: 520px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.8);
}
#xpbar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #b58a2a, #ffd84a);
  transition: width .3s;
  position: relative;
  overflow: hidden;
}
.xpsheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -100%;
  width: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: xp-sweep 3.5s infinite;
}
@keyframes xp-sweep {
  0% { left: -100%; }
  35%, 100% { left: 100%; }
}
.xpticks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-evenly;
  pointer-events: none;
}
.xpticks i {
  width: 1px;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}
#xptext {
  position: absolute;
  inset: 0;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 14px;
  text-align: center;
  text-shadow: 0 0 3px #000, 0 0 1px #000;
  color: #fff;
  z-index: 2;
}
#sectorname {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}
#objective {
  font-size: 12px;
  color: #ffe39a;
  text-shadow: 0 0 4px #000;
  max-width: 440px;
  background: rgba(8, 14, 28, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
#objective:empty { display: none; }
#vignette, #hitflash { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .25s; }
#vignette { background: radial-gradient(ellipse at center, transparent 55%, rgba(200,0,0,.55) 100%); }
#vignette.crit { animation: throb 1s infinite; }
@keyframes throb { 50% { opacity: .35 } }
#hitflash { background: radial-gradient(ellipse at center, transparent 40%, rgba(255,40,20,.35) 100%); transition: opacity .35s; }
.util i { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.7) var(--cd, 0%), transparent 0); pointer-events: none; }
.util .plus { position: absolute; top: 5px; left: 0; right: 0; font-size: 18px; color: #7dff9a; text-shadow: 0 0 6px rgba(80,255,140,.7); }
#lootbtn .plus { color: #ffd84a; text-shadow: 0 0 6px rgba(255,216,74,.7); font-size: 15px; }
#nanite.pulse { animation: nanpulse .8s infinite; border-color: #7dff9a; }
@keyframes nanpulse { 50% { box-shadow: 0 0 16px rgba(80,255,140,.8); } }
#nanite.empty { filter: grayscale(1) brightness(.6); }
#nanite.hot { border-color: #7dff9a; }
#recall.dim { opacity: .45; }
#invcount.warn { color: #ff8a6a !important; font-weight: 700 !important; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid rgba(120,160,255,.1); }
.opt small { display: block; color: var(--dim); font-size: 11.5px; }
#tripsummary { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); width: min(440px, 88vw); padding: 12px 44px 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); pointer-events: auto; }
#tripsummary b { color: var(--accent); }
#tripsummary div { margin: 5px 0; }
#tripsummary small { color: var(--dim); }
#tripsummary button { position: absolute; top: 3px; right: 3px; width: 40px; height: 40px; padding: 0; }

#menu {
  position: absolute;
  top: calc(160px + env(safe-area-inset-top));
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 78px;
  z-index: 10;
}
@media (min-width: 561px) {
  body.panel-open #menu, body.panel-open #minimap {
    right: calc(min(460px, 100vw) + 6px);
  }
  body.panel-open #banner {
    left: calc((100vw - min(460px, 100vw)) / 2);
    width: min(520px, calc(100vw - min(460px, 100vw) - 180px));
  }
}
#menu button {
  font-size: 11.5px;
  padding: 5px 6px;
  position: relative;
  background: rgba(12, 18, 34, .88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 5px;
}
#menu button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(127, 216, 255, 0.35);
}
.m-ic {
  width: 14px;
  height: 14px;
  flex: none;
  stroke: var(--accent);
}
.m-lbl {
  flex: 1;
  text-align: left;
  white-space: nowrap;
}
#menu b { font-weight: 400; color: var(--dim); font-size: 10px; margin-left: auto; }
.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ffd84a;
  color: #000 !important;
  border-radius: 9px;
  min-width: 17px;
  padding: 0 4px;
  font-weight: 700 !important;
  font-size: 11px !important;
  box-shadow: 0 0 6px rgba(255, 216, 74, 0.8);
}
#minimap {
  position: absolute;
  top: calc(6px + env(safe-area-inset-top));
  right: 6px;
  width: 150px;
  height: 150px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: rgba(4, 7, 14, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 10px rgba(127, 216, 255, 0.15);
}
#target {
  position: absolute;
  top: calc(42px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, 58vw);
  text-align: center;
  pointer-events: none;
}
#tname {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 0 4px #000;
  font-size: 14px;
  text-transform: uppercase;
}
#tmods { font-size: 11px; color: #8fb8ff; text-shadow: 0 0 3px #000; min-height: 0; }
.tbar {
  position: relative;
  height: 8px;
  background: rgba(0,0,0,.7);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 2px;
}
#tlag {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: #ffaa40;
  transition: width 0.5s ease-out;
}
#thp {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #991f1a, #e03830);
  transition: width 0.08s ease-out;
}

#banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: min(600px, calc(100vw - 340px));
  pointer-events: none;
  animation: banner-enter 7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 12;
}
@keyframes banner-enter {
  0% { opacity: 0; transform: translateX(-50%) scale(0.92); }
  6% { opacity: 1; transform: translateX(-50%) scale(1); }
  85% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.02); }
}
#btitle {
  font-family: var(--font-display);
  font-size: clamp(22px, 5.5vw, 34px);
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff, #ffd84a 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 16px rgba(255, 216, 74, .6));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
#btitle::before, #btitle::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 216, 74, 0.6), transparent);
}
#btext {
  color: #e8dcc0;
  text-shadow: 0 0 4px #000;
  margin-top: 6px;
  font-size: 14px;
}

#toasts {
  position: absolute;
  /* top centre, under the target / boss bar and clear of the minimap column */
  top: calc(92px + env(safe-area-inset-top));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: auto;
  max-width: min(400px, 86vw);
  z-index: 30;
}
.toast {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 13px;
  background: rgba(10, 16, 30, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--toast-col, var(--accent));
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  animation: toast-slide 3.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  text-shadow: 0 0 3px #000;
}
@keyframes toast-slide {
  0% { opacity: 0; transform: translateY(-10px) scale(.96); }
  8% { opacity: 1; transform: none; }
  80% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-8px); }
}

.orb {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: 86px;
  height: 86px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #141828, #05060b 80%);
  border: 2.5px solid #3c4868;
  box-shadow: 0 0 20px rgba(0,0,0,.85), inset 0 0 14px #000, 0 2px 6px rgba(0,0,0,0.9);
  pointer-events: none;
}
#orb-hull { left: 8px; }
#orb-en { right: 8px; }
.orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.06) 35%, transparent 60%);
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.28), inset 0 -4px 10px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}
.orbfill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  transition: height .15s;
}
#hullfill {
  background: radial-gradient(circle at 40% 30%, #ff7058, #b0161a 60%, #4a0406);
}
#enfill {
  background: radial-gradient(circle at 40% 30%, #7db8ff, #1f4fd6 60%, #0a1854);
}
/* Liquid wavy top surface */
.orbfill::before, .orbfill::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 140px;
  height: 140px;
  pointer-events: none;
}
#hullfill::before {
  margin-left: -70px;
  margin-top: -70px;
  border-radius: 41% 43% 42% 44%;
  background: rgba(255, 110, 85, 0.38);
  animation: wave-spin 5.5s linear infinite;
}
#hullfill::after {
  margin-left: -70px;
  margin-top: -70px;
  border-radius: 43% 41% 44% 42%;
  background: rgba(176, 22, 26, 0.55);
  animation: wave-spin 9s linear infinite reverse;
}
#enfill::before {
  margin-left: -70px;
  margin-top: -70px;
  border-radius: 41% 43% 42% 44%;
  background: rgba(125, 184, 255, 0.38);
  animation: wave-spin 5.5s linear infinite;
}
#enfill::after {
  margin-left: -70px;
  margin-top: -70px;
  border-radius: 43% 41% 44% 42%;
  background: rgba(31, 79, 214, 0.55);
  animation: wave-spin 9s linear infinite reverse;
}
@keyframes wave-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.orb span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-shadow: 0 0 4px #000, 0 0 2px #000;
  white-space: pre;
  text-align: center;
  line-height: 1.1;
  z-index: 2;
}
.ring { position: absolute; inset: 0; transform: rotate(-90deg); z-index: 1; }
.ring circle {
  fill: none;
  stroke: var(--shield);
  stroke-width: 6;
  stroke-dasharray: 100 100;
  filter: drop-shadow(0 0 5px rgba(111, 230, 255, 0.85));
  transition: stroke-dasharray .15s;
}
#orb-hull.pulse {
  animation: orb-danger 0.9s infinite ease-in-out;
}
@keyframes orb-danger {
  0%, 100% {
    box-shadow: 0 0 16px rgba(224, 65, 58, 0.45), inset 0 0 14px #000;
    border-color: #5a2525;
  }
  50% {
    box-shadow: 0 0 28px rgba(255, 50, 40, 0.9), inset 0 0 20px rgba(255, 40, 40, 0.5);
    border-color: #ff4a3a;
  }
}

#bar {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.sk, .util {
  width: 62px;
  height: 62px;
  padding: 0;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(30, 45, 80, 0.7), rgba(8, 12, 22, 0.95) 75%);
  border: 1px solid rgba(127, 178, 255, 0.35);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.75), 0 3px 8px rgba(0, 0, 0, 0.5);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.sk:hover, .util:hover {
  border-color: var(--accent);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.75), 0 0 10px rgba(127, 216, 255, 0.4);
}
.sk img.skic {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -55%);
  width: 40px;
  height: 40px;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
.sk span, .util span {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 4px;
  font-size: 9px;
  line-height: 1.05;
  color: #cfe0ff;
  text-shadow: 0 0 3px #000, 0 0 2px #000;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sk em, .util em {
  position: absolute;
  top: 2px;
  right: 3px;
  font-style: normal;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  color: #ffd84a;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 13px;
}
.sk i {
  position: absolute;
  inset: 0;
  background: conic-gradient(rgba(0, 0, 0, 0.78) var(--cd, 0%), transparent 0);
  pointer-events: none;
}
.sk b.cdn {
  position: absolute;
  inset: 0 0 18px 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 0 6px #000, 0 0 3px #000;
  pointer-events: none;
  z-index: 2;
}
.sk.ready {
  animation: sk-ready-flash 0.4s ease-out;
}
@keyframes sk-ready-flash {
  0% {
    box-shadow: 0 0 22px #7fd8ff, inset 0 0 16px #ffffff;
    border-color: #ffffff;
    filter: brightness(1.7);
  }
  100% {
    filter: none;
  }
}
.sk.nomana {
  filter: grayscale(0.85) brightness(0.65);
  border-color: rgba(60, 90, 140, 0.25);
}
.sk.empty { opacity: .35; }
.util { width: 52px; height: 52px; }
#nancount { color: #7dff9a !important; font-weight: 700; font-size: 12px !important; }

@media (max-width: 560px) {
  .sk { width: 52px; height: 52px; }
  .util { width: 44px; height: 44px; }
  .sk img.skic { width: 34px; height: 34px; }
  .sk span, .util span { font-size: 8.5px; }
  .orb { width: 66px; height: 66px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  #bar { gap: 4px; }
  #chat { bottom: calc(150px + env(safe-area-inset-bottom)) !important; }
  #minimap { width: 110px; height: 110px; }
  #menu { top: calc(120px + env(safe-area-inset-top)); width: 38px; }
  #menu button { padding: 7px 0; justify-content: center; }
  .m-lbl { display: none; }
  .m-ic { width: 16px; height: 16px; }
  #menu b:not(.badge) { display: none; }
  #topbar { right: 120px; }
}

#chat {
  position: absolute;
  left: 8px;
  bottom: calc(104px + env(safe-area-inset-bottom));
  width: min(420px, 70vw);
}
#chatlog {
  max-height: 150px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  font-size: 12.5px;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent 0%, black 20px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20px);
}
#chatlog div { text-shadow: 0 0 3px #000, 0 0 2px #000; animation: chatfade 25s forwards; overflow-wrap: anywhere; }
#chat.open #chatlog {
  mask-image: none;
  -webkit-mask-image: none;
  max-height: 40vh;
  overflow-y: auto;
  pointer-events: auto;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
#chat.open #chatlog div { animation: none; opacity: 1; }
@keyframes chatfade { 0%, 85% { opacity: 1 } 100% { opacity: 0 } }
#chatform { display: flex; gap: 4px; margin-top: 4px; }
#chatform input { flex: 1; min-width: 0; }
#chatbtn { margin-top: 4px; font-size: 12px; padding: 4px 10px; }
.ch-global { color: #ffd88a; } .ch-guild { color: #7dff9a; } .ch-whisper { color: #ff9ae6; } .ch-system { color: #8fd8ff; } .ch-local { color: #fff; }
.ch-event { color: #ffb44a; font-weight: 700; }

/* ---------- panels */
#panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100vw);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0%, transparent 45%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.14) 0 2px, transparent 2px 4px),
    var(--glass);
  border-left: 1px solid var(--edge);
  z-index: 20;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.65);
}
#phead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(8, 12, 24, 0.7);
  position: relative;
}
#phead::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(127, 216, 255, 0.4) 60%, transparent 100%);
  box-shadow: 0 0 6px rgba(127, 216, 255, 0.5);
}
#ptitle {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 15px;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(127, 216, 255, 0.4);
}
#pclose {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 13px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  background: rgba(20, 30, 56, 0.6);
  border: 1px solid var(--edge);
  color: var(--dim);
}
#pclose:hover {
  color: #fff;
  border-color: #ff6a6a;
  box-shadow: 0 0 10px rgba(255, 106, 106, 0.5);
}
#pbody { overflow-y: auto; padding: 12px 14px calc(20px + env(safe-area-inset-bottom)); flex: 1; user-select: text; -webkit-user-select: text; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.muted { color: var(--dim); font-size: 12px; }
h3 {
  margin: 16px 0 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
h3::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--accent);
}
.equip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.slot, .cell {
  position: relative;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: rgba(0,0,0,.35);
  min-height: 58px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.slot:hover:not(.emptyslot), .cell:hover:not(.ghost) {
  transform: translateY(-1px);
  border-color: rgba(160, 200, 255, 0.7);
}
.slot small { color: var(--dim); font-size: 10px; }
.slot .nm, .cell .nm { font-size: 10.5px; line-height: 1.1; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cargo { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.cell img, .slot img { width: 30px; height: 30px; image-rendering: auto; }
.r0 { color: var(--r0); } .r1 { color: var(--r1); } .r2 { color: var(--r2); } .r3 { color: var(--r3); } .r4 { color: var(--r4); } .r5 { color: var(--r5); }
.b0 { border-color: rgba(216,221,230,.25); }
.b1 { border-color: rgba(111,156,255,.55); }
.b2 { border-color: rgba(255,216,74,.65); background: linear-gradient(180deg, rgba(255,216,74,.08), rgba(0,0,0,.4) 40%); }
.b3 {
  border-color: rgba(217,165,90,.85);
  background: linear-gradient(180deg, rgba(217,165,90,.18), rgba(0,0,0,.4) 40%);
  box-shadow: 0 0 10px rgba(217,165,90,.35) inset, 0 0 8px rgba(217,165,90,.25);
}
.b4 {
  border-color: rgba(59,224,122,.85);
  background: linear-gradient(180deg, rgba(59,224,122,.18), rgba(0,0,0,.4) 40%);
  box-shadow: 0 0 10px rgba(59,224,122,.35) inset, 0 0 8px rgba(59,224,122,.25);
}
.b5, .bv {
  border-color: rgba(192,112,255,.85);
  background: linear-gradient(180deg, rgba(192,112,255,.18), rgba(0,0,0,.4) 40%);
  box-shadow: 0 0 12px rgba(192,112,255,.45) inset, 0 0 8px rgba(192,112,255,.3);
}
.b6 {
  border-color: rgba(199,163,107,.9);
  background: linear-gradient(180deg, rgba(199,163,107,.18), rgba(0,0,0,.4) 40%);
  box-shadow: 0 0 10px rgba(199,163,107,.4) inset, 0 0 8px rgba(199,163,107,.3);
}
.new::after { content: ""; position: absolute; top: 4px; left: 4px; width: 6px; height: 6px; border-radius: 3px; background: #ffd84a; }
.up::before { content: "▲"; position: absolute; top: 2px; right: 4px; font-size: 9px; color: #7dff9a; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 13px; }
.stats span:nth-child(odd) { color: var(--dim); }
/* ---------- talent tree */
.sk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}
.sk-points {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sk-sp-val {
  font-size: 26px;
  font-weight: 800;
  color: #ffd84a;
  line-height: 1;
  min-width: 28px;
  text-align: center;
}
.sk-sp-val.pulse {
  animation: sk-sp-pulse 2s infinite ease-in-out;
}
@keyframes sk-sp-pulse {
  0%, 100% { text-shadow: 0 0 4px rgba(255, 216, 74, 0.4); transform: scale(1); }
  50% { text-shadow: 0 0 14px rgba(255, 216, 74, 0.95); transform: scale(1.1); }
}
.sk-sp-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sk-sp-info b {
  font-size: 13px;
  color: #ffd84a;
}
.sk-respec {
  font-size: 12px;
  padding: 5px 10px;
  white-space: nowrap;
}
.sk-respec-note {
  font-size: 11.5px;
}

.sk-tree-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(30, 50, 90, 0.28), transparent 70%),
    linear-gradient(rgba(120, 160, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 255, 0.05) 1px, transparent 1px),
    rgba(5, 10, 22, 0.75);
  background-size: 100% 100%, 24px 24px, 24px 24px, auto;
  overflow: hidden;
  margin: 8px 0;
  padding: 6px 4px;
}
.sk-labels-col {
  display: flex;
  flex-direction: column;
  border-right: 1px dashed rgba(120, 160, 255, 0.15);
  padding-right: 4px;
}
.sk-tier-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-transform: uppercase;
}
.sk-tier-label.locked {
  color: var(--dim);
  opacity: 0.55;
}
.sk-tree-area {
  position: relative;
}
.sk-tree-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.sk-tree-rows {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
}
.sk-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  height: 100px;
}
.sk-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4px;
  position: relative;
}

.sk-node-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: 100%;
  max-width: 96px;
  user-select: none;
}
.sk-node {
  position: relative;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  transition: transform 150ms ease;
}
.sk-node-wrap:hover .sk-node {
  transform: scale(1.06);
}
.sk-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: rotate(-90deg);
  z-index: 2;
}
.sk-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 3.5;
}
.sk-ring-fill {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.3s ease;
}
.sk-frame {
  position: relative;
  display: grid;
  place-items: center;
  background: rgba(12, 18, 32, 0.95);
  border: 2px solid var(--line);
  transition: border-color 150ms ease, box-shadow 150ms ease, outline 150ms ease;
  z-index: 1;
}
.sk-node.active .sk-frame {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
}
.sk-node.active .sk-frame img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: block;
}
.sk-node.passive .sk-frame {
  width: 38px;
  height: 38px;
  transform: rotate(45deg);
  border-radius: 8px;
  overflow: hidden;
}
.sk-node.passive .sk-frame img {
  width: 34px;
  height: 34px;
  transform: rotate(-45deg) scale(1.22);
  display: block;
}

.sk-node.locked {
  filter: grayscale(1);
  opacity: 0.55;
}
.sk-node-lock {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 11px;
  line-height: 1;
  text-shadow: 0 0 3px #000;
  z-index: 6;
  pointer-events: none;
}

.sk-node.can {
  opacity: 1;
  filter: none;
}
.sk-node.can:not(.selected) .sk-frame {
  box-shadow: 0 0 0 2px rgba(255, 216, 74, 0.65), 0 0 10px rgba(255, 216, 74, 0.4);
  animation: sk-can-pulse 1.8s ease-in-out infinite;
}
@keyframes sk-can-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 216, 74, 0.5), 0 0 6px rgba(255, 216, 74, 0.3); }
  50% { box-shadow: 0 0 0 3px rgba(255, 216, 74, 0.9), 0 0 14px rgba(255, 216, 74, 0.7); }
}

.sk-node-plus {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 19px;
  height: 19px;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffd84a, #d49520);
  color: #05070d;
  font-weight: 800;
  font-size: 13px;
  line-height: 17px;
  text-align: center;
  border: 1px solid #fff;
  cursor: pointer;
  z-index: 8;
  box-shadow: 0 0 6px rgba(255, 216, 74, 0.7);
}
.sk-node-plus:hover {
  transform: scale(1.18);
  box-shadow: 0 0 10px #ffd84a;
}

.sk-node.learned .sk-frame {
  border-color: var(--cls-col, var(--accent));
  box-shadow: 0 0 10px var(--cls-glow, rgba(127, 216, 255, 0.45));
}
.sk-node.maxed .sk-frame {
  border-color: #ffd84a !important;
  box-shadow: 0 0 14px rgba(255, 216, 74, 0.75) !important;
}

.sk-slot-badge {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2b4a8f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 1px solid var(--accent);
  z-index: 8;
  box-shadow: 0 0 6px rgba(127, 216, 255, 0.6);
  pointer-events: none;
}

.sk-node.selected .sk-frame {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.sk-node.synergy-partner .sk-frame {
  box-shadow: 0 0 0 2.5px #7dff9a, 0 0 14px rgba(125, 255, 154, 0.75) !important;
}

.sk-node.levelup {
  animation: sk-levelup-burst 0.7s ease-out;
}
.sk-node.levelup::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid #ffd84a;
  animation: sk-levelup-shockwave 0.7s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  pointer-events: none;
  z-index: 10;
}
@keyframes sk-levelup-burst {
  0% { filter: brightness(1.8) drop-shadow(0 0 16px #ffd84a); }
  100% { filter: none; }
}
@keyframes sk-levelup-shockwave {
  0% { transform: scale(0.9); opacity: 1; border-color: #ffd84a; }
  100% { transform: scale(1.65); opacity: 0; border-color: rgba(255, 216, 74, 0); }
}

.sk-node-rank {
  position: relative;
  z-index: 3;
  font-size: 11px;
  font-weight: 700;
  color: #ffd84a;
  text-align: center;
  margin-top: 3px;
  background: rgba(8, 12, 24, 0.88);
  border-radius: 4px;
  padding: 1px 6px;
}
.sk-gear {
  color: #7dff9a;
}
.sk-node-name {
  position: relative;
  z-index: 3;
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
  word-break: break-word;
  margin-top: 2px;
  background: rgba(8, 12, 24, 0.88);
  border-radius: 4px;
  padding: 2px 6px;
}

@keyframes sk-syn-flow {
  to { stroke-dashoffset: -20; }
}
.sk-syn-dash {
  animation: sk-syn-flow 1.2s linear infinite;
}

.now { color: #9fd0ff; font-size: 12px; }
.nx { color: var(--dim); font-size: 11.5px; }

/* Detail Card */
.sk-detail-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: rgba(10, 16, 30, 0.85);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.sk-detail-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sk-detail-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1.5px solid var(--cls-col, var(--accent));
  background: rgba(0, 0, 0, 0.5);
  padding: 2px;
  flex-shrink: 0;
}
.sk-detail-header {
  flex: 1;
  min-width: 0;
}
.sk-detail-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sk-detail-name {
  font-size: 15px;
  color: #fff;
}
.sk-detail-rank {
  font-size: 12px;
  color: #ffd84a;
  font-weight: 600;
  margin-top: 2px;
}
.sk-detail-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #cfd9ea;
}
.sk-detail-meta {
  font-size: 12px;
  color: var(--accent);
}
.sk-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.sk-learn-btn {
  font-weight: 700;
  padding: 8px 18px;
  font-size: 13px;
  letter-spacing: 0.05em;
}

/* ---------------------------------------------------------------- Lattice Tech */
.sk-tabs {
  display: flex;
  gap: 6px;
  background: rgba(14, 20, 36, 0.7);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}
.sk-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.sk-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.sk-tab.active {
  color: #fff;
  background: #1b2640;
  border-color: rgba(127, 216, 255, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.sk-tab-badge {
  background: #ffd84a;
  color: #0b1020;
  font-weight: 800;
  font-size: 11px;
  border-radius: 10px;
  padding: 1px 6px;
  line-height: 14px;
}

.tech-header {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(10, 16, 30, 0.7);
  margin-bottom: 10px;
}
.tech-header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tech-tp-stat {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tech-tp-free {
  font-size: 24px;
  font-weight: 800;
  color: #ffd84a;
  background: rgba(255, 216, 74, 0.12);
  border: 1.5px solid rgba(255, 216, 74, 0.4);
  border-radius: 8px;
  padding: 2px 10px;
  min-width: 32px;
  text-align: center;
}
.tech-tp-free.pulse {
  animation: sk-sp-pulse 2s infinite ease-in-out;
}
.tech-tp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tech-tp-info b {
  font-size: 13.5px;
  color: #fff;
}
.tech-sources {
  font-size: 11.5px;
}
.tech-explainer {
  font-size: 11.5px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.35;
}

.tech-svg-wrap {
  width: 100%;
  max-width: 100%;
  background: #060913;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.8);
}
.tech-svg {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

.tech-branch-label {
  font-size: 0.42px;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-variant: all-small-caps;
  text-transform: uppercase;
  pointer-events: none;
}

.tech-core-spinner {
  transform-origin: 0 0;
  animation: tech-spin 22s linear infinite;
}
@keyframes tech-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.tech-core-text {
  font-size: 0.38px;
  font-weight: 800;
  fill: #ffd84a;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(255, 216, 74, 0.6));
}

.tech-edge-reachable {
  animation: tech-dash-flow 1.2s linear infinite;
}
@keyframes tech-dash-flow {
  to { stroke-dashoffset: -0.30; }
}

.tech-edge.highlighted {
  stroke-width: 0.12 !important;
  opacity: 1 !important;
  stroke: #ffffff !important;
  filter: drop-shadow(0 0 4px #ffffff) !important;
}
.tech-edge-glow.highlighted {
  stroke-width: 0.28 !important;
  opacity: 0.65 !important;
  stroke: #ffffff !important;
}

.tech-node-g {
  cursor: pointer;
}
.tech-node-g:hover .tech-node-shape {
  filter: brightness(1.25);
}
.tech-pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: tech-pulse-anim 1.8s ease-in-out infinite;
}
@keyframes tech-pulse-anim {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.85; }
}

.tech-rank-lbl {
  font-size: 0.17px;
  font-weight: 700;
  fill: #ffd84a;
  user-select: none;
  pointer-events: none;
}
.tech-rank-bg {
  pointer-events: none;
}
.tech-glyph {
  font-weight: 900;
  user-select: none;
  pointer-events: none;
}
.tech-gold-ring {
  filter: drop-shadow(0 0 3px rgba(255, 216, 74, 0.7));
}
.tech-sel-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: tech-sel-rotate 10s linear infinite;
  pointer-events: none;
}
@keyframes tech-sel-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.tech-burst {
  fill: none;
  stroke: #ffd84a;
  stroke-width: 0.08;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: tech-burst-expand 0.75s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
@keyframes tech-burst-expand {
  0% { transform: scale(1); opacity: 1; stroke-width: 0.08; }
  100% { transform: scale(2.4); opacity: 0; stroke-width: 0.01; }
}

/* Detail Card */
.tech-detail-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: rgba(10, 16, 30, 0.85);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.tech-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}
.tech-card-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.tech-card-sub {
  font-size: 12px;
}
.tech-card-flavor {
  font-size: 12px;
  color: #9cb1d4;
  line-height: 1.35;
  border-left: 2px solid rgba(127, 216, 255, 0.3);
  padding-left: 8px;
  margin: 2px 0;
}
.tech-card-rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tech-card-rank {
  font-size: 13px;
  color: #cfd9ea;
}
.tech-card-rank b {
  color: #ffd84a;
}
.tech-card-tradeoff {
  color: #ffaa40;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 170, 64, 0.12);
  border: 1px solid rgba(255, 170, 64, 0.35);
  border-radius: 6px;
  padding: 4px 8px;
}
.tech-card-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}
.tech-card-sec-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tech-stat-line {
  color: #cfd9ea;
  padding-left: 6px;
}
.tech-stat-line.pos {
  color: #7dff9a;
}
.tech-stat-line.neg {
  color: #ff7d7d;
}
.tech-stat-line.total {
  color: #8fd8ff;
}

.tech-research-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  padding: 12px 16px;
  margin-top: 6px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tech-research-btn.can {
  background: linear-gradient(180deg, #ffd84a, #d49520);
  color: #05070d;
  border: 1.5px solid #fff;
  box-shadow: 0 0 14px rgba(255, 216, 74, 0.5);
}
.tech-research-btn.can:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(255, 216, 74, 0.75);
}
.tech-research-btn.disabled, .tech-research-btn:disabled {
  background: rgba(20, 26, 44, 0.8);
  color: #55627a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: not-allowed;
  box-shadow: none;
}
.tech-research-label {
  line-height: 1;
}
.tech-research-reason {
  font-size: 11px;
  font-weight: 600;
  color: #ff9a7a;
  opacity: 0.9;
}
.tech-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

@media (max-width: 420px) {
  .sk-tree-wrap {
    grid-template-columns: 36px 1fr;
    padding: 6px 2px;
  }
  .sk-tier-label {
    font-size: 10px;
  }
  .sk-node {
    width: 50px;
    height: 50px;
  }
  .sk-node.active .sk-frame {
    width: 42px;
    height: 42px;
  }
  .sk-node.active .sk-frame img {
    width: 38px;
    height: 38px;
  }
  .sk-node.passive .sk-frame {
    width: 33px;
    height: 33px;
  }
  .sk-node.passive .sk-frame img {
    width: 29px;
    height: 29px;
  }
  .sk-node-name {
    max-width: 80px;
    font-size: 10px;
  }
  .sk-detail-icon {
    width: 40px;
    height: 40px;
  }
}
.pill { font-size: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 1px 6px; color: var(--dim); }
.binds button { padding: 3px 9px; font-size: 12px; }
.binds button.on { background: #2b4a8f; border-color: var(--accent); }
.list > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid rgba(120,160,255,.1); }
.story-text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; }
.speaker { color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.goal { border-left: 3px solid #ffd84a; padding: 6px 10px; background: rgba(255,216,74,.06); margin: 10px 0; }

/* ---------- item card */
#card {
  position: fixed;
  z-index: 30;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, transparent 45%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 4px),
    var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.85);
}
.ic-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.04em;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
}
.ic-base { color: var(--dim); font-size: 12px; margin-bottom: 6px; }
.ic-head { color: #e6ecf6; font-size: 13px; }
.ic-aff { color: #7fa6ff; font-size: 13px; }
.ic-void { color: #c070ff; }
.ic-neg { color: #ff7a6a; }
.ic-set { color: var(--r4); font-size: 12px; margin-top: 6px; }
.ic-fl { color: var(--r3); font-style: italic; font-size: 12.5px; margin-top: 8px; }
.ic-req { font-size: 12px; margin-top: 6px; color: var(--dim); }
.ic-req.bad { color: #ff5a4a; }
.ic-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cmp { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); opacity: .85; }
.cmp-label { font-size: 10px; letter-spacing: .15em; color: var(--dim); text-transform: uppercase; font-family: var(--font-display); }

/* ---------- story & death */
#story {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.65);
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sbox {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, transparent 45%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.14) 0 2px, transparent 2px 4px),
    var(--glass);
  border: 1px solid rgba(255,216,74,.4);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: 0 0 60px rgba(255,180,60,.15), 0 16px 48px rgba(0, 0, 0, 0.7);
}
.sbox h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #ffd84a;
  font-size: 20px;
}
#stext {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 15px;
  color: #e8e0cc;
}
#sok {
  margin-top: 16px;
  width: 100%;
  padding: 11px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#story.boss .sbox { border-color: rgba(255,80,60,.6); box-shadow: 0 0 60px rgba(255,60,40,.25); }
#story.boss h2 { color: #ff6a50; }
#dead { position: fixed; inset: 0; z-index: 35; display: grid; place-content: center; text-align: center; background: radial-gradient(circle, rgba(80,0,0,.3), rgba(0,0,0,.75)); pointer-events: none; }
#dead h1 { font-family: var(--font-display); color: #ff4a3a; letter-spacing: .25em; font-size: clamp(24px, 7vw, 44px); margin: 0; }
#objective div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sliders */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}
.slider-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--edge);
  border-radius: 3px;
  padding: 0;
  outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent);
}
.slider-row input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px var(--accent);
}
.slider-row span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: var(--dim);
  min-width: 34px;
  text-align: right;
}
@media (max-width: 560px) {
  #target { top: calc(112px + env(safe-area-inset-top)); }
  #objective { font-size: 11px; }
  #toasts { top: calc(118px + env(safe-area-inset-top)); }
}
.quest { border: 1px solid rgba(255,255,255,.08); border-left: 3px solid #ffd84a; border-radius: 6px; padding: 6px 10px; margin: 6px 0; background: rgba(255,216,74,.04); }
.quest .top { display: flex; justify-content: space-between; gap: 8px; }
.quest.done { border-left-color: #3be07a; opacity: .7; }
.quest.locked { border-left-color: #555; opacity: .5; }
.quest.bounty { border-left-color: #7fd8ff; background: rgba(127,216,255,.04); }
.quest .qrw { color: #ffe39a; font-size: 12px; margin-top: 3px; }
.quest .qbrief { font-size: 13px; margin-top: 4px; }
.r6 { color: #c7a36b; } .r8 { color: #ff9a40; }
.b6 { border-color: rgba(199,163,107,.9); box-shadow: 0 0 10px rgba(199,163,107,.4) inset; }
.ic-sock { letter-spacing: 2px; color: #ffcf8a; margin: 2px 0; }
.ic-gl { color: #ffb070; font-size: 13px; }
.glyphs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.glyph { border: 1px solid rgba(255,154,64,.3); border-radius: 6px; padding: 6px 8px; font-size: 12px; background: rgba(255,154,64,.04); }
.glyph.none { opacity: .45; }
.glyph .top { display: flex; justify-content: space-between; }
.glyph button { margin-top: 4px; width: 100%; }
.quest.cipher { border-left-color: #c7a36b; }
#card select { margin-right: 4px; }
#bossbar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: min(460px, 64vw);
  text-align: center;
  pointer-events: none;
  z-index: 3;
}
#bbname {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: #ff9a7a;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9), 0 0 12px rgba(255, 90, 60, 0.5);
  font-size: 14px;
}
#bbsub { font-size: 10.5px; color: var(--dim); text-shadow: 0 0 4px #000; font-family: var(--font-display); letter-spacing: 0.05em; }
#bossbar .bbar {
  position: relative;
  height: 10px;
  border: 1px solid rgba(255,120,90,.6);
  background: rgba(0,0,0,.75);
  border-radius: 5px;
  margin-top: 3px;
  box-shadow: 0 0 12px rgba(255, 80, 50, 0.3);
}
#bossbar .bbar::before, #bossbar .bbar::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 6px;
  height: 14px;
  background: #ffd84a;
  border-radius: 2px;
  box-shadow: 0 0 6px #ffd84a;
  z-index: 4;
}
#bossbar .bbar::before { left: -3px; }
#bossbar .bbar::after { right: -3px; }
#bblag {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: #ff9933;
  transition: width 0.5s ease-out;
  border-radius: 4px;
}
#bbhp {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #8a1f14, #ff5a3a);
  transition: width .1s ease-out;
  border-radius: 4px;
}
#bossbar.enrage #bbhp {
  background: linear-gradient(90deg, #b01010, #ff2a2a);
  animation: throb .6s infinite;
}
.syn { font-size: 12px; color: #9fe0c0; margin-top: 2px; }
@media (max-width: 560px) { #bossbar { width: 46vw; } #bbname { font-size: 11px; } }
.diffs button.on { border-color: var(--accent); color: var(--accent); }

/* ---------- polish pass: tooltips, haven, workshop, cargo */
#panel:not(.hidden) { animation: panel-open 180ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes panel-open { from { transform: translateX(28px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
#card:not(.hidden) { animation: pop .14s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes pop { from { transform: translate(-50%, -48%) scale(.96); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
button.primary { background: linear-gradient(180deg, #2b4a8f, #152448); border-color: rgba(127,216,255,.6); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 0 12px rgba(80,160,255,0.35); }
button:active:not(:disabled) { transform: translateY(1px); }
#menu button.on { border-color: var(--accent); color: var(--accent); background: rgba(30,50,90,.9); box-shadow: 0 0 10px rgba(127,216,255,0.4); }
body.in-town #menu button[data-p="haven"] { border-color: rgba(255,216,74,.65); box-shadow: 0 0 8px rgba(255,216,74,0.4); }
#havenbadge { background: #ffd84a; }

/* tooltips */
#tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: min(760px, 96vw);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, transparent 45%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 4px),
    var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 10px 45px rgba(0, 0, 0, 0.85);
  font-size: 13px;
}
.tipcol { width: 300px; max-width: 46vw; }
.tipcol.cmp { opacity: .85; border-left: 1px dashed var(--line); padding-left: 10px; }
.tipcol hr { border: 0; border-top: 1px dashed var(--line); margin: 8px 0; }
.tip-hint { margin-top: 8px; font-size: 11px; color: var(--dim); font-style: italic; }
.tip-p { margin: 4px 0; font-size: 12.5px; color: #cfd9ea; }
.skill-now { color: #9fd0ff; font-size: 12px; }
.dx { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(127,216,255,.15); font-size: 12.5px; }
.dx-h { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-top: 3px; }
.dx-up { color: #7dff9a; } .dx-dn { color: #ff7a6a; }
.ic-crafted { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #ffd84a; margin-bottom: 6px; }
.bad { color: #ff6a5a; }

/* cargo grid */
.wallet { gap: 14px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 8px; }
.chips button { font-size: 11.5px; padding: 3px 9px; border-radius: 12px; background: rgba(12,18,34,.8); }
.chips button.on { border-color: var(--accent); color: var(--accent); }
.slot, .cell { transition: border-color .12s, background .12s, transform .08s; }
@media (hover: hover) { .slot:not(.emptyslot):hover, .cell:not(.ghost):hover { background: rgba(60,90,160,.22); border-color: rgba(160,200,255,.7); } }
.cell.ghost { cursor: default; opacity: .35; border-style: dashed; min-height: 58px; }
.slot.emptyslot { border-style: dashed; cursor: default; }
.slot .sl { position: absolute; top: 2px; left: 5px; font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.cell.req { background: rgba(120,20,20,.25); }
.cell.req img { filter: saturate(.3) brightness(.8); }
.cell.dear .price { color: #ff8a6a; }
.pips { font-size: 8px; letter-spacing: 1px; color: #ffcf8a; line-height: 1; margin-top: 1px; }
.price { font-size: 10px; color: var(--dim); }

/* haven */
.crew { display: grid; gap: 8px; }
.npc { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: rgba(0,0,0,.25); }
.npc canvas { width: 48px; height: 48px; }
.npc.has { border-color: rgba(255,216,74,.55); background: rgba(255,216,74,.05); }
.npc .top { display: flex; align-items: center; gap: 6px; }
.npc .role { color: var(--accent); font-size: 11.5px; letter-spacing: .04em; margin-bottom: 2px; }
.npc .muted { font-size: 11.5px; }
.mark { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 9px; background: #ffd84a; color: #000; font-size: 12px; font-weight: 900; }
.mark.soft { background: #9fc8ff; }
.hint { color: #ffe39a; font-size: 12px; margin-top: 3px; }
.hint::before { content: "▸ "; color: #ffd84a; }

/* workshop */
details.about { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 8px 0; background: rgba(0,0,0,.2); }
details.about summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
.story-text.small { font-size: 13px; margin-top: 6px; }
.how { margin: 8px 0 2px; padding-left: 18px; font-size: 12.5px; color: #cfd9ea; }
.how li { margin: 3px 0; }
.list.wo > div { align-items: center; }
.woitem { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: 13px; }
.woitem img { width: 30px; height: 30px; flex: none; }
.list.wo select { max-width: 150px; padding: 5px 6px; }
.quest.cipher .have { color: #7dff9a; } .quest.cipher .lack { color: var(--dim); }
.quest.cipher .cst { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.quest.cipher.ready { border-left-color: #7dff9a; background: rgba(125,255,154,.05); }
.qbar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); margin-top: 4px; overflow: hidden; }
.qbar i { display: block; height: 100%; background: linear-gradient(90deg, #b58a2a, #ffd84a); }
.quest.bounty .qbar i { background: linear-gradient(90deg, #2a7ab5, #7fd8ff); }
.tags { font-size: 11px; color: #ffe39a; }
.lock { font-size: 11px; }
@media (max-width: 560px) { .tipcol { width: 260px; } .npc { grid-template-columns: 40px 1fr; } .npc canvas { width: 40px; height: 40px; } .npc button { grid-column: 1 / -1; } }
.stats span:nth-child(even) { text-align: right; }
#wingchip { pointer-events: none; font-size: 11px; color: #9dffb0; text-shadow: 0 0 4px #000; display: flex; flex-direction: column; gap: 2px; width: 150px; }
#wingchip small { color: var(--dim); }
#wingchip .wbar { height: 4px; border-radius: 2px; background: rgba(0,0,0,.55); border: 1px solid rgba(157,255,176,.35); overflow: hidden; }
#wingchip .wbar i { display: block; height: 100%; background: #5fe08a; transition: width .3s; }
#wingchip.down { color: #ff8a7a; }
.quest.wing { border-left-color: #9dffb0; background: rgba(157,255,176,.04); }
.quest.wing.cur { border-color: rgba(157,255,176,.5); }
#deadby { color: #ffb0a0; font-weight: 700; margin: 6px 0 0; text-shadow: 0 0 6px #000; }
#bigmap { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(2,4,10,.7); }
#bigmapc { border: 1px solid var(--line); border-radius: 12px; background: rgba(4,8,18,.85); box-shadow: 0 0 60px #000; cursor: crosshair; max-width: calc(100vw - 24px); }
.codex { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.cx { display: flex; gap: 8px; align-items: flex-start; border: 1px dashed var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; opacity: .6; }
.cx.got { border-style: solid; opacity: 1; background: rgba(0,0,0,.25); }
.cx img { width: 28px; height: 28px; flex: none; }
.cx .ic-fl { font-size: 11.5px; margin-top: 3px; }
.sk img.skic { position: absolute; left: 50%; top: 7px; transform: translateX(-50%); width: 30px; height: 30px; pointer-events: none; }
.sk.nomana img.skic { opacity: .5; }
.skpic { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; }
.sktitle { display: flex; align-items: center; gap: 2px; }
@media (max-width: 560px) { .sk img.skic { width: 24px; height: 24px; top: 5px; } }
#trialbox { pointer-events: none; width: 220px; font-size: 12px; color: #d9b8ff; text-shadow: 0 0 4px #000; background: rgba(20,8,40,.55); border: 1px solid rgba(192,112,255,.4); border-radius: 8px; padding: 5px 8px; }
#trialbox .tt { display: flex; justify-content: space-between; }
#trialbox .tbar2 { height: 5px; border-radius: 3px; background: rgba(0,0,0,.5); overflow: hidden; margin: 3px 0; }
#trialbox .tbar2 i { display: block; height: 100%; background: linear-gradient(90deg, #7a3cff, #d08bff); transition: width .3s; }
#trialbox small { color: var(--dim); }
#trialbox.late .tt span { color: #ff7a6a; font-weight: 700; }
.ladder .rk { display: inline-block; width: 20px; color: var(--dim); }
.ladder > div.me { background: rgba(127,216,255,.07); border-radius: 6px; }
/* cargo: upgrade verdicts, locks, batch select */
.small { font-size: 11px; }
.vd { font-size: 9.5px; letter-spacing: -.1px; line-height: 1.1; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-weight: 700; }
.vd.up { color: #7dff9a; } .vd.later { color: #ffcf6a; } .vd.dn { color: #ff8a6a; font-weight: 400; opacity: .85; } .vd.side { color: var(--dim); font-weight: 400; }
.down::before { content: "▼"; position: absolute; top: 2px; right: 4px; font-size: 9px; color: #ff8a6a; opacity: .85; }
.later::before { content: "▲"; position: absolute; top: 2px; right: 4px; font-size: 9px; color: #ffcf6a; }
.cell.down img { opacity: .7; }
.cell.up { border-color: rgba(125,255,154,.75); }
.lk { position: absolute; bottom: 2px; right: 3px; font-size: 9px; line-height: 1; }
.gridbar { align-items: center; justify-content: space-between; margin: 0 0 8px; }
.gridbar select { font-size: 12px; margin-left: 4px; }
.gridbar button.on { border-color: var(--accent); color: var(--accent); }
.selbar { background: rgba(10,16,32,.96); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 10px; margin: 0 0 8px; font-size: 13px; }
@media (hover: hover) { .selbar { position: sticky; top: -1px; z-index: 2; } }
.selbar .chips { margin: 6px 0 2px; align-items: center; }
.selbar p { margin: 2px 0 6px; }
.selbar .row { flex-wrap: wrap; gap: 6px; }
.cargo.selecting .cell:not(.ghost) { cursor: copy; }
.cell.sel { border-color: var(--accent); background: rgba(60,120,200,.35); box-shadow: 0 0 0 2px var(--accent) inset; }
.cell.sel::after { content: "✓"; position: absolute; top: 1px; left: 4px; width: auto; height: auto; background: none; font-size: 12px; font-weight: 800; color: var(--accent); }
.slotup { position: absolute; top: 2px; right: 4px; font-size: 10px; color: #7dff9a; }

/* ---------- loot rules & junk */
.cell.junk { background: repeating-linear-gradient(-45deg, rgba(255,207,106,.07) 0 5px, transparent 5px 10px), rgba(0,0,0,.35); }
.cell.junk img { opacity: .55; filter: grayscale(.4); }
.cell.junk .nm { opacity: .75; }
.jk { position: absolute; top: 2px; left: 4px; font-size: 10px; line-height: 1; font-weight: 800; color: #ffcf6a; }
.cell.junk.new::after { display: none; }
.cell.sel .jk { display: none; }
.ic-junk { color: #ffcf6a; }
.rulestrip { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 10px 0 4px; background: rgba(0,0,0,.22); font-size: 13px; }
.rulestrip.on { border-color: rgba(127,216,255,.45); }
.rs-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rs-top small { display: block; color: var(--dim); font-size: 11.5px; margin-top: 1px; }
.rs-top button { flex: none; }
.rs-lines { margin-top: 6px; padding-top: 4px; border-top: 1px solid rgba(120,160,255,.1); }
.rs-lines .row { justify-content: space-between; margin: 4px 0; }
.lead { margin: 2px 0 10px; font-size: 13.5px; line-height: 1.4; }
.presets button { font-size: 12px; padding: 4px 11px; }
.rtable { margin: 8px 0 4px; }
.rrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(120,160,255,.1); }
.rname { font-weight: 700; font-size: 14px; }
.rname small { display: block; font-weight: 400; color: var(--dim); font-size: 11px; }
.seg { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 6px 11px; font-size: 12.5px; background: rgba(12,18,34,.8); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { font-weight: 700; }
.seg button.on.a0 { background: rgba(60,110,200,.45); color: #cfe4ff; }
.seg button.on.a1 { background: rgba(255,207,106,.2); color: #ffcf6a; }
.seg button.on.a2 { background: rgba(192,112,255,.22); color: #e2bcff; }
.opt button.on { border-color: var(--accent); color: var(--accent); }
@media (max-width: 380px) { .seg button { padding: 6px 8px; font-size: 12px; } }

/* ---------- feats */
.feat-section { align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 2px; }
.feat-progress-bar { flex: 1; min-width: 80px; height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.feat-progress-fill { height: 100%; background: linear-gradient(90deg, #b58a2a, #ffd84a); border-radius: 3px; transition: width 0.3s; }
.feat-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; margin-top: 8px; }
@media (max-width: 560px) { .feat-grid { grid-template-columns: 1fr; } }
.feat-card { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 12px; background: rgba(0,0,0,.22); position: relative; }
.feat-earned { border-color: rgba(255,216,74,.5); background: rgba(255,216,74,.06); box-shadow: 0 0 10px rgba(255,216,74,.08) inset; }
.feat-locked { opacity: .65; }
.feat-hex { flex: none; width: 32px; height: 32px; display: grid; place-items: center; font-size: 14px; border-radius: 6px; clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); background: rgba(255,216,74,.15); border: 1px solid rgba(255,216,74,.5); color: #ffd84a; text-shadow: 0 0 6px rgba(255,216,74,.7); }
.feat-hex-lock { background: rgba(100,100,130,.15); border-color: rgba(150,150,180,.3); color: var(--dim); text-shadow: none; }
.feat-info { flex: 1; min-width: 0; }
.feat-name { font-weight: 700; color: #e8ecf8; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feat-name-dim { color: var(--dim); }
.feat-desc { font-size: 11px; color: var(--dim); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feat-prog { height: 3px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.feat-prog-bar { height: 100%; background: linear-gradient(90deg, #2a5ab5, #7fd8ff); }
.feat-prog-text { font-size: 10px; color: var(--dim); margin-top: 2px; }
.feat-tp-badge { flex: none; font-family: var(--font-display); font-size: 11px; font-weight: 700; color: #ffd84a; white-space: nowrap; }
.feat-tp-dim { color: var(--dim); }
.feat-header-line { margin: 0 0 8px; font-size: 13px; }

/* ---------- Lattice Anomalies */
.anom-badge { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .03em; color: #ecd6ff; border: 1px solid rgba(192,112,255,.55); vertical-align: 1px; white-space: nowrap;
  background: linear-gradient(110deg, rgba(120,50,190,.35) 0%, rgba(200,130,255,.55) 45%, rgba(120,50,190,.35) 60%) 0 0 / 250% 100%;
  animation: anomsheen 3.2s linear infinite; box-shadow: 0 0 8px rgba(192,112,255,.25); }
@keyframes anomsheen { to { background-position: -250% 0; } }
.anom-eff { color: #cfa6f5; font-size: 11px; }
.anom-note { color: #cfa6f5; }
.anom-obj { color: #d9b3ff; }
.anom-card { border: 1px solid rgba(192,112,255,.35); border-radius: 10px; padding: 8px 10px; margin: 0 0 10px;
  background: linear-gradient(135deg, rgba(90,30,150,.22), rgba(10,15,28,.6)); }
.anom-card-h { font-family: var(--font-display); font-weight: 700; color: #e2bcff; margin-bottom: 4px; }
.anom-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; padding: 3px 0; }
@media (prefers-reduced-motion: reduce) { .anom-badge { animation: none; } }
