  :root {
      --bg-main: #141214;
      --bg-panel: #1f1d20;
      --bg-panel-alt: #252329;
      --accent: #f3b25c;
      --text-primary: #f5f3f0;
      --text-muted: #b4a8a0;
      --border: #3a353c;
      --danger: #d25c5c;
      --success: #63c27d;
      --warning: #f4ce6a;
      --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background: radial-gradient(circle at top, #383033 0, #141214 45%, #0a090b 100%);
      color: var(--text-primary);
      font-family: var(--font-main);
      display: flex;
      align-items: stretch;
      justify-content: center;
      padding: 16px;
    }

    .forge-shell {
      width: 100%;
      max-width: 100%;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

/* Rows that hold 2 result cards (weapons + armor) */
.optimizer-result-row.optimizer-result-row--pair {
  flex-direction: row;
  gap: 8px;
}

.optimizer-result-row.optimizer-result-row--pair .optimizer-result-card {
  flex: 1 1 0;
  min-width: 0; /* avoid overflow */
}

/* On smaller screens, stack again */
@media (max-width: 900px) {
  .optimizer-result-row.optimizer-result-row--pair {
    flex-direction: column;
  }
}


    .forge-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 4px 8px 8px;
      color: var(--text-muted);
      font-size: 14px;
    }

    .forge-title {
      font-size: 20px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--accent);
    }

