/* ============================================================================
   build.css — Build editor + build card styles.

   MHUR Tuning Optimizer — fan-made tool for My Hero Ultra Rumble.
   Author: RDH
   ============================================================================ */

.build-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.build-costume-panel {
  text-align: center;
}
.build-hint {
  color: var(--text-dim);
  font-size: 12.5px;
  margin: -6px 0 16px;
}
.build-slot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.build-slot-grid .slot-col {
  min-width: 0;
}
@media (max-width: 700px) {
  .build-slot-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.build-slot-item {
  margin-bottom: 10px;
}
.build-slot-select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 12.5px;
  margin-top: 4px;
}
.build-face-select {
  margin-top: 4px;
}
.build-face-select .face-select-btn {
  font-size: 12.5px;
  padding: 7px 8px;
}
/* Split slot trigger: main button (left, grows) opens with search/keyboard;
   the ☰ button (right) opens the list to browse without the keyboard. The ☰ is
   hidden on desktop (no keyboard problem there) and shown via mobile.css. */
/* The slot trigger is ONE rectangle. The ☰ is the RIGHT END of that same
   rectangle, marked off by a hairline divider - not a detached square button
   floating beside it. The wrapper owns the border/radius; the two buttons inside
   are borderless and transparent so they read as a single control. (RDH) */
.build-face-select .fs-trigger {
  display: flex;
  align-items: stretch;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.build-face-select .fs-trigger .face-select-btn {
  flex: 1;
  min-width: 0;
  width: auto;
  background: transparent;
  border: none;
  border-radius: 0;
}
.fs-menu-btn {
  /* Desktop hides this: there is no pop-up keyboard to dodge there. Shown on
     mobile (see mobile.css), where it opens the list WITHOUT the keyboard. */
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border); /* just a divider inside the rectangle */
  border-radius: 0;
  color: var(--text-dim);
  padding: 0 13px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.fs-menu-btn:active {
  background: #222a35;
  color: var(--text);
}

.build-save-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.publish-btn {
  background: var(--panel-2);
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.publish-btn:hover {
  background: #241f12;
}
.build-save-status {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
}
.build-save-status a {
  color: var(--hero);
}

.builds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
  min-width: 0;
}
.build-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.build-card:hover {
  border-color: var(--hero);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Image banner header */
.bc-banner {
  position: relative;
  height: 150px;
  background: #0c0f14;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bc-banner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}
.build-card:hover .bc-banner img {
  transform: scale(1.04);
}
.bc-banner-grad {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(12, 15, 20, 0.9), transparent);
}
.bc-stars-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: rgba(12, 15, 20, 0.82);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.bc-upvote-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(12, 15, 20, 0.82);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s,
    transform 0.1s;
}
.bc-upvote-badge:hover {
  color: var(--gold);
  border-color: var(--gold);
}
.bc-upvote-badge:active {
  transform: scale(0.92);
}
.bc-upvote-badge.has-votes {
  color: var(--gold);
}
.bc-upvote-badge.active {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(36, 31, 18, 0.9);
}
.bc-author-link {
  color: #4a7cf6;
  cursor: pointer;
}
.bc-author-link:hover {
  text-decoration: underline;
}
.bc-published-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(12, 15, 20, 0.82);
  color: var(--gold);
  border: 1px solid var(--gold);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* Info body */
.build-card .bc-info {
  flex: 1;
  min-width: 0;
  padding: 12px 13px 13px;
  display: flex;
  flex-direction: column;
}
.build-card .bc-name {
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: 3px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.build-card .bc-meta {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.build-card .bc-submeta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.bc-build-summary {
  font-size: 11.5px;
  margin-top: 7px;
  line-height: 1.5;
}
.bc-special-line {
  color: var(--gold);
  font-weight: 600;
}
.bc-top-tunings {
  color: var(--text-dim);
  margin-top: 2px;
}
.bc-top-tunings strong {
  color: var(--text);
  font-weight: 700;
}

.bc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

/* Action row - primary button grows, icon buttons stay compact */
.build-card .bc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 11px;
}
.build-card button {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  transition:
    color 0.12s,
    border-color 0.12s,
    background 0.12s;
}
.build-card button:hover {
  color: var(--text);
  border-color: var(--hero);
}
.build-card button.bc-primary {
  flex: 1;
  color: var(--text);
  font-weight: 600;
  min-width: 70px;
}
.build-card button.bc-primary:hover {
  background: var(--hero);
  border-color: var(--hero);
  color: #fff;
}
.build-card button.upvote.active {
  color: var(--gold);
  border-color: var(--gold);
}
.build-card button.favorite.active {
  color: var(--gold);
  border-color: var(--gold);
}
.build-card button.bc-delete {
  font-size: 15px;
  line-height: 1;
  padding-top: 4px;
  padding-bottom: 4px;
}
.build-card button.bc-delete:hover {
  color: #f87171;
  border-color: #f87171;
}
.tag-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 14px;
}
.tag-chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
}
.tag-chip:hover {
  color: var(--text);
  border-color: var(--hero);
}
.tag-chip.active {
  color: var(--gold);
  border-color: var(--gold);
  background: #241f12;
}

