:root {
  --role-pink: #E879A8;
  --role-pink-light: #F7B8D3;
  --role-blue: #5B9FE8;
  --role-blue-light: #A3D0FF;
  --role-green: #6FD89A;
  --role-green-light: #A8F0C8;
  --role-purple: #9B7BFF;
  --role-purple-light: #CAB4FF;
  --role-indigo: #7B6CDB;
  --role-indigo-light: #B5ABF3;
  --role-orange: #F5B65A;
  --role-orange-light: #FFD89E;
}

/* 页面容器 */
.role-page {
  position: relative;
  width: 100%;
  min-height: 100%;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.role-bg {
  position: fixed;
  top: 0;
  left: 110px;
  right: 0;
  bottom: 0;
  background: url('/assets/modules/3/bg/3.png') no-repeat center top;
  background-size: cover;
  z-index: 0;
  pointer-events: none;
}

.role-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 17, 56, 0.35) 0%, rgba(14, 17, 56, 0.55) 60%, rgba(14, 17, 56, 0.75) 100%);
  pointer-events: none;
}

.role-scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

/* Hero */
.role-hero {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  margin-bottom: 18px;
  min-height: 70px;
}

.role-hero-center {
  text-align: center;
  flex: 1;
}

.role-title {
  font-size: 42px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 2px 16px rgba(123, 108, 219, 0.6), 0 4px 24px rgba(0,0,0,0.35);
  letter-spacing: 2px;
  margin-bottom: 6px;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.role-subtitle {
  font-size: 15px;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

.role-create-top {
  position: absolute;
  right: 0;
  top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 28px;
  background: linear-gradient(180deg, #FFF5C8 0%, #FFD166 50%, #F4B942 100%);
  color: #5C3D05;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 0 #C97D20, 0 8px 22px rgba(244, 197, 66, 0.45), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.role-create-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 0 #C97D20, 0 14px 28px rgba(244, 197, 66, 0.55);
}

.role-create-top:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #C97D20, 0 5px 12px rgba(244, 197, 66, 0.4);
}

.create-star {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #C97D20;
}

.create-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}

/* Tabs */
.role-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  justify-content: center;
}

.role-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 24px;
  background: rgba(20, 26, 80, 0.55);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.role-tab:hover {
  background: rgba(40, 48, 120, 0.7);
  transform: translateY(-2px);
}

.role-tab.active {
  background: linear-gradient(135deg, rgba(123, 108, 219, 0.85), rgba(91, 80, 180, 0.65));
  border-color: rgba(255, 209, 102, 0.55);
  box-shadow: 0 0 20px rgba(123, 108, 219, 0.45);
  color: var(--primary-gold-light);
}

.role-tab:active {
  transform: translateY(0) scale(0.98);
}

.tab-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Card grid */
.role-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.role-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(255,255,255,0.9) 100%);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.role-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.38);
}

.role-card.hidden {
  display: none;
}

.role-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.75);
  color: #E879A8;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease;
}

.role-fav:hover {
  background: #FFFFFF;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.role-fav:active {
  transform: scale(1.05);
}

.role-fav.faved {
  color: #FF4D8D;
}

.role-card-image-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.role-card-image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1.05;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0) 70%, rgba(255,255,255,0.4) 100%);
}

.role-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.4s ease;
}

.role-card:hover .role-card-image {
  transform: scale(1.05);
}

.role-card-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.role-card-header {
  display: flex;
  align-items: center;
  gap: 5px;
}

.role-card-name {
  font-size: 17px;
  font-weight: 800;
  color: #2A2358;
}

.role-card-crown {
  font-size: 15px;
  display: inline-flex;
  align-items: center;
}
.role-card-crown img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.role-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.role-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 10px;
}

.role-tag-pink { background: rgba(232, 121, 168, 0.14); color: #C94E85; }
.role-tag-blue { background: rgba(91, 159, 232, 0.14); color: #3A7BC8; }
.role-tag-green { background: rgba(111, 216, 154, 0.14); color: #36A66D; }
.role-tag-purple { background: rgba(155, 123, 255, 0.14); color: #7B5FD6; }
.role-tag-indigo { background: rgba(123, 108, 219, 0.14); color: #5E4DB8; }
.role-tag-orange { background: rgba(245, 182, 90, 0.14); color: #C7832A; }

.role-card-desc {
  font-size: 12px;
  color: #5A5478;
  line-height: 1.5;
  flex: 1;
  min-height: 36px;
}

.role-card-level {
  display: grid;
  grid-template-columns: 18px auto auto 1fr;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #5A5478;
}

.level-star {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
}

.level-star img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}
.level-label { font-weight: 700; color: #2A2358; }
.level-value { font-weight: 800; color: #2A2358; }
.level-progress-text { justify-self: end; font-size: 10px; color: #8A83A8; }
.level-progress {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 3px;
  background: rgba(0,0,0,0.08);
  overflow: hidden;
}
.level-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--role-pink), var(--role-pink-light));
}

.role-detail-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border-radius: 18px;
  margin-top: 4px;
  background: var(--btn-color, var(--role-pink));
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
}

.role-detail-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.22);
}

.role-detail-btn:active {
  transform: translateY(0);
}

/* 底部三块 */
.role-bottom {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 18px;
}

.role-glass-panel {
  background: rgba(20, 26, 80, 0.55);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.25);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
}

.role-banner-create {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(91, 80, 180, 0.9) 0%, rgba(91, 80, 180, 0.65) 40%, rgba(123, 108, 219, 0.35) 100%);
}

