/* Forja Shinobi v4 — layout mobile-first no visual do arquivo shinobi.
   Carregado depois de crafting-v2/v3.css para substituir a grade antiga. */

.nrmt-smith-overlay {
  position: fixed;
  z-index: 990200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(6px, 2vw, 22px);
  background: rgba(4, 7, 8, .86);
  backdrop-filter: blur(4px);
  font-family: "Segoe UI", Arial, sans-serif;
}

.nrmt-smith-overlay[hidden] { display: none; }

.nrmt-smith-window {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(1080px, 100%);
  height: min(820px, 100%);
  /* A faixa da moldura PNG ocupa a borda; o padding mantém cabeçalho, lista e
     rodapé fora dela — mesma área segura usada na Coleção de Ninjas. */
  padding: 33px 31px 29px;
  overflow: hidden;
  border: 1px solid rgba(199, 149, 69, .4);
  border-radius: 3px;
  background:
    radial-gradient(circle at 78% 0, rgba(121, 191, 216, .055), transparent 28%),
    linear-gradient(145deg, #0f1518, #070a0c 64%);
  box-shadow: 0 28px 84px rgba(0, 0, 0, .78), inset 0 0 36px rgba(0, 0, 0, .42);
}

/* Moldura modular da janela (window-frame.png). */
.nrmt-smith-frame {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: block;
  box-sizing: border-box;
  border: 28px solid transparent;
  border-image-source: var(--nrmt-archive-window-frame);
  border-image-slice: 126 118;
  border-image-width: 28px;
  border-image-repeat: stretch;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .85));
}

.nrmt-smith-window > :not(.nrmt-smith-frame) { position: relative; z-index: 2; }

/* ------------------------------------------------------------------ header */
.nrmt-smith-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px clamp(10px, 2vw, 16px);
  border-bottom: 1px solid #6b5326;
  background: linear-gradient(#2b3134, #1a1f22);
}

