.pgg-letlm,
.pgg-letlm * {
  box-sizing: border-box;
}

.pgg-letlm {
  --pgg-gold: #ffd700;
  --pgg-ink: #07090d;
  --pgg-panel: rgba(12, 15, 22, 0.96);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  width: min(100%, 1920px);
  height: min(960px, calc(100vh - 24px));
  min-height: 720px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.42);
  border-radius: 18px;
  color: #f7f7f7;
  background:
    radial-gradient(circle at 50% -15%, rgba(255, 215, 0, 0.16), transparent 40%),
    linear-gradient(145deg, #10131b 0%, #080a0f 52%, #040507 100%);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025),
    inset 0 0 70px rgba(255, 215, 0, 0.025);
  font-family: Verdana, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.pgg-letlm.is-studio {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  width: 100vw;
  max-width: none;
  height: 100vh;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

body.pgg-letlm-studio-open {
  overflow: hidden !important;
}

.pgg-letlm__ambient {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.72;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.pgg-letlm__header {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 74px;
  padding: 10px 16px 10px 22px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.25);
  background:
    linear-gradient(90deg, rgba(255, 215, 0, 0.12), transparent 34%),
    rgba(4, 6, 10, 0.83);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.pgg-letlm__branding {
  min-width: 0;
}

.pgg-letlm__kicker {
  margin-bottom: 3px;
  color: var(--pgg-gold);
  font-family: Iceberg, Orbitron, Verdana, sans-serif;
  font-size: clamp(10px, 0.8vw, 13px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.28);
}

.pgg-letlm__title {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-family: Iceberg, Orbitron, Verdana, sans-serif;
  font-size: clamp(23px, 2.15vw, 39px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.85), 0 0 20px rgba(255, 215, 0, 0.12);
}

.pgg-letlm__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.pgg-letlm__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  margin: 0;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #f0f0f0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font: 800 12px/1 Verdana, Arial, sans-serif;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.pgg-letlm__button:hover,
.pgg-letlm__button:focus-visible {
  border-color: rgba(255, 215, 0, 0.62);
  color: var(--pgg-gold);
  outline: none;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.pgg-letlm__button--studio {
  border-color: rgba(255, 215, 0, 0.32);
}

.pgg-letlm__button-icon {
  font-size: 17px;
  line-height: 1;
}

.pgg-letlm__workspace {
  position: relative;
  z-index: 5;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
}

.pgg-letlm__tiers {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: repeat(5, minmax(82px, 1fr));
  gap: 6px;
  min-height: 0;
}

.pgg-letlm-tier {
  --pgg-card-width: 86px;
  position: relative;
  display: grid;
  grid-template-columns: clamp(74px, 5.2vw, 96px) minmax(0, 1fr);
  min-height: 0;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--pgg-tier-color) 46%, transparent);
  border-radius: 11px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--pgg-tier-color) 7%, transparent), transparent 34%),
    rgba(7, 9, 14, 0.88);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.015);
}

