.xingsha-main {
  min-width: 0;
}

.xingsha-wrap {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 22px 18px 40px;
}

.xingsha-panel {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 22px 20px;
  border: 1px solid var(--portal-soft-line, rgba(32, 35, 33, 0.1));
  border-radius: 18px;
  background: var(--portal-panel, rgba(255, 253, 247, 0.92));
  box-shadow: var(--portal-warm-shadow, 0 18px 48px rgba(46, 41, 33, 0.1));
}

.xingsha-tools {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}

.xingsha-search {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 16px;
  border: 1px solid var(--portal-soft-line, rgba(32, 35, 33, 0.1));
  border-radius: 999px;
  background: var(--portal-panel-strong, #fffefb);
  box-shadow: 0 3px 12px rgba(33, 36, 31, 0.04);
}

.xingsha-search > i,
.xingsha-search > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted, #76716b);
}

.xingsha-search input {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink, #221f1b);
  font: inherit;
  font-size: 14px;
}

.xingsha-search-submit {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--cinnabar, #b94132);
  color: #fffdf7;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.xingsha-search-submit:hover {
  opacity: 0.9;
}

.xingsha-status {
  padding: 34px 12px;
  color: var(--muted, #76716b);
  text-align: center;
  font-size: 14px;
}

.xingsha-status[hidden] {
  display: none;
}

.xingsha-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.xingsha-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--portal-soft-line, rgba(32, 35, 33, 0.1));
  border-radius: 8px;
  background: var(--portal-panel-strong, #fffefb);
  box-shadow: 0 4px 14px rgba(33, 36, 31, 0.05);
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

@media (hover: hover) {
  .xingsha-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb, 185, 65, 50), 0.34);
    box-shadow: 0 9px 22px rgba(33, 36, 31, 0.1);
  }
}

.xingsha-card:focus-visible,
.xingsha-modal-close:focus-visible,
.xingsha-search-submit:focus-visible {
  outline: 2px solid var(--cinnabar, #b94132);
  outline-offset: 2px;
}

.xingsha-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: rgba(var(--accent-rgb, 185, 65, 50), 0.06);
}

.xingsha-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xingsha-card-copy {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 9px 8px 10px;
}

.xingsha-card-name {
  display: -webkit-box;
  width: 100%;
  overflow: hidden;
  color: var(--ink, #221f1b);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.xingsha-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(25, 27, 24, 0.52);
  backdrop-filter: blur(4px);
}

.xingsha-modal.show {
  display: flex;
}

.xingsha-modal-sheet {
  width: min(440px, 90vw);
  height: min(560px, 70dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--portal-soft-line, rgba(32, 35, 33, 0.1));
  border-radius: 18px;
  background: var(--portal-panel-strong, #fffefb);
  box-shadow: 0 24px 64px rgba(17, 19, 17, 0.25);
}

.xingsha-modal-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--portal-soft-line, rgba(32, 35, 33, 0.1));
}

.xingsha-modal-heading {
  min-width: 0;
}

.xingsha-modal-heading > span {
  display: block;
  margin-bottom: 2px;
  color: var(--cinnabar, #b94132);
  font-size: 10px;
  font-weight: 850;
}

.xingsha-modal-heading h2 {
  margin: 0;
  overflow: hidden;
  color: var(--ink, #221f1b);
  font-size: 17px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xingsha-modal-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.xingsha-modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(var(--accent-rgb, 185, 65, 50), 0.08);
  color: var(--muted, #76716b);
  cursor: pointer;
}

.xingsha-modal-close i,
.xingsha-modal-close svg {
  width: 17px;
  height: 17px;
}

.xingsha-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.xingsha-image-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 0 0 14px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(var(--accent-rgb, 185, 65, 50), 0.06);
}

.xingsha-image-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.xingsha-image-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted, #76716b);
  background: rgba(255, 253, 247, 0.9);
  font-size: 13px;
}

.xingsha-image-stage.image-ready .xingsha-image-loading {
  display: none;
}

.xingsha-annotations {
  position: absolute;
  inset: 0;
  opacity: 1;
  pointer-events: none;
}

.xingsha-annotation {
  position: absolute;
  max-width: min(42%, 180px);
  transform: translate(-50%, -50%);
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 4px;
  background: rgba(24, 25, 23, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  white-space: normal;
}

.xingsha-summary {
  margin: 0 0 14px;
  color: var(--ink, #221f1b);
  font-size: 14px;
  line-height: 1.72;
}

.xingsha-detail-section {
  padding: 13px 0;
  border-top: 1px solid var(--portal-soft-line, rgba(32, 35, 33, 0.1));
}

.xingsha-detail-section h3 {
  margin: 0 0 7px;
  color: var(--cinnabar, #b94132);
  font-size: 14px;
  font-weight: 900;
}

.xingsha-detail-section p {
  margin: 0;
  color: var(--ink, #221f1b);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
}

body.xingsha-modal-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .xingsha-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .xingsha-main {
    padding-bottom: max(32px, calc(32px + env(safe-area-inset-bottom)));
  }

  .xingsha-wrap {
    width: 100%;
    min-width: 0;
    padding: 0 0 32px;
  }

  .xingsha-panel {
    width: 100%;
    min-width: 0;
    padding: 16px;
    border-radius: 18px;
  }

  .xingsha-tools {
    display: block;
    margin-bottom: 12px;
  }

  .xingsha-search {
    min-height: 50px;
    padding-left: 13px;
  }

  .xingsha-search-submit {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 13px;
  }

  .xingsha-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .xingsha-card-copy {
    min-height: 43px;
    padding: 7px 7px 8px;
  }

  .xingsha-card-name {
    font-size: 11px;
  }

  .xingsha-modal {
    align-items: center;
    padding: 14px;
  }

  .xingsha-modal-sheet {
    border-radius: 18px;
  }

  .xingsha-modal-body {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 350px) {
  .xingsha-grid {
    gap: 6px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .xingsha-card {
    transition: none;
  }
}