.nrmt-smith-title small { display: block; color: #8e9896; font-size: 9.5px; font-weight: 900; letter-spacing: .22em; }
.nrmt-smith-title h2 { margin: 3px 0 0; color: #e7b63e; font: clamp(16px, 3.4vw, 23px) NinjaTitle, Georgia, serif; letter-spacing: .06em; }

.nrmt-smith-wallet { display: grid; justify-items: end; gap: 3px; }
.nrmt-smith-wallet span { color: #94a09d; font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.nrmt-smith-wallet b { display: flex; align-items: center; gap: 5px; color: #f0c75b; font-size: clamp(11px, 2.6vw, 14px); font-variant-numeric: tabular-nums; }
.nrmt-smith-wallet i { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid #7d5f22; background: #2a2110; color: #e9c26b; font-size: 10px; font-style: normal; }

.nrmt-smith-close {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent no-repeat center / contain;
  background-image: var(--nrmt-archive-close);
  cursor: pointer;
}
.nrmt-smith-close:hover { filter: brightness(1.15); }

/* ----------------------------------------------------------------- filtros */
.nrmt-smith-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 9px clamp(10px, 2vw, 16px);
  border-bottom: 1px solid #3a3f42;
  background: #12181a;
}

.nrmt-smith-search {
  display: flex;
  flex: 1 1 190px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid #46504f;
  background: #0b1012;
}
.nrmt-smith-search span { color: #7d8a88; font-size: 13px; }
.nrmt-smith-search input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #e2ddd0;
  font-size: 12px; /* 16px-safe: iOS só faz zoom abaixo de 16px em focus, mas o
                      shell trava o viewport, então 12px continua legível */
}

.nrmt-smith-only { display: flex; align-items: center; gap: 6px; min-height: 38px; color: #9fa9a7; font-size: 10px; cursor: pointer; }
.nrmt-smith-only input { width: 22px; height: 22px; accent-color: #c08a2c; }

/* Chips SEMPRE quebram linha: era daqui que vinha o estouro de 418px. */
.nrmt-smith-chips { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.nrmt-smith-chips button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-image-source: var(--nrmt-archive-button-frame);
  border-image-slice: 56 188;
  border-image-width: 7px 14px;
  border-image-repeat: stretch;
  border-radius: 2px;
  background: linear-gradient(180deg, #11181b, #080c0e);
  color: #939d9b;
  font: 900 10px/1 NinjaUI, Arial, sans-serif;
  letter-spacing: .06em;
  cursor: pointer;
}
.nrmt-smith-chips button.is-active { background: linear-gradient(180deg, #4a3410, #241905); color: #ffd98a; box-shadow: 0 0 9px rgba(199, 149, 69, .3); }
.nrmt-smith-chips--slots button { font-size: 9.5px; padding: 0 9px; }

/* -------------------------------------------------------------------- corpo */
.nrmt-smith-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 356px);
  flex: 1;
  min-height: 0;
}

.nrmt-smith-listwrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid #333a3c; }
.nrmt-smith-listhead { padding: 7px clamp(10px, 2vw, 14px); border-bottom: 1px solid #2b3133; background: #0f1416; }
.nrmt-smith-listhead b { color: #8d9795; font-size: 9px; font-weight: 900; letter-spacing: .16em; }

.nrmt-smith-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 208px), 1fr));
  align-content: start;
  gap: 7px;
  flex: 1;
  min-height: 0;
  padding: clamp(8px, 2vw, 12px);
  overflow: auto;
  overscroll-behavior: contain;
}

.nrmt-smith-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  /* Sem min-height: como item de grid o card era travado nessa altura e o
     selo de situação vazava para fora. Quem manda no tamanho é o conteúdo. */
  padding: 9px;
  border: 1px solid transparent;
  border-image-source: var(--nrmt-archive-panel-frame);
  border-image-slice: 104 122;
  border-image-width: 12px;
  border-image-repeat: stretch;
  border-radius: 2px;
  background:
    radial-gradient(circle at 14% 42%, rgba(121, 191, 216, .08), transparent 36%),
    linear-gradient(145deg, #11181b, #090d0f 72%);
  box-shadow: 0 6px 17px rgba(0, 0, 0, .42);
  text-align: left;
  cursor: pointer;
  transition: filter .15s ease, box-shadow .15s ease;
}
.nrmt-smith-card:hover { filter: brightness(1.08); }
.nrmt-smith-card.is-ready { box-shadow: inset 3px 0 #66b987, 0 0 0 1px rgba(102, 185, 135, .3), 0 6px 17px rgba(0, 0, 0, .42); }
.nrmt-smith-card.is-locked { opacity: .5; }
.nrmt-smith-card.is-selected {
  background:
    radial-gradient(circle at 14% 42%, rgba(199, 149, 69, .2), transparent 40%),
    linear-gradient(145deg, #1d1a10, #090d0f 74%);
  box-shadow: inset 3px 0 #c79545, 0 0 0 1px rgba(199, 149, 69, .38), 0 8px 20px rgba(0, 0, 0, .5);
}

.nrmt-smith-card__art {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 56px;
  height: 62px;
  padding: 9px 7px 6px;
  overflow: hidden;
  border: 1px solid transparent;
  border-image-source: var(--nrmt-archive-portrait-frame);
  border-image-slice: 112 106;
  border-image-width: 11px;
  border-image-repeat: stretch;
  border-radius: 2px;
  background: radial-gradient(circle at 50% 47%, rgba(121, 191, 216, .16), transparent 63%), #070b0d;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, .52);
}
.nrmt-smith-card__art img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.nrmt-smith-card__body { display: grid; gap: 2px; min-width: 0; }
.nrmt-smith-card__body strong { overflow: hidden; color: #ece6d6; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.nrmt-smith-card__body small { color: #c79f3d; font-size: 9px; font-weight: 800; letter-spacing: .05em; }
.nrmt-smith-card__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.nrmt-smith-card__flag { padding: 2px 6px; border: 1px solid #3d4749; color: #8b9694; font-size: 9.5px; font-style: normal; font-weight: 900; letter-spacing: .08em; white-space: nowrap; }
.nrmt-smith-card.is-ready .nrmt-smith-card__flag { border-color: #4d7d55; color: #8ce49b; }
.nrmt-smith-card.is-locked .nrmt-smith-card__flag { border-color: #6d4a48; color: #e08d86; }

.nrmt-smith-role { padding: 2px 6px; border: 1px solid #4a5457; color: #9aa5a3; font-size: 9.5px; font-style: normal; font-weight: 900; letter-spacing: .08em; justify-self: start; white-space: nowrap; }
.nrmt-smith-role--tank { border-color: #3f6f9e; color: #7fbcf0; }
.nrmt-smith-role--damage { border-color: #9d4740; color: #ef8e86; }
.nrmt-smith-role--support { border-color: #3f8a72; color: #7ddcbb; }
.nrmt-smith-role--all { border-color: #9a7a2c; color: #e9c76a; }

/* ------------------------------------------------------------------ detalhe */
.nrmt-smith-side { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; background: #0d1214; }
.nrmt-smith-detail { display: grid; gap: 11px; padding: clamp(11px, 2.4vw, 16px); }

.nrmt-smith-detail > header { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; }
.nrmt-smith-detail__art {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 76px;
  height: 92px;
  padding: 14px 11px 10px;
  overflow: hidden;
  border: 1px solid transparent;
  border-image-source: var(--nrmt-archive-portrait-frame);
  border-image-slice: 112 106;
  border-image-width: 15px;
  border-image-repeat: stretch;
  border-radius: 2px;
  background: radial-gradient(circle at 50% 40%, rgba(199, 149, 69, .16), transparent 58%), #080c0e;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .55);
}
.nrmt-smith-detail__art img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.nrmt-smith-detail > header small { display: block; color: #8b9593; font-size: 9.5px; font-weight: 900; letter-spacing: .16em; }
.nrmt-smith-detail > header h3 { margin: 3px 0 5px; color: #f1e7d2; font: 16px NinjaTitle, Georgia, serif; letter-spacing: .03em; }

.nrmt-smith-desc { margin: 0; color: #8f9997; font-size: 10px; line-height: 1.55; }

.nrmt-smith-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.nrmt-smith-stats li { display: flex; justify-content: space-between; gap: 5px; padding: 5px 7px; border: 1px solid #2f3a33; background: #101613; }
.nrmt-smith-stats span { color: #7f8c86; font-size: 9.5px; font-weight: 900; letter-spacing: .07em; }
.nrmt-smith-stats b { color: #96d78d; font-size: 10px; }

.nrmt-smith-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.nrmt-smith-meta span { display: grid; gap: 3px; padding: 7px 5px; border: 1px solid #343e41; background: #0c1214; text-align: center; }
.nrmt-smith-meta small { color: #737e81; font-size: 9px; font-weight: 900; letter-spacing: .11em; }
.nrmt-smith-meta b { color: #dfb03b; font-size: 11px; font-variant-numeric: tabular-nums; }
.nrmt-smith-meta b.is-bad { color: #ed6659; }

.nrmt-smith-refine { display: grid; gap: 6px; }
.nrmt-smith-refine > small { color: #8b9593; font-size: 9.5px; font-weight: 900; letter-spacing: .16em; }
.nrmt-smith-refine > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.nrmt-smith-refine button {
  display: grid; gap: 3px;
  min-height: 46px;
  padding: 6px 4px;
  border: 1px solid #343e41;
  background: #0c1214;
  color: #8d9799;
  cursor: pointer;
}
.nrmt-smith-refine button b { font-size: 10px; letter-spacing: .04em; }
.nrmt-smith-refine button span { font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.nrmt-smith-refine button.is-active { border-color: #c08a2c; background: #251c0c; color: #f2c251; }
.nrmt-smith-refine p { margin: 0; color: #7e898d; font-size: 9px; line-height: 1.45; }

.nrmt-smith-materials { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.nrmt-smith-materials li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px; border: 1px solid #3d4840; background: #101512; }
.nrmt-smith-materials li.is-missing { border-color: #573536; background: #1a1112; }
.nrmt-smith-materials img { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.nrmt-smith-materials b { display: block; overflow: hidden; color: #c2cdc4; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.nrmt-smith-materials small { color: #6fc963; font-size: 9px; font-variant-numeric: tabular-nums; }
.nrmt-smith-materials li.is-missing small { color: #e8807f; }
.nrmt-smith-materials i { color: #6fc963; font-size: 11px; font-style: normal; font-weight: 900; }
.nrmt-smith-materials li.is-missing i { color: #e8807f; }

.nrmt-smith-cost-note { padding: 9px 11px; border-left: 2px solid #d39735; background: rgba(190, 127, 35, .08); color: #cbbfa9; font-size: 10px; line-height: 1.5; }

.nrmt-smith-craft {
  min-height: 48px;
  border: 1px solid transparent;
  border-image-source: var(--nrmt-archive-button-frame);
  border-image-slice: 56 188;
  border-image-width: 9px 18px;
  border-image-repeat: stretch;
  border-radius: 2px;
  background: linear-gradient(180deg, #6d4c14, #35240a);
  color: #ffe6a8;
  text-shadow: 0 1px 1px #000;
  font: 900 12px NinjaUI, Arial, sans-serif;
  letter-spacing: .09em;
  cursor: pointer;
}
.nrmt-smith-craft:disabled { filter: grayscale(.7) brightness(.6); color: #9aa2a4; cursor: not-allowed; }

.nrmt-smith-empty { display: grid; place-items: center; gap: 7px; padding: 40px 20px; text-align: center; }
.nrmt-smith-empty i { color: rgba(226, 179, 64, .2); font: 900 46px Georgia, serif; font-style: normal; }
.nrmt-smith-empty b { color: #c9b78c; font-size: 11px; letter-spacing: .12em; }
.nrmt-smith-empty span { max-width: 260px; color: #7e898d; font-size: 10px; line-height: 1.55; }

/* ------------------------------------------------------------------- reveal */
.nrmt-smith-reveal {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: rgba(5, 8, 9, .95);
  opacity: 0;
  transition: opacity .3s ease;
}
.nrmt-smith-window { position: relative; }
.nrmt-smith-reveal.is-visible { opacity: 1; }
.nrmt-smith-reveal__sigil { color: rgba(226, 179, 64, .18); font: 900 76px Georgia, serif; }
.nrmt-smith-reveal small { color: #a5895a; font-size: 9px; font-weight: 900; letter-spacing: .2em; }
.nrmt-smith-reveal img { width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 0 14px rgba(240, 190, 80, .5)); }
.nrmt-smith-reveal h2 { margin: 0; color: #f6ecd5; font: clamp(17px, 4vw, 26px) NinjaTitle, Georgia, serif; }
.nrmt-smith-reveal b { font-size: 13px; letter-spacing: .16em; }
.nrmt-smith-reveal span { color: #8b9593; font-size: 10px; }
.nrmt-smith-reveal.rarity-common b { color: #b9c2c0; }
.nrmt-smith-reveal.rarity-uncommon b { color: #7fd08a; }
.nrmt-smith-reveal.rarity-rare b { color: #6cb6f0; }
.nrmt-smith-reveal.rarity-epic b { color: #c184ee; }
.nrmt-smith-reveal.rarity-legendary b { color: #f0b93f; }
.nrmt-smith-reveal.rarity-mythic b { color: #ff7a5c; }

/* --------------------------------------------------------------- responsivo */
@media (max-width: 900px) {
  .nrmt-smith-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .nrmt-smith-listwrap { border-right: 0; border-bottom: 1px solid #333a3c; }
  .nrmt-smith-side { max-height: 46vh; }
}

@media (max-width: 900px) {
  /* Moldura mais estreita: em 28px ela come área útil demais no tablet. */
  .nrmt-smith-frame { border-width: 22px; border-image-width: 22px; }
  .nrmt-smith-window { padding: 27px 25px 23px; }
}

@media (max-width: 620px) {
  .nrmt-smith-overlay { padding: 0; }
  .nrmt-smith-window { width: 100%; height: 100%; border-radius: 0; padding: 21px 19px 17px; }
  .nrmt-smith-frame { border-width: 16px; border-image-width: 16px; }
  .nrmt-smith-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title close" "wallet wallet"; }
  .nrmt-smith-title { grid-area: title; }
  .nrmt-smith-close { grid-area: close; }
  .nrmt-smith-wallet { grid-area: wallet; justify-items: start; }
  .nrmt-smith-list { grid-template-columns: minmax(0, 1fr); }
  .nrmt-smith-meta { grid-template-columns: repeat(3, 1fr); }

  /* Quatro linhas de chips empilhadas comiam ~200px e a lista virava uma
     faixa fina embaixo do detalhe. Cada grupo vira uma tira que rola na
     horizontal dentro de si — o bloco de filtros cai para 3 linhas. */
  .nrmt-smith-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .nrmt-smith-chips::-webkit-scrollbar { display: none; }

  /* Busca e filtro dividem a mesma linha: separados eram mais 40px de altura
     roubados da lista. */
  .nrmt-smith-filters { gap: 5px; padding: 7px 10px; }
  .nrmt-smith-search { flex: 1 1 120px; }
  .nrmt-smith-only { flex: 0 0 auto; gap: 5px; font-size: 9.5px; }
  .nrmt-smith-only span { max-width: 84px; line-height: 1.2; }
  .nrmt-smith-chips button { min-height: 30px; }

  /* A lista precisa continuar sendo o foco: ela fica com o espaço elástico e
     o detalhe é quem cede. */
  .nrmt-smith-body { grid-template-rows: minmax(34vh, 1fr) auto; }
  .nrmt-smith-listwrap { min-height: 34vh; }
  .nrmt-smith-side { max-height: 42vh; }
}

@media (prefers-reduced-motion: reduce) {
  .nrmt-smith-card, .nrmt-smith-reveal { transition: none; }
}
