* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #75BD42;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #75BD42;
  overflow: hidden;
}

/* 左侧主体区 */
.main { position: absolute; left: 0; top: 0; width: 78%; height: 100%; }

.title {
  position: absolute;
  left: 50%;
  top: 3%;
  transform: translateX(-50%);
  color: #000;
  font-size: 40px;
  font-weight: bold;
  white-space: nowrap;
}
.subtitle {
  position: absolute;
  left: 50%;
  top: 11%;
  transform: translateX(-50%);
  color: #44546A;
  font-size: 19px;
  font-weight: bold;
  white-space: nowrap;
}

/* 总目录：5×3 */
.grid { position: absolute; display: grid; }
.grid.cats {
  left: 3%;
  top: 17%;
  width: 94%;
  height: 80%;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2% 2%;
}
.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.cat-img {
  width: 46%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  transition: .2s;
}
.cat-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-name { margin-top: 8px; color: #000; font-size: 22px; font-weight: bold; }
.cat-count { color: #44546A; font-size: 13px; }
.cat:hover .cat-img { transform: scale(1.08); }

/* 分类页：6×4 */
.grid.roles {
  left: 2%;
  top: 15%;
  width: 96%;
  height: 82%;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 1.2% 1%;
}
.cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
  min-width: 0;
}
.thumb {
  width: 72%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  transition: .2s;
  flex-shrink: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cname {
  margin-top: 4px;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  white-space: nowrap;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell:hover .thumb { transform: scale(1.06); }

/* 角色详情 */
.portrait {
  position: absolute;
  left: 3%;
  top: 8%;
  width: 30%;
  height: 84%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.portrait img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .22));
}
.screen {
  position: absolute;
  left: 36%;
  top: 8%;
  width: 61%;
  height: 84%;
  overflow: hidden;
}
.credits { position: absolute; left: 0; right: 0; top: 0; text-align: left; }
.para {
  font-size: 29px;
  color: #fff;
  line-height: 1.75;
  margin-bottom: 16px;
  font-weight: bold;
  text-shadow: 0 2px 5px rgba(0, 0, 0, .85);
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
}
.mask-top, .mask-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 70px;
  z-index: 5;
  pointer-events: none;
}
.mask-top { top: 0; background: linear-gradient(rgba(117, 189, 66, .97), transparent); }
.mask-bottom { bottom: 0; background: linear-gradient(transparent, rgba(117, 189, 66, .97)); }
.screen.centered { display: flex; align-items: center; }
.screen.centered .credits { position: relative; top: auto; transform: none !important; width: 100%; }
.screen.centered .mask-top, .screen.centered .mask-bottom { display: none; }
.screen.manual { overflow-y: auto; }
.screen.manual .credits { position: static; }
.screen.manual .mask-top, .screen.manual .mask-bottom { display: none; }
.screen.manual::-webkit-scrollbar { width: 8px; }
.screen.manual::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .4); border-radius: 4px; }

/* 右侧操作区 */
.sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 22%;
  height: 100%;
  background: rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
}
.sidebar-title {
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cat-tab {
  display: block;
  padding: 8px 10px;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  text-decoration: none;
  text-align: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  white-space: nowrap;
  cursor: pointer;
}
.cat-tab:hover { background: rgba(255, 255, 255, .22); }
.cat-tab.active { background: rgba(117, 189, 66, .9); color: #000; cursor: default; }
.cat-nav::-webkit-scrollbar { width: 6px; }
.cat-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .4); border-radius: 3px; }

.ctrl {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .25);
}
.ctrl button, .ctrl a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border-radius: 10px;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, .25);
  font-family: inherit;
  transition: background .15s;
}
.ctrl button:hover, .ctrl a:hover { background: rgba(0, 0, 0, .6); }
.ctrl button:disabled { opacity: .4; cursor: default; }
.mode-btn.manual { background: rgba(117, 189, 66, .7); color: #000; border-color: #000; }
.page-info { color: #fff; font-size: 13px; text-align: center; padding: 2px 0; opacity: .85; }

/* 状态提示 */
.status-tip {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
