/* ------------------------------------------------------------
  DETAILS — frame + sizing (match Relic Preview)
  ------------------------------------------------------------ */

#details {
  font-size: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 0.75rem;
  padding: 0.9rem !important;
}

#details,
#details * {
  box-sizing: border-box;
}

/* ------------------------------------------------------------
  Mini preview relic scaling (legacy; overridden below by hiding frame)
  ------------------------------------------------------------ */

#details .sorted-preview .relic-frame {
  width: var(--mini-preview-size);
  height: var(--mini-preview-size);
  aspect-ratio: 1 / 1;
}

#details .sorted-preview .relic-frame img {
  width: 100%;
  height: 100%;
  display: block;

  object-fit: cover !important;
  transform: scale(var(--mini-art-zoom));
  transform-origin: center;
}

/* ------------------------------------------------------------
   DETAILS — alert + popovers (scoped, stable)
   Keep RED as the error signal, mute everything else so it plays
   nicely with gold highlights.
   ------------------------------------------------------------ */

#details .details-body{
  display: grid;
  gap: 0.75rem;
}

#details .info-box{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.14);
  border-radius: 0.85rem;
  padding: 0.85rem 0.95rem;
}

/* red stays vibrant */
#details .info-box.is-alert{
  border-color: rgba(220, 70, 70, 0.85);
  background: linear-gradient(
    180deg,
    rgba(170, 32, 44, 0.55),
    rgba(95, 18, 26, 0.48)
  );
  box-shadow:
    inset 0 0 0 1px rgba(255, 120, 120, 0.22),
    inset 0 1px 0 rgba(255, 200, 200, 0.14),
    0 0 22px rgba(160, 30, 40, 0.20);
}

#details .info-line{
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

#details .info-box.is-alert .info-line{
  font-size: 0.94em;
  line-height: 1.35;
}

#details .info-box .popover-title{
  font-size: 0.94em;
}

#details .info-box .popover-body,
#details .info-box .popover-body p{
  font-size: 0.80em;
  line-height: 1.45;
}

/* inline clickable term (underline + caret, aligned) */
#details .term-link{
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;

  display: inline-flex;
  align-items: baseline;
  gap: 0.22rem;

  font: inherit;
  font-weight: 850;
  color: inherit;

  line-height: 1.05;
  vertical-align: baseline;

  cursor: pointer;

  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255,255,255,0.45);
}

#details .term-link::after{ content: none; }

#details .term-link:hover{
  text-decoration-color: rgba(232,194,0,0.95);
  text-shadow: 0 0 6px rgba(232,194,0,0.18);
}

#details .term-link:focus-visible{
  outline: 2px solid rgba(232,194,0,0.55);
  outline-offset: 3px;
  border-radius: 0.35rem;
}

/* expanded panel (neutral smoke — no purple/beige) */
#details .popover{
  margin-top: 0.65rem;
  border-radius: 0.95rem;
  padding: 0.95rem 1rem;

  background: linear-gradient(
    180deg,
    rgba(32, 34, 40, 0.65),
    rgba(18, 20, 26, 0.60)
  );
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    0 10px 24px rgba(0,0,0,0.30),
    inset 0 1px 0 rgba(255,255,255,0.06);

  display: grid;
  gap: 0.75rem;

  overflow-x: hidden;
}

#details .popover-title{
  font-weight: 900;
  font-size: 1.05rem;
  margin: 0;
}

#details .popover-body p{
  margin: 0;
  opacity: 0.88;
}

/* mini preview (LIST ONLY — no relic image) */
#details .sorted-preview{
  margin-top: 0.25rem;
  padding: 0.85rem;
  border-radius: 0.95rem;

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.05),
    rgba(18,20,26,0.18)
  );
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

#details .sorted-preview .relic-frame,
#details .sorted-preview .relic-frame--mini{
  display: none !important;
}

/* force one-column layout inside the Details mini preview */
#details .sorted-preview .relic-preview--mini{
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 0.65rem;
  width: 100%;
  max-width: 100%;
}

#details .sorted-preview .relic-effects{
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

#details .sorted-preview .chosen-effects{
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;

  display: grid;
  gap: 0.6rem;
  grid-template-rows: repeat(3, auto);

  width: 100%;
  max-width: 100%;
  overflow: visible !important;
}

#details .sorted-preview .chosen-effects li{
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;

  padding: 0.50rem 0.75rem;
  border-radius: 0.75rem;

  background: linear-gradient(
    180deg,
    rgba(40, 42, 48, 0.85),
    rgba(28, 30, 36, 0.85)
  );
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);

  overflow: hidden;
}

#details .sorted-preview .effect-line{
  display: flex;
  align-items: center;
  min-width: 0;
}

#details .sorted-preview .effect-line .title{
  font-weight: 850;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