.forge-layout {
  flex: 1;
  display: grid;
  /* wider left & right, slightly less center */
  grid-template-columns: 320px minmax(0, 1.05fr) 360px;
  gap: 10px;
  min-height: 900px;  /* was 540px, +70px for ad space */
}
    .panel {
      background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-panel-alt) 100%);
      border: 1px solid var(--border);
      box-shadow: 0 0 32px rgba(0,0,0,0.6);
      position: relative;
      display: flex;
      flex-direction: column;
    }

    .panel-header {
      padding: 8px 10px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 14px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      background: linear-gradient(to right, rgba(0,0,0,0.5), transparent);
    }

    .panel-header span {
      font-weight: 600;
    }

    .panel-header .panel-subtitle {
      font-size: 11px;
      text-transform: none;
      letter-spacing: 0;
      color: var(--text-muted);
    }

    .panel-body {
      padding: 10px;
      overflow: auto;
      flex: 1;
    }

    /* LEFT: Forge Chances */
    .weapon-chance-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .weapon-chance-row {
      background: rgba(0,0,0,0.3);
      border: 1px solid rgba(255,255,255,0.04);
      padding: 6px 8px;
      border-radius: 2px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .weapon-chance-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 13px;
    }

    .weapon-chance-name {
      font-weight: 600;
    }

    .weapon-chance-percent {
      font-weight: 600;
      color: var(--accent);
    }

    .weapon-chance-bar {
      position: relative;
      height: 4px;
      background: rgba(255,255,255,0.06);
      overflow: hidden;
    }

    .weapon-chance-fill {
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      background: linear-gradient(to right, var(--accent), #f87c3b);
    }

    /* CENTER: Cauldron + selected ores */
    .center-panel {
      display: flex;
      flex-direction: column;
      height: 100%;
    }

    .preview-area {
      flex: 0 0 55%;
      border-bottom: 1px solid var(--border);
      background: radial-gradient(circle at top, #3b2a21 0, #1c1513 45%, #0a090b 100%);
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
     max-height:400px;
    }

    .preview-ring {
      width: 75%;
      max-width: 360px;
      aspect-ratio: 1 / 1;
      border-radius: 50%;
      border: 8px solid #3f332a;
      box-shadow:
        0 0 20px rgba(0,0,0,0.9),
        0 0 60px rgba(255,140,60,0.3) inset;
      position: relative;
      background: radial-gradient(circle at 50% 30%, #2c221f 0, #150f0d 55%, #050404 100%);
    }

    .preview-inner {
      position: absolute;
      inset: 16%;
      border-radius: 50%;
      background: radial-gradient(circle at 50% 20%, #1e1715 0, #080606 70%);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .preview-text-main {
      text-align: center;
      padding: 4px 10px;
    }

    .preview-text-main .label {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.18em;
      color: var(--text-muted);
    }

    .preview-text-main .weapon {
      margin-top: 4px;
      font-size: 20px;
      font-weight: 700;
    }

    .preview-text-main .chance {
      margin-top: 2px;
      font-size: 14px;
      color: var(--accent);
    }

    .preview-text-main .hint {
      margin-top: 6px;
      font-size: 11px;
      color: var(--text-muted);
    }

    .center-lower {
      flex: 1;
      display: flex;
      flex-direction: column;
      padding: 8px 10px 10px;
      gap: 8px;
    }

    .selected-ores-header {
      display: flex;
      justify-content: space-between;
      font-size: 12px;
      color: var(--text-muted);
    }

    .selected-ores-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      min-height: 36px;
    }

    .selected-ore-pill {
      background: rgba(0,0,0,0.5);
      border-radius: 2px;
      border: 1px solid rgba(255,255,255,0.05);
      padding: 4px 8px;
      font-size: 12px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
    }

    .selected-ore-pill:hover {
      border-color: var(--danger);
      box-shadow: 0 0 0 1px rgba(210,92,92,0.4);
    }

    .selected-ore-name {
      font-weight: 500;
    }

    .selected-ore-count {
      color: var(--accent);
    }

    .selected-ore-remove {
      color: var(--danger);
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }

    .center-stats {
      display: flex;
      justify-content: space-between;
      font-size: 12px;
      padding: 4px 0;
      border-top: 1px solid rgba(255,255,255,0.04);
      border-bottom: 1px solid rgba(255,255,255,0.04);
    }

    .center-stats span strong {
      color: var(--accent);
    }

    .center-buttons {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-top: 6px;
    }

    .forge-btn-main,
    .forge-btn-secondary {
      padding: 8px 26px;
      border-radius: 2px;
      border: 1px solid #000;
      background: linear-gradient(to bottom, #3d312a, #1d1410);
      color: #f0e5dc;
      font-weight: 700;
      font-size: 14px;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      cursor: pointer;
      box-shadow:
        0 3px 0 #000,
        0 0 24px rgba(0,0,0,0.6);
    }

    .forge-btn-main:hover {
      filter: brightness(1.1);
    }

    .forge-btn-secondary {
      letter-spacing: 0.1em;
      font-size: 12px;
      background: linear-gradient(to bottom, #26242a, #17151a);
      color: var(--text-muted);
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .forge-btn-secondary .lock {
      width: 14px;
      height: 14px;
      border-radius: 2px;
      border: 1px solid #555;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
    }

    /* RIGHT: Ore grid */
    .ore-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
      font-size: 11px;
    }

    .ore-card {
      background: rgba(0,0,0,0.45);
      border-radius: 2px;
      border: 1px solid rgba(255,255,255,0.06);
      padding: 4px 5px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-height: 46px;
    }

    .ore-card:hover {
      border-color: var(--accent);
      box-shadow: 0 0 0 1px rgba(243,178,92,0.4);
    }

    .ore-name {
      font-size: 11px;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .ore-mult {
      color: var(--text-muted);
    }

    .ore-count {
      margin-left: auto;
      font-weight: 600;
      font-size: 11px;
      color: var(--accent);
    }

    .ore-bottom-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .mode-tabs {
      display: flex;
      gap: 6px;
      margin-top: 6px;
      padding: 0 10px 8px;
      border-top: 1px solid var(--border);
    }

    .mode-tab {
      flex: 1;
      font-size: 12px;
      text-align: center;
      padding: 4px 0;
      border-radius: 2px;
      border: 1px solid rgba(255,255,255,0.04);
      cursor: pointer;
      text-transform: uppercase;
      letter-spacing: 0.1em;
    }

    .mode-tab.active {
      background: linear-gradient(to bottom, #3d312a, #201612);
      border-color: var(--accent);
      color: var(--accent);
    }

    .mode-tab.inactive {
      color: var(--text-muted);
      background: rgba(0,0,0,0.3);
    }

    .note-line {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    @media (max-width: 900px) {
      .forge-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: auto;
      }
      .panel {
        min-height: 0;
      }
    }
	
	.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.inv-card {
  background: rgba(0,0,0,0.45);
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.inv-card-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-card-lower {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.inv-card-mult {
  color: var(--text-muted);
}

.inv-card-input {
  width: 70px;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.6);
  color: var(--text-primary);
}

.optimizer-results {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.optimizer-result-row {
  background: rgba(0,0,0,0.35);
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 6px 8px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.optimizer-result-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.optimizer-result-title {
  font-weight: 600;
}

.optimizer-result-meta {
  color: var(--accent);
  font-weight: 600;
}

.optimizer-result-line {
  color: var(--text-muted);
  font-size: 11px;
}

.preview-text-main .variants {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.selected-ores-list {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

.selected-ore-pill {
  width: 80px;
  height: 80px;
  background: rgba(0,0,0,0.6);
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(0,0,0,0.6);
}

.selected-ore-pill:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(243,178,92,0.4);
}

.selected-ore-pill.empty {
  cursor: default;
  opacity: 0.45;
  border-color: rgba(255,255,255,0.12);
  box-shadow: none;
}

.selected-ore-name {
  font-weight: 600;
}

.selected-ore-count {
  color: var(--accent);
  margin-top: 2px;
}

.selected-ore-remove {
  color: var(--danger);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.traits-box {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  font-size: 13px;
}

.traits-box h3 {
  margin: 0 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.traits-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.traits-box li {
  margin-bottom: 6px;
}

.traits-box .trait-percent {
  opacity: 0.8;
  font-size: 12px;
}

.traits-box-inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* Each column: half width, shrinks nicely */
.traits-column {
  flex: 1 1 0;
  min-width: 0;
}

/* Re-use your existing heading styles, but scoped to the new columns */
.traits-column h3 {
  margin: 0 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Lists inside the box */
.traits-column ul {
  list-style: none;
  margin: 0;
  padding: 0;
  /* if you ever have really long lists, this keeps them scrollable */
  max-height: 150px;
  overflow-y: auto;
}

.traits-column li {
  margin-bottom: 4px;
  line-height: 1.3;
}

/* Prevent long lines from going off the edge */
.traits-column li {
  word-break: break-word;
}

/* On very small screens, stack them again */
@media (max-width: 900px) {
  .traits-box-inner {
    flex-direction: column;
  }
}

.optimizer-result-line {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.optimizer-result-traits {
  margin-top: 4px;
  font-style: italic;
}

.weapon-chance-row.default-active {
  border-color: #22ff99;
  box-shadow:
    0 0 0 1px #22ff99,
    0 0 12px rgba(34, 255, 153, 0.7);
}

.weapon-chance-row.active {
  border-color: #22ff99;
  box-shadow:
    0 0 0 1px #22ff99,
    0 0 12px rgba(34, 255, 153, 0.7);
}

/* Simple single-column layout for info pages */
.info-layout {
  max-width: 920px;
  margin: 24px auto 40px;
}

.info-panel .panel-body {
  line-height: 1.6;
}

.info-panel h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

.info-panel h3 {
  margin-top: 18px;
  margin-bottom: 6px;
}

.info-panel p {
  margin: 6px 0;
}

.info-panel ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.site-footer {
  margin: 32px auto 16px;
  max-width: 920px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.site-footer-links a {
  margin-right: 10px;
  text-decoration: none;
  color: var(--text-muted);
}

.site-footer-links a:hover {
  color: var(--accent);
}

.forge-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.forge-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.forge-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.forge-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.forge-nav-link {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

.forge-nav-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(243, 178, 92, 0.08);
}
.ore-search-row {
  margin-bottom: 8px;
}

.ore-search-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #111;
  color: #eee;
}

.ore-card.search-hit,
.inv-card.search-hit {
  outline: 2px solid #4caf50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

.ore-card.search-miss,
.inv-card.search-miss {
  opacity: 0.35;
}
.best-mode-btn--active {
  outline: 2px solid #ffc107;
  box-shadow: 0 0 6px rgba(255, 193, 7, 0.7);
}
.forge-layout > .panel:first-child .panel-body {
  position: relative;
  padding-bottom: 80px;
}

/* Base CTA styles (no positioning so mobile can't overlap anything) */
.inventory-optimizer-cta {
  background: rgba(0, 0, 0, 0.15);
  padding: 12px;
  border-radius: 8px;
  text-align: center;

  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Desktop CTA floats inside the LEFT panel only */
.inventory-optimizer-cta--desktop {
  position: absolute;
  bottom: 40%;
  left: 10px;
  right: 10px;
}


.inventory-optimizer-cta-text {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.3;
  margin: 0;
}


  .inventoryOptimizer {
      background: linear-gradient(to bottom, #3d312a, #201612);
      border-color: var(--accent);
      color: var(--accent);
    }

.inv-card.inv-has-count {
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.6);
}
.dps-value {
  cursor: help;
  text-decoration: underline dotted;
}

.inventory-split {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.inventory-ocr-panel {
  flex: 0 0 360px;
  max-width: 360px;
  background: rgba(10, 14, 22, 0.9);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.inventory-main-panel {
  flex: 1 1 auto;
  min-width: 0;
}

/* On mobile, stack OCR above inventory */
@media (max-width: 900px) {
  .inventory-split {
    flex-direction: column;
  }

  .inventory-ocr-panel {
    max-width: 100%;
  }
}

/* OCR-specific styles (safe subset from helper) */

.inventory-ocr-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.inventory-ocr-inner {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drop-zone {
  position: relative;
  border: 2px dashed #30363d;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.preview {
  position: relative;
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  background: #05080c;
  border: 1px solid #30363d;
}

.preview-stage img {
    width: 100%;
    height: auto;        /* preserves correct aspect ratio */
    display: block;
    user-select: none;
    pointer-events: none;
}

.preview-stage img {
  max-width: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
}

.overlay-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-box {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.scan-box {
  position: absolute;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.7);
}

.scan-num {
  background: rgba(46, 204, 113, 0.35);
}

.scan-name {
  background: rgba(46, 134, 222, 0.35);
}

.pan-handle,
.resize-handle {
  position: absolute;
  background: #11161f;
  border-radius: 4px;
  font-size: 12px;
  padding: 2px 6px;
  cursor: grab;
  user-select: none;
}

.pan-handle {
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.resize-handle {
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
}

.ocr-grid-controls {
  margin-top: 6px;
}

.mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.mode-btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: #0b0f17;
  cursor: pointer;
}

.mode-btn.active {
  border-color: #2ea043;
  background: #12251a;
}

.control-grid {
  margin-top: 6px;
}

.control-group h4 {
  margin: 0 0 4px;
  font-size: 13px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
}

.slider-row label {
  flex: 0 0 96px;
}

.slider-row input[type="range"] {
  flex: 1;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.status {
  min-height: 18px;
  font-size: 11px;
  opacity: 0.8;
  margin-top: 4px;
}

.ocr-results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.ocr-results-table th,
.ocr-results-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 4px;
}

.edit-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  padding: 3px;
  border-radius: 4px;
  font-size: 11px;
}

.edit-input:focus {
  border-color: #2ea043;
  outline: none;
  background: #0b0f15;
}

.remove-row {
  color: #f85149;
  cursor: pointer;
  font-weight: 700;
}

.stats {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
}

.stats span {
  font-weight: 600;
}

.ocr-apply-btn {
  margin-top: 8px;
  width: 100%;
  font-size: 13px;
}

.ocr-credit {
  margin-top: 8px;
  font-size: 11px;
  opacity: 0.8;
}


.overlay-grid {
  position:absolute;
  inset:0;
  pointer-events:none;
}

.grid-box {
  position:absolute;
  border:1px solid rgba(255,255,255,0.4);
}

.scan-box {
  position:absolute;
  border-radius:3px;
  border:1px solid rgba(0,0,0,0.7);
}

.scan-num {
  background:rgba(46,204,113,0.35);
}

.scan-name {
  background:rgba(46,134,222,0.35);
}

.inventory-split {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

/* ============================================================
   OCR MODULE — PROFESSIONAL VERSION
   Isolation-safe CSS for /ocr/ocr.html
   All classes prefixed with "ocr-"
   Author: Awesomedu + ChatGPT
============================================================ */

/* -------- ROOT CONTAINER -------- */
.forge-ocr-root {
  background: #1b1b1b;
  border: 1px solid #2b2b2b;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  color: #fff;
  font-family: Arial, sans-serif;
}

/* -------- HEADER -------- */
.ocr-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #f0f0f0;
}

.ocr-header p {
  margin: 6px 0 12px 0;
  font-size: 14px;
  color: #ccc;
}

/* -------- DROP ZONE -------- */
.ocr-drop-zone {
  background: #111;
  border: 2px dashed #444;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
}

.ocr-drop-zone:hover {
  background: #161616;
  border-color: #666;
}

.ocr-drop-message {
  font-size: 14px;
  color: #bbb;
}

/* -------- PREVIEW AREA -------- */
.ocr-preview-wrapper {
  margin-top: 18px;
  border: 1px solid #333;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #0e0e0e;
}

.ocr-preview-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
}

#ocr-preview-img {
  width: 100%;
  display: block;
}

/* The overlay grid is positioned on top of preview image */
#ocr-overlay-grid {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* -------- GRID BOXES (tiles) -------- */
.ocr-overlay-tile {
  position: absolute;
  border: 2px solid rgba(0, 200, 255, 0.6);
  box-sizing: border-box;
  pointer-events: none;
  border-radius: 2px;
}

/* -------- NAME + QTY REGIONS -------- */
.ocr-overlay-name {
  position: absolute;
  border: 2px solid rgba(0, 255, 100, 0.7);
  box-sizing: border-box;
  pointer-events: none;
}

.ocr-overlay-qty {
  position: absolute;
  border: 2px solid rgba(255, 200, 0, 0.8);
  box-sizing: border-box;
  pointer-events: none;
}

/* -------- BUTTONS -------- */
.ocr-controls {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ocr-btn {
  background: #2c2c2c;
  border: 1px solid #444;
  padding: 8px 14px;
  cursor: pointer;
  color: #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: 0.15s;
}

.ocr-btn:hover {
  background: #3a3a3a;
  border-color: #555;
}

.ocr-btn-primary {
  background: #3b65ff;
  border-color: #2e52d6;
  color: white;
}

.ocr-btn-primary:hover {
  background: #5077ff;
}
.grid-box-index {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #ffffff;
  opacity: 0.8;
  pointer-events: none;            /* don't block clicks on the tile */
  text-shadow: 0 0 3px #000, 0 0 6px #000;
}

.ocr-btn-green {
  background: #3aba57;
  border-color: #2c9a46;
  color: white;
}

.ocr-btn-green:hover {
  background: #46c565;
}

/* -------- STATUS -------- */
.ocr-status {
  margin-left: auto;
  font-size: 14px;
  color: #bbb;
}

/* -------- RESULTS TABLE -------- */
.ocr-results {
  margin-top: 20px;
}

.ocr-results h3 {
  margin-bottom: 8px;
}

.ocr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid #333;
}

.ocr-table th,
.ocr-table td {
  padding: 8px;
  border: 1px solid #333;
  text-align: left;
}

.ocr-table th {
  background: #232323;
  font-weight: bold;
}

.ocr-table tr:nth-child(odd) {
  background: #1c1c1c;
}

.ocr-table tr:nth-child(even) {
  background: #151515;
}

/* Make sure OCR UI scales on mobile */
@media (max-width: 600px) {
  .ocr-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .ocr-btn {
    width: 100%;
    text-align: center;
  }
}

#ocr-preview-stage {
  position: relative;
  width: 100%;
  max-width: 400px; /* any reasonable limit */
}

#ocr-preview-img {
  display: block;
  width: 100%;
  height: auto;
}

#ocr-overlay-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
/* Keep OCR results table same width as the OCR panel */
.ocr-results {
  max-width: 400px;      /* or whatever your preview width is */
  overflow-x: hidden;    /* don't let it spill out horizontally */
}

/* Make the table fit its container and distribute columns */
.ocr-table {
  width: 100%;
  table-layout: fixed;   /* cells use assigned widths instead of content */
}

/* Column widths: #, Ore name, Count */
.ocr-table th:nth-child(1),
.ocr-table td:nth-child(1) {
  width: 12%;
}

.ocr-table th:nth-child(2),
.ocr-table td:nth-child(2) {
  width: 58%;
}

.ocr-table th:nth-child(3),
.ocr-table td:nth-child(3) {
  width: 30%;
}

/* Inputs should not force the cells wider */
.ocr-edit-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
/* ---- OCR screenshot example modal ---- */
.ocr-example-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.ocr-example-modal.show {
  display: flex;
}

.ocr-example-dialog {
  background: #0b0f17;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 16px 20px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
}

.ocr-example-dialog h3 {
  margin: 0 0 8px;
}

.ocr-example-dialog p {
  margin: 0 0 10px;
  font-size: 14px;
  color: #c9d1d9;
}

.ocr-example-dialog img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 10px;
}

#ocr-example-close {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: #2ea043;
  color: #fff;
}
/* draggable calibration square */
.ocr-cal-box {
  position: absolute;
  border: 2px solid #00e6ff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8);
  pointer-events: auto;
  cursor: move;
  z-index: 30; /* above grid boxes */
}

.ocr-cal-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  right: -7px;
  bottom: -7px;
  border-radius: 50%;
  border: 2px solid #00e6ff;
  background: rgba(0, 0, 0, 0.9);
  cursor: nwse-resize;
}
@media (max-width: 900px) {
  .inventory-split {
    display: block;        /* children will naturally go one under another */
  }

  .forge-ocr-root,
  .inventory-main-panel {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  /* small spacing between the two blocks */
  .inventory-main-panel {
    margin-top: 16px;
  }
}
#inventoryPanel .center-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Mobile: put the label on its own line, stack buttons so nothing overflows */
@media (max-width: 900px) {
  #inventoryPanel .center-buttons {
    justify-content: center;
    text-align: center;
  }

  #inventoryPanel .center-buttons span {
    flex: 0 0 100%;
    margin-bottom: 4px;
  }

  #inventoryPanel .center-buttons .forge-btn-main,
  #inventoryPanel .center-buttons .forge-btn-secondary {
    flex: 0 0 100%;
  }
}
.forge-layout--single {
  grid-template-columns: minmax(0, 1fr);
}

/* Generic ad placeholder styling */
.ad-slot {
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(243, 178, 92, 0.7);
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Left Forge Chances panel – 300x250 at the bottom */
.ad-slot-300x250-left {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  height: 250px;        /* “300x250” – width is responsive, height fixed */
  border-radius: 8px;
}

/* Center panel – 970x250 under Composition & Traits */
.ad-slot-970x250-center {
  margin-top: 16px;
  height: 250px;         /* “970x250” height */
  max-width: 970px;      /* cap at 970px */
  width: 100%;           /* responsive, shrinks on smaller screens */
  margin-left: auto;
  margin-right: auto;    /* center horizontally */
  border-radius: 10px;
}

@media (max-width: 768px) {
  .ad-slot-300x250-left,
  .ad-slot-970x250-center {
    display: none;
  }
}
/* Mobile/desktop variants for the inventory optimizer CTA */
.inventory-optimizer-cta--mobile {
  display: none; /* hidden by default on desktop */
}

@media (max-width: 900px) {
  /* hide the left-panel CTA on mobile */
  .inventory-optimizer-cta--desktop {
    display: none;
  }

  /* show the center CTA under traits on mobile */
  .inventory-optimizer-cta--mobile {
    display: flex;
    position: static;    /* override absolute from base */
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: 12px;
  }
}
/* ----- Current build cards (inventory optimizer) ----- */

.current-builds {
  margin-bottom: 16px;
}

.current-builds-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.current-builds-note {
  font-size: 11px;
  color: var(--text-muted, #bbb);
  margin-bottom: 8px;
}

.current-build-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.current-build-card {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
}

.current-build-card-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.current-build-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.current-build-row--traits {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.current-build-card label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.current-build-card input[type="text"],
.current-build-card input[type="number"] {
  background: rgba(10, 10, 10, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f5f5f5;
  padding: 3px 4px;
  border-radius: 3px;
  font-size: 11px;
}

.current-build-summary {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted, #bbb);
}

/* Mobile stacking */
@media (max-width: 1100px) {
  .current-build-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .current-build-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ----- Result card comparison colors ----- */

.optimizer-result-card--worse {
  box-shadow: 0 0 0 1px rgba(255, 60, 60, 0.8);
}

.optimizer-result-card--mixed {
  box-shadow: 0 0 0 1px rgba(255, 170, 60, 0.9);
}

.optimizer-result-card--better {
  box-shadow: 0 0 0 1px rgba(60, 220, 140, 0.9);
}
/* --- Type / Variant row --- */

.current-build-type-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.current-build-type-input {
  display: flex;
  gap: 4px;
  align-items: center;
}

.current-build-choose-btn {
  padding: 3px 6px;
  font-size: 10px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 30, 30, 0.9);
  color: #f5f5f5;
  cursor: pointer;
  white-space: nowrap;
}

.current-build-choose-btn:hover {
  background: rgba(60, 60, 60, 0.9);
}

/* --- Equipment variant modal --- */

.equip-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.equip-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.equip-modal-content {
  position: relative;
  max-width: 640px;
  max-height: 80vh;
  margin: 40px auto;
  background: #111;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.equip-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.equip-modal-header h3 {
  font-size: 14px;
  margin: 0;
}

.equip-modal-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.equip-variant-list {
  overflow-y: auto;
  padding-right: 4px;
  font-size: 12px;
}

.equip-variant-group {
  margin-bottom: 8px;
}

.equip-variant-group-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.equip-variant-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 4px 6px;
  margin-bottom: 3px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(20, 20, 20, 0.95);
  color: #f5f5f5;
  cursor: pointer;
}

.equip-variant-btn:hover {
  background: rgba(50, 50, 50, 0.95);
}

@media (max-width: 700px) {
  .equip-modal-content {
    margin: 20px 10px;
    max-width: 100%;
  }
}
/* Row that holds Type/Variant + Damage */
.current-build-row {
  display: flex;
  gap: 12px;
}

.current-build-row > label {
  flex: 1 1 0;
}

/* Inner container: Type/Variant input + "Pick from list" button */
.current-build-type-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Make the text input take the remaining width */
.current-build-type-input input {
  flex: 1 1 auto;
  min-width: 0; /* prevents overflow squeezing the button off-screen */
}

/* Button should size to its content and not shrink away */
.current-build-choose-btn {
  flex: 0 0 auto;
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 30, 30, 0.9);
  color: #f5f5f5;
  cursor: pointer;
  white-space: nowrap; /* keep text on one line */
}

.current-build-choose-btn:hover {
  background: rgba(60, 60, 60, 0.9);
}

/* --- Current build cards layout --- */

.current-build-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;           /* lets items wrap on smaller widths */
}


/* On narrow screens, stack the two columns instead of squeezing them */
@media (max-width: 900px) {
  .current-build-row {
    flex-direction: column;
  }
}

.preview-text-main .damage {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.preview-text-main .damage > div + div {
  margin-top: 2px;
}
#ocr-preview-stage img {
  touch-action: none;
}

/* Generic modal layout – works for both select-variant and calc-info modals */
.equip-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.equip-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

/* Responsive modal box */
.equip-modal-content {
  position: relative;
  box-sizing: border-box;
  margin: 4vh auto;
  padding: 1.5rem 2rem;
  background: #151515;         /* match your dark theme */
  border-radius: 12px;
  width: min(900px, 95vw);     /* shrink on smaller screens */
  max-height: 92vh;            /* never go off-screen vertically */
  overflow-y: auto;            /* scroll inside the modal if content is tall */
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

/* Base modal layout */
.equip-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.equip-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

/* Default modal box – used by the variant selector */
.equip-modal-content {
  position: relative;
  box-sizing: border-box;
  margin: 5vh auto;
  padding: 1.25rem 1.5rem;
  background: #151515;
  border-radius: 10px;
  width: min(600px, 94vw);   /* smaller & tighter for this content */
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.75);
}

/* Wider layout only for the long "How our calculations work" modal */
.calc-info-modal {
  width: min(900px, 96vw);
}

/* Header / close button */
.equip-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.equip-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.equip-modal-close {
  border: none;
  background: transparent;
  color: #eee;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
/* Variant list layout */
.equip-variant-list {
  margin-top: 0.75rem;
}

.equip-variant-group-title {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #f5f5f5;
}

/* Pill-style variant buttons */
.equip-variant-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.2rem 0.4rem 0.2rem 0;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;       /* pill shape */
  border: 1px solid #444;
  background: #202020;
  color: #f1f1f1;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    transform 0.05s ease;
}

.equip-variant-line:hover {
  background: #2f4b8f;        /* tweak if you want a different accent */
  border-color: #4f7cff;
  transform: translateY(-1px);
}

.equip-variant-line:active {
  transform: translateY(0);
  background: #253a70;
}

/* Mobile tweaks */
@media (max-width: 768px) {
  .equip-modal-content {
    margin: 2rem auto;
    width: 95vw;
    max-height: 92vh;
    padding: 1rem 1.2rem;
  }

  .equip-variant-line {
    font-size: 0.85rem;
    padding: 0.25rem 0.55rem;
  }
}

/* Wrapper + grid */
.current-builds {
  margin-bottom: 24px;
}

.current-builds-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.current-builds-note {
  color: #c5b8aa;
  font-size: 0.9rem;
  margin-bottom: 0.9rem;
}

.current-build-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

/* Responsive: 2-wide on mid screens, stacked on mobile */
@media (max-width: 1200px) {
  .current-build-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .current-build-grid {
    grid-template-columns: 1fr;
  }
}

/* Card with subtle Forge-ish gradient ring */
.current-build-card {
  position: relative;
  padding: 14px 16px;
  border-radius: 10px;
  background:
    radial-gradient(circle at top left,
      rgba(243, 180, 108, 0.18),
      rgba(15, 12, 16, 0.98) 55%);
  border: 1px solid rgba(243, 180, 108, 0.35);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.65);
}
.current-build-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
  color: #f8eee3;
  letter-spacing: 0.03em;
}

/* Rows */
.current-build-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

/* 2-column and 1-column special rows (if you already had rules, this just refines spacing) */
.current-build-row--wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.current-build-row--traits {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Mobile: make rows easier to read */
@media (max-width: 900px) {
  .current-build-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .current-build-row,
  .current-build-row--traits {
    grid-template-columns: 1fr;
  }
}

/* Labels + text */
.current-build-row label,
.current-build-type-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: #e3d8cc;
}
.current-build-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  border: 1px solid #3b2a1c;
  background: #0f0e12;
  color: #f7f2ea;
  font-size: 0.85rem;
  outline: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

.current-build-input::placeholder {
  color: #85756a;
}

.current-build-input:focus {
  border-color: #f3b46b;
  box-shadow: 0 0 0 1px rgba(243, 180, 107, 0.35);
  background: #141219;
}

/* Type/variant row layout */
.current-build-type-input {
  display: flex;
  gap: 6px;
  align-items: center;
}

.current-build-type-input .current-build-input {
  flex: 1 1 auto;
}

/* Make the “Pick from list” button sit nicely with the input */
.current-build-type-input .forge-btn-secondary {
  white-space: nowrap;
  padding-inline: 0.5rem;
  font-size: 0.8rem;
}
.current-build-summary {
  margin-top: 6px;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  font-size: 0.85rem;
  color: #f4e0c7;
  border: 1px solid rgba(243, 180, 107, 0.25);
}
.optimizer-status {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-right: 8px;
  min-height: 1.2em; /* keeps layout stable when empty */
  display: inline-block;
}
#optimizerStatus,
.optimizer-status {
  font-size: 0.8rem;
  opacity: 0.8;
  max-width: 220px;     /* prevents it from stretching the whole row */
  white-space: normal;  /* let text wrap to a second line */
  line-height: 1.2;
}
@media (max-width: 768px) {
  .optimizer-controls-row {
    flex-direction: column;
    align-items: flex-start;
  }

  #optimizerStatus,
  .optimizer-status {
    max-width: 100%;
  }
}
/* --- "How to Use" section --- */

#how-to-use {
  max-width: 1000px;
  margin: 3rem auto 2rem;
  padding: 2rem 1.75rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(circle at top, #3b2816 0, #1a120a 40%, #07050a 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  color: #f5e9d9;
  line-height: 1.6;
}

#how-to-use h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  text-align: center;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #ffdd99;
}

#how-to-use h3 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.35rem;
  color: #ffe4b5;
  font-weight: 600;
}

#how-to-use p {
  margin: 0.1rem 0 0.6rem;
  font-size: 0.95rem;
  color: #f8f2e7;
}

#how-to-use p:last-of-type {
  margin-bottom: 0;
}

#how-to-use a {
  color: #76c7ff;
  text-decoration: underline;
}

#how-to-use a:hover {
  text-decoration: none;
  filter: brightness(1.15);
}

/* small "step" feel for the numbered headings */
#how-to-use h3::before {
  content: "• ";
  opacity: 0.7;
}

/* spacing to the BuyMeACoffee section below */
#how-to-use + a {
  display: block;
  margin: 2rem auto 0.5rem;
  text-align: center;
}

/* make the donation note below it centered & readable */
#how-to-use + a + em {
  display: block;
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* Mobile tweaks */
@media (max-width: 768px) {
  #how-to-use {
    margin: 2rem 1rem;
    padding: 1.5rem 1.25rem;
  }

  #how-to-use h2 {
    font-size: 1.4rem;
  }

  #how-to-use h3 {
    font-size: 1rem;
  }

  #how-to-use p {
    font-size: 0.9rem;
  }
}
@media (min-width: 901px) {
  /* Constrain the whole 3-panel area so inner panel-bodies can scroll */
  .forge-layout {
    height: 95vh;
    max-height: 1000px;  /* “around 1000px on PC” */
    min-height: 0;       /* important: lets children overflow inside */
  }

  /* Important for scroll inside flex/grid children */
  .panel {
    min-height: 0;
  }

  .panel-body {
    min-height: 0;
    overflow-y: auto;    /* ensure vertical scroll for long lists */
  }
}