.preview-banner {
  background: #241f12;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  margin-bottom: 16px;
}

.build-search-input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
}
.build-search-input:focus {
  border-color: var(--hero);
}
.sort-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.sort-tab {
  padding: 6px 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
}
.sort-tab.active {
  color: var(--gold);
  border-color: var(--gold);
  background: #241f12;
}

/* Build Card (shareable image) */
.build-card-sheet {
  background: linear-gradient(180deg, #161b22, #11151c);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: 480px;
  margin: 0 auto;
}
/* #buildCardPreview is the scale-clipping viewport around .build-card-sheet -
   see "Mobile build card scaling" in buildcard.js. The sheet itself always
   renders at a fixed 480px desktop width/layout; on narrow screens JS scales
   the whole thing down with a CSS transform instead of letting it reflow, so
   it looks identical (just smaller) to the downloaded PNG instead of growing
   tall from stacked rows. */
#buildCardPreview {
  width: 100%;
  overflow: hidden;
}
.bcard-header {
  display: flex;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.bcard-costume-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  border-radius: 8px;
  background: #0c0f14;
  flex-shrink: 0;
}
.bcard-build-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--gold);
}
.bcard-costume-name {
  font-size: 13px;
  color: var(--text);
  margin-top: 3px;
}
.bcard-stars {
  margin-top: 4px;
}
.bcard-section {
  margin-bottom: 14px;
}
.bcard-section h5 {
  margin: 0 0 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.bcard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--panel-2);
  margin-bottom: 4px;
  font-size: 12px;
}
.bcard-row-label {
  color: var(--text-dim);
  min-width: 90px;
  flex-shrink: 0;
  font-size: 10.5px;
}
.bcard-row-skill {
  font-weight: 700;
  flex: 1;
}
.bcard-row-source {
  color: var(--text-dim);
  font-size: 10.5px;
}
.bcard-row-empty {
  opacity: 0.5;
}
.bcard-row-doubled {
  border: 1.5px solid var(--fixer);
}
.bcard-row-empty-text {
  font-style: italic;
  color: var(--text-dim);
  font-size: 11.5px;
}
.bcard-footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-dim);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.bcard-link {
  text-align: center;
  font-size: 10.5px;
  color: var(--hero);
  word-break: break-all;
  margin-top: 4px;
}
/* ^ see PROJECT_KNOWLEDGE.md "Share link baked into the build card" */

/* ===================== Mobile / touch responsiveness ===================== */
@media (max-width: 900px) {
  .build-layout {
    padding: 14px 16px;
  }
}

@media (max-width: 700px) {
  /* NOTE: the build card used to reflow here (stacked header, wrapped rows)  (RDH)
     to fit a phone screen, which made it grow very tall vertically - much
     taller than the same card looks when downloaded as a PNG and viewed on
     a phone, since the PNG is just a fixed-layout image scaled down to fit,
     not reflowed. Reflowing is no longer done at all, at any width: the
     card's internal HTML/CSS layout (header side-by-side, rows side-by-side)
     now always stays exactly as built for desktop, and `buildcard.js`
     (`fitBuildCardToContainer`) uses a CSS transform:scale on the whole
     `.build-card-sheet` to shrink it down to fit `#buildCardPreview`'s
     actual width on narrow screens - same effect as viewing the downloaded
     image at a smaller size. See "Mobile build card scaling" in
     PROJECT_KNOWLEDGE.md.
  */

  /* The card itself scales to fit (see fitBuildCardToContainer above), but
     it was still scaling down more than it needed to on phones because
     .build-card-panel kept its normal desktop side padding/border, eating
     into the width available to scale against - the live card ended up
     visibly smaller than the same card looks as a downloaded image on the
     same phone, with a lot of dead border space around it. On mobile only,
     pull the panel out to the screen edges (negative margin cancelling
     .build-layout's 16px side padding from the 900px rule above) and trim
     its own side padding way down, so #buildCardPreview gets close to the
     full screen width and the card scales up accordingly. Doesn't touch the
     desktop/tablet look at all - only active under this breakpoint.
     Top/bottom padding and the panel's other content (heading, buttons)
     are untouched; only left/right space is reclaimed. */
  .build-card-panel {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 8px;
    padding-right: 8px;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }
}