/* reordered rows (gold stays) */
#details .sorted-preview .chosen-effects li.reorder-changed{
  background: linear-gradient(
    180deg,
    rgba(232,194,0,0.14),
    rgba(232,194,0,0.08)
  );
  border-color: rgba(232,194,0,0.55);
  box-shadow:
    inset 0 0 0 1px rgba(232,194,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ------------------------------------------------------------
   DETAILS — modal overlay (Lexicon-style)
   ------------------------------------------------------------ */

.details-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.details-modal.is-open { display: flex; }

.details-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.details-modal__card {
  position: relative;
  width: min(90vw, 640px);
  max-height: min(88vh, 840px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.85rem;
  background: rgba(12, 14, 18, 0.92);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  color: inherit;
}

.details-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(220, 70, 70, 0.55);
  background: linear-gradient(
    90deg,
    rgba(92, 22, 22, 0.78) 0%,
    rgba(92, 22, 22, 0.62) 48%,
    rgba(0, 0, 0, 0.40) 100%
  );
}

.details-modal.is-effect .details-modal__header {
  border-bottom: 1px solid rgba(80, 186, 150, 0.65);
  background: linear-gradient(90deg, rgba(38, 92, 68, 0.86) 0%, rgba(26, 114, 88, 0.78) 48%, rgba(0, 0, 0, 0.40) 100%);
}

.details-modal.is-curse .details-modal__header {
  border-bottom: 1px solid rgba(168, 120, 230, 0.65);
  background: linear-gradient(90deg, rgba(68, 40, 110, 0.86) 0%, rgba(108, 64, 168, 0.78) 48%, rgba(0, 0, 0, 0.40) 100%);
}

.details-modal__title {
  margin: 0;
  font-size: 1em;
  line-height: 1.2;
  font-weight: 800;
}

.details-modal__close {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.24);
  border-radius: 0.6rem;
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.05rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #f5f7fb;
  margin: 0;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.details-modal__close:hover {
  border-color: rgba(181, 140, 255, 0.38);
  background: rgba(181, 140, 255, 0.16);
}

.details-modal__close:active {
  transform: translateY(1px);
}

.details-modal__close:focus-visible {
  outline: 2px solid rgba(181, 140, 255, 0.60);
  outline-offset: 2px;
}

.details-modal__body {
  padding: 0.95rem 1rem 1.15rem;
  overflow: auto;
  display: grid;
  gap: 0.65rem;
  font-size: 0.80em;
  line-height: 1.45;
  text-align: left;
  max-height: calc(88vh - 120px);
}

.details-modal__body p {
  margin: 0;
  opacity: 0.9;
}

/* ------------------------------------------------------------
   Effect information popover (shared modal layout)
   ------------------------------------------------------------ */

.effect-info-grid {
  display: grid;
  gap: 0.85rem;
}

.effect-info-section {
  display: grid;
  gap: 0.45rem;
}

.effect-info-divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, rgba(220,70,70,0.6), rgba(255,255,255,0.15) 32%, rgba(255,255,255,0.1) 68%, rgba(220,70,70,0.35));
  border-radius: 999px;
}

.effect-info-label {
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: rgba(245, 245, 255, 0.9);
}

.effect-info-label--with-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.effect-info-value {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  align-items: center;
  color: inherit;
  min-width: 0;
}

.effect-copy-btn {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(181, 140, 255, 0.55);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.32) 0%, rgba(30,34,42,0.92) 55%, rgba(18,22,32,0.92) 100%);
  background-repeat: no-repeat;
  background-position: center;
  color: rgba(255, 255, 255, 0.98);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.76rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
  padding: 0;
  margin: 0;
}

.effect-copy-icon {
  width: 0.84rem;
  height: 0.84rem;
  display: block;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M16 1H6a2 2 0 0 0-2 2v12h2V3h10V1Z'/%3E%3Cpath d='M18 5H10a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2Zm0 16H10V7h8v14Z'/%3E%3C/svg%3E");
  background-size: 0.84rem 0.84rem;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.75));
}

.effect-copy-status {
  margin-left: 0.5rem;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: rgba(50, 190, 120, 0.18);
  border: 1px solid rgba(50, 190, 120, 0.55);
  color: rgba(230, 255, 240, 0.95);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1.1;
  white-space: nowrap;
}

.effect-copy-status.is-error {
  background: rgba(200, 70, 70, 0.22);
  border-color: rgba(220, 90, 90, 0.65);
  color: rgba(255, 230, 230, 0.95);
}

.effect-copy-btn:hover {
  border-color: rgba(232, 194, 0, 0.65);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.42) 0%, rgba(45,50,64,0.96) 55%, rgba(28,30,42,0.96) 100%);
  color: rgba(255, 255, 255, 1);
}

.effect-copy-btn:active {
  transform: translateY(1px);
}

.effect-info-name {
  font-weight: 750;
  line-height: 1.35;
}

.effect-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(32, 36, 44, 0.85);
  font-weight: 800;
  font-size: 0.70rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.effect-chip--relic.effect-chip--depth {
  background: linear-gradient(135deg, #2c2144, #5b3c9f);
  border-color: rgba(181, 140, 255, 0.45);
  color: #f5f0ff;
}

.effect-chip--relic.effect-chip--standard {
  background: linear-gradient(135deg, #4a311a, #b58c4a);
  border-color: rgba(235, 195, 120, 0.55);
  color: #fff9f0;
}

.effect-chip--relic.effect-chip--both {
  background: linear-gradient(135deg, #1f343c, #3f7a84);
  border-color: rgba(140, 210, 230, 0.45);
  color: #e9f7ff;
}

.effect-chip--curse-yes {
  background: linear-gradient(135deg, #4c2a80, #8b5fd4);
  border-color: rgba(168, 120, 230, 0.7);
  color: #f7f1ff;
}

.effect-chip--curse-no {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(245, 245, 245, 0.92);
}

.effect-chip--placeholder {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

.effect-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.effect-toggle.is-no {
  color: rgba(241, 197, 197, 0.95);
}

.effect-toggle.is-yes {
  color: rgba(145, 235, 186, 0.95);
}

.effect-note {
  font-size: 0.72rem;
  opacity: 0.85;
}

.effect-raw {
  display: inline-block;
  padding: 0.32rem 0.5rem;
  border-radius: 0.55rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.35;
  word-break: break-word;
}