.world-pill-group{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.world-pill{
  appearance:none;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: inherit;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: transform .08s ease, filter .12s ease, background .12s ease, border-color .12s ease;
}

.world-pill:hover{
  filter: brightness(1.08);
}

.world-pill:active{
  transform: translateY(1px);
}

.world-pill.active{
  border-color: rgba(255,255,255,0.28);
  background: linear-gradient(135deg, rgba(255,190,120,0.28), rgba(120,70,30,0.28));
  box-shadow: 0 0 0 2px rgba(255,190,120,0.12) inset, 0 10px 26px rgba(0,0,0,0.25);
}

.ore-search-row.has-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-tabs.mode-tabs--top {
  margin-top: 0;
  padding: 0 0 8px;
  border-top: 0;
  border-bottom: 1px solid var(--border);
}
.ore-search-row.has-sort .ore-search-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.ore-sort-btn {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #555;
  background: rgba(255,255,255,0.04);
  color: #eee;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.ore-sort-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(243, 178, 92, 0.08);
}

@media (max-width: 520px) {
  .ore-search-row.has-sort { flex-wrap: wrap; }
  .ore-sort-btn { width: 100%; }
}

/* Attack speed mode toggle (under Selected Ores) */
.atkspd-toggle-wrap {
  display: flex;
  justify-content: flex-start;
  margin: -4px 0 10px;
}

.atkspd-toggle-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.atkspd-toggle-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.atkspd-toggle-btn.is-on {
  border-color: rgba(120, 255, 160, 0.45);
  box-shadow: 0 0 0 1px rgba(120, 255, 160, 0.18) inset;
}
#atkSpeedModeToggleOpt.atkspd-toggle-btn {
  border-radius: 999px;
  padding: 6px 10px;
}
#atkSpeedModeToggleOpt.atkspd-toggle-btn.is-on {
  border-color: rgba(120,255,160,0.45);
  box-shadow: 0 0 0 1px rgba(120,255,160,0.18) inset;
}

