.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-connect {
  padding: 8px 11px;
  font-size: 12px;
}

.wallet-disconnect {
  padding: 8px 11px;
  font-size: 12px;
}

.wallet-account {
  min-width: 86px;
  color: var(--muted);
  font: 11px var(--mono);
}

.media-heading h1 {
  margin-bottom: 12px;
}

.media-gallery {
  --gallery-card-min: 235px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--gallery-card-min)), 1fr));
  gap: 18px;
  align-items: start;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: -8px 0 18px;
  color: var(--muted);
  font: 12px var(--mono);
}

.gallery-toolbar button {
  min-width: 38px;
  padding: 7px 10px;
}

.gallery-toolbar output {
  min-width: 152px;
  text-align: center;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.media-frame {
  position: relative;
  display: grid;
  min-height: min(68vh, 720px);
  place-items: center;
  overflow: hidden;
  background: #0d1210;
  color: inherit;
  text-decoration: none;
}

.media-frame img,
.media-frame video,
.media-frame iframe {
  width: 100%;
  height: min(68vh, 720px);
  border: 0;
  object-fit: contain;
}

.audio-preview {
  display: grid;
  width: min(720px, 86%);
  gap: 28px;
  color: white;
  font: 32px var(--serif);
  text-align: center;
}

.audio-preview audio {
  width: 100%;
}

.media-state,
.media-timer {
  position: absolute;
  top: 18px;
  z-index: 2;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  color: white;
  font: 700 12px var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.media-state {
  left: 18px;
  background: #49524d;
}

.media-state.ready,
.media-state.confirmed {
  background: var(--green);
}

.media-state.live {
  background: #8a5a00;
}

.media-state.challenged {
  background: var(--red);
}

.media-timer {
  right: 18px;
  background: rgba(18, 24, 21, .9);
}

.media-caption {
  padding: 22px 26px 26px;
}

.media-caption h2 {
  max-width: 900px;
  margin-bottom: 10px;
}

.media-gallery .media-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.media-gallery .media-card:hover {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  box-shadow: 0 12px 30px rgba(15, 28, 22, .1);
  transform: translateY(-2px);
}

.media-gallery .media-frame {
  min-height: 0;
  height: auto;
  aspect-ratio: 4 / 3;
}

.media-gallery .media-frame > img,
.media-gallery .media-frame > video,
.media-gallery .media-frame > iframe,
.media-gallery .media-zoom-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-gallery .media-frame > video,
.media-gallery .media-frame > iframe {
  object-fit: contain;
}

.media-zoom-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: zoom-in;
}

.media-zoom-open img {
  display: block;
  transition: transform 180ms ease;
}

.media-zoom-open:hover img,
.media-zoom-open:focus-visible img {
  transform: scale(1.035);
}

.media-zoom-open:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: -3px;
}

.media-gallery .media-state,
.media-gallery .media-timer {
  top: 10px;
  padding: 6px 9px;
  font-size: 10px;
}

.media-gallery .media-state {
  left: 10px;
}

.media-gallery .media-timer {
  right: 10px;
}

.media-gallery .media-caption {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 14px 15px 16px;
}

.media-gallery .media-caption h2 {
  display: -webkit-box;
  margin-bottom: 7px;
  overflow: hidden;
  font-size: clamp(17px, 1.7vw, 21px);
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.media-gallery .media-caption h2 a {
  color: inherit;
  text-decoration: none;
}

.media-gallery .media-caption h2 a:hover {
  color: var(--green);
}

.media-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 13px;
  font: 12px var(--mono);
}

.media-lightbox {
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .42);
}

.media-lightbox::backdrop {
  background: rgba(6, 10, 8, .82);
  backdrop-filter: blur(4px);
}

.lightbox-header,
.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}

.lightbox-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.lightbox-header h2 {
  max-width: min(760px, 75vw);
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-header .lightbox-close {
  min-width: 42px;
  font-size: 22px;
}

.lightbox-viewport {
  display: flex;
  align-items: flex-start;
  min-height: 360px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  background: #090d0b;
}

.lightbox-viewport img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: auto;
  transform-origin: center top;
  transition: width 120ms ease;
}

.lightbox-controls {
  justify-content: center;
  border-top: 1px solid var(--line);
}

.lightbox-controls button {
  min-width: 42px;
}

.lightbox-controls output {
  min-width: 52px;
  color: var(--muted);
  font: 12px var(--mono);
  text-align: center;
}

.lightbox-controls .button {
  margin-left: auto;
}

.media-missing {
  color: #cbd2ce;
  font: 14px var(--mono);
}

@media (max-width: 760px) {
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .wallet-account {
    display: none;
  }

  .media-frame.compact,
  .media-frame.compact img,
  .media-frame.compact video,
  .media-frame.compact iframe {
    min-height: 54vh;
    height: 54vh;
  }

  .gallery-toolbar {
    justify-content: center;
    margin-top: 0;
  }

  .gallery-toolbar > span {
    display: none;
  }

  .gallery-toolbar output {
    min-width: 138px;
  }

  .media-gallery {
    gap: 12px;
  }

  .media-gallery .media-frame {
    min-height: 0;
    height: auto;
  }

  .media-gallery .media-caption {
    padding: 10px 10px 12px;
  }

  .media-gallery .media-caption h2 {
    font-size: 15px;
    -webkit-line-clamp: 2;
  }

  .media-gallery .media-caption .meta {
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .media-card-actions {
    gap: 7px;
    padding-top: 9px;
    font-size: 10px;
  }

  .media-lightbox {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .lightbox-header {
    padding: 12px;
  }

  .lightbox-header h2 {
    max-width: 68vw;
    font-size: 17px;
  }

  .lightbox-viewport {
    min-height: 280px;
    max-height: calc(100vh - 180px);
  }

  .lightbox-controls {
    flex-wrap: wrap;
    padding: 10px;
  }

  .lightbox-controls .button {
    width: 100%;
    margin-left: 0;
    text-align: center;
  }

  .media-state,
  .media-timer {
    top: 10px;
    padding: 6px 9px;
    font-size: 10px;
  }

  .media-state {
    left: 10px;
  }

  .media-timer {
    right: 10px;
  }
}
