/* ── Trait Reroll Master Layout ─────────────────────────────────────────── */
.trait-reroll-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 10px;
  width: 100%;
}

.tr-wrapper {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  max-width: 1240px;
  width: 100%;
  margin-top: 45px;
  transform: translateX(4px);
}

/* ── LEFT SIDE: Borderless Scrollable Trait Index ───────────────────────── */
.tr-index-sidebar {
  width: 390px;
  flex-shrink: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  max-height: 520px;
  margin-top: 18px;
}

.tr-index-sidebar.closed {
  display: none !important;
}

.tr-sidebar-scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 6px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tr-sidebar-scroll::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Index Card Box */
.tr-index-card {
  background: #08060d;
  border: 1.5px solid #1c1328;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: none !important;
  position: relative;
}

.tr-card-icon-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 52px;
  flex-shrink: 0;
}

.tr-card-icon-blank {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tr-card-icon-blank img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tr-card-rate-lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
}

.tr-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.tr-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.tr-card-desc {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.35;
}

/* Pity Progress Bar */
.tr-pity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  position: relative;
}

.tr-pity-lbl {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
}

.tr-pity-track {
  position: absolute;
  left: 36px;
  right: 52px;
  height: 12px;
  background: #000000;
  border-radius: 6px;
  overflow: hidden;
}

.tr-pity-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #a855f7 100%);
  transition: width 0.2s ease;
}

.tr-pity-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  margin-left: auto;
}

/* Rainbow Text Styling */
.tr-rainbow-unbound {
  background: linear-gradient(90deg, #facc15 0%, #ec4899 33%, #2dd4bf 66%, #4ade80 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.tr-rainbow-primordial {
  background: linear-gradient(90deg, #f97316 0%, #facc15 33%, #22c55e 66%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.tr-rainbow-forsaken {
  background: linear-gradient(90deg, #facc15 0%, #4ade80 33%, #38bdf8 66%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.tr-rainbow-draconic {
  background: linear-gradient(90deg, #ef4444 0%, #f39c12 33%, #22c55e 66%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

/* ── RIGHT SIDE: Trait Reroll UI Frame ───────────────────────────────────── */
.tr-game-frame-container {
  position: relative;
  width: 100%;
  max-width: 820px;
  aspect-ratio: 880 / 520;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none !important;
  background: transparent !important;
}

.tr-bg-frame-img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

/* Central Unit Slot Overlay */
.tr-overlay-unit-slot {
  position: absolute;
  top: 55.5%;
  left: 54.8%;
  transform: translate(-50%, -50%);
  width: 18.5%;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  z-index: 10;
}

.tr-slot-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Prompt Pill (Select unit) */
.tr-prompt-pill {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(13, 8, 23, 0.95);
  border: 1px solid rgba(168, 85, 247, 0.5);
  padding: 4px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 15;
  box-shadow: none !important;
}

/* Unit Preview Box Container */
.tr-unit-preview-box {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Unit Character Render Layer */
.tr-unit-avatar {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* Static Size Rolled Trait Box (Positioned right & down) */
.tr-equipped-trait-badge {
  position: absolute;
  top: 62%;
  /* Moved down slightly */
  left: 108%;
  /* Static position to the right */
  transform: translateY(-50%);
  width: 135px;
  /* Static fixed width */
  height: 42px;
  /* Static fixed height */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(9, 6, 16, 0.95);
  border: 1px solid rgba(168, 85, 247, 0.5);
  border-radius: 8px;
  box-shadow: none !important;
  z-index: 20;
  box-sizing: border-box;
}

.tr-eq-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom Toolbar Image Buttons */
.tr-bottom-btn-group {
  position: absolute;
  bottom: 2.8%;
  left: calc(17% + 4px);
  right: calc(9.5% - 4px);
  height: 13.5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2%;
  z-index: 30;
  transform: translateY(6px);
}

.tr-img-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.tr-img-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tr-img-btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.15);
}

.tr-img-btn:active {
  transform: translateY(1px) scale(0.98);
}

.tr-btn-index {
  width: 28%;
  height: 100%;
}

.tr-btn-reroll {
  width: 38%;
  height: 100%;
}

.tr-btn-filters {
  width: 28%;
  height: 100%;
}

/* ── Modal Picker ────────────────────────────────────────────────────────── */
.tr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tr-modal-box {
  width: min(440px, 92vw);
  background: #0d0817;
  border: 2px solid #321c4d;
  border-radius: 10px;
  padding: 14px;
  box-shadow: none !important;
}

.tr-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 800;
}

.tr-modal-close-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
}

.tr-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.tr-unit-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: #140d21;
  border: 1px solid #2a1b42;
  border-radius: 6px;
  cursor: pointer;
  color: #ffffff;
}

.tr-unit-card-btn:hover {
  border-color: #818cf8;
}

.tr-unit-card-btn img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}

.tr-unit-card-btn span {
  font-size: 9.5px;
  text-align: center;
}