@media (max-width: 480px) {
  .builds-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================== EXPERIMENTAL: Undo/Redo + Presets ===================== */
.undo-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.undo-btn:hover:not(:disabled) {
  border-color: var(--hero);
  color: var(--text);
}
.undo-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.presets-panel {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.presets-panel h4 {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
}
.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.preset-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.preset-chip:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Same offscreen-rendering skip as .costume-card in style.css - build lists
   can also get long, and every card runs a totals computation for its
   summary line. */
.build-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

/* ===================== Author page ===================== */
.author-header {
  margin: 4px 0 8px;
}
.author-name-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
  background: linear-gradient(90deg, var(--hero), var(--villain));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.author-stats {
  color: var(--text-dim);
  font-size: 13px;
}

/* Author byline on the build-view page */
.build-author-line {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 12px;
}
.build-author-name {
  color: #4a7cf6;
  cursor: pointer;
  font-weight: 600;
}
.build-author-name:hover {
  text-decoration: underline;
}

/* Report (flag) button on build cards */
.bc-report {
  color: var(--text-dim);
  opacity: 0.6;
  padding: 6px 9px !important;
}
.bc-report:hover {
  color: #f87171 !important;
  border-color: #f87171 !important;
  opacity: 1;
}

/* ===================== Loading skeletons ===================== */
.skeleton-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.skeleton-banner {
  height: 150px;
  background: var(--panel-2);
}
.skeleton-body {
  padding: 12px 13px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: var(--panel-2);
}
.skeleton-line.short {
  width: 55%;
}
.skeleton-line.med {
  width: 75%;
}
.skeleton-shimmer {
  position: relative;
  overflow: hidden;
}
.skeleton-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  transform: translateX(-100%);
  animation: skeleton-sweep 1.3s infinite;
}
@keyframes skeleton-sweep {
  100% {
    transform: translateX(100%);
  }
}
html.mobile-ui .skeleton-banner {
  height: 118px;
}

/* ===================== Top Builders strip ===================== */
.top-builders {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 4px;
}
.top-builders-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 9px;
}
.top-builders-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.builder-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  color: var(--text);
  font-size: 12.5px;
  transition:
    border-color 0.12s,
    transform 0.1s;
}
.builder-chip:hover {
  border-color: var(--hero);
  transform: translateY(-1px);
}
.builder-rank {
  color: var(--text-dim);
  font-weight: 700;
  font-size: 11px;
}
.builder-name {
  font-weight: 600;
}
.builder-votes {
  color: var(--gold);
  font-weight: 700;
  font-size: 11.5px;
}

/* ---------- Tuning Totals: "Include Special Tuning effects" ---------- (RDH)
   Checkboxes for Special Tunings that SCALE a whole stat family (Embrittlement
   ×1.1 Attack, Revenge Technical ×1.5 Reload, Revenge Assault ×0.80 damage taken).
   Only specials actually equipped in the build appear here. */
.tt-specials {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--panel-2);
}
.tt-specials-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.tt-special {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 4px 0;
  cursor: pointer;
  flex-wrap: wrap;
}
.tt-special input { cursor: pointer; flex-shrink: 0; }
.tt-special-name { font-weight: 600; color: var(--text); }
.tt-special-eff  { color: var(--gold); font-size: 11.5px; }
/* Equipped, but there's nothing of that family to scale - say so rather than
   leaving a checkbox that silently does nothing. */
.tt-special-empty { cursor: default; opacity: 0.5; }
.tt-special-none  { color: var(--text-dim); font-size: 11px; font-style: italic; }
.tt-specials-note {
  margin-top: 7px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}
/* A total currently being scaled by a ticked special. */
.tt-val-boosted {
  text-shadow: 0 0 9px rgba(232, 184, 74, 0.45);
}