.pgg-letlm-tier__label {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid color-mix(in srgb, var(--pgg-tier-color) 54%, transparent);
  border-radius: 10px 0 0 10px;
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--pgg-tier-color) 42%, transparent), transparent 64%),
    linear-gradient(145deg, color-mix(in srgb, var(--pgg-tier-color) 22%, #0a0c12), #080a0e 70%);
  box-shadow:
    inset -10px 0 28px rgba(0, 0, 0, 0.32),
    5px 0 20px color-mix(in srgb, var(--pgg-tier-color) 9%, transparent);
}

.pgg-letlm-tier__label strong {
  color: var(--pgg-tier-color);
  font-family: Iceberg, Orbitron, Verdana, sans-serif;
  font-size: clamp(32px, 3.25vw, 58px);
  font-weight: 900;
  line-height: 0.82;
  text-shadow:
    0 3px 8px rgba(0, 0, 0, 0.75),
    0 0 11px color-mix(in srgb, var(--pgg-tier-color) 64%, transparent);
}

.pgg-letlm-tier__label span {
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(7px, 0.55vw, 10px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.pgg-letlm-tier__label em {
  position: absolute;
  top: 5px;
  right: 6px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--pgg-tier-color) 48%, transparent);
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}

.pgg-letlm-tier__dropzone,
.pgg-letlm-pool__dropzone {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 0;
  padding: 5px 9px;
  gap: 6px;
  overflow: visible;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.pgg-letlm-tier__dropzone {
  flex-wrap: nowrap;
}

.pgg-letlm-dropzone.is-over {
  background: radial-gradient(circle at var(--pgg-drop-x, 50%) 50%, rgba(255, 215, 0, 0.12), transparent 28%);
  box-shadow: inset 0 0 22px rgba(255, 215, 0, 0.08);
}

.pgg-letlm-tier__empty {
  position: absolute;
  left: 50%;
  top: 50%;
  color: rgba(255, 255, 255, 0.15);
  font-family: Iceberg, Orbitron, Verdana, sans-serif;
  font-size: clamp(12px, 0.9vw, 17px);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.pgg-letlm-dropzone:not(:empty) > .pgg-letlm-tier__empty,
.pgg-letlm-dropzone.has-cards > .pgg-letlm-tier__empty {
  opacity: 0;
}

.pgg-letlm-pool {
  --pgg-card-width: 58px;
  position: relative;
  display: grid;
  flex: 0 0 clamp(180px, 21vh, 220px);
  grid-template-rows: 38px minmax(0, 1fr);
  min-height: 0;
  margin-top: 8px;
  overflow: visible;
  border: 1px solid rgba(255, 215, 0, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 215, 0, 0.055), transparent 50%),
    rgba(4, 6, 10, 0.88);
  box-shadow: inset 0 0 28px rgba(255, 215, 0, 0.02);
}

.pgg-letlm-pool__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.16);
  background: rgba(0, 0, 0, 0.18);
}

.pgg-letlm-pool__heading > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.pgg-letlm-pool__heading strong {
  color: var(--pgg-gold);
  font-family: Iceberg, Orbitron, Verdana, sans-serif;
  font-size: 16px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.pgg-letlm-pool__heading span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.48);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pgg-letlm-pool__count {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.pgg-letlm-pool__count span {
  color: #fff;
  font-size: 12px;
}

.pgg-letlm-pool__dropzone {
  align-content: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 5px 11px 7px;
}

.pgg-letlm-card {
  position: relative;
  z-index: 3;
  display: flex;
  flex: 0 0 var(--pgg-card-width);
  flex-direction: column;
  width: var(--pgg-card-width);
  min-width: 0;
  margin: 0;
  outline: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  will-change: transform, filter;
  transition: transform 150ms ease, filter 150ms ease, opacity 120ms ease;
}

.pgg-letlm-card:hover,
.pgg-letlm-card:focus-visible {
  z-index: 45;
  transform: translateY(-4px) scale(1.17);
  filter: brightness(1.08);
}

.pgg-letlm-pool .pgg-letlm-card:hover,
.pgg-letlm-pool .pgg-letlm-card:focus-visible {
  transform: translateY(-8px) scale(1.34);
}

.pgg-letlm-card:active,
.pgg-letlm-card.is-dragging {
  cursor: grabbing;
}

.pgg-letlm-card.is-dragging {
  --pgg-drag-x: 0px;
  --pgg-drag-y: 0px;
  --pgg-drag-tilt: 0deg;
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 2147483646 !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
  pointer-events: none !important;
  transform: translate3d(var(--pgg-drag-x), var(--pgg-drag-y), 0) rotate(var(--pgg-drag-tilt)) scale(1.055) !important;
  transform-origin: center center !important;
  filter: brightness(1.13) drop-shadow(0 18px 26px rgba(0, 0, 0, 0.78)) drop-shadow(0 0 15px rgba(255, 215, 0, 0.42)) !important;
  transition: none !important;
  will-change: transform !important;
}

.pgg-letlm-card__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 215, 0, 0.29);
  border-radius: clamp(5px, 0.5vw, 9px);
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 215, 0, 0.11), transparent 43%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.46));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.025),
    inset 0 -18px 26px rgba(0, 0, 0, 0.35),
    0 5px 12px rgba(0, 0, 0, 0.28);
}

