:root {
  --bg-color: #0a0a0c;
  --panel-bg: #1e2328;
  --border-color: #c8aa6e;
  --text-main: #f0e6d2;
  --text-muted: #a09b8c;
  --highlight: #005a82;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  margin: 0;
  padding: 20px;
}
body.has-build {
  padding-bottom: 130px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 20px;
}
h1 {
  margin: 0;
  color: var(--border-color);
  font-weight: normal;
}
.version-text {
  color: var(--text-muted);
  font-size: 0.9em;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  background-color: var(--panel-bg);
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  border: 1px solid #333;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.control-group label {
  font-size: 0.9em;
  color: var(--border-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-buttons button {
  background: #111;
  border: 1px solid #444;
  color: var(--text-muted);
  padding: 8px 16px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-buttons button.active {
  background: var(--highlight);
  color: white;
  border-color: var(--highlight);
}
.toggle-buttons button:hover:not(.active) {
  background: #222;
}

.search-sort {
  flex-grow: 1;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
}
input {
  padding: 10px;
  background: #111;
  border: 1px solid #444;
  color: white;
  border-radius: 4px;
  outline: none;
}
input:focus {
  border-color: var(--border-color);
}

/* Clear button */
.clear-btn {
  background: transparent;
  border: 1px solid #555;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8em;
  transition: 0.2s;
}
.clear-btn:hover {
  border-color: #c8aa6e;
  color: #c8aa6e;
}

/* Tag filter */
.tag-group {
  flex-basis: 100%;
}
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-btn {
  background: #111;
  border: 1px solid #444;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.8em;
  transition: 0.2s;
}
.tag-btn:hover:not(.active) {
  background: #222;
  border-color: #666;
}
.tag-btn.active {
  background: #1a3a20;
  border-color: #4caf50;
  color: #4caf50;
}

/* Sort icons */
.sort-group {
  flex-basis: 100%;
}
.sort-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sort-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  background: #111;
  border: 1px solid #444;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: 0.2s;
  min-width: 50px;
}
.sort-btn:hover:not(.active) {
  background: #222;
  border-color: #666;
}
.sort-btn.active {
  background: var(--highlight);
  border-color: var(--highlight);
  color: white;
}
.sort-btn-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.sort-btn-gold {
  font-size: 18px;
  line-height: 24px;
  color: #ffd700;
}
.sort-btn-label {
  font-size: 0.6em;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

/* Grid & Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.item-card {
  background-color: var(--panel-bg);
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.item-card:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  padding: 15px;
  gap: 15px;
  align-items: center;
  min-height: 94px;
  position: relative;
}
.card-header img {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  border: 1px solid #000;
  flex-shrink: 0;
}
.header-info {
  flex: 1;
  min-width: 0;
}
.header-info h3 {
  margin: 0 0 5px 0;
  font-size: 1.1em;
  color: var(--border-color);
}
.gold-text {
  color: #ffd700;
  font-size: 0.9em;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Gold efficiency badge */
.efficiency {
  font-size: 0.75em;
  font-weight: normal;
  padding: 1px 5px;
  border-radius: 3px;
}
.eff-high { background: #1a3a1a; color: #4caf50; border: 1px solid #4caf50; }
.eff-mid  { background: #3a3010; color: #ffc107; border: 1px solid #ffc107; }
.eff-low  { background: #3a1010; color: #f44336; border: 1px solid #f44336; }
.eff-info-icon {
  cursor: pointer;
  opacity: 0.7;
  font-style: normal;
  font-size: 0.9em;
}
.eff-info-icon:hover { opacity: 1; }

#eff-tooltip {
  display: none;
  position: fixed;
  z-index: 500;
  width: 300px;
  background: #1e2328;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.8em;
  line-height: 1.6;
  color: var(--text-main);
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  pointer-events: auto;
}
.eff-tip-title {
  color: var(--border-color);
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 1.05em;
}
.eff-tip-formula {
  color: #fff;
  font-style: italic;
  margin-bottom: 4px;
}
.eff-tip-note {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 8px;
}
.eff-tip-stats {
  color: var(--text-muted);
  border-top: 1px dotted #444;
  padding-top: 8px;
  margin-bottom: 8px;
}
.eff-tip-omnivamp {
  color: #ffc107;
  font-size: 0.85em;
  margin-bottom: 8px;
}
.eff-tip-link {
  display: block;
  color: #4fc3f7;
  text-decoration: none;
  border-top: 1px dotted #444;
  padding-top: 6px;
}
.eff-tip-link:hover { text-decoration: underline; }

/* Add to build button */
.add-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #555;
  background: #111;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: 0.2s;
  margin-left: auto;
}
.add-btn:hover:not(.in-build):not(.disabled) {
  border-color: var(--border-color);
  color: var(--border-color);
}
.add-btn.in-build {
  border-color: #4caf50;
  color: #4caf50;
  background: #1a3a1a;
}
.add-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Card details */
.card-details {
  background-color: var(--panel-bg);
  font-size: 0.9em;
  color: var(--text-muted);
  padding: 15px;
  border-top: 1px solid #333;
}
.stats-section { width: 100%; }
.stat-empty { height: 21px; }

.stats-extra {
  display: none;
  border-top: 1px dotted #333;
  margin-top: 6px;
  padding-top: 6px;
}
.item-card.expanded .stats-extra { display: block; }

.desc-text {
  display: none;
  margin-top: 10px;
  font-style: italic;
  color: #888;
  border-top: 1px dotted #444;
  padding-top: 10px;
  font-size: 0.85em;
  line-height: 1.5;
}
.item-card.expanded .desc-text { display: block; }

.stat-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.stat-value { color: #fff; }
.stat-highlight { color: #c8aa6e; font-weight: bold; }
.stat-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  margin-right: 4px;
  vertical-align: middle;
  opacity: 0.85;
}
.stat-name {
  display: flex;
  align-items: center;
}

/* Build simulator panel */
.build-panel {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #12161a;
  border-top: 2px solid var(--border-color);
  z-index: 100;
  padding: 10px 20px;
}
.build-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.build-title {
  color: var(--border-color);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}
.build-slots {
  display: flex;
  gap: 6px;
}
.build-slot {
  width: 40px;
  height: 40px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #111;
  overflow: hidden;
  cursor: pointer;
}
.build-slot.filled {
  border-color: #666;
}
.build-slot.filled:hover {
  border-color: #e74c3c;
  opacity: 0.7;
}
.build-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.build-total-gold {
  color: #ffd700;
  font-weight: bold;
  font-size: 0.9em;
  margin-left: auto;
}
.build-stats-panel {
  display: none;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #333;
}
.build-stat-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  color: var(--text-muted);
}
.build-stat-row .stat-value {
  margin-left: 4px;
}
