/* Shared entity / guide detail styles */

.page-panel,
.entity-page-panel {
  --entity-section-gap: 1.4rem;
  --entity-panel-radius: var(--radius);
  --entity-panel-border: var(--border);
  --entity-panel-bg: var(--surface-muted);
  --entity-accent-line: rgba(51, 255, 167, 0.32);
  --entity-rare: #ffc44d;
  margin-bottom: 1.8rem;
  padding: 0;
}

.entity-header {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1.1rem;
  align-items: center;
  min-height: 7.2rem;
  padding: 1.35rem 0 1.2rem;
  border-bottom: 1px solid var(--border);
}

/*
 * 攻略阅读壳（资料帖 / 任务链 / 三合一 / 任务正文）统一标题区：
 * 不再用实体页底部分隔线，避免标题与下方正文「两套皮」。
 * 物品 / NPC / 套装等图鉴页仍保留默认底边。
 */
.page-panel--guide .entity-header,
.article-post > .entity-header,
.quest-detail-content > .entity-header,
.quest-detail-shell > .entity-header {
  min-height: 0;
  margin-bottom: 0.35rem;
  padding-top: 0.35rem;
  padding-bottom: 0.75rem;
  border-bottom: 0;
}

.page-panel--guide .entity-header .entity-header__en,
.article-post > .entity-header .entity-header__en,
.quest-detail-content > .entity-header .entity-header__en,
.quest-detail-shell > .entity-header .entity-header__en {
  margin-top: 0.2rem;
}

/* 攻略阅读区：间距与章节头贴近长文 process-card，远离图鉴属性卡节奏 */
.page-panel--guide {
  --guide-read-gap: 1.25rem;
}

.page-panel--guide .entity-header__title {
  font-size: clamp(1.55rem, 2.8vw, 2.1rem);
}

.page-panel--guide .entity-section {
  margin-top: var(--guide-read-gap);
  padding-top: 0.15rem;
}

.page-panel--guide .entity-section > h2,
.page-panel--guide .entity-section__head h2 {
  margin-bottom: 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: var(--text-h2);
}

.page-panel--guide .content-rewards .quest-reward-summary,
.page-panel--guide .content-rewards .quest-reward-summary-list {
  margin: 0;
  line-height: 1.6;
}

.page-panel--guide .content-steps {
  margin-top: 0.15rem;
}

.page-panel--guide .entity-properties {
  margin-top: 0.85rem;
}

.page-panel--guide .entity-property-panel {
  border-color: var(--entity-panel-border, var(--border));
  border-radius: var(--entity-panel-radius, var(--radius));
  background: var(--entity-panel-bg, var(--surface-muted));
}

.page-panel--guide .entity-property-summary {
  border-bottom-color: var(--border);
}

.entity-header--no-icon {
  grid-template-columns: minmax(0, 1fr) auto;
}

.entity-header__body {
  min-width: 0;
}

.entity-header__aside {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  align-self: center;
  justify-self: end;
}

.entity-header__icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #1b1f1d;
  overflow: hidden;
}

.entity-header__icon img,
.entity-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.entity-header__title {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.12;
}

.entity-header--rare .entity-header__title {
  color: var(--entity-rare, #ffc44d);
}

.entity-header__en {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.entity-header__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.entity-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-wrap: wrap;
}

.entity-header__badge {
  display: grid;
  place-items: center;
  min-width: 4.25rem;
  min-height: 4.25rem;
  padding: 0.4rem;
  border: 1px solid rgba(51, 255, 167, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(51, 255, 167, 0.06);
  text-align: center;
}

.entity-header__badge span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.entity-header__badge strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
}

.entity-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.entity-meta-line span {
  color: rgba(255, 255, 255, 0.22);
}

.entity-inline-link {
  color: var(--brand);
  text-decoration: none;
}

.entity-inline-link:hover,
.entity-inline-link:focus-visible {
  color: var(--accent);
}

.entity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.entity-section {
  margin-top: var(--entity-section-gap, 1.4rem);
}

.entity-section > h2 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-h2);
  line-height: 1.3;
  color: var(--text);
}

.entity-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.entity-section__head h2 {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
  font-size: var(--text-h2);
  line-height: 1.3;
}

.entity-section__hint {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.entity-properties {
  margin-top: 1.15rem;
}

.entity-property-panel {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--entity-panel-border, var(--border));
  border-radius: var(--entity-panel-radius, var(--radius));
  background: var(--entity-panel-bg, var(--surface-muted));
}

.entity-property-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.35rem;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.entity-property-summary > div {
  display: flex;
  align-items: baseline;
  gap: 0.42rem;
}

.entity-property-summary dt,
.entity-property-summary dd {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.3;
}

.entity-property-summary dt {
  color: var(--text-muted);
}

.entity-property-summary dd {
  color: var(--text);
  font-weight: 700;
}

.entity-property-summary > [class$="--id"] {
  margin-left: auto;
}

.entity-property-summary > [class$="--id"] dd {
  color: var(--text-muted);
  font-weight: 600;
}

.entity-property-summary .entity-grade {
  margin-left: 0;
  font-size: 0.72rem;
}

.entity-property-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0.7rem 0.8rem;
}

