:root {
  color-scheme: light;
  --ink: #111;
  --muted: #747474;
  --soft: #f2f2f2;
  --max: 1760px;
}

* {
  box-sizing: border-box;
  font-weight: 400 !important;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: Arial, "Helvetica Neue", "Noto Sans JP", sans-serif;
  font-size: 1rem;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 34px;
  padding: 0 18px;
  background: rgba(255, 255, 255, .96);
}

.site-name, .portfolio-link, .back-link { text-decoration: none; }
.site-name, .portfolio-link { font-size: .8125rem; }
.portfolio-link { color: var(--muted); }
.back-link { color: var(--muted); font-size: .8125rem; }
.site-name:hover, .portfolio-link:hover, .back-link:hover { color: var(--ink); }

main {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 8px 18px 54px;
}

body.detail-view main { padding-bottom: 8px; }

main:focus { outline: none; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 1rem; line-height: 1.4; }
h2 { font-size: .875rem; }

.catalog-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 1px 0 10px;
}

.filters { display: flex; flex-wrap: wrap; gap: 15px; }
.order-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 15px; }
.filters button,
.order-button,
.edition-controls button,
.panel-actions button,
.external-links a {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.filters button, .order-button { font-size: .8125rem; }
.filters button.is-active, .order-button.is-active { color: var(--ink); }
.filters button:hover,
.order-button:hover,
.edition-controls button:hover,
.panel-actions button:hover,
.external-links a:hover { color: var(--ink); }

.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 24px 10px;
  padding-top: 6px;
}

.work-card {
  display: block;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.work-image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--soft);
}

.work-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.work-image {
  object-fit: cover;
  transition: opacity .2s;
}

.work-card:hover .work-image { opacity: .84; }
.work-card:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.work-title {
  overflow: hidden;
  margin: 7px 0 1px;
  font-size: .8125rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-meta { margin: 0; color: var(--muted); font-size: .75rem; }

.detail { width: 100%; }
.back-link { display: inline-block; }
.detail-back { margin-top: 6px; }
.detail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}
.detail-heading h1, .detail-heading p { margin-bottom: 0; }
.detail-heading p { color: var(--muted); font-size: .8125rem; white-space: nowrap; }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  align-items: start;
  gap: 18px;
}

.viewer-column { min-width: 0; }
.player-stage {
  position: relative;
  width: 100%;
  height: min(860px, calc(100dvh - 112px));
  min-height: 440px;
  overflow: hidden;
  background: var(--soft);
}

.player-stage iframe {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.player-stage:fullscreen,
.player-stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  min-height: 0;
  background: #fff;
}

.loading-panel {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .8125rem;
  background: var(--soft);
}

.loading-panel.is-hidden { display: none; }

.work-panel {
  position: sticky;
  top: 42px;
  display: flex;
  flex-direction: column;
  height: min(860px, calc(100dvh - 112px));
  max-height: min(860px, calc(100dvh - 112px));
  overflow: hidden;
}

.edition-controls {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  min-height: 38px;
  background: var(--soft);
}

.edition-controls span { padding: 8px 4px; text-align: center; font-size: .8125rem; }
.edition-controls button { height: 38px; color: var(--ink); font-size: 1rem; }
.edition-controls button:disabled { color: #b8b8b8; cursor: default; }

.panel-actions,
.external-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  padding: 13px 0;
}

.panel-actions button,
.external-links a { color: var(--ink); font-size: .8125rem; }
.external-links [hidden] { display: none; }

.minter-block {
  display: grid;
  gap: 3px;
  padding: 7px 0 12px;
}
.minter-block[hidden] { display: none; }
.panel-label { color: var(--muted); font-size: .75rem; }
.minter-name {
  width: fit-content;
  max-width: 100%;
  font-size: .875rem;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.minter-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.minter-address {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .6875rem;
  line-height: 1.45;
}

.seed {
  overflow-wrap: anywhere;
  margin: 2px 0 18px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .6875rem;
}

.mint-section {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding-top: 1px;
}
.mint-section h2 { margin-bottom: 8px; }
.mint-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 8px 6px;
  min-height: 0;
  overflow: auto;
  padding-right: 3px;
  scrollbar-width: thin;
}

.mint-item {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: .6875rem;
  line-height: 1.2;
  text-decoration: none;
}

.mint-image-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--soft);
}
.mint-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mint-number { display: block; padding-top: 3px; }
.mint-item:hover { color: var(--ink); }
.mint-item.is-active .mint-image-wrap { box-shadow: inset 0 0 0 2px var(--ink); }
.mint-item.is-active { color: var(--ink); }

@media (min-width: 1320px) {
  .works-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .detail-layout { display: block; }
  .player-stage {
    height: auto;
    min-height: 0;
    aspect-ratio: var(--work-ratio, 1);
  }
  .work-panel {
    position: static;
    display: block;
    height: auto;
    max-height: none;
    margin-top: 10px;
    overflow: visible;
  }
  .mint-section { display: block; }
  .mint-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 680px) {
  .site-header { min-height: 32px; padding: 0 12px; }
  .site-name { font-size: .75rem; }
  main { padding: 6px 12px 42px; }
  .catalog-controls { align-items: flex-start; }
  .filters { gap: 12px; }
  .order-controls { gap: 12px; }
  .works-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 21px 7px; }
  .work-title { font-size: .75rem; }
  .work-meta { font-size: .6875rem; }
  .detail-heading { display: block; }
  .detail-heading h1 { margin-bottom: 3px; }
  .mint-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  .works-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mint-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