@media (max-width: 900px) {
  /* Force the mobile CTA to behave like normal flow content */
  .inventory-optimizer-cta.inventory-optimizer-cta--mobile {
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    margin: 12px 0 0 !important;
	 position: relative;          /* ensures z-index applies */
  z-index: 9999 !important;    /* bring above anything else */
  pointer-events: auto !important;
  }
#traitSummary{
  margin-bottom: 120px !important;
}
}


/* --- Lock-to-100% button on Forge Chances rows --- */
.weapon-chance-right{ display:flex; align-items:center; gap:8px; }

.chance-lock-btn{
  width:28px; height:24px;
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.90);
  cursor:pointer;
  font-weight:900;
  line-height:1;
  user-select:none;
}
.chance-lock-btn:hover{ background:rgba(255,255,255,.10); }
.chance-lock-btn.locked{
  border-color: rgba(105,255,152,.45);
  box-shadow: 0 0 0 2px rgba(105,255,152,.12);
}
.chance-lock-btn:disabled{
  opacity:.35;
  cursor:not-allowed;
}
.chance-lock-req{
  font-size: 11px;
  opacity: .75;
  white-space: nowrap;
  user-select: none;
}
.chance-lock-btn.locked + .chance-lock-req{
  opacity: .95;
}


/* ----- Guide Hub link styling (How The Forge Calculator Works) ----- */
#forge-guide-hub a {
  color: rgba(120, 170, 255, 0.95);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(120, 170, 255, 0.45);
  transition: color 120ms ease, text-decoration-color 120ms ease, background 120ms ease;
  border-radius: 6px; /* for focus background */
  padding: 1px 3px;   /* subtle clickable feel */
}

#forge-guide-hub a:visited {
  color: rgba(170, 145, 255, 0.92);
  text-decoration-color: rgba(170, 145, 255, 0.45);
}

#forge-guide-hub a:hover {
  color: rgba(255, 210, 140, 0.98); /* warm hover accent */
  text-decoration-color: rgba(255, 210, 140, 0.75);
  background: rgba(255, 210, 140, 0.08);
}

#forge-guide-hub a:active {
  background: rgba(255, 210, 140, 0.14);
}

#forge-guide-hub a:focus-visible {
  outline: 2px solid rgba(255, 210, 140, 0.65);
  outline-offset: 2px;
  background: rgba(255, 210, 140, 0.10);
  text-decoration-color: rgba(255, 210, 140, 0.85);
}

/* Optional: make "Popular searches" list links a bit more button-like */
#forge-guide-hub ul li a {
  display: inline-block;
  margin: 2px 0;
}

/* Optional: if you want the 3 "Popular searches" to stand out more */
#forge-guide-hub h3 + ul li a {
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  border-radius: 999px;
  text-decoration: none;
}

#forge-guide-hub h3 + ul li a:hover {
  border-color: rgba(255, 210, 140, 0.35);
}
