/* Shared entity detail styles */

.entity-page-panel {
  margin-bottom: 1.8rem;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(51, 255, 167, 0.04), rgba(51, 255, 167, 0)), var(--surface);
  box-shadow: var(--shadow);
}

.entity-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

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

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

.entity-header__aside {
  align-self: start;
  justify-self: end;
}

.entity-header__icon {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #202020;
  overflow: hidden;
}

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

.entity-header__title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1.15;
}

.entity-header__en {
  margin: 0 0 0.65rem;
  color: var(--text-muted);
}

.entity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.entity-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid rgba(51, 255, 167, 0.2);
  border-radius: 999px;
  background: rgba(51, 255, 167, 0.08);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.entity-inline-link:hover,
.entity-inline-link:focus-visible {
  text-decoration: underline;
}

  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.entity-section {
  margin-top: 1.35rem;
}

.entity-section h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.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;
}

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

.entity-link .entity-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #202020;
  flex: 0 0 28px;
}

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

.entity-link__main {
  font-weight: 600;
}

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

.entity-empty,
.entity-error {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
}

.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: 620px) {
  .entity-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

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

  .entity-header__aside {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

.floating-actions {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: center;
}

.floating-action,
.back-to-top {
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid rgba(51, 255, 167, 0.28);
  border-radius: 999px;
  background: rgba(31, 61, 50, 0.94);
  color: var(--accent);
  font-size: 1.05rem;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
}

.floating-action {
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(46, 46, 46, 0.94);
}

.floating-action--back {
  font-size: 1.2rem;
  line-height: 1;
}

.back-to-top {
  opacity: 0;
  visibility: hidden;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
}
