body {
      background-color: #1e1e1e;
      color: white;
      font-family: 1, sans-serif;
      display: flex;
      flex-direction: column;
      align-items: center;
      margin: 0;
      padding: 2rem;
    }

    table {
      border-collapse: collapse;
      width: 600px;
      margin-bottom: 1rem;
      font-size: 18px;
    }

    th, td {
      border: 2px solid #333;
      padding: 10px;
      text-align: center;
      background-color: #161616;
    }

    th {
      background: linear-gradient(to right, #666, #999);
      font-weight: bold;
      font-size: 18px;
      color: #111;
    }

    .controls {
      display: flex;
      gap: 10px;
      margin-top: 10px;
    }

    button {
      background-color: #161616;
      color: white;
      border: none;
      padding: 15px 20px;
      border-radius: 6px;
      cursor: pointer;
      font-weight: bold;
    }

    button:hover { background-color: #2a2a2a; }

    .summary-table {
      width: 600px;
      border-collapse: collapse;
      margin-top: 20px;
    }

    .summary-table th, .summary-table td {
      border: 2px solid #333;
      padding: 10px;
      background-color: #161616;
    }

    .top-right-clear {
      position: fixed;
      bottom: 24px;
      left: 24px;
      background: #222;
      color: #fff;
      border: 1px solid #555;
      border-radius: 6px;
      padding: 12px 24px;
      font-size: 16px;
      cursor: pointer;
      z-index: 100;
      transition: background 0.2s;
    }

    .top-right-clear:hover {
        background: #444;
    }

    .ore-icon {
      width: 30px;
      height: 30px;
      vertical-align: middle;
      margin-right: 5px;
    }

    input[type="number"] {
      width: 80px;
      text-align: center;
      background-color: #1c1c1c;
      color: white;
      border: 1px solid #555;
      border-radius: 6px;
      padding: 8px;
    }

    /* Remove the up/down number input arrows (Chrome, Edge, Safari) */
    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    /* Remove arrows in Firefox */
    input[type=number] {
      -moz-appearance: textfield;
    }

    /* Popup Styling */
    #ore-popup {
      display: none;
      position: fixed;
      top: 0; left: 0;
      width: 100vw; height: 100vh;
      background: rgba(0,0,0,0.7) !important;
      align-items: center;
      justify-content: center;
      z-index: 1000;
    }

    #ore-popup-content {
      background: #181818 !important;
      color: #fff;
      padding: 24px 28px;
      border-radius: 12px;
      max-width: fit-content;
      min-width: 320px;
      max-height: 80vh;
      box-shadow: 0 4px 24px rgba(0,0,0,0.5);
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .ore-popup-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 2px;
      margin: 16px 0;
      box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    }

    .ore-popup-row {
      display: flex;
      align-items: center;
      cursor: pointer;
      background: #232323;
      padding: 1.5px 2px;
      border-radius: 6px;
      transition: background 0.15s;
      min-width: 140px;
      font-size: 0.9em;
    }

    .ore-popup-row:hover { background: #333; }

    .ore-popup-row img {
      width: 24px;
      height: 24px;
      margin-right: 8px;
    }

    .ore-popup-row span {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .ore-popup-cancel-btn {
      grid-column: 5;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgb(172, 0, 0);
      color: #fff;
      border: none;
      border-radius: 6px;
      padding: 1.5px 2px;
      min-width: 140px;
      font-size:0.9em;
      cursor: pointer;
      transition: background 0.15s;
      box-sizing: border-box;
    }

    .ore-popup-cancel-btn:hover {
      background: darkred;
    }

    /* Home Button */
    #home-btn {
      position: fixed;
      top: 16px;
      right: 16px;
      z-index: 100;
      padding: 10px 22px;
      background: #222;
      color: #fff;
      border: none;
      border-radius: 6px;
      font-size: 1.1em;
      cursor: pointer;
      box-shadow: 0 2px 8px #0003;
      transition: background 0.2s;
    }

    #home-btn:hover {
      background: #444;
    }

    /* ===============================
   📱 MOBILE RESPONSIVENESS
   =============================== */

/* For tablets and smaller screens */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  table, .summary-table {
    width: 100%;
    font-size: 0.95rem;
  }

  th, td {
    padding: 6px;
  }

  input[type="number"] {
    width: 100%;
    height: 100%;
    font-size: 1rem;
    padding: 6px;
    box-sizing: border-box;
  }

  .controls {
    flex-direction: column;
    width: 100%;
    gap: 8px;
    margin-top: 12px;
  }

  .controls button {
    width: 100%;
    font-size: 1rem;
  }

  /* Allow table to scroll horizontally if too wide */
  #oreTable, .summary-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* Popup content fits small screens */
  #ore-popup-content {
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 18px 20px;
  }

  /* Popup grid adjusts columns for mobile */
  .ore-popup-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .ore-popup-row {
    min-width: auto;
    justify-content: center;
    padding: 4px 6px;
    font-size: 0.9em;
  }

  .ore-popup-cancel-btn {
    grid-column: span 2;
    width: 100%;
  }

  /* Clear Trade Button */
  .top-right-clear {
    bottom: 12px;
    left: 12px;
    font-size: 0.9rem;
    padding: 10px 16px;
  }

  /* Home button scales down slightly */
  #home-btn {
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    font-size: 1rem;
  }
}

/* =========================================
   RESPONSIVE POPUP ORE SELECTION LAYOUT
   ========================================= */
@media (max-width: 480px) {
  #ore-popup-content {
    width: 92%;
    max-width: 340px;
    padding: 16px 18px;
    border-radius: 10px;
  }

  .ore-popup-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    justify-content: center;
  }

  .ore-popup-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: #232323;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.9em;
    min-height: 42px;
  }

  .ore-popup-row img {
    width: 22px;
    height: 22px;
    margin-right: 8px;
  }

  .ore-popup-cancel-btn {
    grid-column: 1 / -1;
    width: 100%;
    padding: 8px 0;
    margin-top: 4px;
  }

  #ore-popup-content {
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* 📱 Medium phones & small tablets (481px–767px) */
@media (min-width: 481px) and (max-width: 767px) {
  #ore-popup-content {
    width: 90%;
    max-width: 480px;
    padding: 20px;
  }

  .ore-popup-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .ore-popup-row {
    min-height: 46px;
    font-size: 0.95em;
  }
}

/* 💻 Tablets & small laptops (768px–1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  #ore-popup-content {
    width: 85%;
    max-width: 600px;
  }

  .ore-popup-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  .ore-popup-row {
    min-height: 48px;
  }
}

/* 🖥️ Large screens (1024px+) */
@media (min-width: 1024px) {
  .ore-popup-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
  }
}