.pgg-letlm-card__media::before {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.035);
  border-radius: inherit;
  pointer-events: none;
}

.pgg-letlm-card__background {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  transform: scale(1.015);
}

.pgg-letlm-card__portrait {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.52)) drop-shadow(0 0 9px rgba(255, 215, 0, 0.18));
  transform: scale(1.02);
}

.pgg-letlm-card__placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.84);
  font-family: Iceberg, Orbitron, Verdana, sans-serif;
  font-size: calc(var(--pgg-card-width) * 0.26);
  font-weight: 900;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.18), transparent 65%);
}

.pgg-letlm-card__name {
  position: relative;
  z-index: 8;
  display: block;
  width: 100%;
  min-height: calc(var(--pgg-card-width) * 0.20);
  margin-top: 3px;
  padding: 3px 3px 2px;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 5px;
  color: #fff;
  background: linear-gradient(180deg, rgba(28, 25, 12, 0.92), rgba(4, 5, 7, 0.96));
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.38);
  font-family: Iceberg, Orbitron, Verdana, sans-serif;
  font-size: clamp(7px, calc(var(--pgg-card-width) * 0.115), 12px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.92);
}

.pgg-letlm-card__badge {
  position: absolute;
  z-index: 6;
  display: block;
  width: calc(var(--pgg-card-width) * 0.235);
  height: calc(var(--pgg-card-width) * 0.235);
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.76));
}

.pgg-letlm-card__badge--faction {
  left: 4%;
}

.pgg-letlm-card__badge--faction-1 {
  top: 8%;
}

.pgg-letlm-card__badge--faction-2 {
  top: 29%;
}

.pgg-letlm-card__badge--damage {
  top: 8%;
  right: 4%;
  width: calc(var(--pgg-card-width) * 0.21);
  height: calc(var(--pgg-card-width) * 0.21);
}

.pgg-letlm-card__badge--class {
  right: 4%;
  bottom: 5%;
  width: calc(var(--pgg-card-width) * 0.23);
  height: calc(var(--pgg-card-width) * 0.23);
}

.pgg-letlm-card__badge--rarity {
  left: 50%;
  bottom: 3%;
  width: calc(var(--pgg-card-width) * 0.24);
  height: calc(var(--pgg-card-width) * 0.24);
  transform: translateX(-50%);
}

.pgg-letlm-placeholder {
  position: relative;
  z-index: 2;
  flex: 0 0 var(--pgg-card-width);
  width: var(--pgg-card-width);
  height: calc(var(--pgg-card-width) * 1.62);
  border: 1px dashed rgba(255, 215, 0, 0.86);
  border-radius: 8px;
  background: rgba(255, 215, 0, 0.075);
  box-shadow: 0 0 17px rgba(255, 215, 0, 0.18), inset 0 0 16px rgba(255, 215, 0, 0.04);
  animation: pgg-letlm-placeholder-pulse 700ms ease-in-out infinite alternate;
}

@keyframes pgg-letlm-placeholder-pulse {
  from { opacity: 0.48; }
  to { opacity: 1; }
}

.pgg-letlm-card.is-drop-flash {
  z-index: 60;
  animation: pgg-letlm-card-land 680ms cubic-bezier(.2, .9, .25, 1);
}

