:root {
  --bg: #06090f;
  --panel: #0b1020;
  --panel2: #0f1628;
  --border: #1e2a44;
  --border-gold: #3a2c10;
  --gold: #c9912a;
  --gold-light: #e8b84b;
  --gold-dim: #7a5518;
  --epic: #cc2233;
  --epic-dim: #5a0f17;
  --epic-glow: rgba(204, 34, 51, 0.15);
  --good: #c88820;
  --good-dim: #5a3c08;
  --good-glow: rgba(200, 136, 32, 0.12);
  --normal: #8899bb;
  --normal-dim: #1e2a44;
  --text: #c8cedf;
  --text-dim: #5a6380;
  --text-bright: #e8ecf8;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Crimson Text", serif;
  font-size: 16px;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 60% 40% at 10% 10%, rgba(201, 145, 42, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 90%, rgba(80, 40, 130, 0.05) 0%, transparent 60%);
}
header {
  text-align: center;
  padding: 36px 20px 24px;
  border-bottom: 1px solid var(--border-gold);
  background: linear-gradient(180deg, rgba(201, 145, 42, 0.06) 0%, transparent 100%);
  position: relative;
}
header::before,
header::after {
  content: "⚜";
  color: var(--gold-dim);
  font-size: 1.4rem;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
header::before {
  left: 40px;
}
header::after {
  right: 40px;
}
header h1 {
  font-family: "Cinzel", serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.12em;
  text-shadow: 0 0 30px rgba(232, 184, 75, 0.3);
}
header p {
  color: var(--text-dim);
  font-style: italic;
  margin-top: 4px;
  font-size: 0.95rem;
}
main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 32px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  position: relative;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-width: 480px;
  width: calc(100% - 40px);
  padding: 20px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.35);
}
.modal-content h2 {
  margin-bottom: 12px;
  color: var(--gold-light);
  font-family: "Cinzel", serif;
  font-size: 1rem;
}
.modal-content p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.panel-title {
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-title .step {
  background: var(--gold-dim);
  color: var(--gold-light);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.import-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.import-textarea {
  flex: 1;
  min-width: 260px;
  height: 100px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  padding: 10px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.import-textarea:focus {
  border-color: var(--gold-dim);
}
.import-textarea::placeholder {
  color: var(--text-dim);
}
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
  width: 100%;
}
.config-grid label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  flex-grow: 1;
}
.config-grid input,
.config-grid select {
  background: #05101f;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  padding: 4px 8px;
  width: 80px;
  font-size: 0.82rem;
}
.config-grid select {
  width: 90px;
}
.btn {
  font-family: "Cinzel", serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  border: none;
  border-radius: 3px;
  padding: 10px 20px;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-gold {
  background: linear-gradient(135deg, #3a2508, #5a3c10);
  color: var(--gold-light);
  border: 1px solid var(--gold-dim);
}
.btn-gold:hover {
  background: linear-gradient(135deg, #5a3c10, #7a5518);
  border-color: var(--gold);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--text-dim);
  transition: all 0.3s ease;
}
.btn-ghost:hover {
  background: rgba(183, 146, 76, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}
.item-count {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
}
.item-count strong {
  color: var(--gold);
  font-style: normal;
}
#stat-section {
  display: none;
}
.stat-tier-group {
  margin-bottom: 18px;
}
.stat-tier-label {
  font-family: "Cinzel", serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid;
}
.stat-tier-label.epic {
  color: var(--epic);
  border-color: var(--epic-dim);
}
.stat-tier-label.good {
  color: var(--good);
  border-color: var(--good-dim);
}
.stat-tier-label.normal {
  color: var(--normal);
  border-color: var(--normal-dim);
}
.stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.85rem;
}
.stat-chip input {
  display: none;
}
.stat-chip.epic {
  background: var(--epic-dim);
  color: #e08090;
  border-color: rgba(204, 34, 51, 0.3);
}
.stat-chip.good {
  background: var(--good-dim);
  color: #e0b060;
  border-color: rgba(200, 136, 32, 0.3);
}
.stat-chip.normal {
  background: var(--normal-dim);
  color: var(--normal);
  border-color: rgba(136, 153, 187, 0.2);
}
.stat-chip:hover {
  filter: brightness(1.3);
}
.stat-chip.checked.epic {
  background: var(--epic);
  color: #fff;
  border-color: #ff4455;
  box-shadow: 0 0 10px var(--epic-glow);
}
.stat-chip.checked.good {
  background: var(--good);
  color: #fff;
  border-color: #ffaa30;
  box-shadow: 0 0 10px var(--good-glow);
}
.stat-chip.checked.normal {
  background: var(--normal);
  color: var(--bg);
  border-color: #aabbdd;
}
.stat-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.selected-count {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
}
.selected-count strong {
  color: var(--text-bright);
  font-style: normal;
}
.find-wrap {
  text-align: center;
}
.btn-find {
  font-family: "Cinzel", serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
  background: linear-gradient(135deg, #3a2508 0%, #6a4010 50%, #3a2508 100%);
  color: var(--gold-light);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  padding: 14px 52px;
  transition: all 0.25s;
  text-shadow: 0 0 15px rgba(232, 184, 75, 0.5);
  box-shadow:
    0 0 20px rgba(201, 145, 42, 0.1),
    inset 0 1px 0 rgba(232, 184, 75, 0.1);
  display: none;
}
.btn-find:hover {
  background: linear-gradient(135deg, #5a3c10 0%, #8a5818 50%, #5a3c10 100%);
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow:
    0 0 30px rgba(201, 145, 42, 0.2),
    inset 0 1px 0 rgba(232, 184, 75, 0.15);
}
.btn-find:active {
  transform: translateY(0);
}
.btn-find:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: linear-gradient(135deg, #2a1a06 0%, #4a2810 50%, #2a1a06 100%);
  border-color: var(--gold-dim);
  text-shadow: none;
  box-shadow: none;
}
.btn-find:disabled:hover {
  background: linear-gradient(135deg, #2a1a06 0%, #4a2810 50%, #2a1a06 100%);
  border-color: var(--gold-dim);
  transform: none;
  box-shadow: none;
}
.btn-cancel {
  background: rgba(220, 100, 100, 0.2);
  color: #ff9999;
  border: 1.5px solid #cc6666;
  padding: 10px 32px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}
.btn-cancel:hover {
  background: rgba(220, 100, 100, 0.4);
  border-color: #ff6666;
  color: #ffcccc;
}
.btn-cancel:active {
  transform: translateY(1px);
}
#status-bar {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 8px;
  display: none;
}
#results-section {
  display: none;
}
.results-header {
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.results-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-gold), transparent);
}
.result-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.result-card:hover {
  border-color: var(--gold-dim);
}
.result-card.top {
  border-color: var(--gold-dim);
}
.result-rank {
  background: var(--panel);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}
.rank-label {
  color: var(--gold);
}
.coverage-badge {
  padding: 3px 10px;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 600;
}
.coverage-full {
  background: rgba(30, 120, 30, 0.3);
  color: #60cc60;
  border: 1px solid rgba(60, 180, 60, 0.3);
}
.coverage-high {
  background: rgba(200, 136, 32, 0.2);
  color: var(--good);
  border: 1px solid var(--good-dim);
}
.coverage-low {
  background: var(--normal-dim);
  color: var(--normal);
  border: 1px solid rgba(136, 153, 187, 0.2);
}
.result-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}
.result-side {
  padding: 16px 18px;
}
.result-side.right {
  border-left: 1px solid var(--border);
}
.side-label {
  font-family: "Cinzel", serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.result-item {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}
.result-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.result-item .item-info-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result-item img {
  width: 48px;
  height: 62px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
}
.item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}
.item-karma-tag {
  display: inline-block;
  font-family: "Cinzel", serif;
  font-size: 0.68rem;
  color: var(--gold-dim);
  border: 1px solid var(--border-gold);
  border-radius: 2px;
  padding: 1px 6px;
  margin-bottom: 5px;
  letter-spacing: 0.1em;
}
.item-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.stat-tag {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 2px;
  font-family: "Crimson Text", serif;
}
.stat-tag.epic {
  background: var(--epic-dim);
  color: #e08090;
}
.stat-tag.good {
  background: var(--good-dim);
  color: #e0b060;
}
.stat-tag.normal {
  background: var(--normal-dim);
  color: var(--normal);
}
.stat-tag.desired {
  outline: 1px solid currentColor;
  outline-offset: -1px;
}
.balance-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: rgba(201, 145, 42, 0.03);
  min-width: 90px;
}
.scale-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 6px;
}
.karma-value {
  font-family: "Cinzel", serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1;
}
.karma-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-top: 2px;
}
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-style: italic;
}
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dim);
}
@media (max-width: 640px) {
  .result-body {
    grid-template-columns: 1fr;
  }
  .result-side.right {
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .balance-center {
    flex-direction: row;
    gap: 12px;
    border: none;
    border-top: 1px solid var(--border);
  }
}
