* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: #0b1220;
  color: #e5edf7;
  font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

body {
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  margin-bottom: 20px;
}

.brand {
  padding: 22px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, #111827, #182338);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 14px 35px rgba(0,0,0,0.25);
}

.brand-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand-subtitle {
  margin-top: 8px;
  color: #9fb0c8;
  font-size: 14px;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: #111827;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
}

.controls {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.tab {
  border: 0;
  background: #1e293b;
  color: #dbe8f8;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.18s ease;
}

.tab:hover {
  background: #263449;
}

.tab.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 700;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 180px 180px;
  gap: 12px;
}

.search-input,
.select {
  width: 100%;
  background: #0f172a;
  color: #e5edf7;
  border: 1px solid #253149;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.search-input:focus,
.select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
}

.result-meta {
  color: #9fb0c8;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  gap: 14px;
  background: linear-gradient(180deg, #162132, #121b2a);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(96,165,250,0.65);
  box-shadow: 0 10px 28px rgba(59,130,246,0.14);
}

.card-image {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 12px;
  background: #0c1422;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 8px;
  flex-shrink: 0;
}

.card-content {
  min-width: 0;
  flex: 1;
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: #f8fbff;
  word-break: break-word;
  margin-bottom: 6px;
}

.card-seller,
.card-sub,
.card-time {
  color: #a9bad0;
  font-size: 14px;
  margin-bottom: 6px;
  word-break: break-word;
}

.card-price {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #ffd98b;
  font-size: 14px;
  font-weight: 700;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: #93a8c3;
  background: #0f172a;
  border-radius: 14px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.page-btn {
  border: 0;
  background: #1e293b;
  color: #e5edf7;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) {
  background: #2a3a52;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-info {
  color: #b7c7da;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.56);
  z-index: 99;
}

.modal {
  position: fixed;
  z-index: 100;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: linear-gradient(180deg, #0f172a, #111827);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
}

.modal-body {
  padding: 24px;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  margin: 10px 10px 0 0;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.modal-main {
  clear: both;
}

.modal-top {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.modal-image {
  width: 128px;
  height: 128px;
  object-fit: contain;
  border-radius: 16px;
  background: #0b1321;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 10px;
  flex-shrink: 0;
}

.modal-info {
  flex: 1;
  min-width: 0;
}

.modal-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 14px;
}

.modal-line {
  color: #d8e5f6;
  margin-bottom: 8px;
}

.detail-block {
  margin-top: 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 16px;
}

.detail-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  color: #dbe7f7;
}

.detail-wide {
  grid-column: 1 / -1;
}

.detail-text {
  color: #dbe7f7;
  line-height: 1.7;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .modal-top {
    flex-direction: column;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.equip-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-box {
  background: linear-gradient(180deg, #172235, #101827);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 13px;
  color: #91a4bf;
  margin-bottom: 6px;
  font-weight: 700;
}

.stat-value {
  font-size: 20px;
  font-weight: 900;
  color: #f8fbff;
  line-height: 1.2;
  word-break: break-word;
}

.stat-flame {
  color: #ff5f5f;
  font-size: 16px;
  font-weight: 800;
}

.equip-extra-row {
  margin-top: 14px;
}

.equip-owner-box {
  background: linear-gradient(180deg, #172235, #101827);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 14px;
}

.equip-note {
  margin-top: 12px;
  color: #9fb0c8;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .equip-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .equip-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input,
.toolbar-select {
  background: #111827;
  color: #e5edf8;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.search-input {
  flex: 0 1 260px;
  min-width: 180px;
  max-width: 260px;
}

.compact-modal {
  max-width: 760px;
  margin: 0 auto;
}

.modal-dialog,
.modal-content,
.modal-main {
  max-width: 760px;
}

.modal-top {
  gap: 16px;
}

.modal-image {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.modal-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 10px;
}

.modal-line {
  font-size: 14px;
  line-height: 1.7;
}

.equip-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-box {
  background: linear-gradient(180deg, #172235, #101827);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 68px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 12px;
  color: #91a4bf;
  margin-bottom: 6px;
  font-weight: 700;
}

.stat-value {
  font-size: 18px;
  font-weight: 900;
  color: #f8fbff;
  line-height: 1.2;
  word-break: break-word;
}

.stat-flame {
  color: #ff5f5f;
  font-size: 15px;
  font-weight: 800;
}

.equip-extra-row {
  margin-top: 12px;
}

.equip-owner-box {
  background: linear-gradient(180deg, #172235, #101827);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
}

.equip-note {
  margin-top: 10px;
  color: #9fb0c8;
  font-size: 13px;
}

.equip-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.equip-summary span {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: #cfe0ff;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .equip-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .equip-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-input {
    min-width: 200px;
  }
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: nowrap;
  width: 100%;
}

.search-input {
  flex: 1 1 auto;
  min-width: 200px;
  max-width: none;
}

.select {
  flex: 0 0 auto;
}

#categorySelect {
  width: 150px;
  min-width: 150px;
}

#sortSelect {
  width: 150px;
  min-width: 150px;
}

#dirSelect {
  width: 220px;
  min-width: 220px;
}

#pageSizeSelect {
  width: 150px;
  min-width: 150px;
}

@media (max-width: 900px) {
  .toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .search-input {
    flex: 1 1 100%;
    min-width: 220px;
  }
}

.list-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-header-row,
.list-row {
  display: grid;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
}

.list-header-row {
  grid-template-columns: minmax(280px, 2.4fr) minmax(100px, 1fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(170px, 1.2fr);
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  color: #a8b3c7;
  font-size: 13px;
  font-weight: 700;
}

.list-row {
  grid-template-columns: minmax(280px, 2.4fr) minmax(100px, 1fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(170px, 1.2fr);
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(20, 27, 39, 0.95), rgba(15, 21, 31, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.list-row:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 215, 130, 0.35);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.list-col {
  min-width: 0;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-image {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  padding: 4px;
  flex-shrink: 0;
}

.list-item-info {
  min-width: 0;
}

.list-title {
  font-size: 15px;
  font-weight: 700;
  color: #f4f7fb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #9aa8bc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-seller,
.list-price,
.list-time {
  font-size: 13px;
  color: #d5deea;
}

@media (max-width: 1100px) {
  .list-header-row,
  .list-row {
    grid-template-columns: minmax(260px, 2fr) minmax(90px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr);
  }

  .list-time {
    display: none;
  }

  .list-header-row .list-time {
    display: none;
  }
}

@media (max-width: 820px) {
  .list-header-row {
    display: none;
  }

  .list-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .list-seller,
  .list-price,
  .list-time {
    padding-left: 56px;
  }
}

#viewModeSelect {
  width: 120px;
  min-width: 120px;
}