:root {
  color-scheme: light;
  --ink: #182028;
  --muted: #657181;
  --line: #d9e0e7;
  --panel: #ffffff;
  --page: #eef3f7;
  --blue: #1766b1;
  --green: #16815a;
  --gold: #b97913;
  --red: #bb3b3b;
  --shadow: 0 12px 30px rgba(24, 32, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(23, 102, 177, 0.12), transparent 38%),
    linear-gradient(300deg, rgba(22, 129, 90, 0.12), transparent 36%),
    var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.status {
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px 14px;
  color: var(--muted);
  text-align: center;
}

main {
  padding: 0 clamp(18px, 4vw, 48px) 42px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.summary > div,
.tools,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 22px rgba(24, 32, 40, 0.07);
}

.summary > div {
  min-height: 86px;
  padding: 18px;
}

.summary span {
  display: block;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-weight: 850;
}

.summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tools {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(23, 102, 177, 0.2);
  outline-offset: 2px;
}

.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

button {
  min-height: 42px;
  border: 1px solid #155a9b;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  padding: 0 13px;
  font-weight: 760;
  cursor: pointer;
}

button.secondary,
.card-actions button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

button.active-owned {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

button.active-wanted {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
}

.notice {
  margin: 12px 0;
  padding: 14px 16px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.art-button {
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #dce5ed;
  padding: 0;
}

.art-button img {
  display: block;
  width: 100%;
  aspect-ratio: 734 / 1024;
  object-fit: cover;
}

.card-body {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.card-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.card h2 {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.18;
}

.price {
  color: var(--green);
  font-weight: 850;
  white-space: nowrap;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7fafc;
}

.price-grid span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 6px;
  border-left: 1px solid var(--line);
}

.price-grid span:first-child {
  border-left: 0;
}

.price-grid small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
  text-transform: uppercase;
}

.price-grid strong {
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 840;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

dialog {
  width: min(980px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(24, 32, 40, 0.32);
}

dialog::backdrop {
  background: rgba(13, 20, 27, 0.58);
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  min-height: 38px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.detail {
  display: grid;
  grid-template-columns: minmax(260px, 42%) 1fr;
  gap: 20px;
  padding: 20px;
}

.detail img {
  width: 100%;
  border-radius: 8px;
  background: #dce5ed;
}

.detail h2 {
  margin: 0 44px 8px 0;
  font-size: clamp(1.6rem, 4vw, 3rem);
  line-height: 1;
}

.detail dl {
  display: grid;
  grid-template-columns: minmax(112px, auto) 1fr;
  gap: 8px 14px;
  margin: 18px 0;
}

.detail dt {
  color: var(--muted);
  font-weight: 800;
}

.detail dd {
  margin: 0;
}

.price-table-wrap {
  overflow-x: auto;
  margin: 18px 0;
}

.price-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.price-table caption {
  padding-bottom: 8px;
  color: var(--muted);
  font-weight: 850;
  text-align: left;
  text-transform: uppercase;
}

.price-table th,
.price-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: right;
  white-space: nowrap;
}

.price-table th:first-child,
.price-table td:first-child {
  text-align: left;
}

.price-table thead th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.price-table tbody th {
  font-weight: 820;
}

.empty-prices {
  margin: 18px 0;
  color: var(--muted);
}

.link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
  font-weight: 760;
  text-decoration: none;
}

@media (max-width: 980px) {
  .tools,
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .searchbox,
  .button-row {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .summary,
  .tools,
  .detail {
    grid-template-columns: 1fr;
  }

  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}