.entity-property-stats > div {
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border-left: 2px solid var(--entity-accent-line, rgba(51, 255, 167, 0.32));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(255, 255, 255, 0.022);
}

.entity-property-stats dt {
  margin: 0 0 0.28rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.entity-property-stats dd {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.entity-lead {
  max-width: 62rem;
  margin: 1rem 0 0;
  color: #d8dedb;
  font-size: 0.98rem;
  line-height: 1.7;
}

.entity-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.entity-fact {
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.entity-fact dt {
  margin: 0 0 0.18rem;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.entity-fact dd {
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.entity-relation {
  margin-top: 0;
  border-top: 1px solid var(--border);
}

.entity-relation:last-child {
  border-bottom: 1px solid var(--border);
}

.entity-relation__summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.85rem;
  padding: 0.65rem 0;
  list-style: none;
  cursor: pointer;
}

.entity-relation__summary::-webkit-details-marker {
  display: none;
}

.entity-relation__summary::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.entity-relation[open] > .entity-relation__summary::before {
  transform: rotate(45deg) translateY(-2px);
}

.entity-relation__summary h2 {
  margin: 0;
}

.entity-relation__count {
  min-width: 1.35rem;
  padding: 0.05rem 0.38rem;
  border-radius: 999px;
  background: rgba(51, 255, 167, 0.75);
  color: #10251c;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.entity-relation__body {
  padding: 0 0 0.75rem;
}

.entity-relations {
  overflow: hidden;
  border: 1px solid var(--entity-panel-border, var(--border));
  border-radius: var(--entity-panel-radius, var(--radius));
  background: rgba(0, 0, 0, 0.08);
}

.entity-relations .entity-relation {
  border: 0;
}

.entity-relations .entity-relation + .entity-relation {
  border-top: 1px solid rgba(255, 255, 255, 0.065);
}

.entity-relations .entity-relation:last-child {
  border-bottom: 0;
}

.entity-relations .entity-relation__summary {
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
}

.entity-relations .entity-relation__body {
  padding: 0 0.8rem 0.75rem;
}

.entity-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.7rem;
}

.entity-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 2.15rem;
  padding: 0.36rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.14);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.entity-tab:hover,
.entity-tab:focus-visible,
.entity-tab.is-active {
  border-color: rgba(51, 255, 167, 0.32);
  color: var(--accent);
  outline: none;
}

.entity-tab.is-active {
  background: rgba(51, 255, 167, 0.08);
}

.entity-tab__count,
.entity-tab span {
  color: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.entity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.entity-table th,
.entity-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.entity-table th {
  width: 38%;
  color: var(--text-muted);
  font-weight: 600;
}

.entity-table tbody tr:last-child th,
.entity-table tbody tr:last-child td {
  border-bottom: 0;
}

.entity-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--link);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.12s ease;
}

.entity-link:hover,
.entity-link:focus-visible {
  color: var(--link-hover);
  outline: none;
}

.entity-link:hover .entity-icon,
.entity-link:focus-visible .entity-icon {
  border-color: rgba(51, 255, 167, 0.28);
}

.entity-link .entity-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-table);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #202020;
  flex: 0 0 28px;
  transition: border-color 0.12s ease;
}

.entity-link__text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.entity-link__main {
  font-weight: 600;
  line-height: 1.3;
}

.entity-link--rare .entity-link__main {
  color: var(--entity-rare, #ffc44d);
}

.entity-link__sub {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.entity-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.25rem;
  margin-left: 0.38rem;
  padding: 0 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: #5f6b67;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: 0.08em;
}

.entity-grade--ng {
  background: #77827e;
}

.entity-grade--d {
  background: #476c89;
}

.entity-grade--c {
  background: #357d70;
}

.entity-grade--b {
  background: #876b31;
}

.entity-grade--a {
  background: #91564b;
}

.entity-grade--s {
  background: #705a91;
}

.entity-empty,
.entity-error {
  /* shared empty/loading styles live in base.css */
}

.entity-note {
  margin: 0.55rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.entity-list-table col.entity-col-icon {
  width: 2.6rem;
}

.entity-list-table col.entity-col-chance {
  width: 5.5rem;
}

.entity-list-table col.entity-col-amount {
  width: 3.5rem;
}

.entity-list-table col.entity-col-group {
  width: 6.5rem;
}

.entity-chance-cell .entity-link__sub {
  display: block;
  margin-top: 0.12rem;
}

@media (max-width: 900px) {
  .entity-property-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .entity-header {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 0;
    padding-block: 1.05rem;
  }

  .entity-header--no-icon {
    grid-template-columns: minmax(0, 1fr);
  }

  .entity-header__aside {
    position: absolute;
    top: 1rem;
    right: 0;
    grid-column: auto;
    justify-self: end;
  }

  .entity-header__body {
    padding-right: 3.9rem;
  }

  .entity-header__icon {
    width: 64px;
    height: 64px;
  }

  .entity-property-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
    gap: 0.5rem 1rem;
  }

  .entity-property-summary > div {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }

  .entity-property-summary > [class$="--id"] {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
  }

  .entity-property-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entity-relations .entity-relation__summary {
    padding-inline: 0.7rem;
  }

  .entity-relations .entity-relation__body {
    padding-inline: 0.7rem;
  }
}