.pgg-letlm-card.is-drop-flash::before {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: 30;
  border: 2px solid rgba(255, 237, 135, 0.9);
  border-radius: 13px;
  pointer-events: none;
  animation: pgg-letlm-ring 720ms ease-out forwards;
}

.pgg-letlm-card.is-drop-flash::after {
  content: "";
  position: absolute;
  inset: -12% -50%;
  z-index: 29;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 36%, rgba(255, 255, 255, 0.08) 43%, rgba(255, 249, 206, 0.92) 50%, rgba(255, 255, 255, 0.08) 57%, transparent 64%);
  transform: translateX(-78%);
  animation: pgg-letlm-shine 720ms ease-out forwards;
}

@keyframes pgg-letlm-card-land {
  0% { transform: scale(0.76); filter: brightness(1.8) drop-shadow(0 0 22px rgba(255, 215, 0, 0.95)); }
  44% { transform: scale(1.15); filter: brightness(1.3) drop-shadow(0 0 18px rgba(255, 215, 0, 0.72)); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes pgg-letlm-ring {
  0% { opacity: 1; transform: scale(0.72); box-shadow: 0 0 22px rgba(255, 215, 0, 0.9); }
  100% { opacity: 0; transform: scale(1.35); box-shadow: 0 0 38px rgba(255, 215, 0, 0); }
}

@keyframes pgg-letlm-shine {
  0% { opacity: 0; transform: translateX(-78%); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateX(78%); }
}

.pgg-letlm-drop-burst {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 70;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.pgg-letlm-drop-burst i {
  --pgg-spark-angle: 0deg;
  position: absolute;
  left: -2px;
  top: -2px;
  display: block;
  width: 4px;
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(to bottom, #fff, #ffe36c, transparent);
  box-shadow: 0 0 8px rgba(255, 225, 89, 0.9);
  transform: rotate(var(--pgg-spark-angle)) translateY(-10px);
  transform-origin: 50% 100%;
  animation: pgg-letlm-spark 700ms ease-out forwards;
}

@keyframes pgg-letlm-spark {
  from { opacity: 1; transform: rotate(var(--pgg-spark-angle)) translateY(-9px) scaleY(0.55); }
  to { opacity: 0; transform: rotate(var(--pgg-spark-angle)) translateY(-44px) scaleY(1.05); }
}

.pgg-letlm__notice {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 80px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 13px;
  text-align: center;
}

.pgg-letlm__drag-hint {
  position: absolute;
  right: 18px;
  bottom: 8px;
  z-index: 1;
  color: rgba(255, 215, 0, 0.06);
  font-family: Iceberg, Orbitron, Verdana, sans-serif;
  font-size: clamp(18px, 2.2vw, 42px);
  font-weight: 900;
  letter-spacing: 0.13em;
  pointer-events: none;
}

html.pgg-letlm-is-dragging,
html.pgg-letlm-is-dragging body,
html.pgg-letlm-is-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

@media (max-height: 820px) {
  .pgg-letlm {
    min-height: 650px;
  }

  .pgg-letlm__header {
    min-height: 60px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .pgg-letlm-pool {
    flex-basis: 170px;
    grid-template-rows: 33px minmax(0, 1fr);
  }

  .pgg-letlm__workspace {
    padding: 7px;
  }

  .pgg-letlm__tiers {
    gap: 4px;
  }
}

@media (max-width: 900px) {
  .pgg-letlm__header {
    padding-left: 13px;
  }

  .pgg-letlm__kicker {
    display: none;
  }

  .pgg-letlm__title {
    font-size: clamp(19px, 3vw, 28px);
  }

  .pgg-letlm__button {
    min-width: 38px;
    padding: 8px 10px;
    font-size: 0;
  }

  .pgg-letlm__button-icon {
    font-size: 18px;
  }

  .pgg-letlm-pool__heading > div:first-child span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pgg-letlm *,
  .pgg-letlm *::before,
  .pgg-letlm *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
