* { box-sizing: border-box; }

:root {
  --bg: #020817;
  --panel: rgba(11, 23, 41, 0.78);
  --panel-strong: rgba(15, 23, 42, 0.92);
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(125, 211, 252, 0.16);
  --text: #e5eefb;
  --muted: #94a3b8;
  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.12);
  --sky: #7dd3fc;
  --sky-soft: rgba(125, 211, 252, 0.08);
  --danger: #f87171;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(14, 165, 233, 0.08), transparent 26%),
    linear-gradient(180deg, #020617 0%, #020817 48%, #06111f 100%);
  color: var(--text);
  font-size: 0.95rem;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.filter-shell {
  display: block;
}

.filter-label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #cbd5e1;
}

.filter-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(15,23,42,.92), rgba(8,15,30,.98));
  color: var(--text);
  color-scheme: dark;
  padding: 0.9rem 1rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.filter-select:focus,
.filter-select:hover {
  border-color: rgba(125, 211, 252, 0.4);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.08);
}

.filter-select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.filter-select option,
.operator-select option {
  background-color: #0b1729;
  color: var(--text);
}

.filter-select,
.operator-select {
  color-scheme: dark;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.legend-swatch {
  width: 1rem;
  height: 0.75rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 0 10px rgba(255,255,255,0.12);
  flex: 0 0 auto;
}

.action-btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, filter 0.16s ease, background-color 0.16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.action-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.action-btn-gold,
#highEndToggle.btn-outline-warning {
  color: var(--gold);
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.07);
}

#highEndToggle.btn-warning {
  color: #111827 !important;
  border-color: rgba(251, 191, 36, 0.88);
  background: linear-gradient(180deg, rgba(253,224,71,1), rgba(251,191,36,1));
  box-shadow: 0 10px 20px rgba(251, 191, 36, 0.14);
}

.action-btn-danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.07);
}

.loot-load-wrap {
  margin-bottom: 0;
}

.loot-progress {
  position: relative;
  overflow: hidden;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.04);
}

.loot-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #fbbf24);
  border-radius: 999px;
  transition: width 120ms linear;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.28);
}

.loot-progress.indeterminate .loot-bar {
  width: 35%;
  animation: lootIndeterminate 1.1s ease-in-out infinite;
}

@keyframes lootIndeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.table-shell {
  min-height: 16rem;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  color: var(--text);
}

.table th,
.table td,
.form-control,
.form-select {
  font-size: 0.88rem !important;
  vertical-align: middle;
}

.table > :not(caption) > * > * {
  padding: 0.72rem 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(9, 15, 27, 0.96);
  border-bottom: 1px solid rgba(125, 211, 252, 0.12);
  backdrop-filter: blur(8px);
}

.table tbody tr {
  background: rgba(15, 23, 42, 0.42);
  transition: background-color 0.14s ease;
}

.table-hover tbody tr:hover {
  background: rgba(30, 41, 59, 0.82);
}

.table-bordered > :not(caption) > * {
  border-width: 0;
}

.table thead input::placeholder {
  color: #8ea3be;
  font-weight: 700;
  text-transform: capitalize;
  font-size: 0.78rem;
}


.table thead input::placeholder {
  color: #8ea3be;
  font-weight: 700;
  text-transform: capitalize;
  font-size: 0.78rem;
}

.table thead input {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.8rem;
  background: rgba(15, 23, 42, 0.96);
  color: #eff6ff;
  text-align: center;
  min-width: 0;
  width: 100%;
  padding: 0.5rem 0.55rem;
}

.table thead input:focus {
  background: rgba(15, 23, 42, 1);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08);
  outline: none;
}

.table th,
.table td {
  white-space: nowrap;
}

.col-item {
  min-width: 0;
  text-align: left;
}

.col-monster {
  min-width: 0;
}

.col-zone {
  min-width: 0;
}

.col-ilvl,
.col-util,
.col-dps,
.col-quality,
.col-x,
.col-y,
.col-type,
.col-val {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
}

.col-proc {
  min-width: 0;
}

.filter-inline {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.filter-inline.has-operator .filter-input {
  padding-left: 1.9rem;
}

.filter-input {
  text-align: center;
}

.filter-input.text-filter {
  text-align: center;
}

.operator-chip {
  position: absolute;
  left: 0.38rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.2rem;
  height: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: #dbeafe;
  font-weight: 800;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.operator-chip:hover,
.operator-chip:focus {
  background: rgba(125, 211, 252, 0.18);
  color: #fff;
  outline: none;
}

.operator-chip:active {
  transform: translateY(-50%) scale(0.96);
}

#hoverMap {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate3d(0, 0, 0);
  z-index: 9999;
  pointer-events: none;
  background: rgba(2, 6, 23, 0.97);
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 18px;
  overflow: hidden;
  color: #fff;
  font-size: 0.85rem;
  display: none;
  padding: 8px;
  max-width: min(500px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  box-shadow: 0 18px 60px rgba(2,8,23,0.68);
  backdrop-filter: blur(10px);
}

#hoverMap.visible { display: block; }

.hover-wrapper {
  display: grid;
  grid-template-columns: 168px minmax(210px, 1fr);
  gap: 10px;
  align-items: flex-start;
  width: min(480px, calc(100vw - 24px));
}

.hover-card {
  background: linear-gradient(180deg, rgba(15,23,42,.96), rgba(2,6,23,.96));
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 16px;
  padding: 8px;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.42);
}

.map-card {
  width: 168px;
  min-width: 168px;
  height: 168px;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
}

.map-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#hoverZone {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(2, 6, 23, 0.72);
  text-align: center;
  font-weight: 700;
  padding: 0.45rem 0.3rem;
  z-index: 3;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #dbeafe;
}

.dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f97316;
  z-index: 4;
  box-shadow: 0 0 0 3px rgba(249,115,22,0.18), 0 0 10px rgba(249,115,22,0.75);
}

.stats-card {
  min-width: 0;
  max-width: 292px;
  width: 100%;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

.item-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 1rem;
  word-break: break-word;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.025);
  align-items: center;
  word-break: break-word;
  font-size: 0.84rem;
}

.table tbody tr.row-otd td {
  background-color: #5a3a00 !important;
  color: #f5e6c8 !important;
}

.table tbody tr.row-merchant td {
  background-color: #3b1e4a !important;
  color: #ffffff !important;
}

.text-secondary {
  color: var(--muted) !important;
}

.text-center {
  text-align: center;
}

.d-flex {
  display: flex;
}

.align-items-center {
  align-items: center;
}

.justify-content-center {
  justify-content: center;
}

.gap-1 {
  gap: 0.25rem;
}

@media (max-width: 900px) {
  .table > :not(caption) > * > * {
    padding: 0.62rem 0.55rem;
  }
}

@media (max-width: 720px) {
  .hover-wrapper {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .map-card,
  .stats-card {
    width: 100%;
    min-width: 0;
  }

  .map-card {
    height: 200px;
  }

  #hoverMap {
    max-width: calc(100vw - 16px);
    padding: 8px;
  }
}
