/* The item catalog and item pages. Loaded after arena.css and heroes.css and reuses their tokens:
   flat panels, hairline borders, one accent. Gold is kept for prices only, as in the game shop. */
:where(.items-page, .item-page) { --gold: #f0c75e; }
.coin { display: inline-flex; align-items: center; gap: 5px; color: var(--gold); font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.coin::before { content: ""; flex: none; width: .72em; height: .72em; border-radius: 50%; background: #d9a93a; box-shadow: inset 0 0 0 2px #f6d77f; }

/* ---------- Shop cards ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 8px; }
.ware {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 14px; min-height: 88px; padding: 10px 14px 14px 10px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--arena-ink); text-decoration: none;
  transition: border-color .15s, background-color .15s;
}
.ware__icon { position: relative; display: block; width: 64px; height: 64px; }
.ware__icon img { width: 64px; height: 64px; border-radius: 50%; display: block; transition: transform .15s ease-out; }
.ware__icon .coin {
  position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px;
  background: #0a1727; font-size: .75rem; line-height: 1.35;
}
.ware__icon .coin::before { display: none; }
.ware__text { display: grid; gap: 3px; min-width: 0; }
.ware__name { font-size: 1rem; font-weight: 500; line-height: 1.25; text-wrap: balance; overflow-wrap: anywhere; }
.ware__note { color: var(--muted); font-size: .8125rem; line-height: 1.3; }
.ware:hover, .ware:focus-visible { border-color: #3a5873; background: #12293f; }
.ware:hover img { transform: translateY(-2px); }

/* ---------- Catalog ---------- */
.items-page .atlas-tools { grid-template-columns: minmax(0, 1fr); }
.item-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: 100%; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-sizing: border-box; }
.item-tabs button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 0; border-radius: 6px;
  font: inherit; font-size: .9375rem; font-weight: 500; line-height: 1; color: var(--muted); background: transparent; cursor: pointer; transition: color .15s, background-color .15s;
}
.item-tabs button:hover { color: var(--arena-ink); background: #142c44; }
.item-tabs button[aria-pressed="true"] { color: var(--arena-ink); background: #1f3b58; }
.item-tabs button:active { transform: scale(.97); }
.shop-board { display: grid; gap: 40px; }
.shop h2 { margin: 0 0 16px; color: var(--arena-ink); font-size: 1.375rem; font-weight: 600; letter-spacing: -.01em; }
.shop-board[data-all] :is(.ware, .part)[data-dup] { display: none; }
.shop-rest { margin-top: 20px; }
.atlas .shop-rest h3 { margin: 0 0 8px; color: var(--muted); font-size: .9375rem; font-weight: 500; }
.parts { display: flex; flex-wrap: wrap; gap: 4px; }
.part { display: grid; justify-items: center; align-content: start; gap: 14px; width: 104px; padding: 10px 4px 12px; border-radius: 10px; color: var(--soft); text-decoration: none; transition: background-color .15s; }
.part .ware__icon, .part .ware__icon img { width: 52px; height: 52px; }
.part__name { max-width: 100%; overflow-wrap: anywhere; font-size: .8125rem; font-weight: 500; line-height: 1.25; text-align: center; text-wrap: balance; }
.part:hover, .part:focus-visible { background: #17304a; color: var(--arena-ink); }
.part:hover img { transform: translateY(-2px); }
#item-empty { padding: 48px 0; text-align: center; }
#item-empty p { margin: 0 0 16px; color: var(--muted); font-size: 1.0625rem; }
#item-empty button { min-height: 44px; padding: 8px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--arena-ink); font: inherit; cursor: pointer; }
.items-popular { margin-top: 56px; }

/* ---------- Item header ---------- */
.relic {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 24px 28px; padding: 24px 28px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.relic__icon { width: 112px; height: 112px; border-radius: 50%; box-shadow: 0 0 0 2px #2d4a66; display: block; }
.relic__body { min-width: 0; display: grid; gap: 10px; }
.relic h1 { margin: 0; color: var(--arena-ink); font-family: var(--display); font-size: clamp(2rem, 4.4vw, 3.25rem); font-weight: 650; letter-spacing: -.03em; line-height: 1.05; text-wrap: balance; }
.relic__alt { margin: -4px 0 0; color: var(--muted); font-size: 1rem; }
.relic .sheet__tags { grid-column: auto; margin-top: 4px; }
a.sheet__tag { text-decoration: none; transition: border-color .15s, color .15s; }
a.sheet__tag:hover { border-color: var(--arena-accent); color: var(--arena-ink); }
.relic__price { margin: 0; text-align: right; }
.relic__price dt { color: var(--muted); font-size: 1rem; }
.relic__price dd { margin: 4px 0 0; font-size: 2.25rem; line-height: 1.1; }
.relic__price .coin { gap: 8px; }
.relic__stats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 20px 0 0; border-top: 1px solid var(--line); }
.relic__stats li { display: grid; gap: 4px; padding: 0 28px 0 0; margin: 0 28px 0 0; border-right: 1px solid var(--line); }
.relic__stats li:last-child { border-right: 0; margin-right: 0; }
.relic__stats b { color: var(--arena-accent); font-family: var(--display); font-size: 1.75rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.relic__stats span { color: var(--soft); font-size: 1rem; }
.relic--blessing { grid-template-columns: 112px minmax(0, 1fr); }

/* ---------- Item sections: visible headings, no tab bar ---------- */
.item-page .atlas-section { margin-top: 48px; }
.item-page .atlas-section > h2 { position: static; width: auto; height: auto; margin: 0 0 16px; overflow: visible; clip-path: none; white-space: normal; }
.effects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; }
.effect { padding: 24px 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); scroll-margin-top: 96px; }
.effect small { display: block; color: var(--muted); font-size: .9375rem; }
.atlas .effect h3 { margin: 4px 0 12px; font-size: 1.375rem; font-weight: 600; letter-spacing: -.01em; }
.effect p { margin: 0; max-width: 64ch; color: #d3dde6; font-size: 1.0625rem; line-height: 1.65; }
.effect--blessing { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 20px; align-items: start; }
.effect--blessing img { width: 64px; height: 64px; border-radius: 50%; }
.atlas .effect--blessing h3 { margin-top: 0; }
.effect p.effect__use { margin-top: 12px; color: var(--muted); font-size: 1rem; }
.effect:target { border-color: var(--arena-accent); }

/* ---------- Recipe tree, drawn like the shop's build panel ---------- */
.recipe { --rule: #3a5570; display: grid; justify-items: center; padding: 28px 16px 32px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow-x: auto; }
.recipe__top { position: relative; padding-bottom: 28px; }
.recipe__top::after { content: ""; position: absolute; left: 50%; bottom: 0; height: 28px; border-left: 2px solid var(--rule); }
.recipe__row, .recipe__sub { display: flex; justify-content: center; list-style: none; margin: 0; padding: 0; }
.recipe__row > li, .recipe__sub > li { position: relative; display: grid; justify-items: center; align-content: start; padding: 28px 12px 0; }
.recipe__row > li::before, .recipe__sub > li::before { content: ""; position: absolute; top: 0; left: 50%; height: 28px; border-left: 2px solid var(--rule); }
.recipe__row > li::after, .recipe__sub > li::after { content: ""; position: absolute; top: 0; left: 0; right: 0; border-top: 2px solid var(--rule); }
.recipe__row > li:first-child::after, .recipe__sub > li:first-child::after { left: 50%; }
.recipe__row > li:last-child::after, .recipe__sub > li:last-child::after { right: 50%; }
.recipe__row > li:only-child::after, .recipe__sub > li:only-child::after { display: none; }
.recipe__sub { position: relative; margin-top: 16px; }
.recipe__sub::before { content: ""; position: absolute; top: -16px; left: 50%; height: 16px; border-left: 2px solid var(--rule); }
.recipe__sub > li { padding-top: 20px; }
.recipe__sub > li::before { height: 20px; }
.recipe__node { position: relative; z-index: 1; display: grid; justify-items: center; gap: 4px; width: 128px; color: var(--soft); text-decoration: none; }
.recipe__node img { width: 64px; height: 64px; }
.recipe__sub .recipe__node { width: 104px; }
.recipe__sub .recipe__node img { width: 48px; height: 48px; }
.recipe__node img { border-radius: 50%; display: block; background: var(--panel); transition: transform .15s ease-out; }
.recipe__node .coin { margin-top: -12px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; background: #0a1727; font-size: .75rem; line-height: 1.35; }
.recipe__node .coin::before { display: none; }
.recipe__name { max-width: 100%; overflow-wrap: anywhere; margin-top: 2px; font-size: .9375rem; line-height: 1.25; text-align: center; text-wrap: balance; }
.recipe__node.is-here { width: 160px; color: var(--arena-ink); }
.recipe__node.is-here img { width: 88px; height: 88px; }
.recipe__node.is-here img { box-shadow: 0 0 0 2px var(--arena-accent); }
.recipe__node.is-here .recipe__name { font-weight: 600; font-size: 1rem; }
a.recipe__node:hover img, a.recipe__node:focus-visible img { transform: translateY(-2px); }
a.recipe__node:hover .recipe__name { color: var(--arena-accent); }
.recipe__note { margin: 12px 0 0; color: var(--muted); font-size: 1rem; }
.into { margin-top: 32px; }
.atlas .into h3 { margin: 0 0 12px; font-size: 1.125rem; }
.item-page .chip-grid { padding-block: 8px; }
.item-page .arena-lore blockquote { max-width: 40ch; font-size: clamp(1.25rem, 2.2vw, 1.625rem); }

/* ---------- Narrow screens ---------- */
@media (max-width: 740px) {
  .item-tabs { display: flex; flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .item-tabs::-webkit-scrollbar { display: none; }
  .item-tabs button { flex: none; padding: 0 12px; }
  .shop-board { gap: 32px; }
  .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ware { grid-template-columns: 1fr; justify-items: center; gap: 14px; min-height: 0; padding: 10px 4px 12px; text-align: center; }
  .ware__icon, .ware__icon img { width: 56px; height: 56px; }
  .ware__note { display: none; }
  .ware__name { font-size: .8125rem; line-height: 1.2; }
  .parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 0; }
  .part { width: auto; padding-inline: 2px; }
  .part__name { font-size: .75rem; }
  .relic { grid-template-columns: 80px minmax(0, 1fr); gap: 16px; padding: 16px; }
  .relic__icon { width: 80px; height: 80px; }
  .relic h1 { font-size: 1.875rem; }
  .relic__price { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; text-align: left; padding-top: 12px; border-top: 1px solid var(--line); }
  .relic__price dd { margin: 0; font-size: 1.75rem; }
  .relic__stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-top: 16px; }
  .relic__stats li { padding: 0; margin: 0; border: 0; }
  .relic__stats b { font-size: 1.375rem; }
  .relic__stats span { font-size: .9375rem; }
  .relic .sheet__tag { font-size: .875rem; padding: 4px 10px; }
  .effect { padding: 16px; }
  .atlas .effect h3 { font-size: 1.1875rem; }
  .effect p { font-size: 1rem; }
  .effect--blessing { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; }
  .effect--blessing img { width: 48px; height: 48px; }
  .recipe { padding: 20px 4px 24px; justify-items: stretch; }
  .recipe__top { justify-self: center; }
  .recipe__row > li, .recipe__sub > li { padding-inline: 4px; }
  .recipe__node { width: 96px; }
  .recipe__node img { width: 52px; height: 52px; }
  .recipe__sub .recipe__node { width: 72px; }
  .recipe__sub .recipe__node img { width: 40px; height: 40px; }
  .recipe__node.is-here { width: 120px; }
  .recipe__node.is-here img { width: 64px; height: 64px; }
  .recipe__name { font-size: .8125rem; }
  .recipe__sub .recipe__name { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ware img, .recipe__node img { transition: none; }
}
