/* Avatar gallery: same terminal palette as bt10x.css and avatar.css. */

#gallery-app {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px 16px;
  gap: 12px;
}

#gallery-head,
#notice,
#view {
  width: 100%;
  max-width: 960px;
}

/* After a submission: "submitted", "already in the gallery", … */
#notice {
  margin: 0;
  text-align: center;
  color: var(--c-green);
}

#notice:empty {
  display: none;
}

/* One render's content; the grid and headers lay out as #view's own children. */
.view-body {
  display: contents;
}

#gallery-head {
  text-align: center;
}

#head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

#whoami {
  flex: 1;
  margin: 0;
  font-size: 12px;
  color: var(--c-dim);
  text-align: left;
}

/* "move key" sits in the line like a link. */
#whoami .link-button {
  padding: 0;
  font: inherit;
  color: var(--c-green);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}

#whoami .pid {
  color: var(--c-white);
}

/* Sized like the language buttons, and as tall: #lang stretches those to
   its tallest (Hangul) line. */
#home-link {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 11px;
}

#gallery-head h1 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.2em;
}

/* Plain links; link buttons keep their own colours and hover. */
#gallery-app a:not(.link-button) {
  color: var(--c-green);
}

#gallery-head h1 a {
  text-decoration: none;
}

.hint {
  margin: 4px 0 0;
  font-size: 12px;
}

#tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  background: #101410;
  min-width: 0;
}

/* The avatar just submitted, first under "new". */
.card.just-added {
  border-color: var(--c-green);
  outline: none;
}

.card-art {
  display: block;
  text-decoration: none;
  border-radius: 3px;
  padding: 2px 4px;
}

.card-art:hover,
.card-art:focus-visible {
  background: var(--cb-green);
  outline: none;
}

.art {
  margin: 0;
  font-family: var(--mono-ff);
  font-size: 20px;
  line-height: var(--board-lh);
  color: var(--c-white);
}

.card-unit {
  font-size: 12px;
  text-align: center;
  overflow-wrap: anywhere;
}

.no-mech {
  color: var(--c-dim);
  font-style: italic;
}

.card-by {
  font-size: 11px;
  color: var(--c-dim);
}

.card-by.mine {
  color: var(--c-yellow);
}

.card-count {
  font-size: 11px;
  color: var(--c-dim);
}

.card-foot {
  display: flex;
  gap: 6px;
  /* Pin the like button to the card's bottom, so a row's buttons line up
     whatever the 'Mech name's length. */
  margin-top: auto;
}

.link-button.vote {
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.link-button.vote[aria-pressed="true"] {
  color: var(--c-yellow);
  border-color: var(--c-yellow);
  background: var(--cb-yellow);
}

.link-button.quiet {
  color: var(--c-dim);
  cursor: pointer;
}

.link-button.danger:hover {
  color: var(--c-red);
  border-color: var(--c-red);
  background: var(--cb-red);
}

.more {
  display: block;
  margin: 12px auto 0;
  cursor: pointer;
}

.empty,
.error {
  text-align: center;
  color: var(--c-dim);
}

.error {
  color: var(--c-red);
}

.unit-head,
.entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.unit-head h2,
.others h2 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--c-white);
  font-weight: normal;
}

.others h2 {
  margin-top: 20px;
  text-align: center;
}

.unit-art {
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  background: #101410;
}

.unit-art img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.no-image {
  color: var(--c-dim);
  font-size: 11px;
}

.entry-art .art {
  font-size: 48px;
}

.entry-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.entry-unit {
  font-size: 14px;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.mech-search {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.mech-search input {
  width: min(320px, 100%);
  font-family: inherit;
  font-size: 13px;
  color: var(--c-white);
  background: #101410;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  padding: 6px 8px;
}

.mech-search input:focus-visible {
  outline: none;
  border-color: var(--c-yellow);
}

.turnstile-host:empty {
  display: none;
}

/* Turnstile shows a checkbox only when Cloudflare asks for one; keep it in view. */
.turnstile-host {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

/* Submit panel, opened by the creator's "submit to gallery" link, and the
   key panel; same look as the creator's snippet panel (avatar.css). */
:is(#submit-panel, #key-panel) {
  width: min(64ch, calc(100vw - 16px));
  padding: 8px 12px;
  color: var(--c-white);
  background: var(--c-panel);
  border: 1px solid var(--c-green);
  border-radius: 4px;
}

:is(#submit-panel, #key-panel)[open],
#submit-form,
#key-panel .gp-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#submit-form[hidden] {
  display: none;
}

:is(#submit-panel, #key-panel) .gp-title {
  color: var(--c-green);
  font-weight: bold;
  letter-spacing: 0.15em;
}

:is(#submit-panel, #key-panel) .gp-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

:is(#submit-panel, #key-panel) .gp-buttons {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

:is(#submit-panel, #key-panel)::backdrop {
  background: rgb(0 0 0 / 0.5);
}

:is(#submit-panel, #key-panel) .hint {
  margin: 0;
}

#submit-preview {
  margin: 0 auto;
  font-family: var(--mono-ff);
  font-size: 28px;
  line-height: var(--board-lh);
}

#submit-mul,
#key-panel .gp-input {
  width: 100%;
  padding: 6px;
  color: var(--c-white);
  background: #000;
  border: 1px solid var(--c-dim);
  font: 12px / 1.3 var(--board-ff, monospace);
}

#submit-mul:focus-visible,
#key-panel .gp-input:focus-visible {
  outline: none;
  border-color: var(--c-yellow);
}

#submit-who,
#key-panel .gp-label,
#key-panel .gp-note {
  margin: 0;
  font-size: 12px;
  color: var(--c-dim);
}

#submit-turnstile:empty,
#submit-status:empty,
#key-panel .gp-note:empty,
#key-panel [hidden],
#key-status:empty {
  display: none;
}

#submit-status,
#key-status {
  margin: 0;
  font-size: 12px;
}

#submit-status.error,
#key-status.error {
  color: var(--c-red);
}

@media (max-width: 480px) {
  /* Buttons keep the top line; the player ID drops below them. */
  #head-row {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  #whoami {
    order: 3;
    flex-basis: 100%;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }
  .art {
    font-size: 17px;
  }
  .entry-art .art {
    font-size: 40px;
  }
}