.role-banner-create::before {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 70%;
  height: 100%;
  background: url('/assets/role/ui/create-banner-kids.png') no-repeat right bottom;
  background-size: contain;
  pointer-events: none;
  z-index: 1;
}

.role-banner-text {
  position: relative;
  z-index: 2;
  max-width: 46%;
}

.role-banner-text h3 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.role-banner-text p {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
  margin-bottom: 16px;
}

.role-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, #FFECB3 0%, #FFD166 50%, #F4B942 100%);
  color: #5C3D05;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 0 #C97D20, 0 8px 20px rgba(244, 197, 66, 0.4);
  transition: all 0.25s ease;
}

.role-banner-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #C97D20, 0 12px 26px rgba(244, 197, 66, 0.5);
}

.role-banner-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #C97D20, 0 5px 12px rgba(244, 197, 66, 0.35);
}

/* 排行榜 */
.role-rank h4,
.role-mine h4 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--primary-gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rank-star {
  color: var(--primary-gold);
}

.rank-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  transition: background 0.2s ease;
}

.rank-list li:hover {
  background: rgba(255,255,255,0.14);
}

.rank-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.rank-list li:nth-child(1) .rank-num { background: linear-gradient(135deg, #FFD166, #F4B942); color: #5C3D05; }
.rank-list li:nth-child(2) .rank-num { background: linear-gradient(135deg, #E0E0E0, #BDBDBD); color: #4A4A4A; }
.rank-list li:nth-child(3) .rank-num { background: linear-gradient(135deg, #F5B65A, #D9943C); color: #5C3D05; }

.rank-list img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.25);
  flex-shrink: 0;
}

.rank-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.rank-score {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-gold-light);
}

.rank-more,
.mine-btn {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.rank-more:hover,
.mine-btn:hover {
  background: rgba(255,255,255,0.22);
  transform: translateY(-2px);
}

.rank-more:active,
.mine-btn:active {
  transform: translateY(0);
}

/* 我的角色 */
.role-mine {
  align-items: stretch;
}

.mine-main {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 1;
}

.mine-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.25);
  flex-shrink: 0;
}

.mine-info {
  flex: 1;
}

.mine-name {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 2px;
}

.mine-level {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-bottom: 6px;
}

.mine-progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.15);
  overflow: hidden;
  margin-bottom: 4px;
}

.mine-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #FFD166, #FFECB3);
}

.mine-exp {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  text-align: right;
}

/* 详情弹窗 */
.role-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 46, 0.75);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.role-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.role-modal {
  width: 520px;
  max-width: 90vw;
  max-height: 86vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #1A1F5C 0%, #121646 100%);
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s ease;
}

.role-modal-backdrop.show .role-modal {
  transform: translateY(0) scale(1);
}

.role-modal-header {
  position: relative;
  height: 240px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  background: linear-gradient(135deg, #9bbfff, #c9c0ff 50%, #f1d7ff);
}

.role-modal-header img {
  width: 400px;
  max-width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  image-rendering: auto;
}

.role-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.35);
  color: #FFFFFF;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.role-modal-close:hover {
  background: rgba(0,0,0,0.55);
}

.role-modal-body {
  padding: 22px 26px 26px;
}

.role-modal-name {
  font-size: 26px;
  font-weight: 900;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.role-modal-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.role-modal-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.82);
  line-height: 1.7;
  margin-bottom: 18px;
}

.role-modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.role-stat {
  text-align: center;
  padding: 12px 8px;
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
}

.role-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-gold-light);
}

.role-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  margin-top: 4px;
}

.role-modal-actions {
  display: flex;
  gap: 12px;
}

.role-modal-actions a,
.role-modal-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.role-modal-actions .btn-primary {
  background: linear-gradient(180deg, #FFECB3 0%, #FFD166 50%, #F4B942 100%);
  color: #5C3D05;
}

.role-modal-actions .btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.role-modal-actions .btn-secondary {
  background: rgba(255,255,255,0.12);
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,0.18);
}

.role-modal-actions .btn-secondary:hover {
  background: rgba(255,255,255,0.2);
}

/* 响应式 */
@media (max-width: 1400px) {
  .role-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1100px) {
  .role-bottom { grid-template-columns: 1fr 1fr; }
  .role-banner-create { grid-column: 1 / -1; }
  .role-hero { flex-direction: column; align-items: center; gap: 12px; }
  .role-create-top { position: relative; right: auto; top: auto; }
  .role-hero-center { text-align: center; }
}

@media (max-width: 768px) {
  .role-grid { grid-template-columns: repeat(2, 1fr); }
  .role-bottom { grid-template-columns: 1fr; }
  .role-title { font-size: 32px; }
  .role-bg { left: 0; }
  .role-banner-text { max-width: 100%; text-align: center; }
  .role-banner-img { display: none; }
}
