/* PHYSICS LAB - player gallery (loads after style.css) */
body.is-gallery { overflow: auto; -webkit-user-select: auto; user-select: auto; }

.gal {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 28px);
}

.gal__top { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; }
.gal__top .iconbtn { text-decoration: none; flex: 0 0 auto; }
.gal__title { flex: 1 1 auto; min-width: 0; }
.gal__kicker {
  display: block;
  font: 800 10px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 4px;
}
.gal__title h1 { margin: 0; font-size: clamp(20px, 5vw, 26px); letter-spacing: -0.01em; }
/* phones: the create button keeps only its + (label stays for screen readers) so the title fits one line */
@media (max-width: 440px) {
  .gal__top { gap: 8px; }
  .gal__top > .btn--sm { padding: 10px; }
  .gal__top > .btn--sm span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.btn--sm { padding: 10px 14px; font-size: 12px; letter-spacing: 0.12em; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

.gal__controls {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  gap: 10px;
  padding: 10px 0 12px;
  background: linear-gradient(180deg, var(--bg) 78%, rgba(7, 11, 18, 0));
}
@media (min-width: 720px) { .gal__controls { grid-template-columns: auto 1fr; align-items: center; } }

.seg {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  justify-self: start;
}
.seg__btn {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: 700 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.08em;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg__btn.is-on { background: var(--accent); color: var(--accent-ink); }
.seg__btn:not(.is-on):hover { color: var(--text); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 224, 207, 0.15); }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: 15px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 11px 0;
}

.gal__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .gal__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .gal__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }

.card {
  display: grid;
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: rgba(63, 224, 207, 0.35); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.card:active { transform: scale(0.985); }
.card__pic { display: block; width: 100%; aspect-ratio: 540 / 900; background: #0b1420; }
.card__body { padding: 10px 11px 11px; display: grid; gap: 3px; min-width: 0; }
.card__name { margin: 0; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__by { margin: 0; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__stats {
  margin: 4px 0 0;
  display: flex;
  gap: 10px;
  font: 600 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: rgba(220, 234, 245, 0.7);
}
.card__stats .is-liked { color: #ff7a93; }

.card--skel .card__pic { animation: shimmer 1.2s ease-in-out infinite; }
.card--skel i { display: block; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.06); }
.card--skel i + i { width: 60%; }
@keyframes shimmer { 50% { opacity: 0.55; } }

.gal__empty { grid-column: 1 / -1; text-align: center; padding: 56px 16px; display: grid; justify-items: center; gap: 8px; }
.gal__empty h2 { margin: 0; font-size: 18px; }
.gal__empty p { margin: 0 0 10px; color: var(--muted); font-size: 14px; max-width: 420px; }
.gal__empty .btn { text-decoration: none; }

.gal__more { display: grid; justify-items: center; margin-top: 18px; }
.gal__foot { margin: 26px auto 0; max-width: 560px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.6; }
.gal__foot a { color: var(--accent); }
.is-gallery .toast { position: fixed; top: auto; bottom: calc(env(safe-area-inset-bottom) + 18px); }

/* ---------------- CJK: tracked mono labels ----------------
 * Wide letter-spacing and a monospace fallback make Hangul / kana / hanzi look
 * spaced out ("에 디 터"). In these languages the translated labels keep the mono
 * face for Latin characters but take a proper CJK face and near-zero tracking. */
html:is(:lang(ko), :lang(ja), :lang(zh-Hans), :lang(zh-Hant)) :is(.seg__btn, .btn--sm) {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, var(--cjk, sans-serif), monospace;
  letter-spacing: 0.01em;
}
