:root {
  --bg: #050507;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f5;
  --muted: #9ca3af;
  --dim: #6b7280;
  --brand: #6366f1;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #050507;
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1000px 700px at 10% 0%,   rgba(99, 102, 241, 0.20), transparent 55%),
    radial-gradient(900px 600px at 95% 20%,  rgba(168, 85, 247, 0.16), transparent 60%),
    radial-gradient(900px 700px at 15% 100%, rgba(129, 140, 248, 0.14), transparent 60%),
    radial-gradient(700px 500px at 85% 90%,  rgba(192, 132, 252, 0.12), transparent 60%);
}

body.is-loading { overflow: hidden; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }

#preloader {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: #050507;
  opacity: 1; visibility: visible;
  transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#preloader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

#preloader .loader-wrapper {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 180px; height: 180px;
  font-family: 'Inter', sans-serif;
  font-size: 1.2em; font-weight: 300;
  color: white;
  border-radius: 50%;
  user-select: none;
}
#preloader .loader {
  position: absolute; top: 0; left: 0;
  width: 100%; aspect-ratio: 1 / 1;
  border-radius: 50%;
  animation: loader-rotate 2s linear infinite;
  z-index: 0;
}
@keyframes loader-rotate {
  0%   { transform: rotate(90deg);  box-shadow: 0 10px 20px 0 #fff inset, 0 20px 30px 0 #ad5fff inset, 0 60px 60px 0 #471eec inset; }
  50%  { transform: rotate(270deg); box-shadow: 0 10px 20px 0 #fff inset, 0 20px 10px 0 #d60a47 inset, 0 40px 60px 0 #311e80 inset; }
  100% { transform: rotate(450deg); box-shadow: 0 10px 20px 0 #fff inset, 0 20px 30px 0 #ad5fff inset, 0 60px 60px 0 #471eec inset; }
}
#preloader .loader-letter {
  display: inline-block; opacity: 0.4; transform: translateY(0);
  animation: loader-letter-anim 2s infinite;
  z-index: 1; border-radius: 50ch; border: none;
}
#preloader .loader-letter:nth-child(1) { animation-delay: 0s; }
#preloader .loader-letter:nth-child(2) { animation-delay: 0.1s; }
#preloader .loader-letter:nth-child(3) { animation-delay: 0.2s; }
#preloader .loader-letter:nth-child(4) { animation-delay: 0.3s; }
#preloader .loader-letter:nth-child(5) { animation-delay: 0.4s; }
#preloader .loader-letter:nth-child(6) { animation-delay: 0.5s; }
#preloader .loader-letter:nth-child(7) { animation-delay: 0.6s; }
#preloader .loader-letter:nth-child(8) { animation-delay: 0.7s; }
#preloader .loader-letter:nth-child(9) { animation-delay: 0.8s; }
@keyframes loader-letter-anim {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  20%      { opacity: 1;   transform: scale(1.15); }
  40%      { opacity: 0.7; transform: translateY(0); }
}

.topbar {
  position: relative; z-index: 20;
  width: 100%; max-width: 1280px;
  margin: 0 auto;
  padding: 18px 40px;
  display: flex; align-items: center; gap: 12px;
  background: rgba(5, 5, 7, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.logo-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.4);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer;
  transition: all 0.16s;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); border-color: var(--border-strong); }
.icon-btn:disabled { opacity: 0.4; cursor: wait; }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.conn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  border-radius: 999px; white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.conn-pill.live { color: #6ee7b7; background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.25); }
.conn-pill.down { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.25); }
.conn-pill .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 8px currentColor;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.stage {
  position: relative; z-index: 10; flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.stage::-webkit-scrollbar { width: 11px; height: 11px; }
.stage::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.11);
  border-radius: 8px; border: 3px solid transparent; background-clip: content-box;
}
.stage::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: content-box; }

.content-wrap {
  max-width: 1280px; margin: 0 auto;
  padding: 20px 40px 40px;
  display: flex; flex-direction: column; gap: 16px;
}

.search-card {
  position: relative;
  padding: 20px;
  background: rgba(11, 11, 15, 0.85);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.search-row { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 16px; color: var(--dim); pointer-events: none; }
#search {
  width: 100%; height: 50px; padding: 0 46px;
  font-family: inherit; font-size: 15px; color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  border-radius: 12px; outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
#search::placeholder { color: var(--dim); }
#search:focus {
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  background: rgba(255, 255, 255, 0.05);
}
.clear-btn {
  position: absolute; right: 12px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  font-size: 20px; line-height: 1;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
  transition: all 0.15s;
}
.clear-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; font-family: inherit; font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer;
  transition: all 0.15s;
}
.chip span {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px; border-radius: 999px;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.07); }
.chip.active {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-color: transparent; font-weight: 600;
}
.chip.active span { color: #fff; background: rgba(0, 0, 0, 0.25); }

.filters {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 1fr 0.8fr 0.8fr auto;
  gap: 12px; margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--dim);
}
.field input, .field select {
  height: 38px; padding: 0 12px;
  font-family: inherit; font-size: 13px; color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  border-radius: 10px; outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
  width: 100%;
}
.field input::placeholder { color: var(--dim); }
.field input:focus, .field select:focus {
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px; cursor: pointer;
}
.field select option { background: #0b0b0f; color: var(--text); }

.segmented {
  display: flex; padding: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  border-radius: 10px; height: 38px;
}
.segmented button {
  flex: 1; padding: 0 8px;
  font-family: inherit; font-size: 12px; font-weight: 500;
  color: var(--muted); background: transparent;
  border: 0; border-radius: 7px; cursor: pointer;
  white-space: nowrap; transition: all 0.16s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 4px 14px -6px rgba(99, 102, 241, 0.8);
}
.ghost {
  height: 38px; padding: 0 16px;
  font-family: inherit; font-size: 13px; color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  border-radius: 10px; cursor: pointer;
  transition: all 0.16s;
}
.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }

.meta-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 18px; padding: 4px 4px 0;
  font-size: 12.5px; color: var(--muted);
}
.meta-item strong { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }
.meta-item.muted { color: var(--dim); font-size: 12px; }
.meta-item.muted span { font-family: var(--mono); color: var(--muted); }
.spacer { flex: 1; }

.banner {
  padding: 12px 16px; font-size: 13px; border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
  color: #fcd34d;
}

.table-card {
  background: rgba(11, 11, 15, 0.85);
  border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.table-scroll { overflow: auto; }
.table-scroll::-webkit-scrollbar { width: 11px; height: 11px; }
.table-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.11);
  border-radius: 8px; border: 3px solid transparent; background-clip: content-box;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 12px 16px; text-align: left;
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--dim);
  background: #0b0b0f;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
tbody tr:last-child td { border-bottom: 0; }

.c-item { width: 34%; }
.c-world { width: 14%; }
.c-price { width: 11%; }
.c-pos { width: 10%; }
.c-path { width: 7%; }
.c-acc { width: 10%; }
.c-time { width: 14%; }

.item-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.item-name { font-weight: 500; letter-spacing: 0.1px; }
.item-id {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
  padding: 1px 6px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
}
mark { background: rgba(99, 102, 241, 0.3); color: #c7d2fe; border-radius: 3px; padding: 0 1px; }

.world-btn {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: #c7d2fe; padding: 4px 10px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(129, 140, 248, 0.3);
  border-radius: 8px; cursor: pointer;
  transition: all 0.15s;
}
.world-btn:hover { color: #e0e7ff; background: rgba(99, 102, 241, 0.2); border-color: rgba(129, 140, 248, 0.55); }
.world-btn.copied { color: #05231e; background: var(--success); border-color: var(--success); }

.price {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-family: var(--mono); font-size: 13.5px; font-weight: 650;
  letter-spacing: 0.2px; cursor: help;
}
.price em {
  font-style: normal; font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase;
  padding: 1px 5px; border-radius: 5px;
}
.price.each { color: var(--success); }
.price.each em { color: #065f46; background: rgba(52, 211, 153, 0.22); }
.price.per { color: #c084fc; }
.price.per em { color: #3730a3; background: rgba(192, 132, 252, 0.25); }

.badge {
  display: inline-block; padding: 3px 9px;
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.4px;
  border-radius: 999px; text-transform: uppercase;
}
.badge.ok { color: #6ee7b7; background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); }
.badge.no { color: #fca5a5; background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.28); }

.c-time.mono { color: var(--dim); font-size: 11.5px; }
.c-path.mono { color: var(--muted); }
.c-pos.mono { color: var(--muted); }

.empty { padding: 60px 24px; text-align: center; color: var(--dim); }
.empty-icon { font-size: 30px; color: #334155; margin-bottom: 8px; }
.empty p { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.empty span { font-size: 12.5px; }

.limit-note {
  padding: 12px 16px; font-size: 12px; color: var(--dim);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.footer {
  position: relative; z-index: 10;
  width: 100%; max-width: 1280px; margin: 0 auto;
  padding: 14px 40px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--dim);
  border-top: 1px solid var(--border);
  background: rgba(5, 5, 7, 0.55);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.footer kbd {
  font-family: var(--mono); font-size: 10.5px;
  padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translate(-50%, 14px);
  padding: 10px 18px; font-size: 12.5px; font-weight: 500;
  color: #05231e;
  background: linear-gradient(135deg, var(--success), #6ee7b7);
  border-radius: 10px;
  box-shadow: 0 16px 40px -14px rgba(52, 211, 153, 0.7);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1024px) {
  .topbar { padding: 16px 28px; }
  .footer { padding: 14px 28px; }
  .content-wrap { padding: 16px 28px 32px; }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .field.action { grid-column: span 3; }
  .ghost { width: 100%; }
}
@media (max-width: 820px) {
  .topbar { padding: 14px 20px; }
  .content-wrap { padding: 12px 16px 24px; }
  .footer { padding: 12px 20px; }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .field.action { grid-column: span 2; }
  .c-pos, .c-path, .c-time { display: none; }
}
@media (max-width: 560px) {
  .brand span { display: none; }
  .filters { grid-template-columns: 1fr; }
  .field.action { grid-column: span 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}